9805 Commits

Author SHA1 Message Date
Chaskiel Grundman
51b5f42faf Linux 4.5: get_link instead of follow_link+put_link
In linux commit 6b255391, the follow_link inode operation was
replaced by the get_link operation, which is basically the same
but takes the inode and dentry separately, allowing for the
possibility of staying in RCU mode.

For now, only support this if page_get_link is available and we are
using the USABLE_KERNEL_PAGE_SYMLINK_CACHE

The previous test for USABLE_KERNEL_PAGE_SYMLINK_CACHE used a bogus,
undefined configure variable (ac_cv_linux_kernel_page_follow_link).
Remove it, as it was not needed

Reviewed-on: https://gerrit.openafs.org/12265
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 2ef27ea1bb032cee8d26980e60e02b52a0805763)

Change-Id: I828823ad16f24bae583de9cf436844565217918d
Reviewed-on: https://gerrit.openafs.org/12301
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-06-21 09:43:57 -04:00
Benjamin Kaduk
6e2988d7e6 Linux 4.5: no highmem in symlink ops
Symlink bodies in the pagecache should not be in highmem, as
upstream converted in commit 21fc61c73.

Reviewed-on: https://gerrit.openafs.org/12264
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit d9cfc1f3f5a75f1dbb14a56cd3da9db6b7a48065)

Change-Id: If1ef28955b08db4d95d6bd8a3b833895243f858a
Reviewed-on: https://gerrit.openafs.org/12300
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-06-21 09:42:46 -04:00
Stephan Wiesand
a854188922 Make OpenAFS 1.6.18
Update version strings and finalize NEWS for release 1.6.18 .

Change-Id: I526f8964913d0cd869bfabad74036328e26ed5c3
Reviewed-on: https://gerrit.openafs.org/12261
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
openafs-stable-1_6_18
2016-04-27 10:30:51 -04:00
Stephan Wiesand
72b84db9f7 Make OpenAFS 1.6.18pre1
Update version strings for the first 1.6.18 prerelease

Change-Id: I7dd02969ace4868cd562f2e6a1ff9dd4eecf5fb2
Reviewed-on: https://gerrit.openafs.org/12234
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
openafs-stable-1_6_18pre1
2016-04-14 07:12:36 -04:00
Stephan Wiesand
ee08daff26 Update NEWS for 1.6.18pre1
Preliminary release notes for 1.6.18

Change-Id: I03fafe2ffa2f280ad2e7e67a00cbcc1bdc6ec5f2
Reviewed-on: https://gerrit.openafs.org/12242
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 07:11:46 -04:00
Michael Meffie
5ba144bcf9 afs: shake harder in shake-loose-vcaches
Linux based cache managers will allocate vcaches on demand and
deallocate batches of vcaches in the background. This feature is called
dynamic vcaches.

Vcaches to be deallocated are found by traversing the vcache LRU list
(VLRU) from the oldest vcache to the newest. Up to a target number of
vcaches are attempted to be evicted.  The afs_xvcache lock protecting
the VLRU may be dropped and re-acquired while attempting to evict a
vcache. When this happens, it is possible the VLRU may have changed, so
the traversal of the VLRU is restarted.  This restarting of the VLRU
transversal is limited to 100 iterations to avoid looping indefinitely.

Vcaches which are busy cannot be evicted and remain in the VLRU. When a
busy cache was not evicted and the afs_xvache lock was dropped, the VLRU
traversal is restarted from the end of the VLRU. When the busy vcache is
encountered on the retry, it will trigger additional retries until the
loop limit is reached, at which point the target number of vcaches will
not be deallocated.

This can leave a very large number of unbusy vcaches which are never
deallocated.  On a busy machine, tens of millions of unused vcaches can
remain in memory. When the busy vcache at the end of the VLRU is finally
evicted, the log jam is broken, and the background deamon will hold the
afs_xvcache lock for an excessively long time, hanging the system.

Fix this by moving busy vcaches to the head of the VLRU before
restarting the VLRU traversal. These busy vcaches will be skipped when
retrying the VLRU traversal, allowing the cache manager to make progress
deallocating vcaches down to the target level.

This was already done on the mac osx platform while attempting to evict
vcaches. Move the code to move busy vcaches to the head of the VLRU up
the the platform agnostic caller.

Thanks to Andrew Deason for the initial version of this patch.

Reviewed-on: https://gerrit.openafs.org/11654
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@dson.org>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 5c136c7d93ed97166f39bf716cc7f5d579b70677)

Change-Id: I612a7b9ddafc697c0d15042344f0ff678decb4d5
Reviewed-on: https://gerrit.openafs.org/12257
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 07:05:33 -04:00
Michael Meffie
440b518e60 LINUX: hold vcache while dropping dcache refs
Hold a reference on a vcache while attempting to evict the inode from
the dcache. Since the afs_xvcache lock is dropped, it could be possible
for the vcache to be flushed during this time, making it unsafe to use
the vcache after the eviction attempt.

Reviewed-on: https://gerrit.openafs.org/12206
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@dson.org>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 961875cbedc2c91cdba6dc34a43c6136ea9797fb)

