openafs.git
20 months agoMake OpenAFS 1.8.2 openafs-stable-1_8_2
Benjamin Kaduk [Tue, 11 Sep 2018 03:18:34 +0000]
Make OpenAFS 1.8.2

Update version strings for the 1.8.2 release.

Change-Id: I90e59f3a8c930d80eab46b405050e11ea2fc2fe1

20 months agoUpdate NEWS for 1.8.2
Benjamin Kaduk [Tue, 11 Sep 2018 01:26:20 +0000]
Update NEWS for 1.8.2

Release notes for the OpenAFS 1.8.2 security release.

Change-Id: If447b08cc3b3901da22eeb92a2e75bf2ab476633

20 months agoFix typos in audit format strings
Benjamin Kaduk [Tue, 11 Sep 2018 15:51:01 +0000]
Fix typos in audit format strings

Commit 9ebff4c6caa8b499d999cfd515d4d45eb3179769 introduced audit
framework support for several butc-related data types, but had
a typo ('$d' for '%d') in a couple of places, that was not reported
by compiler format-string checking.  Fix the typo to properly print
all the auditable data.

(cherry picked from commit d5816fd6cd1876760a985a817dbbb3940cf3bddb)

Change-Id: Iaea64ab0fe422381c298d94eff201c3525bd00c2

20 months agoOPENAFS-SA-2018-001 backup: use authenticated connection to butc
Benjamin Kaduk [Sun, 9 Sep 2018 15:44:38 +0000]
OPENAFS-SA-2018-001 backup: use authenticated connection to butc

Use the standard routine to pick a client security object, instead of
always assuming rxnull.  Respect -localauth as well as being able to
use the current user's tokens, but also provide a -nobutcauth argument
to fall back to the historical rxnull behavior (but only for the connections
to butc; vldb and budb connections are not affected).

(cherry picked from commit 345ee34236c08a0a2fb3fff016edfa18c7af4b0a)

Change-Id: I1e5e0e38d4003020db5875609db08194f7684bb7

20 months agoOPENAFS-SA-2018-001 butc: require authenticated connections with -localauth
Benjamin Kaduk [Thu, 6 Sep 2018 23:50:39 +0000]
OPENAFS-SA-2018-001 butc: require authenticated connections with -localauth

The butc -localauth option is available to use the cell-wide key to
authenticate to the vlserver and buserver, which in normal deployments
will require incoming connections to be authenticated as a superuser.
In such cases, the cell-wide key is also available for use in
authenticating incoming connections to the butc, which would otherwise
have been completely unauthenticated.

Because of the security hazards of allowing unauthenticaed inbound
RPCs, especially ones that manipulate backup information and are allowed
to initiate outboud RPCs authenticated as the superuser, default to
not allowing unauthenticated inbound RPCs at all.  Provide an opt-out
command-line argument for deployments that require this functionality
and have configured their network environment (firewall/etc.) appropriately.

Change-Id: Ia6349757a4c6d59d1853df1a844e210d32c14feb

20 months agoOPENAFS-SA-2018-001 Add auditing to butc server RPC implementations
Benjamin Kaduk [Sun, 9 Sep 2018 16:49:03 +0000]
OPENAFS-SA-2018-001 Add auditing to butc server RPC implementations

Make the actual implementations into helper functions, with the RPC
stubs calling the helpers and doing the auditing on the results, akin
to most other server programs in the tree.  This relies on support for
some additional types having been added to the audit framework.

(cherry picked from commit c43169fd36348783b1a5a55c5bb05317e86eef82)

Change-Id: Ia90c355bfded24820ae3b5c014e948e28eac6356

20 months agoOPENAFS-SA-2018-001 audit: support butc types
Benjamin Kaduk [Sun, 9 Sep 2018 00:42:36 +0000]
OPENAFS-SA-2018-001 audit: support butc types

Add support for several complex butc types to enable butc auditing.

Change-Id: I6aedd933cf5330cda40aae6f33827ae65409df32

20 months agoOPENAFS-SA-2018-001 butc: remove dummy osi_audit() routine
Benjamin Kaduk [Sun, 9 Sep 2018 01:35:25 +0000]
OPENAFS-SA-2018-001 butc: remove dummy osi_audit() routine

This local stub was present in the original IBM import and is unused.
It will conflict with the real audit code once we start adding auditing
to the TC_ RPCs, so remove it now.

(cherry picked from commit 50216dbbc30ed94f89bdd0e964f4891e87f28c0b)

Change-Id: I63db513bb107ef47da77f13b27cdf5d24b4a24b4

20 months agoOPENAFS-SA-2018-003 rxgen: prevent unbounded input arrays
Mark Vitale [Fri, 6 Jul 2018 07:14:19 +0000]
OPENAFS-SA-2018-003 rxgen: prevent unbounded input arrays

RPCs with unbounded arrays as inputs are susceptible to remote
denial-of-service (DOS) attacks.  A malicious client may submit an RPC
request with an arbitrarily large array, forcing the server to expend
large amounts of network bandwidth, cpu cycles, and heap memory to
unmarshal the input.

Instead, issue an error message and stop rxgen when it detects an RPC
defined with an unbounded input array.  Thus we will detect the problem
at build time and prevent any future unbounded input arrays.

(cherry picked from commit a4c1d5c48deca2ebf78b1c90310b6d56b3d48af6)

Change-Id: I4c60c4776d7f02ea9790b76b49e7325d9c55f31d

20 months agoOPENAFS-SA-2018-003 volser: prevent unbounded input to various AFSVol* RPCs
Mark Vitale [Fri, 6 Jul 2018 07:21:26 +0000]
OPENAFS-SA-2018-003 volser: prevent unbounded input to various AFSVol* RPCs

Several AFSVol* RPCs are defined with an unbounded XDR "string" as
input.

RPCs with unbounded arrays as inputs are susceptible to remote
denial-of-service (DOS) attacks.  A malicious client may submit an
AFSVol* request with an arbitrarily large string, forcing the volserver
to expend large amounts of network bandwidth, cpu cycles, and heap
memory to unmarshal the input.

Instead, give each input "string" an appropriate size.
Volume names are inherently capped to 32 octets (including trailing NUL)
by the protocol, but there is less clearly a hard limit on partition names.
The Vol_PartitionInfo{,64} functions accept a partition name as input and
also return a partition name in the output structure; the output values
have wire-protocol limits, so larger values could not be retrieved by clients,
but for denial-of-service purposes, a more generic PATH_MAX-like value seems
appropriate.  We have several varying sources of such a limit in the tree, but
pick 4k as the least-restrictive.

[kaduk@mit.edu: use a larger limit for pathnames and expand on PATH_MAX in
commit message]

(cherry picked from commit 8b92d015ccdfcb70c7acfc38e330a0475a1fbe28)

Change-Id: Ifa591dfd861688d4d7eb43145b29a1739c6e0f6f

20 months agoOPENAFS-SA-2018-003 volser: prevent unbounded input to AFSVolForwardMultiple
Mark Vitale [Fri, 6 Jul 2018 05:09:53 +0000]
OPENAFS-SA-2018-003 volser: prevent unbounded input to AFSVolForwardMultiple

AFSVolForwardMultiple is defined with an input parameter that is defined
to XDR as an unbounded array of replica structs:
  typedef replica manyDests<>;

RPCs with unbounded arrays as inputs are susceptible to remote
denial-of-service (DOS) attacks.  A malicious client may submit an
AFSVolForwardMultiple request with an arbitrarily large array, forcing
the volserver to expend large amounts of network bandwidth, cpu cycles,
and heap memory to unmarshal the input.

Even though AFSVolForwardMultiple requires superuser authorization, this
attack is exploitable by non-authorized actors because XDR unmarshalling
happens long before any authorization checks can occur.

Add a bounding constant (NMAXNSERVERS 13) to the manyDests input array.
This constant is derived from the current OpenAFS vldb implementation, which
is limited to 13 replica sites for a given volume by the layout (size) of the
serverNumber, serverPartition, and serverFlags fields.

[kaduk@mit.edu: explain why this constant is used]

(cherry picked from commit 97b0ee4d9c9d069e78af2e046c7987aa4d3f9844)

Change-Id: I49945ce1fd5979eadf6d5b310dc6d8c68f6f8dc7

20 months agoOPENAFS-SA-2018-003 budb: prevent unbounded input to BUDB_SaveText
Mark Vitale [Fri, 6 Jul 2018 03:51:37 +0000]
OPENAFS-SA-2018-003 budb: prevent unbounded input to BUDB_SaveText

BUDB_SaveText is defined with an input parameter that is defined to XDR
as an unbounded array of chars:
   typedef char charListT<>;

RPCs with unbounded arrays as inputs are susceptible to remote
denial-of-service (DOS) attacks.  A malicious client may submit a
BUDB_SaveText request with an arbitrarily large array, forcing the budb
server to expend large amounts of network bandwidth, cpu cycles, and
heap memory to unmarshal the input.

Modify the XDR definition of charListT so it is bounded.  This typedef
is shared (as an OUT parameter) by BUDB_GetText and BUDB_DumpDB, but
fortunately all in-tree callers of the client routines specify the same
maximum length of 1024.

Note: However, SBUDB_SaveText server implementation seems to allow for up to
BLOCK_DATA_SIZE (2040) = BLOCKSIZE (2048) - sizeof(struct blockHeader)
(8), and it's unknown if any out-of-tree callers exist.  Since we do not need a
tight bound in order to avoid the DoS, use a somewhat higher maximum of
4096 bytes to leave a safety margin.

[kaduk@mit.edu: bump the margin to 4096; adjust commit message to match]

