Chas Williams [Wed, 2 Dec 2015 15:38:42 +0000 (10:38 -0500)]
Open syscall emulation file O_RDONLY
As reported on the -info mailing list, docker is now exporting the
/proc filesystem as read only. ioctl() doesn't need write permissions
to do its work, so change O_RDWR to O_RDONLY.
Michael Meffie [Mon, 30 Mar 2015 17:17:25 +0000 (13:17 -0400)]
dafs: remove the salvageserver -datelogs option
Remove the undocumented -datelogs option from the salavageserver, which
was a carry over from the standalone salvager program, but is not
appropriate for a daemon.
Change-Id: Ia382d6550e0641edcba55a414e00323755487e18
Reviewed-on: http://gerrit.openafs.org/11814 Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Benjamin Kaduk [Sun, 22 Nov 2015 22:34:16 +0000 (16:34 -0600)]
Fix ptserver -default_access parsing
Commit 0b9986c8758c13a1de66b8bdae51b11abaea6cf3 converted ptserver
to use libcmd for parsing, but erroneously listed the
-default_access argument as CMD_SINGLE instead of CMD_LIST, since
two arguments are needed. This made it impossible to use
-default_access at all, since libcmd would reject an extra argument
and the later argument processing would notice that the second
argument was missing.
Christof Hanke [Wed, 18 Nov 2015 13:02:50 +0000 (14:02 +0100)]
tabular_output: allocate footer-line when set for the first time
If the footer line is not allocated, programs segfault at runtime.
The printFooter functions should check if the footer
is allocated before printing them.
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.
Stephan Wiesand [Tue, 17 Nov 2015 14:03:03 +0000 (15:03 +0100)]
writeconfig: emit error messages again in VerifyEntries
Before commit e4a8a7a38dbf29e89bc1a7b6b017447a6aa0c764 an error message
was printed if looking up a server hostname failed. Restore this, and
also print a message in the now detected case that the lookup returns
loopback addresses only.
Change-Id: Idf7c3133ab5c83e081335ba1dc8fcbddb7da7329
Reviewed-on: http://gerrit.openafs.org/12097 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Michael Meffie [Wed, 21 Jan 2015 19:42:47 +0000 (14:42 -0500)]
bozo: create a syslog connection only if the -syslog option is given
Fix a minor bug in which an unnecessary syslog connection is opened when
the BosLog is not present (typically, the first time the bosserver is
started) or when the BosLog is a named pipe, even if the -syslog option
was not given.
Michael Meffie [Wed, 18 Feb 2015 02:54:46 +0000 (21:54 -0500)]
prdb_check: fix out of bounds array access in continuation entries
A continuation entry (struct contentry) contains 39 id elements, however
a regular entry (struct prentry) contains only 10 id elements.
Attempting to access more than 10 elements of a regular entry is
undefined behavior.
Use a stuct contentry when when processing continuation entries in
prdb_check. This is done to safely traverse the id arrays of the
continuation entries. Use the new pr_PrintContEntry to print
continuation entries.
The undefined behavior manfests as a segmentation violation in
WalkNextChain() when built with GCC 4.8 with optimization enabled.
Michael Meffie [Wed, 18 Feb 2015 01:58:27 +0000 (20:58 -0500)]
prdb_check: check for continuation entries in owner chains
Continuation entries may not be in owner chains. Fix the
comments in WalkOwnerChain (which were probably copied from
WalkNextChain) and add a check and error message for
continuation entries found on owner chains.
Michael Meffie [Wed, 18 Feb 2015 02:11:50 +0000 (21:11 -0500)]
libprot: add pr_PrintContEntry function
A continuation entry (struct contentry) contains 39 id elements, however
a regular entry (struct prentry) contains only 10 id elements. Attempting
to access more than 10 elements of a regular entry is undefined
behavior.
Add a new function to safely print continuation entries and change
pr_PrintEntry to avoid accessing the entries array out of bounds.
The pr_PrintEntry function is at this time only used by the prdb_check
and ptclient debugging utilities.
Michael Meffie [Wed, 21 May 2014 21:27:47 +0000 (17:27 -0400)]
doc: document the version subcommand
Document the built-in version sub-command which displays
the OpenAFS version string. This sub-command is provided
by the cmd library.
Document the switch style -version option provided by the cmd
library for the initcmd based commands: afsmonitor, scout,
xstat_fs_test, and xstat_cm_test.
Michael Meffie [Tue, 13 Oct 2015 02:16:54 +0000 (22:16 -0400)]
afs: fix for return an error from afs_readdir when out of buffers
Commit 9b0d5f274fe79ccc5dd0e4bba86b3f52b27d3586 added a return code to
BlobScan to allow afs_readdir to return an error when afs_newslot failed
to allocate a buffer. Unfortunately, that change introduced a false
EIO error.
Originally, BlobScan would return a blob number of 0 to indicate the end
of the file has been reached while traversing the directory blobs.
Restore that behavior by changing the cache manager's DRead function to
return ENOENT instead of the generic EIO error to indicate the page to
be read is out of bounds, and change BlobScan to return a blob of zero
to indicate to callers the last blob has been reached. All callers
already check for a blob number of zero, which is out of range.
Change-Id: I5baae8e5377dd49dcca6765b7a4ddc89cca70738
Reviewed-on: http://gerrit.openafs.org/12058 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>
Michael Meffie [Fri, 6 Nov 2015 16:56:31 +0000 (11:56 -0500)]
vos: reinstate the -localauth option for vos setaddrs
Commit d1d411576cf39c4bc55918df0eb64327718d566c added the vos remaddrs
subcommand, but unfortunately stole the common parameters from
setaddrs. Fix this bug and remove the extra blank line between
the subcommand syntax and the common params macro.
Tim Creech [Mon, 2 Nov 2015 13:12:32 +0000 (08:12 -0500)]
Make libuafs safe for parallel make
In src/libuafs, "make" with a large number of jobs (e.g., "make -j16")
can fail because some of the LT_objs depend on make_h_tree having been
called already.
Make "h" (the libuafs header subdirectory) a dependency of all of
LT_objs.
Jeffrey Altman [Fri, 9 Oct 2015 02:22:12 +0000 (22:22 -0400)]
rx: OPENAFS-SA-2015-007 "Tattletale"
CVE-2015-7762:
The CMU/Transarc/IBM definition of rx_AckDataSize(nAcks) was mistakenly
computed from sizeof(struct rx_ackPacket) and inadvertently added three
octets to the computed ack data size due to C language alignment rules.
When constructing ack packets these three octets are not assigned a
value before writing them to the network.
Beginning with AFS 3.3, IBM extended the ACK packet with the "maxMTU" ack
trailer value which was appended to the packet according to the
rx_AckDataSize() computation. As a result the three unassigned octets
were unintentionally cemented into the ACK packet format.
In OpenAFS commit 4916d4b4221213bb6950e76dbe464a09d7a51cc3 Nickolai
Zeldovich <kolya@mit.edu> noticed that the size produced by the
rx_AckDataSize(nAcks) macro was dependent upon the compiler and processor
architecture. The rx_AckDataSize() macro was altered to explicitly
expose the three octets that are included in the computation.
Unfortunately, the failure to initialize the three octets went unnoticed.
The Rx implementation maintains a pool of packet buffers that are reused
during the lifetime of the process. When an ACK packet is constructed
three octets from a previously received or transmitted packets will be
leaked onto the network. These octets can include data from a
received packet that was encrypted on the wire and then decrypted.
If the received encrypted packet is a duplicate or if it is outside the
valid window, the decrypted packet will be used immediately to construct
an ACK packet.
CVE-2015-7763:
In OpenAFS commit c7f9307c35c0c89f7ec8ada315c81ebc47517f86 the ACK packet
was further extended in an attempt to detect the path MTU between two
peers. When the ACK reason is RX_ACK_PING a variable number of octets is
appended to the ACK following the ACK trailers.
The implementation failed to initialize all of the padding region.
A variable amount of data from previous packets can be leaked onto the
network. The padding region can include data from a received packet
that was encrypted on the wire and then decrypted.
OpenAFS 1.5.75 through 1.5.78 and all 1.6.x releases (including release
candidates) are vulnerable.
Credits:
Thanks to John Stumpo for identifying both vulnerabilities.
Thanks to Simon Wilkinson for patch development.
Thanks to Ben Kaduk for managing the security release cycle.
Jeffrey Altman [Mon, 12 Oct 2015 13:56:07 +0000 (09:56 -0400)]
Windows: CM_ERROR_INEXACT_MATCH is not a fatal error
cm_BPlusDirLookup() and cm_Lookup() can return CM_ERROR_INEXACT_MATCH
which is not a fatal error. Instead it is an indication that the returned
cm_scache object was not a case sensitive match. Do not fail the request
and do not leak the cm_scache reference.
Windows: cm_Lookup return ambiguous filename to caller
cm_Lookup() must not mask a CM_ERROR_AMBIGUOUS_FILENAME error by
converting it to CM_ERROR_BPLUS_NOMATCH. Doing so results in the
redirector believing that the object does not exist instead of
there being a STATUS_OBJECT_NAME_COLLISION.
Windows: fix RDR detection of ambiguous directory entries
The redirector is supposed to reject access to file objects if there
is no case exact match and multiple entries match in a case insensitive
comparison. The check was only present in the AFSLocateNameEntry()
function and not elsewhere.
Fix the AFSLocateNameEntry() call and addd the missing checks.
Jeffrey Altman [Mon, 19 Oct 2015 00:32:06 +0000 (20:32 -0400)]
Windows: rdr pioctl operations are opaque
Although pioctl operations are delivered through the redirector the
contents of the operations are opaque to the redirector. Therefore,
the cm_req must not be initialized as a redirector operation. If they
are the necessary invalidation notifications for symlink and mount point
operations will not be delivered.
Jeffrey Altman [Fri, 9 Oct 2015 14:20:41 +0000 (10:20 -0400)]
Windows: if no known IP addrs, query the addr list
If cm_noIPAddrs == 0, then no servers will be probed. If
syscfg_GetIFInfo() fails then cm_noIPAddrs is set to 0. Therefore,
also set cm_LanAdapterChangeDetected to non-zero if syscfg_GetIFInfo()
fails so that the interface info can be queried again prior to a server
probe attempt.
In cm_CheckServersMulti() if cm_ConnByServer() fails or if cm_noIPAddr is
zero then a cm_server.pingCount will be leaked. This can result in
servers being marked down and never restored to an up state.
This change adds the necessary pingCount decrement and moves the
assignment of the cm_server_t pointer to serversp[] to make it clear
that the cm_server_t will not be in the array if a failure occurs.
Only objects in the array will have the pingCount decremented after
the RPCs are issued.
Windows: Replace CM_SERVERFLAG_PINGING with pingCount
Instead of replying upon a server flag use a pingCount interlocked
variable to track whether active ping operations are being performed
and whether or not to wait sleeping threads.
The cm_GetCell_Gen() function permits cells to be searched for by
prefix. The idea is to permit "cs.cmu.edu" to be abbreviated "cs"
when at CMU. There are two problems with the current behavior:
1. the existing match rules will accept "cs.c" and "cs.cmu.ed" as
valid prefix matches. By not restricting the prefix matching
to full components the Freelance symlink list can become
cluttered.
2. the existing match rules will accept the first cell that
matches even if there are more than one cells that would match.
this can result in unpredictable behavior since the ordering
of the cells is not guaranteed.
Instead, fail requests for cell prefixes that are not full component
matches or that would be ambiguous.
Jeffrey Altman [Mon, 4 May 2015 17:25:04 +0000 (13:25 -0400)]
Windows: Network Provider registration at service start
Windows 8, 8.1 and pre-releases of 10 have a horrible bug as part
of the upgrade process. All non-Microsoft network provider services
are removed from the NetworkProvider "Order" registry value. For
OpenAFS this has the side effect of breaking integrated logon and
all drive letter mappings to \\AFS.
During service start add code to:
1. Add "AFSRedirector" before "LanmanWorkstation" if not present
2. Add "TransarcAFSDaemon" to the end of the list if not present
Jeffrey Altman [Sun, 28 Jun 2015 19:06:34 +0000 (15:06 -0400)]
Windows: cm_Analyze mark server down for misc rx errors
In cm_Analyze() replace the token error retry logic for miscellaneous
rx errors and simply mark the server down. The most common error
that will be seen in this category is RX_INVALID_OPERATION which would
be received if the Rx service id or security class is not recognized
by the peer. This could happen if an AuriStor server is replaced by
an AFS3 server or if a packet is reflected.
A side effect of this change is that V* and CM_ERROR_* errors will
once again be retried. This will permit proper failover to occur.
Jeffrey Altman [Sun, 28 Jun 2015 18:56:47 +0000 (14:56 -0400)]
Windows: avoid vldb lookup race with network stack
If a VLDB query attempt occurs when there is no current cell db server
list then the VLDB query won't actually occur but the last query time
would be set. This prevents a query from taking place again on the volume
for 60 seconds. If the volume in question is the root.cell volume then
the redirector will be forced to return device not ready for the share
(aka \\afs\cell).
Check for a failure of cm_UpdateCell() and only set the last update time
for the volume if there was success or if the VLDB responded with volume
unknown.
Jeffrey Altman [Sun, 28 Jun 2015 17:51:40 +0000 (13:51 -0400)]
Windows: NPSupport Remote Name verification
When adding a connection verify that the server name and the share name
are valid. If not return ERROR_BAD_NETWORK_NAME.
When getting connection information, if a pre-existing connection does
not exist and either the server name or the share name do not verify
return ERROR_BAD_NETWORK_NAME and not ERROR_INVALID_PARAMETER.
Jeffrey Altman [Sun, 28 Jun 2015 17:27:03 +0000 (13:27 -0400)]
Windows: AFSParseName() uniFullName.MaximumLength
The uniFullName.MaximumLength in AFSParseName() is not properly
modified and can end up being extended beyond the actual memory
allocation due to a missing decrement.
Jeffrey Altman [Sun, 28 Jun 2015 17:18:01 +0000 (13:18 -0400)]
Windows: Always fetch auth id in kernel
When processing network provider requests in afsredirlib.sys always
obtain the auth id using the SYSTEM worker thread. Do not trust
the values provided by userland.
Jeffrey Altman [Sun, 28 Jun 2015 17:12:13 +0000 (13:12 -0400)]
Windows: Move GetAuthenticationId to Worker Thread
When PsReferenceImpersonationToken(), PsReferencePrimaryToken(), and
SeQueryInformationToken() are called in the kernel from a user process
thread the restrictions on the userland process still apply. Since we do
not want to be restricted we must obtain the token and query the token
information from a SYSTEM thread.
This change restructures the AFSGetAuthenticationId() process to queue a
synchronous task to the worker thread.
This should address the problem that has been seen during system boot when
the Group Policy Service attempts to query, remove or create a drive
letter mapping.
Jeffrey Altman [Tue, 9 Jun 2015 12:55:44 +0000 (08:55 -0400)]
Windows: AFSRetrieveFileAttributes no parent path
Modify AFSRetrieveFileAttributes() to handle the case of a ParentPathName
with a Length == 0. In such a case the introduction of a path separator
would result in the construction of an absolute path when a relative path
is required.
Jeffrey Altman [Tue, 9 Jun 2015 12:44:43 +0000 (08:44 -0400)]
Windows: AFSRetrieveParentPath handle no parent
AFSRetrieveParentPath() when presented with a relative path that has no
parent will walk off the front of the FullFileName buffer. Add checks to
ensure that Length never becomes less than zero.
Jeffrey Altman [Wed, 13 May 2015 03:15:50 +0000 (23:15 -0400)]
Windows: AFSGetConnectionInfo partial match validation
AFSGetConnectionInfo() is called to respond to NPGetResourceInformation
and NPGetConnectionPerformance WNet API requests. The former permits
the requestor to provide a path containing components that are not
processed by the file system represented by the called network provider.
As such partial matches are permitted BUT they must consist of full
components. In other words, \\afs\sh is not a valid partial match for
\\afs\share but \\afs\share is a valid partial match for \\afs\share\dir.
This change adds validation checks to enforce full component comparisons.
It also cleans up some of the associated comparisons and trace output.
Windows: NetrShareGetInfo do not return registry errors
In NetrShareGetInfo() when registry api calls fail do not leak the
error codes to the caller. Instead, set the error to CM_ERROR_NOSUCHPATH
so that NERR_NetNameNotFound can be returned.
Michael Meffie [Wed, 29 Apr 2015 15:54:45 +0000 (11:54 -0400)]
libafs: remove linux conditionals for md5 inode number calculation
Remove the conditionals which hide the md5 digest calculation for inode
numbers on non-linux platforms. This feature was originally added to
support sites running on linux, but is generally useful and the
implementation is not specific to linux.
Change-Id: I7f406f9492780c1893dc1a2892db253b05036120
Reviewed-on: http://gerrit.openafs.org/11854 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Michael Meffie [Tue, 15 Sep 2015 17:33:12 +0000 (13:33 -0400)]
LINUX: Fix oops during negative dentry caching
Commit 2e9dcc069904aaa434787eec53c6f9821911cbab reinstated negative
dentry caching, but introduced an oops when fakestat is in use. Be sure
the GLOCK is held when looking up the parent vcache dv when the parent
is a mount point and fakestat is in use, since the calls to do the
lookup require the GLOCK to be held.
Benjamin Kaduk [Thu, 15 Jan 2015 16:54:30 +0000 (11:54 -0500)]
afs: Increase vcache and dcache hash table sizes
Now that we are using a real hash function, larger hash tables
will be more useful.
The vcache hash tables are statically sized, and this increase will
add about a megabyte to the kernel module's memory footprint.
Update the algorithm used to dynamically size the dcache hash tables,
keeping the old behavior for small numbers of dcaches, but growing
the hash table's size to keep the average chain length near two
for a range of dcache numbers. Cap the dcache hash tables at 32k
entries to avoid excessive resource usage.
This involves code from opr, namely opr/ffs.h, which is acceptable
in the kernel module because that header is a standalone header
like jhash.h, with no dependencies on the system.
Change-Id: I7cdb3e993b1c2ad177a46ecc06bfa2be52e619e5
Reviewed-on: http://gerrit.openafs.org/11679 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Andrew Deason [Mon, 25 Aug 2014 04:01:16 +0000 (23:01 -0500)]
LINUX: Restore negative dentry caching
One of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba
effectively disabled negative caching for dentries, by always
invalidating a negative dentry in afs_linux_dentry_revalidate. This
was because various temporary errors could result in ENOENT errors
being returned to afs_lookup, which created incorrect negative dentry
cache entries.
These incorrect ENOENT errors were rectified in change
Ib01e4309e44b532f843d53c8de2eae613e397bf6 . So, negative dentry cache
entries should work now, so remove the code to unconditionally
invalidate these negative entries.
Benjamin Kaduk [Tue, 27 Jan 2015 21:33:25 +0000 (16:33 -0500)]
Make compile_et output usable out-of-tree
Prior to this commit, the output C files from compile_et would
emit #includes of <afsconfig.h> and <afs/param.h>. These files
are not installed, and are only available in an OpenAFS build tree.
The output C files also emit #includes of <afs/error_table.h>, which
is an installed file, and is therefore expected to be available on
a system with OpenAFS installed. Removing the first two headers will
allow OpenAFS's compile_et binary to be used to compile error tables
which are not part of OpenAFS, on systems where OpenAFS is installed.
The inclusion of afsconfig.h was added in commit 972a4072827fb2ec680354d5adebc2c5cca06939 to ensure that it was included
prior to afs/param.h; however, the inclusion of afs/param.h in
compile_et.c stems from the original IBM import and seems of minimal
value. The only changes needed to build without param.h are to use
int instead of afs_int32 in a couple places (int is 32 bits on
all platforms currently supported) and to include <sys/types.h>
for size_t.
Benjamin Kaduk [Wed, 14 Jan 2015 01:22:59 +0000 (20:22 -0500)]
afs: use jenkins hash for dcache, vcache tables
Switch the four dcache and vcache hash tables to use the jenkins
hash from opr.
This requires making DCHash into a full-weight function in order
to properly hash all three inputs; convert all four symbols to
full functions for consistency. Just pull in <opr/jhash.h> via
afs.h so all consumers (e.g., of VCSIZE) can use it without
modification.
This is the first use of src/opr/ in src/afs/ (outside UKERNEL),
but it is permissible because opr/jhash.h is a standalone
header and there are no C files needed for its implementation which
would require anything from the system.
Benjamin Kaduk [Sun, 14 Dec 2014 21:13:39 +0000 (16:13 -0500)]
rx: Tidy up rxi_CheckCall()'s mtuout handling
We don't actually do anything that matters if lastPacketSizeSeq
is set and lastPacketSize is zero, so zero both when we're cleaning
up.
lastPacketSize and lastPacketSizeSeq are set together in
rxi_SendPacket (and rxi_SendPacketList), when we are sending a packet
larger than the current estimate of the peer's maxPacketSize.
The two fields are checked together during ack processing, but
rxi_CheckCall() only checks lastPacketSize, ignoring lastPacketSizeSeq.
Michael Meffie [Wed, 21 Jan 2015 19:31:51 +0000 (14:31 -0500)]
bozo: use the full path when renaming BosLog to BosLog.old
Use the full path when renaming the BosLog file to BosLog.old and when
checking whether the BosLog file can be opened, otherwise the rename
will fail (and go unnoticed), and the initial BosLog check opens a
handle to a file in the wrong directory.
Create the server directories, including the logs directory, before
forking and log file initialization.
Change-Id: I3733d64335f348190572f6278086b634641f2754
Reviewed-on: http://gerrit.openafs.org/11685 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Chas Williams <3chas3@gmail.com> Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Michael Meffie [Mon, 9 Feb 2015 20:04:19 +0000 (15:04 -0500)]
bozo: fix -pidfiles default
Fix the default value for the -pidfiles argument. The pidfiles
should be stored in the local state directory, not the server
configuration directory when using modern paths.
Anders Kaseorg [Fri, 31 Jul 2015 05:49:03 +0000 (01:49 -0400)]
kauth: Resolve date signedness warning in SetFields
Resolves this warning:
admin_tools.c: In function ‘SetFields’:
admin_tools.c:611:30: warning: pointer targets in passing argument 2 of ‘ktime_DateToInt32’ differ in signedness [-Wpointer-sign]
code = ktime_DateToInt32(s, &expiration);
^
In file included from /home/anders/wd/openafs/include/afs/afsutil.h:84:0,
from admin_tools.c:39:
/home/anders/wd/openafs/include/afs/afsutil_prototypes.h:101:18: note: expected ‘afs_int32 *’ but argument is of type ‘afs_uint32 *’
extern afs_int32 ktime_DateToInt32(char *adate, afs_int32 * aint32);
^
Change-Id: Id24e7a6cd1ab2291c0c05d3835f4ad7fddfec8d7
Reviewed-on: http://gerrit.openafs.org/11956 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Perry Ruiter <pruiter@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Benjamin Kaduk [Fri, 27 Feb 2015 22:47:45 +0000 (17:47 -0500)]
Update asetkey.8 for KeyFileExt
Prefer KeyFileExt to KeyFile ~everywhere. Make the main documentation
assume a modern cell with KeyFileExt and rxkad-k5, moving the old
rxkad and KeyFile documentation to a new section,
HISTORICAL COMPATIBILITY.
Note that kaserver is deprecated.
Do not mention the Update Server, which is also disrecommended for
new installations.
Marc Dionne [Wed, 29 Jul 2015 12:03:14 +0000 (09:03 -0300)]
Linux: Only use automount for volume roots
As long as we avoid using directory aliases when crossing
a mount point (at the volume root), we should always get
to a given non root directory with the same dentry.
The mechanism added by commit de381aa0 ("Linux: Make dir
dentry aliases act like symlinks") is therefore only really
necessary for a volume root.
With kernel 4.2 it is not possible to tweak the "total link
count", resulting in ELOOP errors when looking up a path
with 40 or more directories that are being looked up for
the first time. With this change, only mountpoints will
count against the limit.
Anders Kaseorg [Sat, 1 Aug 2015 03:26:43 +0000 (23:26 -0400)]
tests/auth/keys-t.c: Don’t ignore return value of write
Resolves this warning:
keys-t.c: In function ‘copy’:
keys-t.c:63:6: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(out, block, len);
^
Simon Wilkinson [Sat, 2 Mar 2013 09:19:13 +0000 (09:19 +0000)]
Unix CM: Make rootVolume array big enough
In afs_CheckRootVolume, the local rootVolumeName array needs to
be large enough to hold the contents of the global
afs_rootVolumeName string, which is 64 characters long. Fix our
local array to be the same length by using a new defined constant
MAXROOTVOLNAMELEN.
with the command "vos dump -clone" use the volumename of the cloned volume
instead of the fixed string "dump-clone-temp". This volumename is recorded
in the DumpHeader and VolumeHeader of the dump file.
Marc Dionne [Mon, 16 Dec 2013 21:52:17 +0000 (16:52 -0500)]
afsmonitor: Skip additional bits for large timeval
When the timeval structure uses 64-bit values for sec and usec,
64 extra bits need to be skipped in the input for every time value
that is parsed. There's a remaining assumption in this part of the
code that the time values received from the server are 32-bits, but
after decoding they will always have the local size which may well
be 64-bits.
Benjamin Kaduk [Mon, 12 Jan 2015 21:13:28 +0000 (16:13 -0500)]
Switch to jhash for VNODE_HASH
Remove the vnodeHashOffset field, as the Jenkins hash will get
a uniform-enough distribution without this extra help. Per-volume
unique hashing is retained by using the volume ID as the initial
value input to the Jenkins hash.
While here, increase the vnode hash table size from 256 to 2048.
Benjamin Kaduk [Mon, 12 Jan 2015 20:14:48 +0000 (15:14 -0500)]
Normalize on vp->hashid for hash table usage
At present the hashid is set to the same value as the volume ID
(i.e., V_id(vp) a.k.a. vp->header->diskstuff.id), but we should
not leak across the abstraction barrier without cause.
For non-objdir builds this doesn't happen, since $srcdir is just '.',
and afs_trace.et gets expanded to just afs_trace.et (or possibly
./afs_trace.et). This is also not a problem for objdir builds that are
specified as a relative path and are 'adjacent' to the srcdir. For
example, if we ran '../openafs-1.6.10pre1/configure --options', our
$top_srcdir is just '../openafs-1.6.10pre1', with some magic to
expand '..' to the correct number of levels. So in the above example,
the compile_et invocation gets expanded to:
/path/to/objdir/src/comerr/compile_et -emit h -v 2 \
-p ../../../openafs-1.6.10pre1/src/afs \
../../../openafs-1.6.10pre1/src/afs/afs_trace.et
And compile_et then tries to open the path
../../../openafs-1.6.10pre1/src/afs/../../../openafs-1.6.10pre1/src/afs/afs_trace.et
which collapses to just
../../../openafs-1.6.10pre1/src/afs/afs_trace.et, which is the correct
file.
However, if the $srcdir is specified as an absolute path, or if the
number of '..'s is wrong, this doesn't work. It is perhaps easiest to
explain why by just using another example. For an absolute path, the
invoked command is:
/path/to/objdir/src/comerr/compile_et -emit h -v 2 \
-p /path/to/openafs-1.6.10pre1/src/afs \
/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et
And compile_et tries to open
/path/to/openafs-1.6.10pre1/src/afs/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et,
which obviously does not exist. This results in a build failure like:
/path/to/openafs-1.6.10pre1/src/afs/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target `afs_trace.msf'
For a non-working relative objdir, we may invoke a command like this:
/path/to/objdir/src/comerr/compile_et -emit h -v 2 \
-p ../../../../openafs-1.6.10pre1/src/afs \
../../../../openafs-1.6.10pre1/src/afs/afs_trace.et
And compile_et tries to open
../../../../openafs-1.6.10pre1/src/afs/../../../../openafs-1.6.10pre1/src/afs/afs_trace.et,
which is ../../../../../openafs-1.6.10pre1/src/afs/afs_trace.et, which
(probably) doesn't exist, since it goes one too many levels up.
To avoid this, we can just prevent the filename argument to compile_et
from undergoing VPATH expansion. compile_et never opens the given path
directly if -p is given, so it's not really a file path and so should
not be altered by VPATH.
compile_et will add a trailing .et to the filename if it doesn't have
one, so we can avoid the VPATH expansion by just leaving out the
trailing .et. We could also avoid the VPATH expansion by specifying
something like './afs_trace.et', but it is perhaps more clear to not
say the explicit filename, since we're not really specifying a path to
a file.
Just leaving out the -p option, as in this style of compile_et
invocation:
also fails for objdir builds. This is because, without the -p option,
compile_et defaults to '.' as the prefix. If the srcdir is
/path/to/openafs-1.6.10pre1, then this will expand to:
/path/to/objdir/src/comerr/compile_et -emit h \
.//path/to/openafs-1.6.10pre1/src/tools/dumpscan/dumpscan_errs.et
which will fail, since that path to dumpscan_errs.et does not exist.
So to fix this, make all compile_et invocations follow this style:
${COMPILE_ET_H} -p ${srcdir} foo
Many other invocations of compile_et in the tree are already like
this, so this commit just changes the others to match.
Andrew Deason [Mon, 13 Jan 2014 05:24:55 +0000 (23:24 -0600)]
LINUX: Fix "unused but set var" autoconf warnings
A few of the linux autoconf tests generate -Wunused-but-set-variable
warnings, unless the test is run with -Wno-unused-but-set-variable.
Since we run these tests with -Werror, this can cause the tests to
incorrectly fail if they are not run with
-Wno-unused-but-set-variable.
The Linux kernel build process normally does run with that option, but
due to some other (possibly buggy) behavior, sometimes these configure
tests do not run with that option. So, make our tests work without
generating that warning, so we will work in more cases.
Reorganize a few of these tests so we are setting a field in a global
structure, instead of a function-local one. Make the test function
names and style little more consistent while we are here, but do not
make the global structure 'static', in case the compiler recognizes we
are setting fields for a structure that cannot be used by anything.
In particular, the "revalidate takes nameidata" test had been wrongly
succeeding, but that didn't usually matter because of how the feature
tests are ordered in the code. It does matter in the case when the
"revalidate takes unsigned" check also gets a wrong result, which
can cause kernel BUGs, which should be fixed by these changes.
Andrew Deason [Mon, 10 Feb 2014 20:13:39 +0000 (14:13 -0600)]
vol: Log more info on wrong SYNC response length
We log that the length of the response was wrong, so we're dropping
the connection. Log what the actual and expected lengths were, at
least, so we can maybe get a little bit of useful information from
this message.
Andrew Deason [Sat, 14 Feb 2015 00:08:25 +0000 (18:08 -0600)]
afs: Stop abusing ENOENT
When looking up a file, the ENOENT error code is supposed to be used
if we know that the target filename does not exist. That is, the
situation is a user or application error; they specified a filename
that was not previously created.
Currently, though, we use ENOENT for a variety of different
situations, such as:
- After successfully looking up a directory entry, we fail to
afs_GetDCache or afs_GetVCache on the FID for that entry.
- We encounter an invalid mount point, in certain code paths.
In each of these situations, an ENOENT error code is incorrect, since
the target filename does indeed exist and these situations may be
caused by network or administrative errors. An ENOENT error implies
that the user may be able to then create the target filename, which is
not true most of the time in the above situations.
In addition, on LINUX we return a negative dcache entry when we
encounter an ENOENT error on lookup. This means that if any of the
above scenarios occur, Linux would cache the fact that that directory
entry did not exist, and return ENOENT for future lookups. This was
worked around in one of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba to always invalidate such
negative dentries, but at the cost of performance (since this caused
negative lookups to never be cached).
To avoid all of these issues, just don't use ENOENT in these
situations. For simple non-disconnected afs_GetDCache or afs_GetVCache
errors, return EIO, since we have encountered an error that is
internal to AFS (either the underlying data is inconsistent, or we
have a network error, or something else). In disconnected operation,
return ENETDOWN like in other disconnected code paths, since often the
root cause is due to us not having network access. When a bad
mountpoint is encountered, return ENODEV, since that is what we use
elsewhere in the code when encountering a bad mountpoint.
It is also noteworthy that this changes removes the translation of
VNOVNODE into ENOENT, since a nonexistent vnode is not the same as a
nonexistent filename, as described above. Some code paths have special
behavior for this situation (ignoring the error in some cases where it
does not matter). These code paths should be okay with this change,
since all of them examine error codes that have not been translated
through afs_CheckCode.
Some useless references to ENOENT were also removed in
src/afs/LINUX*/osi_misc.c. These did not result in incorrect behavior,
but removing them makes searching for bad ENOENT references easier.
Andrew Deason [Sat, 14 Feb 2015 00:02:44 +0000 (18:02 -0600)]
afs: Clarify vcache->mvid accesses
Currently, numerous places in the code treat the 'mvid' field in
struct vcache as a few different things:
- If the vcache is a mountpoint, mvid points to the fid of the root
dir of the target volume.
- If the vcache is a volume root dir, mvid points to the fid of the
parent dir for the mountpoint.
- If the vcache is a sillyrenamed file, mvid points to a string,
which is the name the vcache was renamed to.
Despite these three things being very different (and one of them is a
completely different type than the others), everywhere in the code
just accesses mvid as 'avc->mvid'. This can make it very confusing as
to what the field actually means at any particular part of the code,
and makes it very difficult to search the code for places that use
mvid in any one of these specific ways.
So, to aid in code clarity, make mvid into a union, with the following
members:
- target_root: For the "mountpoint" case.
- parent: For the "root dir" case.
- silly_name: For the "sillyrename" case.
This should have no effect on code behavior, but just makes the code a
bit clearer.
Andrew Deason [Fri, 13 Feb 2015 23:31:37 +0000 (17:31 -0600)]
afs: Use named constants for mvstat
Currently the vcache 'mvstat' field is assigned three magic values: 0
for normal files and directories, 1 for mountpoint objects, and 2 for
volume root dirs. These values are clearly defined in comments, but
everywhere we actually assign or compare these values, we use the bare
numbers.
Stop this nonsense and use named constants, to make the code less
inscrutable.
Change-Id: Ic1b133109d619b70317141431f163e552bafd109
Reviewed-on: http://gerrit.openafs.org/11747 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Andrew Deason [Mon, 11 Aug 2014 18:51:39 +0000 (13:51 -0500)]
vol: Avoid FDH_SEEK/FDH_READ
All code in the tree except for this uses positional i/o
(FDH_PREAD/FDH_PWRITE). For consistency and to ensure that we do not
mix positional and non-positional i/o, just use the positional i/o
functions here. It's simpler, too.
Michael Meffie [Mon, 31 Mar 2014 18:25:54 +0000 (14:25 -0400)]
readme: remove README.PTHREADED_UBIK
We enabled pthreaded ubik by default in commit 27cb0d38885428474b0d4287,
and it is no longer considered beta or experimental. There is no longer
a need for separate documentation of it, and adjust the options
listing in INSTALL accordingly.
[kaduk@mit.edu: adjust for the changed default behavior.]
Jeffrey Altman [Sat, 1 Aug 2015 13:32:35 +0000 (09:32 -0400)]
vlserver: ListAttributesN2 volume name safety
The vlserver ListAttributesN2 RPC permits filtering the result set
by volume name in addition by site or volume id.
Two issues identified by Andrew Deason (Sine Nomine Associates) are
addressed by this patch. First, the size of the volumename[] buffer
is insufficient to store the valid input read over the network. The
buffer needs to be able to store VL_MAXNAMELEN characters of the volume
name, two characters for the regular expression '^' and '$', and the
trailing NUL.
Second, sprintf() is used to write to the buffer and even with valid
input from the caller SVL_ListAttributesN2 can overflow the buffer
when ".backup" and ".readonly" are appended to the volume name. If
there is an overflow the search name is invalid and there can not be
a valid match.
This patch increases the size of volumename[] to VL_MAXNAMELEN+3.
It also uses snprintf() instead of sprintf() and performs error
checking. The error VL_BADNAME is returned when the network input is
invalid.
D Brashear [Fri, 18 Jul 2014 20:00:12 +0000 (16:00 -0400)]
vlserver: limit use of regex to admins always
allow regexes only if the querying user is a superuser.
if the superuser uses up all the resources, well, they could just do
whatever damage directly anyway. means even in unrestricted mode
we are not vulnerable
Change-Id: Ib35d649f31e752ba5ae8373a06b67ea76f97425c
Reviewed-on: http://gerrit.openafs.org/11968 Reviewed-by: Daria Brashear <shadow@your-file-system.com> Reviewed-by: Mark Vitale <mvitale@sinenomine.net> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Anders Kaseorg [Sat, 1 Aug 2015 03:28:49 +0000 (23:28 -0400)]
tests/volser/vos-t.c: Don’t ignore return value of pipe
Resolves this warning:
vos-t.c: In function ‘TestListAddrs’:
vos-t.c:60:5: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result]
pipe(outpipe);
^
jhash-t.c: In function ‘main’:
jhash-t.c:60:4: warning: this decimal constant is unsigned only in ISO C90
is_int(3704403432, opr_jhash(test, 2, 0),
^
jhash-t.c:62:4: warning: this decimal constant is unsigned only in ISO C90
is_int(3704403432, opr_jhash_int2(test[0], test[1], 0),
^
Anders Kaseorg [Sat, 1 Aug 2015 07:58:19 +0000 (03:58 -0400)]
Add XBSA_XLIBS to XLIBS after it’s computed
Commit 353aa7ef2c172f574998480d6d051b3f4e95ae7b (after 1.6 was
branched) reordered things such that XBSA_XLIBS was being added to
XLIBS before it was computed, which caused link failures with
--enable-tivoli-tsm.
Anders Kaseorg [Sat, 1 Aug 2015 09:54:42 +0000 (05:54 -0400)]
tests/opr/time-t.c: Use labs instead of abs for long argument
Resolves this warning with clang:
time-t.c:46:8: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause
truncation of value [-Wabsolute-value]
ok(abs(osTime - osNow) < 2, "opr_time_Now returns a reasonable value");
^
time-t.c:46:8: note: use function 'labs' instead
ok(abs(osTime - osNow) < 2, "opr_time_Now returns a reasonable value");
^~~
labs
Anders Kaseorg [Sat, 1 Aug 2015 09:52:59 +0000 (05:52 -0400)]
src/kauth/krb_udp.c: Remove redundant NULL check for array address
Resolves this warning with clang:
krb_udp.c:302:13: warning: address of array 'tentry.misc_auth_bytes' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (tentry.misc_auth_bytes) {
~~ ~~~~~~~^~~~~~~~~~~~~~~
Anders Kaseorg [Fri, 31 Jul 2015 05:35:05 +0000 (01:35 -0400)]
rfc3961: prototype _krb5_internal_hmac
Resolves this warning:
src/external/heimdal/krb5/crypto-arcfour.c: In function ‘_oafs_h__krb5_HMAC_MD5_checksum’:
src/external/heimdal/krb5/crypto-arcfour.c:82:5: warning: implicit declaration of function ‘_oafs_h__krb5_internal_hmac’ [-Wimplicit-function-declaration]
ret = _krb5_internal_hmac(context, c, signature, sizeof(signature),
^