Change-Id: I5beea5798f6cb10a00db90e1ba18dbc7ab1e43cb
Reviewed-on: https://gerrit.openafs.org/12256
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 07:02:58 -04:00
Andrew Deason
fbd50cb0c4 afs: Log abnormally large chunk files
Any chunk in our cache for a regular file should be smaller than or
equal to our configured chunksize. If someone sets a chunk to be
larger than that, it is very strange and may cause other confusing
issues. Specifically, afs_DoPartialWrite determines if our cache is
"too full" by counting the number of dirty chunks. If we have a dirty
chunk that is much larger than the chunksize, it can throw off the
afs_DoPartialWrite calculation.

This is only true for dcaches backing regular files, though. For
directories, we fetch the entire directory into a single chunk file,
and the size of a directory blob can easily exceed the chunksize
without issues. The aforementioned issue with afs_DoPartialWrite does
not apply, since directory chunks cannot be dirty (we only locally
modify the chunk if we modify the dir on the server, and the DVs
match).

Anyway, it should not be possible to get a chunk for a regular file
larger than the chunksize. Log a message if it does occur, to help
assist anyone in tracking down issues when this does occur.

[mmeffie@sinenomine.net remove unnecessary casts in afs_warn args.]

Reviewed-on: http://gerrit.openafs.org/11831
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 11845765c75a2f15404ac55a882358c3f88595b9)

Change-Id: I7c9f4aa147ba63e51bb805484bac5785259847cb
Reviewed-on: https://gerrit.openafs.org/12216
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 06:59:37 -04:00
Andrew Deason
10d148abe2 afs: Log weird 'size' fetchdata errors
There are a couple of situations that should never happen when issuing
a fetchdata, but cause errors when they do:

 - The fileserver responds with more than 2^32 bytes of data
 - The fileserver responds with more data than requested (but still
   smaller than 2^32)

While these should normally never be encountered, it can be very
confusing when they do, since they cause file fetches to fail. To give
the user or investigating developer some hope of figuring out what is
going on, at least log a warning in these situations, to at least
indicate this is the area in which something is breaking.

Only log these once, in case something causes these conditions to be
hit, e.g., every fetch. Once is at least enough to say this is
happening.

[mmeffie@sinenomine.net remove unneeded casts in afs_warn args and
explicit static initializers.]

Reviewed-on: http://gerrit.openafs.org/11830
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 5fbf45b56298aa5a93cf9015f2d6346c7a0f615c)

Change-Id: I2f15255f33f44bef038ac9926d1ed47eca73d89a
Reviewed-on: https://gerrit.openafs.org/12215
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 06:58:59 -04:00
Andrew Deason
8cb61b0578 afs: Fix fetchInit for negative/large lengths
Currently, the 'length64' variable in rxfs_fetchInit is almost
completely unused (it just goes into an icl logging function). For the
length that we actually use ('*alength'), we just take the lower 32
bits of the length that the fileserver told us. This method is
incorrect in at least the following cases:

 - If the fileserver returns a length that is larger than 2^32-1,
   we'll just take the lower 32 bits of the 64-bit length the
   fileserver told us about. The client currently never requests a
   fetch larger than 2^32-1, so this would be an error, but if this
   occurred, we would not detect it until much later in the fetch.

 - If the fileserver returns a length that is larger than 2^31-1, but
   smaller than 2^32, we'll interpret the length as negative (which we
   assume is just 0, due to bugs in older fileservers). This is also
   incorrect.

 - If the fileserver returns a negative length smaller than -2^31+1,
   we may interpret the give length as a positive value instead of a
   negative one. Older fileservers can do this if we fetch data beyond
   the file's EOF (this was fixed in the fileserver in commit
   529d487d65d8561f5d0a43a4dc71f72b86efd975). This positive length
   will cause an error (usually), instead of proceeding without error
   (which is what would happen if we correctly interpreted the length
   as negative).

On Solaris, this can manifest as a failed write, when writing to a
location far beyond the file's EOF from the fileserver's point of
view, because Solaris writes can trigger a fetch for the same area.
Seeking to a location far beyond the file's EOF and writing can
trigger this, as can a normal copy into AFS, if the file is large
enough and the cache is large enough. To explain in more detail:

When copying a file into AFS, the cache manager will buffer the dirty
data in the disk cache until the file is synced/closed, or we run out
of cache space. While this data is buffering, the application will
write into an offset, say, 3GiB into the file. On Solaris, this can
trigger a read for the same region, which will trigger a fetch from
the fileserver at the offset 3GiB into the file. If the fileserver
does not contain the fix in commit
529d487d65d8561f5d0a43a4dc71f72b86efd975, it will respond with a large
negative number, which we interpret as a large positive number; much
larger than the requested length. This will cause the fetch to fail,
which then causes the whole write() call to fail. Specifically this
will fail with EINVAL on Solaris, since that is the error code we
return from afs_GetOnePage when we fail to acquire a dcache. If the
cache is small enough, this will not happen, since we will flush data
to the fileserver before we have a large amount of dirty data,
e.g., 3GiB. (The actual error occurs closer to 2GiB, but this is just
for illustrative purposes.)