(cherry picked from commit 124445c0c47994f5e2efef30e86337c3c8ebc93f)

Change-Id: Ic34f8f9e7484b7503a223509d5d61b72e1298b35

20 months agoOPENAFS-SA-2018-003 vlserver: prevent unbounded input to VL_RegisterAddrs
Mark Vitale [Fri, 6 Jul 2018 01:11:30 +0000]
OPENAFS-SA-2018-003 vlserver: prevent unbounded input to VL_RegisterAddrs

VL_RegisterAddrs is defined with an input argument of type bulkaddrs,
which is defined to XDR as an unbounded array of afs_uint32 (IPv4 addresses):
  typedef afs_uint32 bulkaddrs<>

The <> with no value instructs rxgen to build client and server stubs
that allow for a maximum size of "~0u" or 0xFFFFFFFF.

Ostensibly the bulkaddrs array is unbounded to allow it to be shared
among VL_RegisterAddrs, VL_GetAddrs, and VL_GetAddrsU.  The VL_GetAddrs*
RPCs use bulkaddrs as an output array with a maximum size of MAXSERVERID
(254). VL_RegisterAddrss uses bulkaddrs as an input array, with a
nominal size of VL_MAXIPADDRS_PERMH (16).

However, RPCs with unbounded array inputs are susceptible to remote
denial-of-service attacks.  That is, a malicious client may send a
VL_RegisterAddrs request with an arbitrarily long array, forcing the
vlserver to expend large amounts of network bandwidth, cpu cycles, and
heap memory to unmarshal the argument.  Even though VL_RegisterAddrs
requires superuser authorization, this attack is exploitable by
non-authorized actors because XDR unmarshalling happens long before any
authorization checks can occur.

Because all uses of the type that our implementation support have fixed
bounds on valid data (whether input or output), apply an arbitrary
implementation limit (larger than any valid structure would be), to
prevent this class of attacks in the XDR decoder.

[kaduk@mit.edu: limit the bulkaddrs type instead of introducing a new type]

(cherry picked from commit 7629209219bbea3f127b33be06ac427ebc3a559e)

Change-Id: I1726a834eb98b7e06285bac78a74e20bbedb9ce8

20 months agoOPENAFS-SA-2018-002 butc: Initialize OUT scalar value
Benjamin Kaduk [Thu, 30 Aug 2018 15:38:56 +0000]
OPENAFS-SA-2018-002 butc: Initialize OUT scalar value

In STC_ReadLabel, the interaction with the tape device is
synchronous, so there is no need to allocate a task ID for status
monitoring.  However, we do need to initialize the output value,
to avoid writing stack garbage on the wire.

(cherry picked from commit f5a80115f8f7f9418287547f0fc7fdb13d936f00)

Change-Id: I3f5ea1cfff0d04adb49cdca7b05ac869665660e5

20 months agoOPENAFS-SA-2018-002 ubik: prevent VOTE_Debug, VOTE_XDebug information leak
Mark Vitale [Tue, 26 Jun 2018 10:01:16 +0000]
OPENAFS-SA-2018-002 ubik: prevent VOTE_Debug, VOTE_XDebug information leak

VOTE_Debug and VOTE_XDebug (udebug) both leave a single field
uninitialized if there is no current transaction.  This leaks the memory
contents of the ubik server over the wire.

struct ubik_debug
- 4 bytes in member writeTrans

In common code to both RPCs, ensure that writeTrans is always
initialized.

[kaduk@mit.edu: switch to memset]

(cherry picked from commit 7a7c1f751cdb06c0d95339c999b2c035c2d2168b)

Change-Id: I2759989bf1a5190f9f03621218224c47094a88b7

20 months agoOPENAFS-SA-2018-002 kaserver: prevent KAM_ListEntry information leak
Mark Vitale [Tue, 26 Jun 2018 09:26:21 +0000]
OPENAFS-SA-2018-002 kaserver: prevent KAM_ListEntry information leak

KAM_ListEntry (kas list) does not initialize its output correctly.  It
leaks kaserver memory contents over the wire:

struct kaindex
- up to 64 bytes for member name
- up to 64 bytes for member instance

Initialize the buffer.

[kaduk@mit.edu: move initialization to top of server routine]

(cherry picked from commit b604ee7add7be416bf20973422a041e913d20761)

Change-Id: Ic40bb2d5af409399c11a378340ba92174e26112f

20 months agoOPENAFS-SA-2018-002 butc: prevent TC_DumpStatus, TC_ScanStatus information leaks
Mark Vitale [Tue, 26 Jun 2018 09:12:32 +0000]
OPENAFS-SA-2018-002 butc: prevent TC_DumpStatus, TC_ScanStatus information leaks

TC_ScanStatus (backup status) and TC_GetStatus (internal backup status
watcher) do not initialize their output buffers.  They leak memory
contents over the wire:

struct tciStatusS
- up to 64 bytes in member taskName (TC_MAXNAMELEN 64)
- up to 64 bytes in member volumeName  "

Initialize the buffers.

[kaduk@mit.edu: move initialization to top of server routines]

(cherry picked from commit be0142707ca54f3de99c4886530e7ac9f48dd61c)

Change-Id: I7a97ad1dbab004938085b401929d4925d80ff3b2

20 months agoOPENAFS-SA-2018-002 butc: prevent TC_ReadLabel information leak
Mark Vitale [Tue, 26 Jun 2018 09:00:25 +0000]
OPENAFS-SA-2018-002 butc: prevent TC_ReadLabel information leak

TC_ReadLabel (backup readlabel) does not initialize its output buffer
completely.  It leaks butc memory contents over the wire:

struct tc_tapeLabel
- up to 32 bytes from member afsname (TC_MAXTAPELEN 32)
- up to 32 bytes from member pname (TC_MAXTAPELEN 32)

Initialize the buffer.

[kaduk@mit.edu: move initialization to the RPC stub]

(cherry picked from commit 52f4d63148323e7d605f9194ff8c1549756e654b)

Change-Id: Ia5d9dd649bdbd45c8b201f344bf55080a55e3392

20 months agoOPENAFS-SA-2018-002 budb: prevent BUDB_* information leaks
Mark Vitale [Tue, 26 Jun 2018 08:39:44 +0000]
OPENAFS-SA-2018-002 budb: prevent BUDB_* information leaks

The following budb RPCs do not initialize their output correctly.
This leaks buserver memory contents over the wire:

BUDB_FindLatestDump (backup dump)
BUDB_FindDump (backup volrestore, diskrestore, volsetrestore)
BUDB_GetDumps (backup dumpinfo)
BUDB_FindLastTape (backup dump)

struct budb_dumpEntry
- up to 32 bytes in member volumeSetName
- up to 256 bytes in member dumpPath
- up to 32 bytes in member name
- up to 32 bytes in member tape.tapeServer
- up to 32 bytes in member tape.format
- up to 256 bytes in member dumper.name
- up to 128 bytes in member dumper.instance
- up to 256 bytes in member dumper.cell

Initialize the buffer in common routine FillDumpEntry.

(cherry picked from commit e96771471134102d3879a0ac8b2c4ef9d91a61b8)

Change-Id: I85ec8a21966386baa8243326072e5730726cba96

20 months agoOPENAFS-SA-2018-002 afs: prevent RXAFSCB_TellMeAboutYourself information leak
Mark Vitale [Tue, 26 Jun 2018 07:56:24 +0000]
OPENAFS-SA-2018-002 afs: prevent RXAFSCB_TellMeAboutYourself information leak

RXAFSCB_TellMeAboutYourself does not completely initialize its output
buffers.  This leaks kernel memory over the wire:

struct interfaceAddr
Unix cache manager (libafs)
- up to 124 bytes in array addr_in ((AFS_MAX_INTERFACE_ADDR 32 * 4) - 4))
- up to 124 bytes in array subnetmask "
- up to 124 bytes in array mtu "

Windows cache manager
- 64 bytes in array addr_in ((AFS_MAX_INTERFACE_ADDR 32 - CM_MAXINTERFACE_ADDR 16)* 4)
- 64 bytes in array subnetmask "
- 64 bytes in array mtu         "

The following implementations of SRXAFSCB_TellMeAboutYourself are not susceptible:
- fsprobe
- libafscp
- xstat_fs_test

Initialize the buffer.

(cherry picked from commit 211b6d6a4307006da1467b3be46912a3a5d7b20b)

Change-Id: I2fee5cc9c11ea42726c7c8f9a7d14eafee6142f0

20 months agoOPENAFS-SA-2018-002 afs: prevent RXAFSCB_GetLock information leak
Mark Vitale [Tue, 26 Jun 2018 07:47:41 +0000]
OPENAFS-SA-2018-002 afs: prevent RXAFSCB_GetLock information leak

RXAFSCB_GetLock (cmdebug) does not correctly initialize its output.
This leaks kernel memory over the wire:

struct AFSDBLock
- up to 14 bytes for member name (16 - '<cellname>\0')

Initialize the buffer.

(cherry picked from commit b52eb11a08f2ad786238434141987da27b81e743)

Change-Id: If84c5d9d805356cd56be77313149a931a948b4d5

20 months agoOPENAFS-SA-2018-002 ptserver: prevent PR_ListEntries information leak
Mark Vitale [Tue, 26 Jun 2018 07:37:37 +0000]
OPENAFS-SA-2018-002 ptserver: prevent PR_ListEntries information leak

PR_ListEntries (pts listentries) does not properly initialize its output
buffers.  This leaks ptserver memory over the wire:

struct prlistentries
- up to 62 bytes for each entry name (PR_MAXNAMELEN 64 - 'a\0')

Initialize the buffer, and remove the now redundant memset for the
reserved fields.