To fix this, detect the various ranges of values mentioned above, and
handle them specially. Lengths that are too large will yield an error,
since we cannot handle values over 2^31-1 in the rxfs_* framework
currently.

For lengths that are negative, just act as if we received a length of
0. Do this for both the 64-bit codepath and the non-64-bit codepath,
just so they remain identical.

[mmeffie@sinenomine.net: directly use 64 bit comparisons, don't mask
end call error code, commit nits.]

Reviewed-on: http://gerrit.openafs.org/11829
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit c0f52c3a3d76059c9d8b2df3374df844d8d6861b)

Change-Id: If6b9debe3f6381634b15be4529931422d908c2aa
Reviewed-on: https://gerrit.openafs.org/12214
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 06:58:21 -04:00
Andrew Deason
a1065ca054 afs: Avoid incorrect size when fetching beyond EOF
Currently, afs_GetDCache contains a couple of calculations that look
similar to this:

    if (position + size > file_length) {
        size = file_length - position;
    }
    if (size < 0) {
        size = 0;
    }

Most of the time, this is fine. However, if 'position' is more than
2GiB greater than file_length, 'size' will calculated to be smaller
than -2GiB. Since 'size' in this code is a signed 32-bit integer, this
can cause 'size' to underflow, and result in a value closer to
(positive) 2GiB.

This has two potential effects:

The afs_AdjustSize call in afs_GetDCache will cause the underlying
cache file for this dcache to be very large (if our offset is around
2GiB larger than the file size). This can confuse other parts of the
client, since our cache usage reporting will be incorrect (and can be
even way larger than the max configured cache size).

This will also cause a read request to the fileserver that is larger
than necessary. Although 'size' will be capped at our chunksize, it
should be 0 in this situation, since we know there is no data to
fetch. At worst, this currently can just result in worse performance
in rare situations, but it can also just be very confusing.

Note that an afs_GetDCache request beyond EOF can currently happen in
non-race conditions on at least Solaris when performing a file write.
For example, with a chunksize of 256KiB, something like this will
trigger the overflow in 'size' in most cases:

    $ printf '' > smallfile && printf b | dd of=smallfile bs=1 oseek=2147745793

But there are probably other similar scenarios.

To fix this, just check if our offset is beyond the relevant file
size, and do not depend on 'size' having sane values in edge cases
such as this.

Reviewed-on: http://gerrit.openafs.org/11828
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
(cherry picked from commit 3caee7575491c33920b9c84f5dc4098d99373cf6)

Change-Id: Ibbecd779050f72e90db991e5a0695c86dadf484b
Reviewed-on: https://gerrit.openafs.org/12213
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 06:57:04 -04:00
Michael Meffie
ce8c728f4b vlserver: do not perform ChangeAddr on mh entries, except for removal
Fix a long standing bug in the ChangeAddr RPC which damages the vldb,

When vos changeaddr is run with -oldaddr and -newaddr, and the -oldaddr
is present in an multi-homed entry, instead of changing the address in
the mh entry, the server slot is "downgraded" to a single homed entry
and the mh entry is orphaned in the vldb.

Instead, if the -oldaddr is in a multi-home entry, refuse to change the
address with a VL entry not found error and log the event.

Multi-homed addresses can be changed manually using the vos setaddrs
command which calls the RegisterAddrs() RPC.

Reviewed-on: http://gerrit.openafs.org/11639
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 1cc77cd43732cca1c617db329a71693903d2b699)

Change-Id: I14a77317d582dd1cb8490e643b8fdfc86f4942c0
Reviewed-on: https://gerrit.openafs.org/12089
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-14 06:56:05 -04:00
Benjamin Kaduk
994531efe7 Fix typo in cm_dcache.c
Commit b85c5f9339e20d3de9b1316217dadbea41ad537e introduced a new
memset() but left out a prenthesis.

In the absence of a windows build machine, this error went unnoticed.

Reported by Mark Vitale.

Reviewed-on: https://gerrit.openafs.org/12241
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 808b156bd890cd78dc59b443b4ebe32e98d440d4)

Change-Id: I1e8ac9c0edaf38212c63b662af227f4c1ef9603f
Reviewed-on: https://gerrit.openafs.org/12252
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-13 10:31:53 -04:00
Stephan Wiesand
bfd7fced97 Linux: Fix misleading indentation and other whitespace
Commit 7edc6694e7632c9736bd1516935604a638165313 introduced a
misleading indentation of a line in afs_linux_prefetch. Correct
it, and once here remove trailing whitespace throughout the file.

Reviewed-on: https://gerrit.openafs.org/12253
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3609ebcfa3f70ca7612364c0cc2345b1d7f1096b)

Change-Id: I0d42c6751b835308c692c0ebb7d217f56ad5cf2a
Reviewed-on: https://gerrit.openafs.org/12254
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-08 09:35:45 -04:00
Jeff Blaine
0e72e84637 Hide -noexecute in favor of -dryrun
Makes all previous -noexecute arguments hidden (still callable)
and replaces them with -dryrun whose help text has been made
common where appropriate instead of the 3 previous ways the
argument was explained.

Reviewed-on: http://gerrit.openafs.org/4678
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
(cherry picked from commit f1928b9d26cfc415911a2e4346fbfefb909745ac)

Change-Id: I1685d2de6d4f690300deac36143912fad11608c9
Reviewed-on: https://gerrit.openafs.org/11613
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jan Iven <jan.iven@cern.ch>
Reviewed-by: Daria Phoebe Brashear <shadow@your-file-system.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-06 04:12:49 -04:00
Marcio Barbosa
49a95f7c2b afs: do not allow two shutdown sequences in parallel
Often, ‘afsd -shutdown’ is called right after ‘umount’.
Both commands hold the glock before calling ‘afs_shutdown’.
However, one of the functions called by 'afs_shutdown', namely,
‘afs_FlushVCBs’, might drop the glock when the global
'afs_shuttingdown' is still equal to 0. As a result, a scenario
with two shutdown sequences proceeding in parallel is possible.

To fix the problem, the global ‘afs_shuttingdown’ is used as an
enumerated type to make sure that the second thread will not run
‘afs_shutdown’ while the first one is stuck inside ‘afs_FlushVCBs’.

Reviewed-on: http://gerrit.openafs.org/12016
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 70fd9bc6dcc79cb25e98cdcfd0f085c4bf4f310a)

Change-Id: I073d1914a7daa858a78305ff154074f2a51a9f5f
Reviewed-on: https://gerrit.openafs.org/12179
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-05 08:23:56 -04:00
Chas Williams (CONTRACTOR)
18e761bdea doc: fix some broken link specifications
"local" links to section heads inside the same pod page should be written
L</OPTIONS> instead of L<OPTIONS>.  the other broken links are assorted
typos and capitalization changes.

Reviewed-on: http://gerrit.openafs.org/4831
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Ken Dreyer <kdreyer@usgs.gov>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
(cherry picked from commit 6770c6c411f2766471b4dc07bd7c66794f95ba63)

Change-Id: Id53b3ad6c2f8e0ec00fabf733b2b2052495b3f27
Reviewed-on: https://gerrit.openafs.org/11675
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-04-04 05:17:01 -04:00
Mark Vitale
c77ca20f3e DAFS: large volume support - fileserver crash after "addled bitmap"
Any DAFS fileserver operation that allocates a new vnode but fails
to update the vnode index will crash:

"Fatal Rx error: assertion failed: --vp->nWaiters >= 0,
				file: ../vol/volume.c, line: nnnn"

Note: This crash was exposed by other bugs (to be addressed in future
commits) in OpenAFS large volume support.  However, there may
be other failure paths (unrelated to large volumes) that expose
this error as well.

When VAllocVnode() must allocate a new vnode but fails while
updating the vnode index file (e.g. an "addled bitmap" due to other
bugs in working with a vnode index larger than 2^31 bytes), it branches
to common recovery logic at label error_encountered:.

Part of this recovery is to call VFreeBitmapEntry_r().  Commit
08ffe3e81d875b58ae5fe4c5733845d5132913a0 added a VOL_FREE_BITMAP_WAIT
flag to VFreeBitmapEntry() in order to prevent races with VAllocBitmapEntry().
If the caller specifies VOL_FREE_BITMAP_WAIT, VFreeBitmapEntry_r will
call VCreateReservation_r() and VWaitExclusiveState_r().  However, the
exit from VFreeBitmapEntry_r() calls VCancelReservation_r() unconditionally.
This works correctly with the majority of callers to VFreeBitmapEntry_r,
which do specify the VOL_FREE_BITMAP_WAIT flag.

However, the VAllocVnode() error_encountered logic must specify 0 for
this flag because the thread is already in an exclusive state
(VOL_STATE_VNODE_ALLOC).  This correctly causes VFreeBitmapEntry_r() to
forgo both the reservation and wait-for-exclusive-state.  However, before
exit it erroneously calls VCancelReservation_r().  We now have unbalanced
reservations (nWaiters); this causes an assert when the VAllocVnode()
error_encountered recovery code later calls VCancelReservation_r()
for what it believes is its own prior reservation.

Modify VFreeBitmapEntry_r() to make its final VCancelReservation_r()
conditional on flag VOL_FREE_BITMAP_WAIT.

Reviewed-on: http://gerrit.openafs.org/11983
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit d833ba768064a32a19c6b0b94ffb0d8a3a40a089)

Change-Id: Ia146ca55b1c0497d475357e61eaeb061a11bd597
Reviewed-on: https://gerrit.openafs.org/12209
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 06:56:42 -04:00
Mark Vitale
7a0aa1f614 vlserver: VL_GetEntryByName* requests undercounted
Commit a14e791541bf19c6c377e68bc2f978fba34f94b1
refactored and corrected the counting of requests and aborts.
However, it inadvertently introduced a new undercount for
VL_GetEntryByName* requests, counting them only if
NameIsId(volname), e.g. volname="536870911".

Ensure that the normal case of a non-"numeric" volname is
also counted.

Discovered during review of pullup to 1.6.x.

Reviewed-on: http://gerrit.openafs.org/12106
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 670381aa5d3a7bc91ad74c7499605cca2c33d612)