(cherry picked from commit 9d1aeb5d761581a35bef2042e9116b96e9ae3bf5)

Change-Id: I679c205502941891cbb34f10e648a6f9d83c3c60

20 months agoOPENAFS-SA-2018-002 volser: prevent AFSVolMonitor information leak
Mark Vitale [Tue, 26 Jun 2018 07:00:02 +0000]
OPENAFS-SA-2018-002 volser: prevent AFSVolMonitor information leak

AFSVolMonitor (vos status) does not properly initialize its output
buffers.  This leaks information from volserver memory:

struct transDebugInfo
- up to 29 bytes in member lastProcName (30-'\0')
- 16 bytes in members readNext, tranmitNext, lastSendTime,
  lastReceiveTime

Initialize the buffers.  This must be done on a per-buffer basis inside
the loop, since realloc is used to expand the storage if needed,
and there is not a standard realloc API to zero the newly allocated storage.

[kaduk@mit.edu: update commit message]

(cherry picked from commit 26924fd508b21bb6145e77dc31b6cd0923193b72)

Change-Id: Id10aa1f4d0b8694f6d85468d743c2fc2a8102339

20 months agoOPENAFS-SA-2018-002 volser: prevent AFSVolPartitionInfo(64) information leak
Mark Vitale [Tue, 26 Jun 2018 06:33:05 +0000]
OPENAFS-SA-2018-002 volser: prevent AFSVolPartitionInfo(64) information leak

AFSVolPartitionInfo and AFSVolPartitionInfo64 (vos partinfo) do not
properly initialize their reply buffers.  This leaks the contents of
volserver memory over the wire:

AFSVolPartitionInfo (struct diskPartition)
- up to 24 bytes in member name (32-'/vicepa\0'))
- up to 12 bytes in member devName (32-'/vicepa/Lock/vicepa\0'))

AFSVolPartitionInfo64 (struct diskPartition64)
- up to 248 bytes in member name (256-'/vicepa\0'))
- up to 236 bytes in member devName (256-'/vicepa/Lock/vicepa\0')

Initialize the output buffers.

[kaduk@mit.edu: move memset to top-level function scope of RPC handlers]

(cherry picked from commit 76e62c1de868c2b2e3cc56a35474e15dc4cc1551)

Change-Id: I041b91873a38a2af40f5b0a00b70cc87634f25c8

20 months agoOPENAFS-SA-2018-002 ptserver: prevent PR_IDToName information leak
Mark Vitale [Mon, 25 Jun 2018 22:03:12 +0000]
OPENAFS-SA-2018-002 ptserver: prevent PR_IDToName information leak

SPR_IDToName does not completely initialize the return array of names,
and thus leaks information from ptserver memory:

- up to 62 bytes per requested id (PR_MAXNAMELEN 64 - 'a\0')

Use calloc to ensure that all memory sent on the wire is initialized,
preventing the information leak.

[kaduk@mit.edu: switch to calloc; update commit message]

(cherry picked from commit 70b0136d552a0077d3fae68f3aebacd985abd522)

Change-Id: I787fc26ecb6fa64b17f8579198793903bc4eb16d

20 months agoUpdate NEWS for 1.8.1.1 97/13297/2 openafs-stable-1_8_1_1
Stephan Wiesand [Fri, 24 Aug 2018 14:15:32 +0000]
Update NEWS for 1.8.1.1

Release notes for the OpenAFS 1.8.1.1 release

Change-Id: I94e0d52c22ca1f7ddfab0f12538a3e32136a3846
Reviewed-on: https://gerrit.openafs.org/13297
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>

20 months agoMake OpenAFS 1.8.1.1 98/13298/2
Stephan Wiesand [Fri, 24 Aug 2018 14:19:07 +0000]
Make OpenAFS 1.8.1.1

Update configure version strings for 1.8.1.1. Note that macos kext
can be of form XXXX.YY[.ZZ[(d|a|b|fc)NNN]] where d dev, a alpha,
b beta, f final candidate so we have no way to represent 1.8.1.1.
Switch to 1.8.2 dev 1 for macOS.

Change-Id: I9a8e9a2f0e2c70599d4c9c95eb8828f31aa35731
Reviewed-on: https://gerrit.openafs.org/13298
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>

22 months agoLINUX: Update to Linux struct iattr->ia_ctime to timespec64 with 4.18 68/13268/2
Joe Gorse [Mon, 2 Jul 2018 20:36:04 +0000]
LINUX: Update to Linux struct iattr->ia_ctime to timespec64 with 4.18

With 4.18+ Linux kernels we see a transition to 64-bit time stamps by
default.

current_kernel_time() returns the 32-bit struct timespec.
current_kernel_time64() returns the 64-bit struct timespec64.

struct iattr->ia_ctime expects struct timespec64 as of 4.18+.

Timestamps greater than 31-bit rollover after 2147483647 or
January 19, 2038 03:14:07 UTC. This is the same approach taken by
the Linux developers for converting between timepsec64 and timespec.

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

Change-Id: I16f93fd54dd45fe64f0c6fd499bf3adca978e9b1
Reviewed-on: https://gerrit.openafs.org/13268
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoMake OpenAFS 1.8.1 66/13266/3 openafs-stable-1_8_1
Benjamin Kaduk [Sat, 28 Jul 2018 15:16:37 +0000]
Make OpenAFS 1.8.1

Update version strings for the 1.8.1 release.
(Note that the version number for Windows for the 1.8.1 prereleases was
erroneously 1.8.99xx, when it should have been 1.8.00xx to reflect
"next after 1.8.0-final".)

Change-Id: I2ce32aeae50d80b88cbc3f73f6787e3a15747085
Reviewed-on: https://gerrit.openafs.org/13266
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoUpdate NEWS for 1.8.1 65/13265/3
Benjamin Kaduk [Sat, 28 Jul 2018 15:13:13 +0000]
Update NEWS for 1.8.1

Change-Id: I341cf2a5e02874629ceee2c9e46d4f764e3494fa
Reviewed-on: https://gerrit.openafs.org/13265
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoredhat: actually remove unused AFS::ukernel man page 64/13264/2
Marcio Barbosa [Thu, 26 Jul 2018 17:30:35 +0000]
redhat: actually remove unused AFS::ukernel man page

Commit 278581c24a802834719e0d57f27978321556c9bb (redhat: package libuafs
perl bindings) added swig as a build dependency on RHEL 6+/Fedora 15+ to
build and package AFS::ukernel perl bindings for libuafs.  The man page
for AFS::ukernel is generated from the pod files unconditionally, so
needs to be removed from the staging directories when AFS::ukernel is
not packaged.

Unfortunately, the full path to the staged AFS::ukernel manpage was
not given in that commit, so the rpmbuild will fail on RHEL 5 with
the error:

        RPM build errors:
        Installed (but unpackaged) file(s) found:
        /usr/share/man/man3/AFS::ukernel.3.gz

Fix this error by specifying the full path to the AFS::ukernel man page
to actually remove it when we are not packaging AFS::ukernel files.

[mmeffie: updated commit message]

Reviewed-on: https://gerrit.openafs.org/13257
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit a85aab9dfe7c2ee9e025bc15d849de2dd0a48913)

Change-Id: If81f930bd7e922cd5e71c0d459751d4bbe85c843
Reviewed-on: https://gerrit.openafs.org/13264
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoafs: Stop looking for dcaches on Get*DSlot errors 91/13191/2
Andrew Deason [Thu, 26 Apr 2018 17:27:12 +0000]
afs: Stop looking for dcaches on Get*DSlot errors

In various places in the code, we'll be looking for a dslot, calling
afs_GetValidDSlot (or afs_GetUnusedDSlot) in a loop. In a few places,
we currently keep looking for the dslot when we get an error back,
since afs_GetValidDSlot may return successfully for other slots, and
we might find the dslot we're looking for.

This behavior was introduced in a few commits, including:

- commit 2679af76 (afs: Traverse discard/free dslot list if errors)
- commit 00fd34a6 (afs: Handle easy GetValidDSlot errors)
- commit 9a558660 (afs: Cope with afs_GetValidDSlot errors)

This behavior means that if afs_GetValidDSlot/afs_GetUnusedDSlot
returns an error for a particular dcache slot, but other slots are
okay, then we may still find the dcache we're looking for.

However, by far the most common reason that
afs_GetValidDSlot/afs_GetUnusedDSlot fails is because our disk cache
is completely unusable; it is very rare that only a few slots cannot
be used, but others are fine (this would mean that the disk cache was
corrupted in oddly specific ways, or there are small isolated errors
in the underlying disk). So continuing the dcache search in these
situations is not very useful.

On Linux, this is most commonly seen by the underlying disk cache i/o
calls returning -EINTR, which can happen if a SIGKILL signal is
pending for the current process when we try to do the i/o. In this
situation, all attempts to read in a dslot from disk will fail; trying
other slots or waiting will not improve the situation. Depending on
which specific code path encounters an afs_Get*DSlot error, we can
then flood the log with "disk cache read error in CacheItems" messages
emitted from afs_UFSGetDSlot, since we keep calling afs_Get*DSlot in
our loop.

The worst offender of this is usually afs_GetDSlotFromList via
afs_AllocDCache, since we end up calling afs_GetUnusedDSlot for every
single dslot in the free and discard lists. However, our other call
sites that are looking for dcaches for a specific file can still
generate quite a few of these messages, since we'll end up calling
afs_GetValidDSlot for every slot in a dcache hash chain.

So to avoid flooding the log in these situations, change most callers
of afs_GetValidDSlot and afs_GetUnusedDSlot to stop on the first
error, and act like we never found a dcache that we were looking for.