Change-Id: Ic41f8775e4897efe5f6280b56d06d733865556a2
Reviewed-on: https://gerrit.openafs.org/12113
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 06:52:33 -04:00
Mark Vitale
86624d4118 viced: incorrect FID audit of BulkStatus and InlineBulkStatus
The audit code for object AUD_FIDS is off by one - we list the
first FID twice and skip the last FID.

Repair so all FIDs are properly audited.

Reviewed-on: http://gerrit.openafs.org/12191
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 44349d0694c7a185fae4c55c75cb01196d109a26)

Change-Id: I7f662fd54aaab8182fedc5ebd607db37e501b423
Reviewed-on: https://gerrit.openafs.org/12211
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 06:08:38 -04:00
Simon Wilkinson
790cc13064 vlserver: Tidy up request counting
Tidy up the counting of requests and aborts in the vlserver. Don't
hide a variable allocation within a macro, convert macros to inline
functions, and make it possible to not count particular operations
by passing in an opcode of 0.

Reviewed-on: http://gerrit.openafs.org/4769
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit a14e791541bf19c6c377e68bc2f978fba34f94b1)

Change-Id: I1dcea218fbd3097511a93c9a825d6e76e9c8cf59
Reviewed-on: https://gerrit.openafs.org/12085
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 06:03:05 -04:00
Michael Meffie
e980a39cc3 volser: detect eof in dump stream while reading acl
Detect an EOF condition while reading the ACL in a dump stream
and return a restore error, instead of filling the ACL with
0xFF and then failing the restore due to an invalid tag.

Reviewed-on: http://gerrit.openafs.org/11703
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit ed52d65fe98549e13023e0a8997da479b626085a)

Change-Id: I9aacd635b8bbf89923db0121639d5112ab775c19
Reviewed-on: https://gerrit.openafs.org/12185
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 05:18:57 -04:00
Benjamin Kaduk
cc6dc146e7 cellconfig: check for invalid dotted quads
IP addresses entered into the CellServDB with components larger
than 255 would silently be trucated down to 8-bit unsigned integer
representations.  This could cause confusing behavior with
occasional hangs.

FIXES 131794

Reviewed-on: http://gerrit.openafs.org/12109
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 97150150e6d12cbbc0c4a5af3424c9bf1e56918c)

Change-Id: I4e628ab7e12e33b23cc513a268879de115ddec2e
Reviewed-on: https://gerrit.openafs.org/12210
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 04:59:12 -04:00
Michael Meffie
30da3d3253 volser: range check acl header fields during dumps and restores
Perform range checks on the acl header fields when reading an
acl from a dump stream and when writing an acl to a dump
stream.

Before this change, a bogus value in the total, positive, or
negative acl fields from a dump stream could cause an out of
bounds access of the acl entries table, crashing the volume
server.

Reviewed-on: http://gerrit.openafs.org/11702
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0bf9fba458b39035a09f45c1b63f1e65672d4c00)

Change-Id: Icebeb1d62900a7978f02177627a30e41de49a182
Reviewed-on: https://gerrit.openafs.org/12127
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 04:47:00 -04:00
Michael Meffie
c402e60e2b LINUX: ifconfig is deprecated
ifconfig is deprecated and is no longer installed by default on RHEL 7 and
Centos 7. Use the replacement ip command in the init script for linux.
Fallback to ifconfig in the event the ip command is not available.

Thanks to Ben Kaduk for pointing out the hash built-in command.

Reviewed-on: http://gerrit.openafs.org/12192
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit b702ab5da216976ed01ad3b1c474ecd4cc522ff2)

Change-Id: I9ffdfee233555f1e06bc4f980e2905851224ecc9
Reviewed-on: https://gerrit.openafs.org/12193
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 04:20:21 -04:00
Marc Dionne
7883453bc4 Convert ubik_Call(x) calls to ubik_x()
Convert remaining ubik_Call(function, ..) users to ubik_function(..).

Reviewed-on: http://gerrit.openafs.org/4399
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit b3094a39b74c0c593f6dcac945ad5e4bbf155c2d)

Change-Id: Ida6d324e744904606c7cbfc073b60e0ed5733ed7
Reviewed-on: https://gerrit.openafs.org/11780
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-31 04:15:18 -04:00
Benjamin Kaduk
c9bbfff826 Typo fix in comment
afsd -shutdown takes only a single dash, as with all cmd-style
options.

Improve the grammar a bit while we're here.

Reviewed-on: http://gerrit.openafs.org/12133
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 6db49a841784459cf583e914b3f2433ce1e70f4c)

Change-Id: Id3b12157c9d5ac3b9aeeba0c2af22fac33a2630f
Reviewed-on: https://gerrit.openafs.org/12197
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 11:02:02 -04:00
Benjamin Kaduk
44b1874cf2 volser: set error, not code, before rfail
The rfail cleanup handler overwrites 'code' ~unconditionally, but
does use an existing 'error' value if present.  Since the intent
is to return failure to the caller, preserve the code in the error
variable and do so.

FIXES 131897

Reviewed-on: http://gerrit.openafs.org/12108
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 888fc16db5f0063464bf219a6cf6fee0faea4705)