This commit also adjusts one caller in afs_ProcessOpCreate, which was
not handling errors from afs_GetValidDSlot at all, and changes
FlushVolumeData to be able to return error codes.

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

Change-Id: I2a9865e510be39d1b5bcb9280419630036c00bef
Reviewed-on: https://gerrit.openafs.org/13191
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoafs: Make afs_osi_Free(NULL) a no-op 50/13250/2
Andrew Deason [Fri, 29 Jun 2018 20:25:48 +0000]
afs: Make afs_osi_Free(NULL) a no-op

In userspace, we assume that free(NULL) does nothing, which makes
certain cleanup code paths simpler. This may or may not be true for
our free() abstractions that can run in the kernel (like afs_osi_Free,
rxi_Free, etc), which is confusing. To make the higher-level free()
abstractions more consistent, change afs_osi_Free to guarantee that
passing a NULL pointer does nothing.

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

Change-Id: Ifda1bd8c99f128fe01d38fd64dc19afee4c5158f
Reviewed-on: https://gerrit.openafs.org/13250
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoLINUX: Detect NULL page during write_begin 43/13243/2
Andrew Deason [Thu, 5 Jul 2018 22:16:48 +0000]
LINUX: Detect NULL page during write_begin

In afs_linux_write_begin, we call grab_cache_page_write_begin to get a
page to use for writing data when servicing a write into AFS. Under
low-memory conditions, this can return NULL if Linux cannot find a
free page to use. Currently, we always try to reference the page
returned, and so this causes a BUG.

To avoid this, check if grab_cache_page_write_begin returns NULL, and
just return -ENOMEM, like other callers of grab_cache_page_write_begin
do.

Linux's fault injection framework is useful for testing code paths
like these. The following settings made it possible to
somewhat-reliably exercise the relevant code path on a test RHEL7
system:

    # grep ^ /sys/kernel/debug/fail_page_alloc/*
    /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem:Y
    /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait:N
    /sys/kernel/debug/fail_page_alloc/interval:1
    /sys/kernel/debug/fail_page_alloc/min-order:0
    /sys/kernel/debug/fail_page_alloc/probability:100
    /sys/kernel/debug/fail_page_alloc/space:90
    /sys/kernel/debug/fail_page_alloc/task-filter:Y
    /sys/kernel/debug/fail_page_alloc/times:-1
    [...]

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

Change-Id: I37b4d1ebb1b76e435bb1c56a76d7e475f47f33de
Reviewed-on: https://gerrit.openafs.org/13243
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agovldb_check: write mh entry header flags in network order 46/13246/2
Michael Meffie [Fri, 6 Jul 2018 19:22:36 +0000]
vldb_check: write mh entry header flags in network order

Commit 6b93ad695e53a86dbe9eea13bd0ff651e1d8c9b7 fixed a false error
reported when the vldb contained more than one mh extent blocks.  That
fix changed the readMH() function to convert the flags field to host
byte order of all the mh blocks, not just the first block, in order to
check the value of those flags.

Unfortunately, that commit missed converting non-zero blocks back to
network byte order in the complementary writeMH() function, which is
used to write the data back to disk when vldb_check is run with the -fix
option.

FIXES 134589

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

Change-Id: I28afa243c78d0a8a53e13f302d69c17a779837d9
Reviewed-on: https://gerrit.openafs.org/13246
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoredhat: parallel builds 49/13249/2
Stephan Wiesand [Mon, 2 Jul 2018 12:05:47 +0000]
redhat: parallel builds

Parallel builds can be an order of magnitude faster. Add the
_smp_mflags macro to all invocations of make in the rpm spec,
to make use of all available cores and SMT threads on the build
system. This should also help noticing new dependency issues
early. Note the macro can be overridden on the rpmbuild command
line.

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

Change-Id: I3428e5acc7114a5bf1a1090352055041ef099fbd
Reviewed-on: https://gerrit.openafs.org/13249
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoredhat: speed up userland-only rpm builds 48/13248/2
Stephan Wiesand [Mon, 2 Jul 2018 11:33:20 +0000]
redhat: speed up userland-only rpm builds

When building with --define "build_modules 0", have configure
skip the Linux kernel tests, which are slow and many.

Reviewed-on: https://gerrit.openafs.org/13239
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit ab61bcffefdd0a431a435def193cd9a46e3b8ab6)

Change-Id: I030c4fab62bc8973dd4d914374865569d878090d
Reviewed-on: https://gerrit.openafs.org/13248
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

22 months agoredhat: package new file include/opr/lock.h 47/13247/2
Stephan Wiesand [Mon, 2 Jul 2018 11:28:07 +0000]
redhat: package new file include/opr/lock.h

Commit 792dd44ac57032a3f2a4743c83c8a0208a08ecec added the
installation of include/opr/lock.h, but the rpm spec fails
to pick it up, making rpm builds fail. Add the new file
to the files list for the -devel package.

FIXES 134579

Reviewed-on: https://gerrit.openafs.org/13238
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit babf419886d687f8359159f35e8b89aff5e166f8)

Change-Id: I32b6737a6868239c56a604030a49cc45f0379707
Reviewed-on: https://gerrit.openafs.org/13247
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoMake OpenAFS 1.8.1pre2 31/13231/2 openafs-stable-1_8_1pre2
Benjamin Kaduk [Fri, 22 Jun 2018 02:05:56 +0000]
Make OpenAFS 1.8.1pre2

Update version strings for the first 1.8.1 prerelease.
(This time, for sure!)

Change-Id: I50a1f939f64f0fd78c47c99d4c921d28c00380ce
Reviewed-on: https://gerrit.openafs.org/13231
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoUpdate NEWS for 1.8.1pre2 30/13230/2
Benjamin Kaduk [Sun, 1 Jul 2018 17:43:28 +0000]
Update NEWS for 1.8.1pre2

Change-Id: I5ceba218589aab4f2c3c1874661e2edbb9be0b65
Reviewed-on: https://gerrit.openafs.org/13230
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agorxevent: prevent negative rx_connection refCount 29/13229/2
Mark Vitale [Sat, 30 Jun 2018 21:35:09 +0000]
rxevent: prevent negative rx_connection refCount

rxi_ChallengeEvent is called directly from rxi_ChallengeOn to start the
first challenge; subsequent calls to rxi_ChallengeEvent are from the
event handler.  When called as an event, we must putConnection the
reference held by the event.  But when called directly for the first
time, the event has not been scheduled yet and so has not taken a
reference on the connection.  For this case, we must not putConnection
or the rx_connection refCount will go negative.

One reported symptom of this bug is a fileserver crash with:
  'Assertion failed! file rx.c, line 1327.'

Introduced by commit 304d758983b499dc568d6ca57b6e92df24b69de8
('Standardize rx_event usage').

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

Change-Id: Ice5856627f4f77b5ede3a84fef4b6f2915f5477d
Reviewed-on: https://gerrit.openafs.org/13229
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoMake OpenAFS 1.8.1pre1 25/13225/2 openafs-stable-1_8_1pre1
Benjamin Kaduk [Fri, 22 Jun 2018 02:05:56 +0000]
Make OpenAFS 1.8.1pre1

Update version strings for the first 1.8.1 prerelease.

Change-Id: Iaf262f468d36fb27d4ce8c994483c99bde666aff
Reviewed-on: https://gerrit.openafs.org/13225
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoUpdate NEWS for 1.8.1pre1 24/13224/3
Benjamin Kaduk [Mon, 18 Jun 2018 03:31:21 +0000]
Update NEWS for 1.8.1pre1

Change-Id: I9c443b26cd937b7d7d0d6863ca92792dfacae770
Reviewed-on: https://gerrit.openafs.org/13224
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoComment out missing comerr functions from afsauthent.def 22/13222/3
Benjamin Kaduk [Fri, 15 Jun 2018 14:07:04 +0000]
Comment out missing comerr functions from afsauthent.def

Apparently commit 70c4922980d1596155b4021cd72d6895c2371e23 was overzealous
in making Windows match Unix, as these functions are not available
in the Windows build.

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

Change-Id: I6ea04a04a2e18f3a8b7f2fdd0e2ca49f4b208361
Reviewed-on: https://gerrit.openafs.org/13222
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

23 months agoComment out opr_AssertionFailed from afsrpc.def 21/13221/2
Benjamin Kaduk [Fri, 15 Jun 2018 13:39:47 +0000]
Comment out opr_AssertionFailed from afsrpc.def

Apparently the Windows utilities link opr.lib directly, so this
caused a "multiply defined symbol" error.

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

Change-Id: Ibdd1388235086177bd3fec3c1088916d71fc204f
Reviewed-on: https://gerrit.openafs.org/13221
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoComment out (again!) xdr_Capabilities from afsrpc.def 20/13220/2
Benjamin Kaduk [Fri, 15 Jun 2018 13:16:26 +0000]
Comment out (again!) xdr_Capabilities from afsrpc.def

This shows up as an "unresolved external" when linking (though apparently
this error does not cause a buildbot failure), noticed when viewing
a related windows build log.

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

Change-Id: Ia3a4977f00a0e4b3e3a9c16b20028d78269c4ce8
Reviewed-on: https://gerrit.openafs.org/13220
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoUn-export opr_AssertFailU 14/13214/3
Benjamin Kaduk [Fri, 15 Jun 2018 01:35:46 +0000]
Un-export opr_AssertFailU

It appears to have been created for parity with osi_AssertFailU, but
was then never used.

It is safe to remove the export line, since this export has never
been in a released version of OpenAFS.

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

Change-Id: I4811d1587fc7a25e90e2a0203d965ef352efe7c5
Reviewed-on: https://gerrit.openafs.org/13214
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

23 months agolibafsrpc: export more xdr functions 95/13195/3
Benjamin Kaduk [Fri, 1 Jun 2018 00:02:18 +0000]
libafsrpc: export more xdr functions

Most of the xdr functions in the library text are to support RXAFS and
RXAFSCB RPCs, which we explicitly do not expose from libafsrpc.
As such, they do not need to be in the export list, but a couple of
generic ones probably should be exported.

Do so, for both Unix and Windows.

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

Change-Id: I42ae33f5fdb36401d052cfb200a22aff423ac0a9
Reviewed-on: https://gerrit.openafs.org/13195
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

23 months agolibafsrpc: export some more rx functions 94/13194/3
Benjamin Kaduk [Fri, 1 Jun 2018 00:00:03 +0000]
libafsrpc: export some more rx functions

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

Change-Id: I86c81dd95c75953ebd193bd8b49b467693572614
Reviewed-on: https://gerrit.openafs.org/13194
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

23 months agoExport missing opr functions from libafsrpc 93/13193/2
Benjamin Kaduk [Thu, 31 May 2018 23:40:21 +0000]
Export missing opr functions from libafsrpc

Our assertion macros expand to function calls, and we have assertions
included in macros in installed headers, so the public needs to be
able to link against them.

Export for both Unix and Windows.

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

Change-Id: I1d983d352f4838619d0b8a833e6be90207dffa87
Reviewed-on: https://gerrit.openafs.org/13193
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoafs: Avoid GetDCache delays on screwy cache 90/13190/2
Andrew Deason [Thu, 26 Apr 2018 17:01:57 +0000]
afs: Avoid GetDCache delays on screwy cache

Currently, if our afs_AllocDCache call fails in afs_GetDCache, we
retry once per second for 5 minutes. The reasoning is that we're out
of dcache slots, and so if we wait a little while, maybe something
will become freeable and we can continue.

However, afs_AllocDCache can also fail if we have plenty of free
dslots, but we are unable to successfully call afs_GetUnusedDSlot() on
any of them. This can happen if our disk cache is screwed up, and so
waiting and retrying will not make things better (but we'll spew a ton
of "disk cache read error in CacheItems slot" errors in the log each
time, and do so 300 times).

So instead, only do our sleep/retry loop if we actually appear to be
out of free or discarded dslots. Otherwise, just return an error
immediately, since sleeping and retrying will not make anything
better.

Reviewed-on: https://gerrit.openafs.org/13033
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit bec329c1c81d96b5933527f7cdb3638f24833087)

Change-Id: Iaee53eca133985ad5964b61b3641cd8ad2802014
Reviewed-on: https://gerrit.openafs.org/13190
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoafs: Avoid GetDCache panic on AllocDCache failure 89/13189/2
Andrew Deason [Thu, 26 Apr 2018 17:02:18 +0000]
afs: Avoid GetDCache panic on AllocDCache failure

Currently, in afs_GetDCache, if afs_AllocDCache fails, we retry for 5
minutes and then panic. Panicing in this situation is completely
unnecessary; afs_GetDCache can fail for a variety of other mundane
reasons (such as, if we can't fetch the requested data from the
relevant fileserver).

It may seem unusual for afs_AllocDCache to fail for over 5 minutes
(this is supposed to mean that we're out of dslots, and our attempts
to free up dslots have failed). However, afs_AllocDCache can also fail
if we are having issues in accessing the disk cache, and so we may not
be out of cache space or dslots at all; we just can't access the
cache. In this case, afs_AllocDCache can easily fail forever; waiting
longer or trying to free up cache space isn't going to help.

So, to avoid panicing in such situations, just make afs_GetDCache
return an error. We just need to make sure afs_xdcache is unlocked,
and then we can just jump to 'done', like plenty of other codepaths
do; no extra cleanup is required.

Also since we are removing a panic, add a log message when this
situation happens, so EIO errors don't suddenly pop up silently.

Reviewed-on: https://gerrit.openafs.org/13032
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 0ff2364bd5e68c0a7587f8fbc552bf20b99d7039)

Change-Id: Ie29eed271b490edc943929710a87550e2d67b735
Reviewed-on: https://gerrit.openafs.org/13189
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoxdr: remove dead code, whitespace from xdr_enum 84/13184/2
Mark Vitale [Tue, 5 Jun 2018 18:12:20 +0000]
xdr: remove dead code, whitespace from xdr_enum

The 'enum sizecheck' declaration has been unused since openafs-ibm-1_0; it is
apparently vestigial from the original XDR code.  Remove it, along with some
extraneous whitespace.

No functional change is incurred by this commit.

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

Change-Id: Ie586f210d17169a03143d1bdebb8430e3881e58c
Reviewed-on: https://gerrit.openafs.org/13184
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoxdr: avoid xdr_enum memory overrun 83/13183/2
Mark Vitale [Wed, 6 Jun 2018 19:23:26 +0000]
xdr: avoid xdr_enum memory overrun

Since openafs-ibm-1_0, xdr_enum has used xdr_long to read and write, even
though enum_t is defined as int.  For systems where sizeof(int) ==
sizeof(long), this works by accident.  But other systems (e.g., DARWIN
ARCHFLAGS=x86_64) xdr_enum will overrun its int-sized second parameter.  For
XDR_DECODE, this results in memory corruption.

This was first noticed with OpenAFS 1.8.0 on macOS 10.13; if aklog is issued
while already holding a token, it will fail in token_SetsEquivalent with a
segfault in decodeToken.  The root cause is that the address passed to
decodeToken had been overwritten by a previous call to tokenType -> xdr_enum ->
xdr_long.

Instead, modify xdr_enum to use xdr_int for its work.

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

Change-Id: I548ab43fe4513262b6be0608be45bfd8580e6ed8
Reviewed-on: https://gerrit.openafs.org/13183
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoutil: check for trailing characters in partition names 21/13121/2
Michael Meffie [Sat, 28 Apr 2018 03:08:34 +0000]
util: check for trailing characters in partition names

The function which maps partition names to partition ids currently
ignores trailing characters in the partition names. For example, the
partition name "/vicepbogus" is currently considered a valid partition
name ("/vicepbogus" maps to "bo" which is id 66). Although this is not a
regression, it is problematic for several reasons.

Firstly, this can lead to duplicate partition ids on the server, for
example "/vicepbad" and "/vicepbar" both map to the same partition id
("ba" is id 52).

Second, partitions are internally tracked by numeric id. The partition
names are generated from numeric ids when reporting partition names.
This means the trailing characters are lost when reporting the partition
names. For example, vos reports the attached partition "/vicepbad" as
"/vicepba".

Third, it could be possible (but perhaps unlikely) in the future to
extend the range of partition ids, so the trailing characters could
become significant at that time.

Finally, it could be confusing to admins that such partition names are
attached by the fileserver. For example, "/vicepaa-backup" is attached
and is used by the fileserver as partition id 26.

This change adds a check for trailing characters in partition names in
the volutil_GetPartitionID function, so it is more strict in what it
accepts as a valid partition name.  That function will now return -1
(illegal partition name) when trailing characters are found in
partition names.

Reviewed-on: https://gerrit.openafs.org/13039
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
(cherry picked from commit 850c7c50dccbdebb8e0a44da4fc7840760d9e02d)

Change-Id: I1244630f3b31408f9f723b97956dca6987dd9747
Reviewed-on: https://gerrit.openafs.org/13121
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoautoconf: add kernel module to the summary 12/13112/3
Michael Meffie [Mon, 9 Apr 2018 23:54:54 +0000]
autoconf: add kernel module to the summary

Add the kernel module to the list of optional build items in the
configure summary to indicate whether the kernel module build is
enabled.

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

Change-Id: I842752bb12b09fdcab6bfb341673bff3528f3880
Reviewed-on: https://gerrit.openafs.org/13112
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

23 months agolibafsauthent: export additional xdr_ functions 92/13192/2
Benjamin Kaduk [Mon, 28 May 2018 03:54:01 +0000]
libafsauthent: export additional xdr_ functions

Formally, we need to use xdr_free to deallocate storage for RPC output
variables, in case the XDR stack uses a different allocator than the
standard application allocator.  Some types have non-autogenerated
wrappers exposed already (e.g., token_FreeSet()), but for a handful of
the base ptint types we need to expose the xdr routines in order for a
safe way to deallocate their storage to be available.

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

Change-Id: Iea3b0bd9fdb373020b41c2bcbf1ebbde222114a8
Reviewed-on: https://gerrit.openafs.org/13192
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agolibafsauthent: export ugen_ClientInit* 82/13182/2
Benjamin Kaduk [Sun, 27 May 2018 21:23:16 +0000]
libafsauthent: export ugen_ClientInit*

Windows was only exporting the bare version and not the Cell/Flags/Server
versions; Unix was exporting none of them.

These routines for obtaining a ubik client are more generic than the
historical (and already exported) ubik_ClientInit routine, allowing for
the use of an alternative configuration directory, additional flags,
and the like.

Reviewed-on: https://gerrit.openafs.org/13130
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit ef6a1e8118a25b885889179739a3539a598068bc)

Change-Id: I04c6565cc4b9c3366bf15b86cd5f70402609c5c5
Reviewed-on: https://gerrit.openafs.org/13182
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agolibafsauthent: Export more token-manipulation functions 81/13181/2
Benjamin Kaduk [Sun, 27 May 2018 21:03:12 +0000]
libafsauthent: Export more token-manipulation functions

For both Windows and Unix.

Reviewed-on: https://gerrit.openafs.org/13129
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 1974eac772157651594c1b76ea8f55e4567b3ec5)