Change-Id: Ic8aab7cbe9bac6c0677b1e3bc2ca2b59a76bd621
Reviewed-on: https://gerrit.openafs.org/12126
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 10:20:41 -04:00
Michael Meffie
bb8a6f45cb afsd: deprecate afsd -settime
Print a warning message if -settime is given and update the afsd man
page to declare that -settime is deprecated.

Thanks to Stephan Wiesand for suggesting this change.  This is a 1.6.x
specific change.

Change-Id: Iab3f9aa602552e88d74b04e4628c7af13e0439e3
Reviewed-on: https://gerrit.openafs.org/12207
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 10:17:30 -04:00
Benjamin Kaduk
79f7c6c9f0 Fix optimized IRIX kernel module builds
Commit 9f94892f8d996a522e7801ef6088a13769bee7c2 (from 2006)
introduced per-file CFLAGS, using $(CFLAGS-$@); this construct
is not parsed well by IRIX make, which ends up attempting to
expand '$@)' and finding mismatched parentheses.

Commit 5987e2923a2670a27a801461dc9668ec88ed7d2a (from 2007) followed,
fixing the IRIX build but only for the NOOPT case.  This left the
problematic expression in CFLAGS_OPT until 2013, when another RT
ticket was filed reporting the continued breakage.  That ticket
was then ignored until 2015 (now) with no particular cries of
outrage on the mailing lists.  Perhaps this gives some indication
of the size and/or mindset of the IRIX userbase.  (There have
been successful IRIX installations during this time period, so
presumably it was discovered that disabling optimizations helped
the build along.)

FIXES 131621

Reviewed-on: http://gerrit.openafs.org/12111
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 767694d9ec86fc9451f5a4ba2ec7405c29986a21)

Change-Id: Ie5d349b1e9f8a768efcb461d7367d2d7deac31f6
Reviewed-on: https://gerrit.openafs.org/12198
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 10:16:09 -04:00
Michael Meffie
54a14d5349 viced: add missing new lines to log messages
The server logger requires an explicit new line.

Reviewed-on: http://gerrit.openafs.org/11841
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 634ca4fdc206884afe0826bc682aa7d5208cdc8b)

Change-Id: Ic04d98d15b92a86303a38000d5738c038b83d68f
Reviewed-on: https://gerrit.openafs.org/12129
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 10:02:34 -04:00
Dave Botsch
848eb258e9 Initial set of changes for El Capitan OS X 10.11 .
Mainly new El Capitan specific config files and defitions of
Darwin 15 variables and config tests/etc.

Reviewed-on: http://gerrit.openafs.org/12072
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit bf3707ccbf98f44103171f4a5c6fb5bcd0744bfc)

Change-Id: I96c6c451841081d26a101507f35ff86fc8c54771
Reviewed-on: https://gerrit.openafs.org/12212
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 09:52:08 -04:00
Stephan Wiesand
d73bbdfc49 Linux 4.4: Do not use splice()
splice() may return -ERESTARTSYS if there are pending signals, and
it's not even clear how this should be dealt with. This potential
problem has been present for a long time, but as of Linux 4.4
(commit c725bfce7968009756ed2836a8cd7ba4dc163011) seems much more
likely to happen.

Until resources are available to fix the code to handle such errors,
avoid the riskier uses of splice().

If there is a default implementation of file_splice_{write,read},
use that; on somewhat older kernels where it is not available,
use the generic version instead.

[kaduk@mit.edu: add test for default_file_splice_write]

Reviewed-on: https://gerrit.openafs.org/12217
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit ae5f411c3b374367ab8ae69488f78f8e0484ce48)

Change-Id: I40dd0d60caece6379a62674defb8d46a2bfadad6
Reviewed-on: https://gerrit.openafs.org/12228
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 09:48:10 -04:00
Michael Laß
2c3558c8d0 Linux 4.4: Use locks_lock_file_wait
The locks API was changed in Linux 4.4, introducing locks_lock_file_wait
(e55c34a66f87e78fb1fc6b623b78c5ad74b475af) and removing
flock_lock_file_wait (616fb38fa7a9599293e05ae1fa9acfaf73922434).

locks_lock_file_wait can be used as a drop-in replacement so define
flock_lock_file_wait as an alias for it.

Reviewed-on: https://gerrit.openafs.org/12170
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 58d82226a555d3781a5cb45e5cc177727628ebd8)

Change-Id: Icceae3906c1a612fb9104b860e519bb7f94d25d3
Reviewed-on: https://gerrit.openafs.org/12227
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 09:46:53 -04:00
Michael Laß
0bd41d090e Linux 4.4: key_payload has no member 'value'
In Linux 4.4 (146aa8b1453bd8f1ff2304ffb71b4ee0eb9acdcc) type-specific and
payload data have been merged. The payload is now accessed directly and has
no 'value' member anymore.

FIXES 132677

Reviewed-on: https://gerrit.openafs.org/12169
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 5067ee3ae11932a3f1c972c8f88b20afbd9e1d88)

Change-Id: I5a3e89b2676b463935e9a77042cbcd8ab812dc68
Reviewed-on: https://gerrit.openafs.org/12226
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 06:50:55 -04:00
Michael Meffie
4b00492016 doc: fs examine no longer requires read rights on the volume root vnode
Update the man page to reflect the current access rights required for fs
examine.  Historically, fs examine required read access on the root
vnode of the volume housing the directory or file being examined.  This
access check was relaxed in commit d2d591caf2c9b4cf2ebae708cc9b4c8b78ca5a5a,
since the information returned by the file server is already available
anonymously by other means.