Change-Id: I7b26772fe9f447ac1cf562eb5837a6035d8f0175
Reviewed-on: https://gerrit.openafs.org/13181
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agolibafsauthent: export ktc token 'Ex' routines for Unix 80/13180/2
Benjamin Kaduk [Sun, 27 May 2018 20:18:12 +0000]
libafsauthent: export ktc token 'Ex' routines for Unix

We need these to handle the modern identity structures (they are
already exported on Windows).

Reviewed-on: https://gerrit.openafs.org/13128
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 4008f83ca80c5ed7b612a13f760b4bb8b9866f2b)

Change-Id: I05d4ea37212738db6be9dace0b9cc1db1e76bd08
Reviewed-on: https://gerrit.openafs.org/13180
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agolibafsauthent: export more afsconf_ functions 79/13179/2
Benjamin Kaduk [Sun, 27 May 2018 19:18:07 +0000]
libafsauthent: export more afsconf_ functions

We have new functions for (among other things) typed keys, and generic
rx identity management; expose them as well as the legacy key- and user-
management functions, on both Unix and Windows.

Reviewed-on: https://gerrit.openafs.org/13127
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit cdd1f16f5ef52093a8f7d3f87a45775d3c87b780)

Change-Id: Ia9ab364fcac10822ba50eb7f418a2228ac0fd935
Reviewed-on: https://gerrit.openafs.org/13179
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoSynchronize libafsauthent afsconf_ exports with windows 78/13178/2
Benjamin Kaduk [Sun, 27 May 2018 18:11:05 +0000]
Synchronize libafsauthent afsconf_ exports with windows

The Windows library was exporting several more afsconf_* symbols
than the Unix one; bring them into sync.

Reviewed-on: https://gerrit.openafs.org/13126
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit bcce41bd99b4361631b64cf4749d1dcf80df1cd7)

Change-Id: I4993395d30ca93d28e0ccd4c6ad52975a1e23324
Reviewed-on: https://gerrit.openafs.org/13178
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoautoconf: remove uss from configure summary 11/13111/2
Michael Meffie [Mon, 9 Apr 2018 23:50:28 +0000]
autoconf: remove uss from configure summary

Commit 00a33b26d74aa067086ddc340efb82184715857f (uss: always build uss)
made the uss build unconditional. Remove it from the list of optional
items in the configure summary.

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

Change-Id: I345752f0739edc3d621b39a50157adb23923e256
Reviewed-on: https://gerrit.openafs.org/13111
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoRemove pointless assignments 50/13150/2
Pat Riehecky [Fri, 25 May 2018 17:03:35 +0000]
Remove pointless assignments

scan-build identified these var assignements as being unused or redundant.

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

Change-Id: Ic93c5e775f13a8f75ba619391d71cb78f4dc06ae
Reviewed-on: https://gerrit.openafs.org/13150
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: PatRiehecky <jcpunk@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoAdd braces to empty conditional blocks 49/13149/2
Pat Riehecky [Wed, 23 May 2018 20:50:45 +0000]
Add braces to empty conditional blocks

GCC 7+ is able to quickly optimize away empty if/else blocks if the braces are
provided.  While this adds some additional syntax, it should also result
in faster optimization, so change our empty blocks after conditionals to use
braces.

FIXES 134377

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

Change-Id: I9243105d75878487ec965070d3946e8d683f264b
Reviewed-on: https://gerrit.openafs.org/13149
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: PatRiehecky <jcpunk@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoConvert extended character set to unicode 52/13152/2
Pat Riehecky [Fri, 25 May 2018 17:48:15 +0000]
Convert extended character set to unicode

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

Change-Id: I8ba39f92dd485cf8b12fc99cf4251277b29e403d
Reviewed-on: https://gerrit.openafs.org/13152
Reviewed-by: PatRiehecky <jcpunk@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoWindows: define AFS_IHANDLE_PIO_ENV for ihandle pio 48/13148/2
Michael Meffie [Mon, 25 Apr 2016 15:19:10 +0000]
Windows: define AFS_IHANDLE_PIO_ENV for ihandle pio

Support for positional i/o in the ihandle package was added to the
windows platform in commit 50b6a116a1c412d0e6d7442d13d6e92c9dbb35ee
using native windows functions.  That commit also defined HAVE_PIO in
the windows version of the afsconfig.h file. Unfortunately, that
definition of HAVE_PIO is not limited to the ihandle package.

Remove the project-wide HAVE_PIO definition from the windows afsconfig.h
file and define the new AFS_IHANDLE_PIO_ENV symbol when position i/o
support is available in the ihandle package.

Build the fallback ih_pread and ih_pwrite functions (which use lseek)
only when positional i/o is not available in the ihandle package for the
current platform.

Use AFS_IHANDLE_PIO_ENV instead of HAVE_PIO in ih_open() to determine
when it is is safe to share ihandles among threads.

Reviewed-on: https://gerrit.openafs.org/12270
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 759f29cfdfabed4dc5c1b96a0b2b79a3f83c08e3)

Change-Id: Ic64f9e65b10fbe6f7650eff852d5a7e20762ef10
Reviewed-on: https://gerrit.openafs.org/13148
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoptserver: improve PR_GetHostCPS logging 47/13147/2
Mark Vitale [Tue, 24 Apr 2018 18:41:11 +0000]
ptserver: improve PR_GetHostCPS logging

The IP address of the host is logged as a signed number.  Instead, log
it as the unsigned (and hex) representation of the host IP addr.

Reviewed-on: https://gerrit.openafs.org/13043
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 8225518cd08b810bf3d8c74e27e3d3a753b6b30b)

Change-Id: Idbb380fa0c9d71398ea2d47ba49fd217be9f9f26
Reviewed-on: https://gerrit.openafs.org/13147
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agovol: check for bad partition names 20/13120/2
Michael Meffie [Sat, 28 Apr 2018 02:59:57 +0000]
vol: check for bad partition names

Currently, servers attempt to attach any partition name starting with
"/vicep", even partition names which map to out of range partition ids.
Examples of such misnamed partitions are "/vicepzz", "/vicep0", and
others.

The presence of these misnamed partitions cause the server processes to
crash on startup, since the out of range partition ids are used as an
index.

Add a check for the bad partition names in VCheckPartitions to avoid
attaching them. Log a warning for such partitions to let the admins know
why the partitions are not attached.

Reviewed-on: https://gerrit.openafs.org/13038
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit c0f2c26e9298d12209fbb5e523ea3173202316e5)

Change-Id: Id7dcbd80402b7c8ec1f0e2e5fa2ea0123a2da898
Reviewed-on: https://gerrit.openafs.org/13120
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoviced: SRXAFS_InlineBulkStatus set InterfaceVersion on error 17/13117/2
Jeffrey Altman [Fri, 11 May 2018 19:44:24 +0000]
viced: SRXAFS_InlineBulkStatus set InterfaceVersion on error

AFSFetchStatus.InterfaceVersion is required to be "1" for any
of the fields in the structure to be considered valid.  Therefore,
InterfaceVersion must be set to one when returning an 'errorCode'
value.

When RXAFS_InlineBulkStatus was introduced by OpenAFS in
362d26c733b086d26f013bd229af979a112098f5 not only wasn't
InterfaceVersion set but neither was the memory allocated
to OutStats initialized.  As a result the InterfaceVersion field
value could be not only zero but random.  The OutStats memory
was initialized to zeros beginning with
726e1e13ff93e2cc1ac21964dc8d906869e64406.

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

Change-Id: I0d15147081f6e8744680c16e43b22075070647e4
Reviewed-on: https://gerrit.openafs.org/13117
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoubik: clones should not request votes 16/13116/2
Marcio Barbosa [Tue, 15 May 2018 21:10:45 +0000]
ubik: clones should not request votes

Clones should not be able to become the sync-site. To make it possible,
regular sites do not vote for a site tagged as clone. In other words,
the clones ask for votes but they cannot be the sync-site. Knowing that
their requests for votes should be refused by the regular sites, they
should never have enough votes to win the election.

In addition to the unnecessary network traffic created by these
unnecessary requests, this current approach can be problematic in some
specific situations. As an example, consider the following scenario:

    The user wants to turn a regular site, called host1, into a clone.
    To do so, he runs the following commands on every single server:

    $ bos removehost -server <server> -host host1
    $ bos addhost -server <server> -host host1 -clone

After that, he restarts the servers, one by one. Depending on the delay
between the restarts, a clone can become the sync-site. This is possible
because the clones request votes from the other sites. If enough regular
sites are not aware (yet) that the request for vote came from a clone,
the clone in question can get enough votes to win the election.

To fix the problems mentioned above, do not request votes if you cannot
be the sync-site.

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

Change-Id: Ifa748546aec6928eb4ca988a036d0bf8fb70f6f8
Reviewed-on: https://gerrit.openafs.org/13116
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoafs: alloc openafs_lck_grp before osi_Init() on darwin 15/13115/2
Marcio Barbosa [Thu, 10 May 2018 03:46:01 +0000]
afs: alloc openafs_lck_grp before osi_Init() on darwin

Commit a27bed59cae1a4244429c752edfde0a8363c8a3b moved init_hckernel_init
to osi_Init. On Darwin (AFS_DARWIN80_ENV), MUTEX_INIT
(called by init_hckernel_init) uses openafs_lck_grp as the argument of
one of the functions called during the initialization of the mutex in
question. Since openafs_lck_grp was not allocated yet, we crash.

To fix this problem, call MUTEX_SETUP() before osi_Init() on Darwin.

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

Change-Id: Ic1c58b5e2baeedd1cd24c364dd2907761064c8a9
Reviewed-on: https://gerrit.openafs.org/13115
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoUse afs_DestroyReq in afs_PrefetchNoCache() 14/13114/2
Benjamin Kaduk [Tue, 8 May 2018 23:04:21 +0000]
Use afs_DestroyReq in afs_PrefetchNoCache()

Since commit 76ad941902c650a4a716168d3cbe68f62aef109f we use afs_DestroyReq()
instead of osi_Free() directly.

Also update the UKERNEL version of the function to afs_CreateReq() properly.

FIXES 134533

Reviewed-on: https://gerrit.openafs.org/13060
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3ec0414f769c37a19410fbd9aefb086cb5b69e55)

Change-Id: Ic85fef48f7adb2a152b5cb4d68b8c4a43c45c06a
Reviewed-on: https://gerrit.openafs.org/13114
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoExport {Get,Set}ServiceSpecific from liboafs_rx.la 08/13108/2
Ben Kaduk [Fri, 13 Dec 2013 21:25:47 +0000]
Export {Get,Set}ServiceSpecific from liboafs_rx.la

rxgk will use service-specific data.

Reviewed-on: https://gerrit.openafs.org/10589
Reviewed-by: Daria Phoebe Brashear <dariaphoebe@auristor.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 60a006bdc43df42e40eb43f1e1af7fffe3e85763)

Change-Id: I997a6dc9ab728e9e87df321c30d0a26ce2853698
Reviewed-on: https://gerrit.openafs.org/13108
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoAdd missing va_end 51/13151/2
Pat Riehecky [Fri, 25 May 2018 17:11:54 +0000]
Add missing va_end

Per man va_start:
Each invocation of va_start() must be matched by a corresponding
invocation of va_end() in the same function.

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

Change-Id: I8d649b06a8e0baedc40612fe7b2251df1426ce26
Reviewed-on: https://gerrit.openafs.org/13151
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: PatRiehecky <jcpunk@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoExport afs_getDirPath from shared libraries 46/13146/2
Benjamin Kaduk [Sat, 5 May 2018 20:59:08 +0000]
Export afs_getDirPath from shared libraries

Add this function to the export list for libafsauthent on Windows
and Unix.

Reviewed-on: https://gerrit.openafs.org/13059
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 849ddd4fde0759e385cf3ed4054fc11c36a62fc3)

Change-Id: I39dd95185a705eaf96852e7bae9acbb5f5c50159
Reviewed-on: https://gerrit.openafs.org/13146
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoRename getDirPath to afs_getDirPath in preparation for export 45/13145/2
Benjamin Kaduk [Sat, 5 May 2018 20:42:51 +0000]
Rename getDirPath to afs_getDirPath in preparation for export

The symbol name getDirPath is rather generic and we probably shouldn't
squat on it in the application's namespace.  In preparation for exporting
this functionality from the Unix shared libraries, rename it to
afs_getDirPath.

Retain a Windows-only wrapper getDirPath that can continue to be
exported from libafsauthent on Windows, for ABI compatibility.
New consumers should use afs_getDirPath.

Reviewed-on: https://gerrit.openafs.org/13058
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 554c38473d1465af4c4613209229c274807fffd8)

Change-Id: If527d3f6d619e8bc41914353d28d5d74cb683637
Reviewed-on: https://gerrit.openafs.org/13145
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoRemove duplicates from liboafs_util.la.sym 44/13144/2
Benjamin Kaduk [Sat, 5 May 2018 20:35:03 +0000]
Remove duplicates from liboafs_util.la.sym

Remove the extra copy of things which appeared twice.

Reviewed-on: https://gerrit.openafs.org/13057
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit b48fe6b57f13bacb368e27389ccd3f9c279822da)

Change-Id: I322967df048cb49d270cc149d6b710a38797cbbf
Reviewed-on: https://gerrit.openafs.org/13144
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoExport ubik_PR_ symbols from libafsauthent 43/13143/2
Benjamin Kaduk [Sat, 5 May 2018 19:42:31 +0000]
Export ubik_PR_ symbols from libafsauthent

Also export from liboafs_prot the ones missing from this set.

This brings the unix exports in sync with the Windows exports
(of ubik_PR_ symbols), and is tested as being sufficient to compile
python-afs.

Reviewed-on: https://gerrit.openafs.org/13056
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3be1de0e823db7068e27b9c5c30a91673f058e52)

Change-Id: I2cd44eb5686b1b7134eb0e4480f5f3502e865ce8
Reviewed-on: https://gerrit.openafs.org/13143
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoExport comerr initialization functions from libafsauthent 42/13142/2
Benjamin Kaduk [Sat, 5 May 2018 19:00:27 +0000]
Export comerr initialization functions from libafsauthent

Add to the libafsauthent export symbol list these comerr initialization
functions so that they are usable by consumers.

Reviewed-on: https://gerrit.openafs.org/13055
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 70c4922980d1596155b4021cd72d6895c2371e23)

Change-Id: I7fb91b14c0730abd8544ff0484af8746c2bb50db
Reviewed-on: https://gerrit.openafs.org/13142
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoopr: install afs/opr.h and opr/lock.h 41/13141/2
Benjamin Kaduk [Sat, 5 May 2018 18:11:00 +0000]
opr: install afs/opr.h and opr/lock.h

These headers are (transitively) referenced from rx_pthread.h, which is pulled
in from rx.h when AFS_PTHREAD_ENV is defined.  As such, we are presenting an
incomplete public API without this header.

Reviewed-on: https://gerrit.openafs.org/13054
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 792dd44ac57032a3f2a4743c83c8a0208a08ecec)

Change-Id: I9785e4d408b2838a2c65ae372717a6c92e38767b
Reviewed-on: https://gerrit.openafs.org/13141
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoubik: remove redundant memset from udisk_write 24/13124/2
Mark Vitale [Fri, 19 May 2017 20:34:21 +0000]
ubik: remove redundant memset from udisk_write

When udisk_write is extending the database, DRead will return a null
buffer.  udisk_write then calls DNew to get a brand new buffer for the
extension write, and clears it with memset.  However, this is redundant,
since DNew has already cleared the new buffer.

Remove the redundant memset.

No functional change should be incurred by this commit.

Reviewed-on: https://gerrit.openafs.org/12621
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 845c8927ef20e245bb88bc783dc2e581b61fbaba)

Change-Id: I58d4052c69c16e4758c6accfbb2a0b1ac2aa413f
Reviewed-on: https://gerrit.openafs.org/13124
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoubik: Make udisk_Log* functions static 19/13119/2
Andrew Deason [Thu, 10 May 2018 21:23:48 +0000]
ubik: Make udisk_Log* functions static

Nothing uses the udisk_Log* functions outside of disk.c. Declare these
static to make sure they stay that way, to make it easier to change
their semantics.

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

Change-Id: I9c1cae678fc099f1eabe4aa6a661dcbc4ea72648
Reviewed-on: https://gerrit.openafs.org/13119
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoubik: Remove 'mtime' from ubik_stat 18/13118/2
Andrew Deason [Thu, 10 May 2018 21:05:10 +0000]
ubik: Remove 'mtime' from ubik_stat

Nothing uses the 'mtime' field from ubik_stat. Remove it.

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

Change-Id: I1770e55aa45192b4bab6d4256be562cb308fd03a
Reviewed-on: https://gerrit.openafs.org/13118
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoafs: fix broken volume callbacks (e.g. vos release) 40/13140/2
Mark Vitale [Fri, 25 May 2018 21:05:28 +0000]
afs: fix broken volume callbacks (e.g. vos release)

Commit e99bfcfaa3bca3e65f03928718c2c9eb5eff7c8c ('afs: use jenkins hash
for dcache, vcache tables') introduced new hashing implementations for
the dcache and vcache hash tables.  Unfortunately, a typo introduced a
bug into the VCHashV hash function; instead of hashing by volume id, it
currently hashes by vnode.

The most common symptom is that volume callbacks (RXAFSCB_Callback with
fid <volid>:0:0) fail to find and invalidate all the files for the
specified volume.  This typically manifests as persistent stale RO
content after a 'vos release' for new RW content.

This bug only affects the Unix cache manager; the Windows cache manager
implementation of RXAFSCB_Callback was unaffected.

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

Change-Id: I535f91630948e7aa6a8d72eb37e0cce88c33156d
Reviewed-on: https://gerrit.openafs.org/13140
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoBSD: Work around panic in FlushVCache 13/13113/2
Benjamin Kaduk [Fri, 13 Apr 2018 13:07:59 +0000]
BSD: Work around panic in FlushVCache

Commit 64cc7f0ca7a44bb214396c829268a541ab286c69 created the very useful
afs_StaleVCache() helper function, but unfortunately it also introduced
a subtle change into how we check for whether a vcache may be a directory.
Previously, we just used the low bit of the Fid's Vnode number, since files
have an even number and non-files an odd number.  The new version uses
that check but also explicitly checks `vType(avc)` against VDIR, and this new
check involves consulting information stored in the associated vnode entry,
not the vcache directly.  The afs_FlushVCache() implementation for
XBSD and DARWIN NULLs removes the cross-linkage between vcache and vnode,
so that AFSTOV(avc) becomes NULL.  Just a few lines later, it calls
afs_StaleVCacheFlags(), at which point vType() dereferences a bad pointer
(offset from a NULL pointer) and panics.  This would happen during shutdown,
or other periodic reclaim/flush events that can be scheduled.

Reviewed-on: https://gerrit.openafs.org/13014
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 54e84a98f9747bb5bb2ad4b8031115ad7684c914)