Reviewed-on: https://gerrit.openafs.org/12223
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit f99c1ec32bb6e8d31ac517173ff7502dbd85aa05)

Change-Id: I580d1e0cab7f823ac1932f99066495cef9e2410a
Reviewed-on: https://gerrit.openafs.org/12224
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 03:27:34 -04:00
Benjamin Kaduk
bfe80a986a Add param files for FreeBSD 10.2, 10.3
FreeBSD 10.3 is in the beta stage now; better get ready for it.

Reviewed-on: https://gerrit.openafs.org/12222
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 02a393de6b30a500b77f276011c70d41eff363b5)
[updated to match the FreeBSD param.h files on openafs-stable-1_6_x]

Change-Id: Iae290edd29b34aa849f7422b48c765f81eb802fe
Reviewed-on: https://gerrit.openafs.org/12232
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-30 03:19:27 -04:00
Benjamin Kaduk
5ce1027906 Make OpenAFS 1.6.17
Update version strings for release 1.6.17.

Change-Id: I5872643935f2c195b938e9cd94e7b0d7b81906fa
openafs-stable-1_6_17
2016-03-16 10:31:22 -04:00
Benjamin Kaduk
0261b67367 Update NEWS for 1.6.17
Release notes for OpenAFS 1.6.17

Change-Id: I47281bcdb6074a5ab6ba493abf86c1efb2227674
2016-03-16 10:31:14 -04:00
Benjamin Kaduk
becf282ecf OPENAFS-SA-2016-002 ListAddrByAttributes information leak
The ListAddrByAttributes structure is used as an input to the GetAddrsU
RPC; it contains a Mask field that controls which of the other fields
will actually be read by the server during the RPC processing.
Unfortunately, the client only wrote to the fields indicated by the
mask, leaving the other fields uninitialized for transmission on the
wire, leaking some contents of client memory.

Plug the information leak by zeroing the entire structure before use.

FIXES 132847

Change-Id: Ia7aaccd53db56c7359552b70113f9ae5edbd833e
2016-03-16 00:03:33 -04:00
Benjamin Kaduk
5c4afd5558 OPENAFS-SA-2016-002 VldbListByAttributes information leak
The VldbListByAttributes structure is used as an input to several
RPCs; it contains a Mask field that controls
which of the other fields will actually be read by the server
during the RPC processing.  Unfortunately, the client only
wrote to the fields indicated by the mask, leaving the other
fields uninitialized for transmission on the wire, leaking
some contents of client memory.

Plug the information leak by zeroing the entire structure before use.

FIXES 132847

Change-Id: Ia7aaccd53db56c7359552b70113f9ae5edbd833e
2016-03-16 00:03:33 -04:00
Benjamin Kaduk
3ed9750162 OPENAFS-SA-2016-002 AFSStoreVolumeStatus information leak
The AFSStoreVolumeStatus structure is used as an input to the
RXAFS_SetVolumeStatus RPC; it contains a Mask field that controls
which of the other fields will actually be read by the server
during the RPC processing.  Unfortunately, the client only
wrote to the fields indicated by the mask, leaving the other
fields uninitialized for transmission on the wire, leaking
some contents of kernel memory.

Plug the information leak by zeroing the entire structure before use.

FIXES 132847

Change-Id: Ia7aaccd53db56c7359552b70113f9ae5edbd833e
2016-03-16 00:03:33 -04:00
Benjamin Kaduk
90cb77f975 OPENAFS-SA-2016-002 AFSStoreStatus information leak
Marc Dionne reported that portions of the AFSStoreStatus structure
were not written to before being sent over the network for
operations such as create, symlink, etc., leaking the contents
of the kernel stack to observers.  Which fields in the request
are used are controlled by a flags field, and so if a field was
not going to be used by the server, it was sometimes left
uninitialized.

Fix the information leak by zeroing out the structure before use.

FIXES 132847

Change-Id: Iebcac04d1ff70df06d054ddb3b886ab422fb2a14
2016-03-16 00:03:33 -04:00
Benjamin Kaduk
396240cf07 OPENAFS-SA-2016-001 group creation by foreign users
CVE-2016-2860:

The ptserver permits foreign-cell users to create groups as if they were
system:administrators.  In particular, groups in the user namespace
(with no colon) and the system: namespace can be created.  No group
quota is enforced for the creation of these groups, but they will be
owned by system:administrators and cannot be changed by the user that
created them.  When processing requests from foreign users, the
creator ID is overwritten with the ID of system:administrators, and
that field is later used for access control checks in
CorrectGroupName(), called from CreateEntry().

The access-control bypass is not possible for creating user entries,
since there is an early check in CreateOK() that only permits
administrators to create users, using a correct test for whether
the call is being made by an administrator.

FIXES 132822

[Based on a patch by Jeffrey Altman.]