Change-Id: I810f72e0be8ab98ea6b4ac05c23bc0cb44e4da3a
Reviewed-on: https://gerrit.openafs.org/13113
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoautoconf: remove more linux 2.4 references 10/13110/2
Michael Meffie [Mon, 9 Apr 2018 20:42:41 +0000]
autoconf: remove more linux 2.4 references

Remove old linux 2.2 and 2.4 references in the autoconf macros left over
from the linux 2.2 and 2.4 days.

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

Change-Id: I3bf407ec084d911cc826b50fc39f48a20eb0fd77
Reviewed-on: https://gerrit.openafs.org/13110
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoautoconf: remove check for lorder 09/13109/3
Marcio Barbosa [Thu, 29 Mar 2018 18:52:12 +0000]
autoconf: remove check for lorder

Currently, lorder is not being used. Remove the conditional that checks
if this binary exists.

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

Change-Id: I3630b6ec9629361e86971ff0c37d93327f6763f4
Reviewed-on: https://gerrit.openafs.org/13109
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoubik: death to orphaned signals 23/13123/3
Mark Vitale [Wed, 17 May 2017 20:32:20 +0000]
ubik: death to orphaned signals

ubik has a few very old "orphaned" LWP events that are signalled via
LWP_NoYieldSignal, but have no matching waits (LWP_WaitProcess).

Each "signal" runs the LWP waiting element list for each LWP on the
blocked queue; this may add up to substantial wasted overhead on a
heavily loaded ubik server.

Remove the orphaned signals.

No functional difference should be incurred by this commit.

Reviewed-on: https://gerrit.openafs.org/12620
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit e4c7321560acf0bd34eeee7d46269818d82fdb44)

Change-Id: I4303542683aaa62895b73a5ea93bc3d0ac82804a
Reviewed-on: https://gerrit.openafs.org/13123
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

23 months agoSuppress statement not reached warnings under Solaris Studio 07/13107/3
Michael Meffie [Sun, 21 Jan 2018 23:38:11 +0000]
Suppress statement not reached warnings under Solaris Studio

Solaris Studio issues warnings for statements which can not be reached,
such as statements following an infinite loop.  For example, the return
statement will generate a 'statement not reached' warning in the
following code:

    while (1) {
       /*  no breaks or gotos in this body */
    }
    return 0;

Suppress these warnings by conditionally removing such statements when
building under Solaris Studio.

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

Change-Id: I3ac84edbc18d7b6aebd568e9a1c4a3e47aba5512
Reviewed-on: https://gerrit.openafs.org/13107
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoafs: squash empty declaration warning 06/13106/2
Michael Meffie [Sun, 14 Jan 2018 01:14:59 +0000]
afs: squash empty declaration warning

Remove spurious semi-colon which generates a warning when
building under Solaris Studio.

  "./src/afs/UKERNEL/sysincludes.h", line ...: warning: syntax error:  empty declaration

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

Change-Id: Ie6657ab06c8d44b1452d9583908efd1596311971
Reviewed-on: https://gerrit.openafs.org/13106
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agolibafs: git ignore build artifacts on Solaris 05/13105/2
Michael Meffie [Sat, 20 Jan 2018 23:34:18 +0000]
libafs: git ignore build artifacts on Solaris

Ignore build artifacts generated when building the kernel
module for Solaris:

src/libafs/inet
src/libafs/nfs
src/libafs/ufs

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

Change-Id: I5b25a5a4ef6a3b2134daaf848fef9d64b01ee156
Reviewed-on: https://gerrit.openafs.org/13105
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoExport a few krb5 routines for rxgk 04/13104/2
Ben Kaduk [Fri, 13 Dec 2013 21:17:54 +0000]
Export a few krb5 routines for rxgk

We need oafs_h_krb5_generate_random_block when generating random
keys and oafs_h_krb5_crypto_fx_cf2 for CombineTokens.
Having oafs_h_krb5_crypto_prf_length proves very convenient for
key derivation of transport keys, so move it to the public header
and export it.
oafs_h_krb5_enctype_keysize is needed so that we can tell whether or not we
need to pass through random_to_key() when making rxgk_keys.
oafs_h_krb5_random_to_key is needed for that random_to_key() operation.

Reviewed-on: https://gerrit.openafs.org/10936
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 348dc87bb2eeb66d1e683dc91ee36724ee18f1af)

Change-Id: I3ae0f5ba6b0bd2f851f4d41f756521153e303102
Reviewed-on: https://gerrit.openafs.org/13104
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoauth: Let superuser identities be superusers 03/13103/2
Ben Kaduk [Wed, 4 Dec 2013 18:03:15 +0000]
auth: Let superuser identities be superusers

We have a special rx_identity_kind for superusers, let it actually
be useful for something.

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

Change-Id: I36b6b6be6851c45b13c41e751e4d741cd0130fdb
Reviewed-on: https://gerrit.openafs.org/13103
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoAvoid libtool 'nm' errors 66/13066/2
Andrew Deason [Wed, 7 Mar 2018 19:28:34 +0000]
Avoid libtool 'nm' errors

Starting around Solaris 11.3, '/usr/bin/nm -p' starts reporting some
symbols with the 'C' code. libtool cannot handle this (libtool bug
 #22373), which causes global_symbol_pipe in the generated libtool
script to be empty. This causes a rather confusing error when we go to
actually use libtool to link something ("syntax error near unexpected
token '|'"; see libtool bug #20947), and prevents the build from
continuing.

Address this in two ways:

For all Solaris 11 builds, default to /usr/sfw/bin/gnm over
/usr/bin/nm. This avoids any interop issues with libtool and nm, since
libtool of course works very well with GNU tooling.

In addition, try to catch any nm-related errors with libtool at
configure time, to provide a more helpful error message.

To implement these changes, create a wrapper around LT_INIT, called
AFS_LT_INIT.

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

Change-Id: I4a5a358857ec5bfbc31cd99fcca59f3390ad4d16
Reviewed-on: https://gerrit.openafs.org/13066
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoRemove warning "find_preferred_connection: no connection and !create" 25/13025/2
Ian Wienand [Tue, 20 Mar 2018 03:01:43 +0000]
Remove warning "find_preferred_connection: no connection and !create"

find_preferred_connection() is called with !create via
afs_ConnByHost->afs_ConnBySA to determine if there is a cached
connection available.  Don't warn, as it will next be called with the
create flag to create the connection anyway.

Reviewed-on: https://gerrit.openafs.org/12964
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 909d8358109445fdb316b68a8e55e17626cf17c9)

Change-Id: If2cb4fd25e98f5bbdde00f76e8b3850c53cb6358
Reviewed-on: https://gerrit.openafs.org/13025
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agorx: fix atomics on darwin 84/13084/2
Marcio Barbosa [Mon, 14 May 2018 19:46:26 +0000]
rx: fix atomics on darwin

As described by commit b2a21422129ca1eeeb5ea1a1f7b08b537fd2a9f7, the API
used for atomic operations in kernel space is not the same as the one
used in user space. To fix this problem, the commit mentioned above
introduced macros to correct the name of these functions in kernel space.
Unfortunately, the return value of the functions used in kernel space is
not the same as the ones used in user space. Generally speaking, the
kernel space atomic functions return the original value of the variable
received as an argument before the operation in question. On the other
hand, the user space atomic functions return the new value, after the
operation has been performed. To fix this problem, this commit provides
a new set of inline functions (only used in kernel space) with the
expected return values.

Also, in order to get the inline implementations of the OSAtomic
interfaces in terms of the <stdatomic.h> primitives, commit
74f837fd943ddfa20d349a83d6286a0183cb4663 defines OSATOMIC_USE_INLINED
on OS X 10.12. However, the definition of this macro only affects the
user space legacy interfaces for atomic operations. The kernel space
interfaces for atomics are not deprecated and OSATOMIC_USE_INLINED does
not affect these functions. To fix this problem, only define
OSATOMIC_USE_INLINED in user space (OS X 10.12+).

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

Change-Id: Ic3ecc1f26a9e81eb0dc6e1503845be57ad80498a
Reviewed-on: https://gerrit.openafs.org/13084
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoSOLARIS: Check for map_addr() without 'vacalign' 02/13102/3
Andrew Deason [Wed, 7 Mar 2018 04:04:28 +0000]
SOLARIS: Check for map_addr() without 'vacalign'

Add a configure check to see if the map_addr() function contains the
'vacalign' argument or not. The argument was removed sometime around
Solaris 11.4.

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

Change-Id: I141ad3c54b2aa3e32311785f4320eba04d840bb2
Reviewed-on: https://gerrit.openafs.org/13102
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agohcrypto: Avoid arc4random in kernel 01/13101/3
Andrew Deason [Wed, 7 Mar 2018 21:57:56 +0000]
hcrypto: Avoid arc4random in kernel

Our HAVE_ARC4RANDOM symbol represents the availability of arc4random()
in userspace, not in the kernel. On Solaris, we'll define
HAVE_ARC4RANDOM, but the built kernel module will be unusable, since
we cannot resolve the arc4random symbol.

To to avoid this, undef HAVE_ARC4RANDOM when building hcrypto for the
kernel, just like we do with HAVE_GETUID.

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

Change-Id: I41c4c6f65581aee3d53a7c4b8f6c108f88631e3f
Reviewed-on: https://gerrit.openafs.org/13101
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agovenus: convert fs.c to safer string functions 00/13100/3
Michael Meffie [Thu, 22 Feb 2018 18:23:18 +0000]
venus: convert fs.c to safer string functions

Convert string handling to safer functions to avoid buffer overflows.

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

Change-Id: Ic7fd4c3c0ffd4b0b38b9735002e9bf8eba8fd0d6
Reviewed-on: https://gerrit.openafs.org/13100
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>