Change-Id: I77dcf4a2f7d9c770c805a649f2ddc6bee5f83389
2016-03-16 00:03:33 -04:00
Brian Torbich
be42de4f4f redhat: Correct permissions on systemd unit files
Change the systemd unit file permissions created via
openafs.spec to be 0644 instead of 0755.  Having the
systemd unit files be executable will trigger a systemd
warning.

FIXES 132662

Reviewed-on: http://gerrit.openafs.org/12174
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a4c4b786059ac7d5f9ecc5ec07727f000b62c13f)

Change-Id: I0ad33a93c963b7a2d242b43b7d94e2e3f5041e8d
Reviewed-on: http://gerrit.openafs.org/12196
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-04 10:17:28 -05:00
Michael Meffie
e42c91172a CellServDB update 01 Jan 2016
Update all remaining copies of CellServDB in the tree, and make the
Red Hat packaging use it by default too.

[mmeffie@sinenomine.net: 1.6.x specific change; also update the debian
packaging.]

Reviewed-on: http://gerrit.openafs.org/12187
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 378eae1d534d61d357a0ad681b57b5e203f814ad)

Change-Id: I5f3c8a03fac30e4da6d26ce7f65529e9f048f6b8
Reviewed-on: http://gerrit.openafs.org/12188
Reviewed-by: Chas Williams <3chas3@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-04 08:38:34 -05:00
Stephan Wiesand
9cf75ab6dd redhat: Avoid bogus dependencies when building the srpm
By default the spec defines that both userland and kernel module
packages should be built. This results in a dependency of the form
"kernel-devel-`uname -m` = `uname -r`" being added to the source
package created by makesrpm.pl, which is bogus because the uname
values are from the system on which the srpm is built and needn't
apply to the system where it is used. While rpm and rpmbuild ignore
such dependencies of source packages, other tools don't and may fail.

Some versions of rpmbuild will also enforce those requirements when
building the srpm itself, which is pointless too.

Avoid both problems by pretending not to attempt building modules
and ignoring any dependencies when makesrpm.pl invokes rpmbuild -bs.

Reviewed-on: http://gerrit.openafs.org/11903
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 9ee5fa152b7b7de6a6ddc6ed87bbf9f76da6e3e4)

Change-Id: I76aac20b8dcad2105f8d20a3e169b2f5526ef956
Reviewed-on: http://gerrit.openafs.org/12195
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-04 07:41:28 -05:00
Mark Vitale
50ae422550 pioctl.c: restore required result variable
Commit b9fb9c62a6779aa997259ddf2a83a90b08e04d5f refactored lpioctl()
so that LINUX would have its own implementation. This also simplified
the other lpioctl() implementations by removing superfluous variable
'rval'.

Unfortunately, 'rval' was actually required for both DARWIN and SUN511.
On both of these platforms, the address of 'errcode' is passed
to the respective ioctl_*() routine so its value may be passed back
to lpioctl().   Therefore, 'errcode' must not also be used for the
return value from these functions;  doing so results in the return
value from the function overwriting the intended value of 'errcode' upon
return to lpioctl().

In the case of Solaris 11, ioctl_sun_afs_syscall() always returns zero
(as long as the ioctl device 'dev/afs' opened successfully).
So 'errcode' was always being set to zero, even if the pioctl had
actually failed.  For example, without this fix, 'fs listcells'
loops forever on Solaris 11, listing an infinite number of "cells",
because it will never "see" the EDOM that informs it of the last defined
cell.

Partially revert b9fb9c62a6779aa997259ddf2a83a90b08e04d5f by restoring
the 'rval' variable and logic for DARWIN and SUN511.

Reviewed-on: http://gerrit.openafs.org/11734
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 7ae8e64d1ee79c23da96c326111fdc40015ed5a6)

Change-Id: I6a4b8817f02522144b3adbbae06b3737e6c62585
Reviewed-on: http://gerrit.openafs.org/11795
Reviewed-by: Daria Phoebe Brashear <shadow@your-file-system.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-04 07:34:18 -05:00
Benjamin Kaduk
6f5dc12bb2 pioctl.c: removed unused variable
The 'rval' variable is only actually used in the LINUX20 case;
adding another conditional block is making the LINUX20 case
different enough that it should get split out entirely.
Doing so lets the 'else' clause be simpler.

Found by clang on FreeBSD 10.0.

Reviewed-on: http://gerrit.openafs.org/10819
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: D Brashear <shadow@your-file-system.com>
(cherry picked from commit b9fb9c62a6779aa997259ddf2a83a90b08e04d5f)

Change-Id: I47f781bc13d54ad5a1b34365fcb9680793b206d1
Reviewed-on: http://gerrit.openafs.org/11778
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-04 07:33:54 -05:00
Benjamin Kaduk
4c17087b8d fstrace: only declare 'rval' when it is used
... to avoid compiler warnings about unused variables.

Found by clang on FreeBSD 10.0.

Reviewed-on: http://gerrit.openafs.org/10822
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit 63291be2216762dd89072f41c9a016608b736ceb)

Change-Id: Ib5d7e14d6077ec2377180b9308d99f49ff79cccc
Reviewed-on: http://gerrit.openafs.org/11777
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
2016-03-04 06:49:12 -05:00