openafs.git
23 months agobuild: Select param.h in sysname.m4 14/14914/6
Marcio Barbosa [Mon, 14 Feb 2022 23:09:27 +0000]
build: Select param.h in sysname.m4

Currently, the way the file that will be used as param.h is selected
doesn't allow us to choose headers from other architectures, making
cross-compiling difficult. In an effort to facilitate this process,
select the header that will be used as param.h in sysname.m4. By doing
this, we will have more flexibility to select which header should be
used (in future commits).

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

23 months agomacos: Build afscell for supported architectures 45/14745/10
Marcio Barbosa [Wed, 6 Apr 2022 23:36:15 +0000]
macos: Build afscell for supported architectures

Given that i386 is no longer supported, trying to build the current
version of afscell on macOS 11 (Big Sur) results in the following error:

error: The i386 architecture is deprecated. You should update your ARCHS
build setting to remove the i386 architecture.

To fix this problem, build afscell for all architectures listed in
ARCHS_STANDARD.

For the macosx11.0 sdk:

$ xcodebuild -showBuildSettings -scheme afscell -sdk macosx | grep ARCHS

    ARCHS = arm64 x86_64
    ARCHS_STANDARD = arm64 x86_64
    ARCHS_STANDARD_32_64_BIT = arm64 x86_64 i386
    ARCHS_STANDARD_32_BIT = i386
    ARCHS_STANDARD_64_BIT = arm64 x86_64
    ARCHS_STANDARD_INCLUDING_64_BIT = arm64 x86_64
    VALID_ARCHS = arm64 arm64e i386 x86_64

While here, add arm64 to the list of valid architectures.

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

23 months agoDARWIN: Declare/include functions before using them 44/14744/11
Marcio Barbosa [Wed, 23 Mar 2022 20:58:41 +0000]
DARWIN: Declare/include functions before using them

Every function should be explicitly declared before it can be called.
Since -Wimplicit-function-declaration is usually a warning and not an
error, calling undeclared functions does not prevent us from building
the code.

However, apple-clang 12 makes this an error by default, prohibiting the
build of the current version on macOS 11 (Big Sur).

To fix this problem, declare functions before calling them. Also,
include mach/thread_act.h into afs_call.c so the declaration of
thread_terminate() can be found on macOS. Last, given that the third
argument of PIOCTL() (if UKERNEL is defined) is a pointer, cast it to
'long'. Doing so, we can avoid another inhibited warning. Notice that
this PIOCTL definition is scoped to a single file (src/auth/ktc.c).

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

23 months agobucoord: Introduce ubik_Call_SingleServer_BUDB_* 86/14886/7
Marcio Barbosa [Wed, 23 Mar 2022 20:31:54 +0000]
bucoord: Introduce ubik_Call_SingleServer_BUDB_*

In an effort to avoid the usage of undeclared functions, add wrappers
for ubik_Call_SingleServer() (_BUDB_GetVolumes(), _BUDB_DumpDB()) and
adjust its callers accordingly.

Also, make sure that ubik_Call_SingleServer() uses the same signature as
ubik_Call(). This change helps us to get rid of casting errors.

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

23 months agoafs: Ensure dirEntry->name has room for entry name 38/14938/5
Marcio Barbosa [Tue, 5 Apr 2022 22:39:56 +0000]
afs: Ensure dirEntry->name has room for entry name

Currently, the afs_dynroot_addDirEnt() function assumes that the caller
has allocated the directory to be large enough to hold the necessary
entry. In order to make sure that memory isn't being accidentally
stomped, use strlcpy to truncate instead of stomping on other memory.
That way, if the caller makes a mistake we don't silently corrupt memory.

We specifically do not assert that there is no truncation or panic if
truncation occurs, since the effect of a truncated entry in the
dynamic AFS root volume is limited and does not justify bringing down
the entire client.

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

23 months agoafs: Replace strcpy &co by safer alternatives 43/14743/11
Marcio Barbosa [Wed, 6 Apr 2022 20:59:56 +0000]
afs: Replace strcpy &co by safer alternatives

In addition to being unsafe, these functions (strcpy, strncpy, strcat,
and sprintf) are deprecated on macOS. Replace these functions by safer
alternatives (strlcpy, strlcat, snprintf, and afs_strdup).

Notice that, in order to use afs_strdup(), this commit adds the afs_util
library to the AFSPAGOBJS list. Given that afs_strcasecmp() is also
implemented in afs_util.c, src/crypto/hcrypto/kernel/strcasecmp.c can be
removed from the tree.

No functional change should be incurred by this commit.

This commit is a continuation of a patch initially developed by
cwills@sinenomine.net.

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

23 months agoUKERNEL: Remove flock -> usr_flock redirection 13/14913/6
Marcio Barbosa [Wed, 23 Mar 2022 19:04:46 +0000]
UKERNEL: Remove flock -> usr_flock redirection

In order to replace 'struck flock' with 'struct usr_flock' and 'flock()'
with 'usr_flock()', the current version of src/afs/UKERNEL/sysincludes.h
defines flock to usr_flock. This can cause problems when trying to use
libroken in UKERNEL code, because roken.h redefines flock.

To avoid conflicts with libroken (included in a future commit), add a
new UKERNEL specific AFS_FLOCK -> usr_flock redirection. Doing so, the
flock -> usr_flock redirection can be removed. While here, also remove
'usr_flock()' as it shouldn't be called and is not defined in any header
file.

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

23 months agoafs: Remove redundant AFS_LINUX_ENV test 35/14935/4
Andrew Deason [Thu, 24 Mar 2022 17:04:13 +0000]
afs: Remove redundant AFS_LINUX_ENV test

After our Linux checks were converted to AFS_LINUX_ENV in commit
6329a523 (Change AFS*_LINUXnn_ENV to AFS*_LINUX_ENV), the extra
AFS_LINUX_ENV check in this line doesn't make any sense. Get rid of
it.

Change-Id: I4196744b1a6674469efef04aa487a50743084656
Reviewed-on: https://gerrit.openafs.org/14935
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

23 months agoafs: Save size of sysname_info->name 12/14912/4
Marcio Barbosa [Wed, 23 Mar 2022 18:10:15 +0000]
afs: Save size of sysname_info->name

In preparation for a future commit, save the size of sysname_info->name
by adding a new field (name_size) into the sysname_info struct. Also,
remove the sysname_info->allocked field, since now we can find out if
memory has been allocated by checking if sysname_info->name_size is
different than zero.

No functional change should be incurred by this commit.

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

23 months agocmdebug: Print AFSFid fields as unsigned integers 50/14950/2
Marcio Barbosa [Wed, 20 Apr 2022 13:06:17 +0000]
cmdebug: Print AFSFid fields as unsigned integers

Currently, AFSFid fields are printed as signed integers. As a result,
large numbers can be erroneously printed as negative numbers.

To fix this problem, print AFSFid fields as unsigned integers.

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

2 years agoDARWIN: Drop afs_event lock before destroying it 33/14933/2
Marcio Barbosa [Mon, 21 Mar 2022 17:43:34 +0000]
DARWIN: Drop afs_event lock before destroying it

On macOS arm64, a lock (lck_mtx_t) must be released (lck_mtx_unlock)
before it can be destroyed/freed (lck_mtx_free -> lck_mtx_destroy). If
this rules isn't respected, the operating system in question will panic
with the following message:

  panic("lck_mtx_assert(): mutex (%p) not owned", lock);

Unfortunately, the current shutdown process of the osi_sleep module
doesn't respect this rule. As a result, macOS arm64 panics when the
OpenAFS client is shut down/restarted. To fix this problem, release
afs_event->lck (EVTLOCK_UNLOCK) before destroying it (EVTLOCK_DESTROY).

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

2 years agotests: Avoid plain printf in auth/superuser-t 66/14866/3
Andrew Deason [Tue, 23 Nov 2021 21:56:49 +0000]
tests: Avoid plain printf in auth/superuser-t

If we're reporting an error, we should be printing to stderr. If we're
printing informational data, we should be using diag() to try to avoid
interfering with the TAP data. Change all printf() calls into one of
those two options.

Change-Id: I2e0d577e0c32efa539ed486190dbaca23bd0487f
Reviewed-on: https://gerrit.openafs.org/14866
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

2 years agotests: Improve fork/waitpid error handling 65/14865/3
Andrew Deason [Tue, 23 Nov 2021 21:52:23 +0000]
tests: Improve fork/waitpid error handling

A couple of places in our test code aren't handling errors from fork()
or waitpid() properly. We don't expect to ever hit errors for these,
but sysbail() in this case, so they don't fail silently.

Change-Id: I1c548f93f4d4ac4344032d7847470b04319386f2
Reviewed-on: https://gerrit.openafs.org/14865
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

2 years agotests: Put tmp dirs in objdir, not /tmp 64/14864/3
Andrew Deason [Tue, 23 Nov 2021 21:31:33 +0000]
tests: Put tmp dirs in objdir, not /tmp

Currently, all tests that use afstest_mkdtemp() generate a temporary
dir in /tmp, which is removed when the test is done (unless MAKECHECK
isn't set, or the test prematurely exits/crashes). The /tmp dir on a
system may not be the best choice; it may be limited in size, and it's
visible to other users, which is annoying if we are littering the dir
with afs_XXXXXX dirs if broken tests are running during development.

Instead, use a tmp dir in the objdir of the current build
(specifically, tests/tmp/). Since this is the same dir we're building
the tree in, we must be able to write to it and it should have plenty
of space. And it will almost certainly get cleaned up eventually, even
with broken tests, since it will get removed when the build tree is
inevitably removed.

While we're doing this, run the paths from afstest_src_path and
afstest_obj_path through realpath(), so our tmp paths (and other
paths) look a little cleaner, and don't look like
/home/user/openafs/tests/../tests/tmp/foo.

Change-Id: I6633f58ac1f6ef34e33b51cc19d3bff7a4f3fdb0
Reviewed-on: https://gerrit.openafs.org/14864
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

2 years agoLinux-5.18 replace set_page_dirty with dirty_folio 39/14939/2
Cheyenne Wills [Wed, 30 Mar 2022 17:09:45 +0000]
Linux-5.18 replace set_page_dirty with dirty_folio

The commits going into Linux 5.18:

  fs: Add aops->dirty_folio (6f31a5a261db)
  fs: Convert __set_page_dirty_buffers to block_dirty_folio (e621900ad2)
  fs: Remove aops ->set_page_dirty (3a3bae50af)

replaces the address_space_operations structure member set_page_dirty
which with dirty_folio.  The linux function __set_page_dirty_buffers is
replaced by block_dirty_folio.

Nothing within afs uses or implements the set_page_dirty function,
however the structure member is required to be initialized.

Add an autoconf test for the dirty_folio member and if present, set the
address_space_operations member dirty_folio to block_dirty_folio
instead of setting the set_page_dirty member.

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

2 years agofinale: translate_et (Unix) support for UAE 49/14649/6
Mark Vitale [Sat, 19 Jun 2021 03:54:00 +0000]
finale: translate_et (Unix) support for UAE

Add support for the UAE numbers to the Unix implementation of
translate_et.

example:
$ translate_et 49733388
49733388 (uae).12 = Permission denied

Change-Id: Id70aaf0fcbffd580ee21de39aa32923dda3e6dac
Reviewed-on: https://gerrit.openafs.org/14649
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agolibadmin: add support for UAE error translation 48/14648/6
Mark Vitale [Mon, 21 Jun 2021 22:05:04 +0000]
libadmin: add support for UAE error translation

Routine util_AdminErrorCodeTranslate() provides the support for error
translation that is used by the libadmin package and several Windows utilities,
including the Windows implementation of translate_et (translate_et_nt.c).

Enhance it so the Windows translate_et can translate UAE errors.
No changes are required for translate_et_nt.c.

Note: this may be unit-tested under Unix via a libadmin test:
$ src/libadmin/test/afscp UtilErrorTranslate -error 49733388
49733388 -> Permission denied

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

2 years agoFix PrintInode() mismatched array parameter warnings 70/14770/9
Michael Meffie [Mon, 23 Aug 2021 19:33:19 +0000]
Fix PrintInode() mismatched array parameter warnings

The PrintInode() prototypes do not match the function definitions.

When AFS_64BIT_IOPS_ENV is defined (which is the common case and is
required for namei), the buffer parameter is declared as a bounded
character array (afs_ino_str_t) in the prototype, but is defined as an
unbounded character pointer.  When AFS_64BIT_IOPS_ENV is not defined
(for legacy 32-bit inode vice partitions), PrintInode() is declared with
no specified parameters.

A static buffer is used to hold the formatted string when a NULL is
passed as the first argument to PrintInode(). However, this method is
only used by the volinfo and iopen utility programs.

Fix the mismatch function prototypes and definitions to use the bounded
char array (afs_ino_str_t) in all cases.  Remove the deprecated function
declaration with no specified parameters. Update vol-info and iopen to
pass an afs_ino_str_t buffer and remove the now unused static buffer.
Update the duplicated PrintInode() function definition in namei_ops.c.
(This duplicated code could be removed in a future commit.)

Change-Id: I5c0128bb0d572dab0df637289daad0e648ad8a8f
Reviewed-on: https://gerrit.openafs.org/14770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agobucoord: Fix doDispatch() array-parameter gcc warning 71/14771/8
Michael Meffie [Mon, 23 Aug 2021 19:37:13 +0000]
bucoord: Fix doDispatch() array-parameter gcc warning

The doDispatch() prototype does not match the function definition. The
targv parameter is declared as an unbounded array in the prototype, but
is defined as a bounded array. As of GCC 12, a warning is issued for the
mismatch.

    main.c:346:18: error: argument 2 of type ‘char *[100]’ with
      mismatched bound [-Werror=array-parameter=]
    bucoord_internal.h:123:40: note: previously declared as ‘char *[]’

Within doDispatch(), the targv argument is just passed to cmd_Dispatch()
(this is the only use of targv). Since cmd_Displatch() expects an
unbounded array, update the doDispatch() definition to match the
prototype.

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

2 years agodoc: Show correct path to BosConfig when using modern paths 08/14908/3
Michael Meffie [Tue, 22 Feb 2022 19:10:36 +0000]
doc: Show correct path to BosConfig when using modern paths

The BosConfig.5 man page shows the incorrect path to the BosConfig file
when modern installation paths are used.  For example, BosConfig.5 man
page distributed by Debian contains the text:

    The file must reside in the /var/lib/openafs/local directory ...

which should read:

    The file must reside in the /etc/openafs directory ...

The man page files contain Transarc-style paths which are translated to
the configured paths by the install target.  The path /usr/afs/local in
the BosConfig pod file is interpreted as @afslocaldir@, not the correct
@afsbosconfigdir@.

Change the BosConfig POD text to trigger a special substitution case in
the install-man script. This case is is already in use to correctly
translate paths of the BosConfig.new and BosConfig files the bosserver
man page.

    /usr/afs/local/BosConfig -> @afsbosconfigdir@/BosConfig

Using this rule requires a change to the text to show the fully
qualified path to the BosConfig file, instead of just the directory
name.

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

2 years agoFBSD: Check VOP_ISLOCKED for LK_EXCLUSIVE 04/14204/5
Andrew Deason [Sun, 10 May 2020 22:26:27 +0000]
FBSD: Check VOP_ISLOCKED for LK_EXCLUSIVE

A couple of places in the code check if a vnode is locked by the
current thread by simply checking 'if (VOP_ISLOCKED(vp))'. But
VOP_ISLOCKED() doesn't just return a simple 1 or 0, it returns LK_*
constants (or 0). LK_EXCLUSIVE indicates that the calling thread holds
an exclusive lock on the vnode, but LK_SHARED means someone holds a
shared lock (possibly not the current thread), and LK_EXCLOTHER
indicates that a different thread holds an exclusive lock.

Because of this, it's possible for us to skip grabbing the vnode lock
for certain operations, if someone else holds the lock at the same
time. For example, this can happen when we call vinvalbuf() inside
afs_GetVCache(), and FreeBSD will warn us that we didn't lock the
vnode:

    #0 0xffffffff80bf6557 at kdb_backtrace+0x67
    #1 0xffffffff80c7a337 at assert_vop_locked+0x77
    #2 0xffffffff80c7a273 at vinvalbuf+0x23
    #3 0xffffffff8285aa2d at afs_GetVCache+0x25d
    #4 0xffffffff828d3325 at afs_root+0x145
    #5 0xffffffff80c70296 at lookup+0x8c6
    #6 0xffffffff80c6f599 at namei+0x4a9
    #7 0xffffffff80c872e4 at sys_lpathconf+0x54
    #8 0xffffffff81074581 at amd64_syscall+0x291
    #9 0xffffffff8104cde0 at fast_syscall_common+0x101
    vnode 0xfffff8012a62bc58: tag afs, type VDIR
        usecount 2, writecount 0, refcount 2 mountedhere 0
        flags (VV_ROOT|VI_ACTIVE)
        lock type afs: UNLOCKED
    #0 0xffffffff80b81fc2 at lockmgr_lock_fast_path+0x1e2
    #1 0xffffffff811fa9f6 at VOP_LOCK1_APV+0x96
    #2 0xffffffff80c8c705 at _vn_lock+0x65
    #3 0xffffffff80c7c066 at vget+0xa6
    #4 0xffffffff828d3437 at afs_root+0x257
    #5 0xffffffff80c70296 at lookup+0x8c6
    #6 0xffffffff80c6f599 at namei+0x4a9
    #7 0xffffffff80c872e4 at sys_lpathconf+0x54
    #8 0xffffffff81074581 at amd64_syscall+0x291
    #9 0xffffffff8104cde0 at fast_syscall_common+0x101
    vc 0xfffffe002be00000 vp 0xfffff8012a62bc58 tag afs, fid: 1.536870924.1.1, opens 0, writers 0

To fix this, change our "islocked"-style checks to check if
VOP_ISLOCKED() returns LK_EXCLUSIVE specifically.

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

2 years agolibadmin: skip authentication setup for tests that don't need it 47/14647/5
Mark Vitale [Tue, 22 Jun 2021 04:04:23 +0000]
libadmin: skip authentication setup for tests that don't need it

src/libadmin/test/afscp is a testbed with subcommands to test many
libadmin functions.  Almost all of these subcommands call
SetupCommonArgs to add authentication specification arguments (e.g.
-noauth, -cell <cell>, etc).  These common args are checked in
MyBeforeProc to obtain authentication before processing the actual test
command.

There are a few afscp subcommands which should not require any
authentication setup:
  UtilErrorTranslate -error <code>
  UtilNameToAddress -host <hostname>

Yet these will segfault in MyBeforeProc unless a valid authentication
argument is specified.

Instead, do not call SetupCommonArgs for these subcommands; this will
cause MyBeforeProcs to skip authentication setup.

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

2 years agolibadmin: allow tests to skip authentication setup 46/14646/5
Mark Vitale [Tue, 22 Jun 2021 04:28:54 +0000]
libadmin: allow tests to skip authentication setup

src/libadmin/test/afscp is a testbed with subcommands to test many
libadmin functions.  Almost all of these subcommands call
SetupCommonArgs to add authentication specification arguments (e.g.
-noauth, -cell <cell>, etc).  These common args are checked in
MyBeforeProc to obtain authentication before processing the actual test
subcommand.

However, some afscp subcommands shouldn't need any authentication setup,
for example:
  UtilErrorTranslate -error <code>
  UtilNameToAddress -host <hostname>

In preparation for a future commit, modify MyBeforeProc to skip
authentication setup for subcommands that haven't called SetupCommonArgs
to define authentication options.

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

2 years agoremove vestigial reference to 'sia' 90/14890/2
Mark Vitale [Sat, 29 Jan 2022 03:39:06 +0000]
remove vestigial reference to 'sia'

Commit 21006bb844a3 oops-sias-dead-20080906 removed references to 'sia'
from the tree, but overlooked the reference in the clean2 rule.  This
results in a harmless error from 'make clean', or any target with
'clean' as a dependency:

  /bin/sh: line 0: cd: sia: No such file or directory
  make[1]: [clean2] Error 1 (ignored)

Remove this last reference to eliminate the error.

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

2 years agodoc: Update INSTALL w/info on overriding dirpaths 88/14888/2
Cheyenne Wills [Thu, 10 Feb 2022 16:02:35 +0000]
doc: Update INSTALL w/info on overriding dirpaths

Fix a typo in INSTALL for 'afslogsdir'.

Add a note with information that it is possible to override the
directory paths via environment variables.

The added documentation is targeting distro maintainers so they are
aware that the directory paths can be configured without patching.

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

2 years agoUKERNEL: Remove socket -> usr_socket redirection 87/14887/3
Andrew Deason [Thu, 27 Jan 2022 20:49:15 +0000]
UKERNEL: Remove socket -> usr_socket redirection

Currently, src/afs/UKERNEL/sysincludes.h #defines 'socket' to
'usr_socket', in order for 'struct socket' declarations to use struct
usr_socket. Redefining a simple word/function like 'socket' can easily
cause issues, and currently makes it difficult to introduce libroken
callers in UKERNEL code. There are already several instances of
'#undef socket' in the tree for UKERNEL, suggesting that this wasn't a
good idea to start with.

Fortunately, this redefinition of 'socket' in UKERNEL seems
unnecessary, since the only place 'struct usr_socket' is actually
deferenced is inside src/rx/UKERNEL/rx_knet.c. So we can treat 'struct
usr_socket' as a struct definition that's just internal to rx_knet.c,
and no other code even needs to know about the struct, or think that
it's equivalent to 'struct socket'.

Most code in rx_knet.c already explicitly casts between 'struct
socket' and 'struct usr_socket'. The only exception is rxi_Recvmsg
starting in commits near 27c42be1 (ukernel-rx-knet-deref-20060126),
but this is easily fixed by adding an additional explicit cast.

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

2 years agoLinux-5.17: Kernel build uses -Wcast-function-type 81/14881/6
Cheyenne Wills [Fri, 28 Jan 2022 21:10:46 +0000]
Linux-5.17: Kernel build uses -Wcast-function-type

The linux 5.17 commit:
  "Makefile: Enable -Wcast-function-type" (552a23a0)
added the -Wcast-function-type compiler flag for kernel module builds.

This change catches a type mismatch in the external files obtained from
heimdal: hcrypto/evp.c and hcrypto/evp-algs.c and produces the following
type of compile time error messages.

  src/libafs/MODLOAD-.../evp.c: In function ‘hc_EVP_md_null’:
  src/libafs/MODLOAD-.../evp.c:501:2: error: cast between incompatible
      function types from ‘void (*)(void *)’ to ‘int (*)(EVP_MD_CTX *)’
          {aka ‘int (*)(struct hc_EVP_MD_CTX *)’}
          [-Werror=cast-function-type]
  501 |  (hc_evp_md_init)null_Init,
      |  ^

Use AX_APPEND_COMPILE_FLAGS to create a CFLAGS_NOCAST_FUNCTION_TYPE
macro to disable this warning and update the CFLAGS for these 2 files
for the Linux libafs build.

Update the CODING documentation to add the new exceptions.  In addition
add a brief description on how to set up autoconf to add a new build
macro to suppress compiler warnings.

Note: upstream heimdal has committed a fix for this in:

   hcrypto: Fix return type for null_Init, null_Update and null_Final
   (fc4b3ce49b)

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

2 years agoafs: Organize setpag() declarations better 83/14883/4
Andrew Deason [Fri, 21 Jan 2022 23:54:48 +0000]
afs: Organize setpag() declarations better

The current declarations for setpag() are a mess (not to be confused
with many other setpag functions, like afs_setpag()), accumulated
across various commits over time. Shuffle the #ifdef logic around, so
this becomes a much more straightforward #ifdef ladder, with one
declaration per conditional. And move the LINUX declaration to be next
to all of the others (even the LINUX setpag() is declared in
osi_groups.c, not osi_misc.c, so it's in the wrong spot anyway).

The resulting #ifdef logic should be identical to the original code,
but is now easier to follow. For the BSDs, it may look like we have
changed the conditional for the case of "XBSD && !DFBSD && !FBSD &&
!NBSD", but that's a very roundabout way of saying OBSD (OpenBSD).

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

2 years agoLinux-5.17: kernel func complete_and_exit renamed 82/14882/5
Cheyenne Wills [Fri, 28 Jan 2022 03:19:17 +0000]
Linux-5.17: kernel func complete_and_exit renamed

Handle the Linux kernel function rename made in commit
 "exit: Rename complete_and_exit to kthread_complete_and_exit"
 (cead1855)

Add a new autoconf test for the linux function kthread_complete_and_exit
and if not found use a define to map kthread_complete_and_exit to
complete_and_exit.

Replace calls to complete_and_exit with kthread_complete_and_exit.

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

2 years agoafs.h: fix out of tree build failures 57/14857/5
Cheyenne Wills [Tue, 11 Jan 2022 01:11:58 +0000]
afs.h: fix out of tree build failures

There are several compiler errors and warnings when building an out of
tree program that includes "afs/afs.h".

 - Errors for unknown type names 'afs_ucred_t' and 'wait_queue_head'
    .../afs/afs.h:1542:16: error: unknown type name ‘afs_ucred_t’
      ... | afs_set_cr_uid(afs_ucred_t *cred, uid_t uid) {
    .../afs/afs.h:1605:5: error: unknown type name ‘wait_queue_head_t’
      ... |     wait_queue_head_t cond;

 - Warnings about declaring structures within missing declarations for
   the structs: osi_File, dcache and afs_FetchOutput
   .../afs/afs.h:1486:36: warning: ‘struct osi_file’ declared inside
        parameter list will not be visible outside of this definition or
        declaration
      ... |     int (*read)(void *rock, struct osi_file *tfile,
                     afs_uint32 offset,

 - Unable to find the file for the include opr/jhash.h

The missing type name 'afs_ucred_t' is due to miss-placed declarations
for some kernel only functions.

The type name 'wait_queue_head' is a data type for Linux kernel modules.

The warnings for the missing declarations are due to either references
to the structures before they are declared, or because they are not
available in any of the other public header files.

To fix the unknown type name afs_ucred_t, relocate the function
declarations that reference 'afs_ucred_t' into the KERNEL only section
(since afs_ucred_t is a kernel specific type).

To fix the unknown type name 'wait_queue_head', relocate the afs_event
structure and the afs_evhasht variable to be within the KERNEL only
section.

To resolve the warnings associated with the structures, simply declare
the structure names before they are referenced.  All references that
are resulting in the warnings are declarations for pointers.

Relocate the include for opr/jhash.h and the define for VCSIZE into the
kernel block.

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

2 years agoAdd sysname, files and header entries for FreeBSD 12.3 60/14860/2
Mans Nilsson [Thu, 16 Dec 2021 20:36:22 +0000]
Add sysname, files and header entries for FreeBSD 12.3

Created a new sysname "amd64_fbsd_123" in src/config/afs_sysnames.h
and added "param" files with minimal changes:

modified:   src/config/afs_sysnames.h
new file:   src/config/param.amd64_fbsd_123.h
new file:   src/config/param.i386_fbsd_123.h

This mod builds on 12.3 with all tests passing.

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

2 years agotests: Add test keys in afstest_BuildTestConfig 35/14835/5
Andrew Deason [Thu, 1 Apr 2021 05:12:43 +0000]
tests: Add test keys in afstest_BuildTestConfig

Change afstest_BuildTestConfig to add the local keys into the
generated config dir, unless the info->skipkeys is set. This just
makes afstest_BuildTestConfig a little easier to use for the common
case of generating a fully-usable config dir with usable keys (only
some callers want to skip generating keys in order to test
key-populating functionality).

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

2 years agoafs: Drop GLOCK for various Rx calls 84/14184/7
Andrew Deason [Sun, 3 May 2020 15:33:28 +0000]
afs: Drop GLOCK for various Rx calls

Most calls into Rx from libafs do so without the AFS_GLOCK, but a few
pieces of code still hold AFS_GLOCK while making some Rx calls. A few
calls into Rx also currently require AFS_GLOCK, but drop AFS_GLOCK
internally, which is somewhat confusing/inconsistent. Calling Rx
functions with AFS_GLOCK held can potentially cause locking/allocation
problems on various platforms, such as FreeBSD where we get WITNESS
warnings about acquiring sleepable Rx locks while holding the
non-sleepable AFS_GLOCK.

Fix a variety of Rx calls from libafs to drop AFS_GLOCK before calling
into Rx. Specifically, this commit handles calls to rxi_GetIFInfo,
rx_InitHost, rx_StartServer, rx_ServerProc, rx_GetConnection,
rx_DestroyConnection/rx_PutConnection, and
rx_SetConnSecondsUntilNatPing.

For calls made via afs_start_thread, adjust afs_start_thread to accept
a new argument that says whether to acquire AFS_GLOCK for the relevant
function or not.

For a call to rx_InitHost inside afs_InitSetup, dropping GLOCK makes
it possible for another thread to also enter afs_InitSetup while we're
running, before afs_InitSetup_done is set. To prevent two threads from
running afs_InitSetup in parallel, introduce afs_InitSetup_running
(which is set while afs_InitSetup is running), and simply wait for it
to be cleared if it is set when we enter afs_InitSetup.

This commit does not handle strictly all calls into Rx from libafs,
since many Rx calls don't do anything interesting besides set some
internal variables, and so AFS_GLOCK doesn't really matter for them,
and dropping/reacquiring it around those calls may have performance
impact.

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

2 years agoautoconf: Remove/update obsolete autoconf macros 38/14838/4
Cheyenne Wills [Tue, 2 Nov 2021 15:18:51 +0000]
autoconf: Remove/update obsolete autoconf macros

Autoconf 2.70 (released in 2020-12) produces warning messages about
obsolete constructs by default.

Running regen.sh with autoconf 2.70 installed produces the following
warnings:

..
 configure.ac:7: warning: The macro `AC_CONFIG_HEADER' is obsolete.
 configure.ac:21: warning: AC_PROG_LEX without either yywrap or noyywrap
   is obsolete
 configure.ac:21: warning: The macro `AC_HEADER_STDC' is obsolete.
 configure.ac:21: warning: The macro `AC_HEADER_TIME' is obsolete.
..

Replace AC_CONFIG_HEADER with AC_CONFIG_HEADERS

Add the noyywrap parameter to AC_PROG_LEX.  Use the noyywrap option
since we already provide a yywrap function in the .l sources.

Remove AC_HEADER_STDC.  There are no references to the the autoconf
variable set by this macro.  This macro was marked as obsolete prior to
autoconf 2.64 with the following note:
 "This macro is obsolescent, as current systems have conforming header
 files. New programs need not use this macro."

AC_HEADER_TIME was marked as obsolete prior to autoconf 2.64 with the
following note:
 "This macro is obsolescent, as current systems can include both files
  when they exist. New programs need not use this macro."

The only reference that requires AC_HEADER_TIME is within the external
roken code pulled from heimdal. Compiles that use the external upstream
heimdal packages result in a build error if TIME_WITH_SYS_TIME is not
defined:
  building src/crypto/hcrypto
    src/external/heimdal/hcrypto/camellia.c
      include/roken.h:803:58: error: ‘struct tm’ declared inside

Update autoheader.m4 so a define for TIME_WITH_SYS_TIME is created. This
avoids modifying the external heimdal/roken code.

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

2 years agoLINUX-5.16: Use linux/stdarg.h if available 44/14844/3
Cheyenne Wills [Tue, 16 Nov 2021 17:55:30 +0000]
LINUX-5.16: Use linux/stdarg.h if available

Global use of the compiler option '-isystem' was removed from the top
level Makefile with Linux commit ('isystem: delete global -isystem
compile option' 04e85bbf7). This results with an error due to not
finding "stdarg.h" when building the openafs kernel module.

 .../src/rx/rx_kcommon.h:143:12: fatal error: stdarg.h: No such file or
                                 directory
   143 | #  include "stdarg.h"
       |            ^~~~~~~~~~

Linux-5.15, introduced a copy of stdarg.h as 'linux/stdarg.h' in commit
('isystem: ship and use stdarg.h' c0891ac15)

Add a test for the linux/stdarg.h include file and if available, use
"linux/stdarg.h" instead of "stdarg.h" within the Linux kernel module.

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

2 years agoprdb.txt: correct fixed header length 24/14824/3
Benjamin Kaduk [Sun, 3 Oct 2021 22:44:05 +0000]
prdb.txt: correct fixed header length

It is decimal 64, not hex 64.

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

2 years agotests: Check for vlserver startup 04/14804/5
Andrew Deason [Thu, 17 Sep 2020 04:05:07 +0000]
tests: Check for vlserver startup

Currently, afstest_StartVLServer waits for a fixed amount of time (5
seconds) for the vlserver to startup. This means each test that runs a
vlserver takes at least 5 seconds, which adds up very quickly when new
tests are added for vlserver functionality.

Instead of waiting 5 seconds each time, change afstest_StartVLServer
to check if the vlserver has started up, and to wait a much shorter
time if it hasn't finished starting up yet. Specifically, wait until
the "Starting AFS vlserver" message appears in VLLog, and the
UBIK_RECHAVEDB recovery state bit is set. This allows vlserver-based
tests to run much more quickly.

Change-Id: I74015670a301980e6d89b3149ed9f2a6c1a40523
Reviewed-on: https://gerrit.openafs.org/14804
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agotests: Introduce afstest_MyHostAddr 02/14802/3
Andrew Deason [Sat, 24 Apr 2021 21:08:38 +0000]
tests: Introduce afstest_MyHostAddr

Several places resolve the local hostname into an IP address.
Consolidate these into a single function (gethostaddr), and add the
function afstest_MyHostAddr, which caches the IP and bails if we can't
resolve our hostname.

Change-Id: I7f71cd136796e4395c639eed8dd8eb19a7b9beec
Reviewed-on: https://gerrit.openafs.org/14802
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoafs: record afs_CacheTruncateDaemon stats indirectly 99/14199/14
Mark Vitale [Tue, 14 Apr 2020 21:13:02 +0000]
afs: record afs_CacheTruncateDaemon stats indirectly

In preparation for a future commit, record the CTD_stats through a
pointer.

No functional change is incurred by this commit.

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

2 years agoafs: export internal stats for afs_CacheTruncateDaemon 98/14198/14
Mark Vitale [Wed, 1 Apr 2020 18:48:37 +0000]
afs: export internal stats for afs_CacheTruncateDaemon

In preparation for a future commit, redefine CTD_stats so they can be
reported externally.  While here, move and rename the struct.

While here, also remove an old comment concerning AIX.

No functional change is incurred by this commit.

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

2 years agoafs: consolidate disk block calculations 27/14227/9
Mark Vitale [Fri, 22 May 2020 22:31:56 +0000]
afs: consolidate disk block calculations

Similar code is used in several places to calculate the number of 1KiBi
blocks required for a cache chunk, rounded up to the nearest
afs_fsfragsize.  Coalesce these into a single inline function,
afs_round_to_fsfragsize.

No functional change should be incurred by this commit.

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

2 years agoAdd static assert for size of osi_timeval32_t 95/14195/14
Mark Vitale [Mon, 4 May 2020 19:55:07 +0000]
Add static assert for size of osi_timeval32_t

OpenAFS code requires osi_timeval32_t to have 32-bit sizes for members
tv_sec and tv_usec - a total of 8 octets.  One symptom of a
misdefinition may be incorrect operation of xstat_cm_test, which relies
on wire representations of time being 8 bytes on both the client and
server side.

In order to prevent incorrect sizes of osi_timeval32_t, add a static
assert.

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

2 years agoFBSD: Drop GLOCK when grabbing vnode locks 82/14182/7
Andrew Deason [Sun, 3 May 2020 02:01:50 +0000]
FBSD: Drop GLOCK when grabbing vnode locks

In a few places, we try to vn_lock() or VOP_LOCK() while holding
AFS_GLOCK (or do something like vrele(), which internally acquires the
vnode lock). This is against the FBSD locking rules, since our
AFS_GLOCK is a non-sleepable 'struct mtx' lock, and vnode locks are
sleepable lockmgr locks.

So, drop AFS_GLOCK while acquiring vnode locks.

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

2 years agoRemove kdump 23/14623/10
Cheyenne Wills [Wed, 7 Jul 2021 17:08:10 +0000]
Remove kdump

Remove the obsolete kdump debugging tool from the tree.  Remove and
clean up the preprocessor tests associated with KDUMP, KDUMP_RX_LOCK and
KDUMP_KERNEL.  Clean up the autoconf and Makefiles to remove kdump and
the associated autoconf and Makefile vars XLIBELFA and XLIBKVM.

The kdump utility has not been well maintained; for some platforms it
fails to build (e.g. Solaris 11).  For Linux, the makefile does not
even try to compile the kdump source but instead creates the kdump file
via touch.

The intended functionality of kdump has been replaced by various kernel
debugging tools, such as dtrace or systemtap.

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

2 years agoFBSD: use sx(9) locks for rx afs_kmutex_t 83/14183/6
Andrew Deason [Sun, 3 May 2020 01:56:46 +0000]
FBSD: use sx(9) locks for rx afs_kmutex_t

On FBSD, afs_kmutex_t is defined as a struct mtx, which is a
non-sleepable lock. If we hold one of these locks and then try to
acquire a sleepable lock, there is the potential for deadlock, and
WITNESS complains.

One way this is a problem is that we acquire IFNET_RLOCK in
rxi_GetIFInfo(), which is a sleepable lock. We enter this function
via rxi_FindPeer -> rxi_InitPeerParams, which is encountered while
holding a variety of different Rx locks in different situations, such
as rx_peerHashTable_lock and rx_connHashTable_lock.

Another way this is a problem is that we allocate memory in a variety
of situations whole holding various Rx locks. Currently many of these
are sleepable allocations (which could cause deadlocks); we could
avoid that if they were converted to non-sleepable allocations, but
then the allocations may fail and we'd need to adjust all of the
relevant code paths to accommodate.

To avoid these issues, define Rx's afs_kmutex_t locks to sx(9) locks,
which are sleepable. Drop the use of MTX_DUPOK/SX_DUPOK during lock
init, since we shouldn't be acquiring duplicate locks.

This does not appear to introduce any new issues, except where we
acquire Rx locks while holding the libafs AFS_GLOCK, which we probably
shouldn't be doing and is fixed in subsequent commits. Note that other
platforms also tend to use sleepable locks for afs_kmutex_t: for
example, on LINUX, we use struct mutex (which is sleepable).

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

2 years agoubik: Skip sleep on first pass in urecovery loop 03/14803/2
Andrew Deason [Fri, 18 Sep 2020 01:54:54 +0000]
ubik: Skip sleep on first pass in urecovery loop

When running a dbserver without any remote sites, we become the sync
site immediately, since there aren't any other sites so we don't need
to do any processing of votes. The ubik database can thus be accessed
immediately, except we cannot start ubik write transactions right
away, since UBIK_RECHAVEDB will not be set, causing
urecovery_AllBetter() to fail.

UBIK_RECHAVEDB is not set immediately, because urecovery_Interact
sleeps 4 seconds at the beginning of its loop, so no recovery flags
will be set for the first 4 seconds during startup. This makes it
impossible to start any ubik write transactions for the first 4
seconds, even if we're the only site. That may not be a significant
amount of time for a user (since a dbserver daemon doesn't startup too
frequently), but this can cause huge delays for automated testing of
dbservers.

To get rid of this unnecessary delay, just skip this delay the first
time we go through the urecovery_Interact loop.

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

2 years agoprdb_check: fix -pheader output 27/14827/2
Benjamin Kaduk [Fri, 8 Oct 2021 04:11:12 +0000]
prdb_check: fix -pheader output

This is prdb_check, so we will print the PRDB header, not the
KADB header.

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

2 years agoLINUX 5.14: explicitly set set_page_dirty to default 26/14826/2
Cheyenne Wills [Thu, 7 Oct 2021 17:15:58 +0000]
LINUX 5.14: explicitly set set_page_dirty to default

Linux 5.14 commit: 'mm: require ->set_page_dirty to be explicitly wired
up' (0af573780b0b13) removed calling __set_page_dirty_buffers when the
address_space_operations structure member set_page_dirty was NULL.

A kernel RIP error can occur when the set_page_dirty operation is
requested. (Reproducible by running 'iozone -B -a')

Update the definition for afs_file_aops to explicitly set the
'set_page_dirty' member to '__set_page_dirty_buffers'.

There are no functional changes, since this commit is using the same
function that the Linux kernel was using if set_page_dirty had been
NULL.

Problem originally reported by "Andrej Filipcic"
<andrej.filipcic@ijs.si> in the openafs-info mailing list.  The Linux
5.14 commit causing the openafs failure was identified by "Michael Laß"
<lass@mail.upb.de> also on in the openafs-info mailing list.

Note: The declaration for the function '__set_page_dirty_buffers' was
moved from linux/mm.h into linux/buffer_head.h in Linux 2.6.19.  Since
this is close to the minimum supported Linux version 2.6.18, we are not
introducing an additional autoconf test to determine which header file
the declaration for __set_page_dirty_buffers resides in.

Change-Id: I8f2a00e374635ab1aa69d6eaef8cf97bb449d089
Reviewed-on: https://gerrit.openafs.org/14826
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Tested-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Tested-by: Ralf Brunckhorst <rbrunckhorst@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoCVE-2018-7168 RXAFS_StoreACL deprecate 134 introduce 164 42/12942/5
Jeffrey Altman [Sat, 24 Feb 2018 01:10:27 +0000]
CVE-2018-7168 RXAFS_StoreACL deprecate 134 introduce 164

There exist in the wild AFS3 clients that improperly construct access
control lists which are then stored to directories via RXAFS_StoreACL
(opcode 134).  These clients add negative access control entries (if any)
to the normal rights list.

As there is no method by which a fileserver can determine that the
ACL is improperly constructed, the only method to defend the storage of
broken ACLs is to identify clients that are known to properly construct
ACLs by introducing a new RXAFS_StoreACL opcode (164).

This change:

 * Renames RXAFS opcode 134 to RXAFS_OldStoreACL

 * Introduces RXAFS opcode 164 as RXAFS_StoreACL

 * Implements SRXAFS_OldStoreACL and SRXAFS_StoreACL in the fileserver
   via a common_StoreACL() function that accepts the executed opcode
   as input.

 * To avoid breaking changes in stable release branches,
   SRXAFS_OldStoreACL will still be allowed by default, with an option
   to cause it to be failed by default with error EPERM/UAEPERM.
   A follow-up commit will cause SRXAFS_OldStoreACL to fail by default
   on the master branch.

 * When opcode 134 is called, the a FileLog entry will be generated
   at log level 0 instead of 1 and the entry will contain the string
   "CVE-2018-7168".

 * Modifies the format of the ACL logged to the FileLog and the audit
   stream.  Previously the AFSOpaque format was used directly.  The
   problem with this format is that it uses newlines as the ACE
   separator.  Since the FileLog and file audit log is intended to
   be one line per log entry, the newlines break the file formats.
   This change replaces the newlines with spaces for display purposes
   unless the process is unable to allocate the additional memory.

 * Introduces a new fileserver command line switch -cve-2018-7168-enforce
   which when specified causes SRXAFS_OldStoreACL RPCs to be failed.

[kaduk@mit.edu: switch en/disable-by-default behavior and fix argument parsing]

Change-Id: Ic92ef45314d75fbc2b8ff574223fab2d398a1d60
FIXES: 134485
Reviewed-on: https://gerrit.openafs.org/12942
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agotests: Add existing-database test for pt_util 01/14801/2
Andrew Deason [Mon, 28 Dec 2020 20:14:54 +0000]
tests: Add existing-database test for pt_util

Our current tests for pt_util use pt_util to generate a prdb, and then
check the output of pt_util against that created database. Add a new
test that runs pt_util against an existing database (with the same
test data), to make sure that pt_util is still using the same db
format.

Change-Id: I4dbe7f3b5080ee6ff1f9509992b5686fc8381da0
Reviewed-on: https://gerrit.openafs.org/14801
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agorx: Cleanup rx.h 29/14629/6
Cheyenne Wills [Mon, 14 Jun 2021 22:13:57 +0000]
rx: Cleanup rx.h

Fix up indentation and white space within preprocessor statements.

Remove multiple blank lines

Fix #endif comments so they match the #if

Split long #define lines
  RX_PACKET_TYPES
  rx_MaxUserDatasize,
  RXS_OP
  RXS_SetConfiguration

Note, this commit does not refactor any preprocessor statements.

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

2 years agotests: Introduce afstest.pm 00/14800/3
Andrew Deason [Mon, 28 Dec 2020 19:12:59 +0000]
tests: Introduce afstest.pm

Create a perl module for some generic common code for our tests
written in perl: afstest.pm. With this commit, the module just
contains a couple of functions to calculate paths in our src and obj
trees (src_path(), obj_path()), analogous to afstest_src_path and
afstest_obj_path in our C helper library, libafstest_common.la.

Convert all existing perl test code that uses C_TAP_SOURCE/C_TAP_BUILD
to use these new functions.

Change-Id: I5e4d45e3d2d59449bbfc426476cb29b710c73bc1
Reviewed-on: https://gerrit.openafs.org/14800
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agofs: add option to evaluate symlink or mtpt 42/14542/7
Marcio Barbosa [Thu, 1 Jul 2021 13:47:50 +0000]
fs: add option to evaluate symlink or mtpt

Currently, several fs subcommands for Windows offer an option (-literal)
to evaluate symlink / mount point rather than the object it refers to.
Provide the same option on Unix for fs_getfid.

Change-Id: I55ab5f96d5b9e63efbe7e938647edba05a1787ed
Reviewed-on: https://gerrit.openafs.org/14542
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoFBSD: Use GENERIC kernel headers by default 01/14001/8
Andrew Deason [Sun, 22 Dec 2019 06:43:07 +0000]
FBSD: Use GENERIC kernel headers by default

Currently, if --with-bsd-kernel-build is not specified during
configure, we do not set KERNBUILDDIR during the libafs build at all.
This means that we do not use an opt_global.h during the build.

For the GENERIC kernel, in the past this has worked well enough to
produce a working kernel module, but with FreeBSD 12, the GENERIC
kernel turns on the VIMAGE option by default. If our kernel module is
built without VIMAGE defined, our kernel module cannot be loaded into
GENERIC, since VIMAGE changes the definitions of some symbols that we
use (for example, trying to load such a libafs fails with the message
"link_elf_obj: symbol in_ifaddrhead undefined").

To allow the build to work by default for GENERIC kernels, without
needing any additional configure flags, change the libafs Makefile to
use the headers for the GENERIC kernel if no kernel build dir is
given. To do this, we create a directory in our build tree and
generate the opt_*.h headers in there (using config(8)), and specify
that directory as the kernel build dir.

This approach only works for GENERIC kernels, of course, but that is
the most common scenario. Users that want to build for a custom kernel
configuration still need to specify the actual kernel build dir with
--with-bsd-kernel-build.

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

2 years agoafs: Call afs_FindVCache with DO_STATS, not 1 23/14823/2
Andrew Deason [Sat, 2 Oct 2021 02:02:42 +0000]
afs: Call afs_FindVCache with DO_STATS, not 1

Several callers pass the bare literal 1 to afs_FindVCache, instead of
the named constant DO_STATS. Use the constant, for clarity.

Change-Id: I0c70ee17f48c773dcb3f4d42ec106f440c5bed2c
Reviewed-on: https://gerrit.openafs.org/14823
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoIRIX: Remove pre-65 code 30/14230/4
Andrew Deason [Mon, 25 May 2020 21:48:34 +0000]
IRIX: Remove pre-65 code

Commit d1923139 (irix kill efs and start pruning pre-65) removed all
files that defined AFS_SGI64_ENV and earlier, but didn't remove that
code that depended on those defines. In addition, there has been code
in the tree that checks for AFS_SGI53_ENV since OpenAFS 1.0, but
nothing has ever defined Irix 5.3 support in OpenAFS.

Remove all of this obsolete code. Change all references to
AFS_SGIXX_ENV to AFS_SGI_ENV, and assume AFS_SGI_ENV is defined in all
IRIX dirs. Consolidate some of the resulting ifdef logic
appropriately.

Change-Id: I9dd426296e04801980b805a5e195063762b23189
Reviewed-on: https://gerrit.openafs.org/14230
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoafs: Remove 'retry' arg from afs_FindVCache 31/14231/4
Andrew Deason [Mon, 25 May 2020 21:48:37 +0000]
afs: Remove 'retry' arg from afs_FindVCache

Since OpenAFS 1.0, afs_FindVCache has had an optional 'retry' output
arg. The relevant functionality appears to have been specific to Irix
versions before 5.3, but even OpenAFS 1.0 only had param.h files and
general build logic for Irix 6.2 and later.

With commit 13e44b2b (afs: Refactor osi_vnhold/AFS_FAST_HOLD), the
unused 'retry' argument has now been removed from the lower-level
osi_vnhold function, so now remove it from afs_FindVCache and related
comments, and remove the associated logic to handle a non-zero
'retry'.

Change-Id: I4464347bf6e0a57f8babbcdcdf5283e52532f687
Reviewed-on: https://gerrit.openafs.org/14231
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agobos: Improve string safety 65/14765/7
Michael Meffie [Wed, 23 Jun 2021 01:13:44 +0000]
bos: Improve string safety

To avoid potential string overflows and allow for larger strings in the
future, convert to safe string functions and remove fixed length stack
allocated strings in the bos client.

Add string truncation checks to the date format helper function.

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

2 years agoafs: remove dead code afs_SetCheckServerNATmode 12/14812/3
Mark Vitale [Thu, 16 Sep 2021 20:46:59 +0000]
afs: remove dead code afs_SetCheckServerNATmode

afs_SetCheckServerNATmode was introduced by f86af4af2600
'nat-mode-20060330', an early implementation of cache manager
disconnected mode.

It was first used in d335c636e25d 'discon-20060714'.

The last caller was removed by 99c1e0beb1b
'disconnected-merge-conflict-20080630'.

Remove the dead code.  While here, also remove an incorrect comment on
the default probe interval value.

No functional change is incurred by this commit.

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

2 years agoafs: eliminate INSTRUMENT_LOCKS 16/14716/2
Mark Vitale [Mon, 26 Jul 2021 03:01:51 +0000]
afs: eliminate INSTRUMENT_LOCKS

Since the original IBM code import, there have been two versions of the
lock macros: one with INSTRUMENT_LOCKS (the default) and one without.
Only the former is ever enabled.  Therefore, remove the unused latter
versions, and all INSTRUMENT_LOCKS conditional logic.

No functional change is incurred by this commit.

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

2 years agoafs: remove lock dead code 07/14407/4
Mark Vitale [Thu, 22 Oct 2020 22:35:49 +0000]
afs: remove lock dead code

Since OpenAFS 1.0, LockWait has been commented out, and the following
routines have been unreferenced:
- ObtainLock
- ReleaseLock
- afs_osi_SleepR
- afs_osi_SleepW
- afs_osi_SleepS

Remove them from the code and comments.

No functional change is incurred by this commit.

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

2 years agotests: Use real tempfile in pt_util-t 99/14799/2
Andrew Deason [Mon, 28 Dec 2020 18:22:22 +0000]
tests: Use real tempfile in pt_util-t

Use a real call to File::Temp::tempfile to generate our temporary
filename, instead of creating a somewhat predictable filename based on
our pid.

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

2 years agoFBSD: Invalidate pages after non-VM write 66/14166/6
Andrew Deason [Mon, 27 Apr 2020 19:47:08 +0000]
FBSD: Invalidate pages after non-VM write

Our VOP_WRITE implementation causes the given data to be written to
the libafs cache, and potentially to the fileserver, but does not
update pages mapped to our vnode. This can cause file data to appear
out-of-date if otherwise valid pages exist for that range.

As a practical example of this, when running 'make buildworld' in
/afs, we run:

cc -nostdlib -Wl,-dc -r -o ipf.lo ipf_stub.o [...]
    crunchide -k _crunched_ipf_stub ipf.lo

The first 'cc' command generates ipf.lo by writing to an mmap'd
region, and the second 'crunchide' command rewrites that file using
write() syscalls.

Afterwards, anything that reads from ipf.lo using mmap'd memory will
see the ipf.lo that 'cc' generated; anything that reads using read()
syscalls will see the updated version from 'crunchide'. And of course
if the pages are evicted for any other reason (such as memory
pressure), everything will see the updated version from 'crunchide'.

The eventual error seen during 'make buildworld' involves duplicate
symbols during linking, since 'crunchide' modifies most symbols to be
hidden. For example:

cc [...] -static -o rescue rescue.o cat.lo [...] ipf.lo [...]
    ld: error: duplicate symbol: main
    >>> defined at rescue.c
    >>>            rescue.o:(main)
    >>> defined at count4bits.c
    >>>            ipf.lo:(.text+0x10)

    ld: error: duplicate symbol: main
    >>> defined at rescue.c
    >>>            rescue.o:(main)
    >>> defined at trace.c
    >>>            routed.lo:(.text+0x3DE0)
    [...]

To fix this, call vn_pages_remove() to invalidate the pages in the
given range after the write has gone through (successfully or not, in
case of partial writes or other edge cases). We don't do this lower in
afs_write(), since that is also called from our VOP_PUTPAGES()
implementation, and we'd be invalidating pages that we were just given
to write out.

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

2 years agovlserver: Use bounded string copy in FindByName() 63/14763/3
Michael Meffie [Thu, 19 Aug 2021 16:52:30 +0000]
vlserver: Use bounded string copy in FindByName()

Although the volname string passed to FindByName() is currently always
limited 65 characters (including the terminating nul), to be on the safe
side, use the bounded strlcpy() function when coping the volname to the
temporary tname local variable to avoid the possibility of overwriting
the stack with an unbounded strcpy().

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

2 years agorxgen: Generate default switch arm for void 98/14798/2
Andrew Deason [Wed, 10 Feb 2021 22:42:16 +0000]
rxgen: Generate default switch arm for void

When defining an xdr union with a 'default' arm, rxgen generates xdr
routines like this:

    bool_t
    xdr_myunion(...)
    {
        switch (objp->op) {
        case FOO:
            xdr_foo(...);
            break;

        default:
            xdr_default(...);
            break;
        }
    }

However, if the default arm of the union is just 'void;', we just
don't generate a 'default:' arm in the switch statment in the
generated routines. If there are enum values that are not explicitly
specified, and are handled by the default arm, this generates a
compiler warning (which breaks the build for --enable-checking):

    foo_int.xdr.c:80:2 error: enumeration value 'BAR' not handled in switch [-Werror=switch]
    switch (objp->op) {

To avoid this, change rxgen to always generate a 'default' arm in the
generated switch if there's one specified in the RPC-L. For a void
default, just generate an empty default arm, which avoids the compiler
warning.

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

2 years agoRemove reference to afsinstall from src/README.md 05/14805/3
Cheyenne Wills [Thu, 16 Sep 2021 15:14:51 +0000]
Remove reference to afsinstall from src/README.md

Commit "deorbit afsinstall" (ed15b0d5b3) removed afsinstall from the
source tree, but not did remove where it was referenced in
src/README.md.

Remove the reference to 'afsinstall' from the 'Not Maintained' section
in src/README.md.

Change-Id: Ie5226bf97003c21044759bd5dc2b8efe5d9138c2
Reviewed-on: https://gerrit.openafs.org/14805
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agofs: Trim trailing lsmount and flushmount path slashes 79/14779/2
Michael Meffie [Wed, 1 Sep 2021 16:38:14 +0000]
fs: Trim trailing lsmount and flushmount path slashes

Remove trailing slashes from paths given to `fs lsmount` and `fs
flushmount`.  This makes for a more pleasant user experience when shell
tab completion is used to specify the paths.

Thanks to Stephan Wiesand for pointing out this issue.

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

2 years agoLinux 5.15: Convert osi_Msg macro to a function 91/14791/7
Cheyenne Wills [Tue, 14 Sep 2021 12:36:49 +0000]
Linux 5.15: Convert osi_Msg macro to a function

With Linux 5.15-prerc1 printk is defined as a macro instead of a
function ("printk: Userspace format indexing support" 33701557)

This change is causing a build failure:

 .../src/rx/rx_kernel.h:62:18: error: ‘printk’ undeclared (first use in
   this function); did you mean ‘_printk’?
   62 | # define osi_Msg printk)(
      |                  ^~~~~~

The definition and use of the osi_Msg and osi_VMsg macros are
unconventional and the C preprocessor is not handling the macro
expansion when printk is itself a macro.

   #define osi_Msg printk)(
   ...
   (osi_Msg "%s", x);

Change osi_Msg to a function, and simply replace osi_VMsg with vprintf
since osi_VMsg is only used at one location within user space code.

osi_Msg is implemented in 2 locations, in rx_kcommon for kernel space
and in rx_user for userspace.

Note: The unconventional definitions of osi_Msg/osi_VMsg was historical
and due to older compilers not supporting variadic macros.  All of
the currently support platforms should now support variadic functions.

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

2 years agoFBSD: Disable background stores 85/14185/6
Andrew Deason [Sun, 3 May 2020 15:26:27 +0000]
FBSD: Disable background stores

Currently, when closing a vcache (via afs_close), we write any dirty
data to the net, and we do so via a background daemon if one is
available (for the rarely-used 'fs storebehind' functionality).

However, on FBSD, this breaks the locking rules, since flushing dirty
pages for a vnode requires the vnode to be locked. In the situation
where we are writing via a background daemon, the afs_close() thread
is what holds the vnode lock, but the background thread is the one
that's actually flushing the dirty pages. So the vnode is effectively
locked in this situation, but to the FreeBSD kernel it looks like we
are flushing pages without the vnode lock, and so it complains:

    kernel: KDB: stack backtrace:
    kernel: #0 0xffffffff80bf6557 at kdb_backtrace+0x67
    kernel: #1 0xffffffff80c7a337 at assert_vop_locked+0x77
    kernel: #2 0xffffffff811fc0bb at VOP_PUTPAGES_APV+0x7b
    kernel: #3 0xffffffff80f016bd at vnode_pager_putpages+0x7d
    kernel: #4 0xffffffff80ef424f at vm_pageout_flush+0xff
    kernel: #5 0xffffffff80ee9b39 at vm_object_page_collect_flush+0x239
    kernel: #6 0xffffffff80ee9819 at vm_object_page_clean+0x179
    kernel: #7 0xffffffff828d7181 at osi_VM_StoreAllSegments+0x111
    kernel: #8 0xffffffff82850a3d at afs_StoreAllSegments+0x9d
    kernel: #9 0xffffffff8287b1ce at afs_StoreOnLastReference+0x17e
    kernel: #10 0xffffffff8282dc70 at BStore+0xd0
    kernel: #11 0xffffffff8282d6ec at afs_BackgroundDaemon+0x2cc
    kernel: #12 0xffffffff828c2f2f at afs_syscall_call+0x35f
    kernel: #13 0xffffffff82855963 at afs3_syscall+0x83
    kernel: #14 0xffffffff81074581 at amd64_syscall+0x291
    kernel: #15 0xffffffff8104cde0 at fast_syscall_common+0x101
    kernel: vnode 0xfffff8006974fc58: tag afs, type VREG
    kernel:     usecount 2, writecount 0, refcount 3
    kernel:     flags (VI_ACTIVE)
    kernel:     v_object 0xfffff80023917900 ref 0 pages 171 cleanbuf 0 dirtybuf 0
    kernel:     lock type afs: EXCL by thread 0xfffff800852775e0 (pid 31828, ld.lld, tid 100787)
    kernel: #0 0xffffffff80b81fc2 at lockmgr_lock_fast_path+0x1e2
    kernel: #1 0xffffffff811fa9f6 at VOP_LOCK1_APV+0x96
    kernel: #2 0xffffffff80c8c705 at _vn_lock+0x65
    kernel: #3 0xffffffff80c8c8a3 at vn_close1+0x73
    kernel: #4 0xffffffff80c8b76c at vn_closefile+0x4c
    kernel: #5 0xffffffff80b571ba at _fdrop+0x1a
    kernel: #6 0xffffffff80b5a3cc at closef+0x1ec
    kernel: #7 0xffffffff80b577be at closefp+0x9e
    kernel: #8 0xffffffff81074581 at amd64_syscall+0x291
    kernel: #9 0xffffffff8104cde0 at fast_syscall_common+0x101
    kernel: vc 0xfffffe002b8d4d30 vp 0xfffff8006974fc58 tag afs, fid: 1.536870912.13317022.33596982, opens 1, writers 1
    kernel:   states statd dirty
    kernel: VOP_PUTPAGES: 0xfffff8006974fc58 is not locked but should be

To avoid this, force afs_close() to write dirty data in the same
thread, instead of passing it off to a background daemon.

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

2 years agopts: Fix stringop-overflow warnings 69/14769/4
Michael Meffie [Mon, 23 Aug 2021 23:43:45 +0000]
pts: Fix stringop-overflow warnings

The ptutil functions are defined to accept bounded character arrays for
user and group names. As of GCC 11, callers which provide the names as
string literals now trigger the stringop-overflow warning, since the
regions provided by the string literals are smaller than the bounded
areas.

    error: ‘pr_ChangeEntry’ accessing 64 bytes in a region of size 1
           [-Werror=stringop-overflow=]
    note: referencing argument 4 of type ‘char *’

    error: ‘pr_IsAMemberOf’ accessing 64 bytes in a region of size 22
           [-Werror=stringop-overflow=]
    note: referencing argument 2 of type ‘char *’

    error: ‘pr_CreateUser’ accessing 64 bytes in a region of size 16
           [-Werror=stringop-overflow=]
    note: referencing argument 1 of type ‘char *’

    error: ‘pr_Delete’ accessing 64 bytes in a region of size 16
           [-Werror=stringop-overflow=]
    note: referencing argument 1 of type ‘char *’

Update the callers in pts and testpt which pass literal strings. Instead
of passing char pointers to literal strings, assign the strings to
prname buffers and pass the prname buffers to the pr utility functions.

Change-Id: I7d8c67aa28d21bb6889ef92a2193a77b54c83cb1
Reviewed-on: https://gerrit.openafs.org/14769
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoptserver: Fix CreateEntry() stringop-overflow warnings 89/14789/4
Michael Meffie [Fri, 3 Sep 2021 11:05:36 +0000]
ptserver: Fix CreateEntry() stringop-overflow warnings

The CreateEntry() prototype has been fixed to match the function
definition, so callers are expected to provide bounded arrays for the
user or group name. Fix the InitialGroup() macro which is used to set
the built-in names using string literal to avoid stringop-overflow
warnings.

    error: ‘CreateEntry’ accessing 64 bytes in a region of size 22 [-Werror=stringop-overflow=]
            code = CreateEntry(tt, (name), &temp, /*idflag*/1, flag, SYSADMINID, SYSADMINID); \

    note: in expansion of macro ‘InitialGroup’
           InitialGroup(SYSADMINID, "system:administrators");
    note: referencing argument 2 of type ‘char *’
    note: in a call to function ‘CreateEntry’
            CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ...

    (Repeated for "system:backup", "system:anyuser", "system:authuser",
    "system:ptsviewers", and "anonymous".)

Change-Id: I7a37d4c8e191ffff52c2fdc1ed3783f4c3592b11
Reviewed-on: https://gerrit.openafs.org/14789
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agoafs: Avoid touching CBRs after free 65/14165/6
Andrew Deason [Mon, 27 Apr 2020 18:28:33 +0000]
afs: Avoid touching CBRs after free

Currently, we free our CBR structures in shutdown_vcache, but later on
in shutdown_server, we call afs_FreeCBR on each one that's attached to
a struct server. afs_FreeCBR doesn't actually free the memory; it just
modifies some pointers to put the CBR on the free list. Since we do
this after the underlying memory has been freed, it can cause a panic
during shutdown since the structures are no longer valid.

To avoid this, make the afs_FreeCBR calls inside shutdown_vcache,
right before the memory is freed.

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

2 years agoFBSD: Use user creds for afs_vop_putpages() 64/14164/6
Andrew Deason [Sun, 26 Apr 2020 05:25:10 +0000]
FBSD: Use user creds for afs_vop_putpages()

Currently, the FBSD afs_vop_putpages uses the credentials of the
current process for writing data back to the fileserver. Usually this
works, but sometimes we're being called from syncer(4), which runs as
root instead of as the user accessing the relevant file.

This means that instead of using the tokens from the user that wrote
to the relevant file, we use whatever tokens belong to uid 0. This
usually causes an EACCES error when trying to write the data back to
the fileserver, causing us to store EACCES (13) in avc->vc_error, and
possibly causing a message in the kernel log like so:

    afs: failed to store file (0/13)

Since we set vc_error during these errors, this can also cause access
to the file to fail for the normal user process until vc_error is
cleared (such as when the file is closed).

To avoid this, store the credentials of the current user that
successfully opens the file for writing (in avc->cred), and use those
creds for writing back data to the fileserver. This is the same
approach that LINUX uses as of commit 70c8deab (Use user credentials
for Linux writepage()), and the NFS client code in FreeBSD itself (see
the usage of n_writecred in struct nfsnode as of 12.1-RELEASE).

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

2 years agoptserver: Fix CreateEntry() mismatched array parameter warning 68/14768/3
Michael Meffie [Tue, 24 Aug 2021 20:40:22 +0000]
ptserver: Fix CreateEntry() mismatched array parameter warning

The CreateEntry() prototype does not match the function definition. The
aname parameter is declared as an unbounded array in the prototype but
is defined as a bounded array. As of GCC 12, a warning is issued for the
mismatch.

    error: argument 2 of type ‘char[64]’ with mismatched bound
           [-Werror=array-parameter=]
           CreateEntry(struct ubik_trans *at, char aname[PR_MAXNAMELEN], ...

    note: previously declared as ‘char[]’
          extern afs_int32 CreateEntry(struct ubik_trans *at, char aname[], ...

Fix the prototype to declare the 'aname' parameter as a bounded array as
expected for this function.

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

2 years agoubik: Fix ubeacon_updateUbikNetworkAddress() mismatched array parameter warning 67/14767/3
Michael Meffie [Mon, 23 Aug 2021 18:23:01 +0000]
ubik: Fix ubeacon_updateUbikNetworkAddress() mismatched array parameter warning

The ubeacon_updateUbikNetworkAddress() prototype does not match the
function definition. The ubik_host parameter is declared as an unbounded
array in the prototype but is defined as a bounded array. As of GCC 12,
a warning is issued for the mismatch:

    error: argument 1 of type ‘afs_uint32[256]’ {aka ‘unsigned int[256]’}
           with mismatched bound [-Werror=array-parameter=]
           ubeacon_updateUbikNetworkAddress(
             afs_uint32 ubik_host[UBIK_MAX_INTERFACE_ADDR])

    note: previously declared as ‘afs_uint32[]’ {aka ‘unsigned int[]’}
          extern int ubeacon_updateUbikNetworkAddress(afs_uint32 ubik_host[]);

Restore the ubik_host array length in the function prototype, which was
dropped in commit 9020e6e2f0357b1082705dcaa6626573433969ec (ubik: Defer
updateUbikNetworkAddress until after RX startup).

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

2 years agolibadmin: Fix isAlias may be uninitialized warning 72/14772/6
Michael Meffie [Mon, 23 Aug 2021 19:42:52 +0000]
libadmin: Fix isAlias may be uninitialized warning

The cfgutil_HostNameIsAlias() function has an output parameter called
isAlias, which is used when cfgutil_HostIsAlias() returns non-zero.
However, it possible for isAlias to not be set before returning. GCC 12
issues a warning about the possible use of the uninitialized isAlias
variable:

    cfginternal.c:366:32: error: ‘isAlias’ may be used uninitialized
       [-Werror=maybe-uninitialized]

Initialize the cfgutil_HostNameIsAlias() isAlias output flag to false.
Also, fix the misleading code indentation around the
cfgutil_HostNameIsAlias() call.

Change-Id: I68e66ae5f9019a613187321bb792d0505959ed30
Reviewed-on: https://gerrit.openafs.org/14772
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agovol: Remove unused ihandle macros 61/14761/2
Andrew Deason [Wed, 18 Aug 2021 23:29:09 +0000]
vol: Remove unused ihandle macros

All of these macros are not used anywhere in the tree; get rid of
them. Mostly this is just removing cruft, but removing
FDH_READ/FDH_WRITE/FDH_SEEK also helps make sure we don't accidentally
reintroduce code paths that use non-positional i/o.

No functional change should be incurred by this commit.

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

2 years agoFBSD: Skip page flush in afs_DoPartialWrite 63/14163/6
Andrew Deason [Thu, 2 Jan 2020 02:11:35 +0000]
FBSD: Skip page flush in afs_DoPartialWrite

Currently, the FBSD afs_vop_putpages() will call afs_write(), which
can then go through afs_DoPartialWrite -> afs_StoreAllSegments ->
osi_VM_StoreAllSegments -> vm_object_page_clean, which will then try
to go through afs_vop_putpages() again.

In this call stack, we're only calling afs_StoreAllSegments to reduce
our dirty cache chunks (afs_StoreAllSegments does nothing if we don't
have that many dirty cache chunks); we don't need to reduce dirty
pages, so calling osi_VM_StoreAllSegments is not needed.

To avoid calling osi_VM_StoreAllSegments in this situation, add a new
flag AFS_NOVMSYNC, which skips the osi_VM_StoreAllSegments call and
just flushes the dirty cache chunks. Use this flag in
afs_DoPartialWrite on FBSD, and slightly refactor the ifdefs to reduce
some code duplication.

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

2 years agoclang-13: remove unused variables flagged by clang 75/14775/4
Cheyenne Wills [Fri, 27 Aug 2021 14:20:42 +0000]
clang-13: remove unused variables flagged by clang

Clang-13 changed the default for the unused-but-set-variable resulting
in build warnings/errors with the following type of messages

vsprocs.c:3493:25: error: variable 'tentries' set but not used
    [-Werror,-Wunused-but-set-variable]
       afs_int32 nentries, tentries = 0;

The locations where these local variables are being flagged show that
while the variables are being updated, they are actually never used for
anything (e.g. used as part of an assignment to another variable, passed
as a parameter, used for as returned value, etc.)

Remove the variables being flagged by the clang-13 compiler.

Removal of these variables will not alter the overall functionality of
the code.

Change-Id: I521ea1323837e0d293e6f45eb8c15d5e05765f19
Reviewed-on: https://gerrit.openafs.org/14775
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>

2 years agobozo: Log a warning if the bosserver is not started in restricted mode 62/14762/4
Michael Meffie [Thu, 19 Aug 2021 15:47:04 +0000]
bozo: Log a warning if the bosserver is not started in restricted mode

Log a warning to the BosLog when the bosserver is not started in
restricted mode to encourage admins to enable restricted mode.

Also, log a notice when restricted mode is enabled to reassure admins
restricted mode is enabled on start up.

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

2 years agobozo: Fix problems found by static analysis 76/14676/7
Cheyenne Wills [Tue, 31 Aug 2021 14:48:33 +0000]
bozo: Fix problems found by static analysis

Several static analysis tools have identified various problems:
 - files left open from early exits/returns       (infer)
 - missing checks to ensure *alloc was successful (infer)
 - possible memory leaks                          (scan-build, cppcheck)

To resolve the above problems:
 - close files before exiting/returning
 - add checks to ensure *alloc was successful before using the memory
 - fix possible memory leaks by freeing memory

This commit is a reorganization of commits developed by Pat Riehecky,
who ran the static analysis tools and developed the fixes.

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

2 years agorxdebug: Remove rxdumptrace.c 48/14748/2
Andrew Deason [Sun, 8 Aug 2021 20:13:14 +0000]
rxdebug: Remove rxdumptrace.c

Ever since it was introduced in commit 8bc58a3d
(macos-10-6-support-20090216), rxdumptrace.c appears to have been
unused. While we do build a binary called rxdumptrace, we build it
from src/rx/rx_trace.c, not from rxdumptrace.c (which appears to be a
copy of the relevant portions of rx_trace.c).

Also remove rxdumptrace from src/rx/.gitignore, since the binary is
built in src/rxdebug/, not in src/rx/. While we're here, remove the
other entries in src/rx/.gitignore (rxperf and rxdebug), since those
are also built in different directories.

Change-Id: Ide816979168dcf70358f39db035ce16ef6c1dd17
Reviewed-on: https://gerrit.openafs.org/14748
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

2 years agotests: Remove check/test/tests subdir targets 36/14636/3
Andrew Deason [Mon, 7 Jun 2021 21:44:38 +0000]
tests: Remove check/test/tests subdir targets

Since commit a62de618 (Build util tests properly with make check),
running 'make check' in tests/ also runs 'make check' in each of the
tests subdirectories, which builds the tests in that dir. (And the
same goes for 'make test' and 'make tests'.)

This does ensure that the tests are built before we run them, but it's
a bit strange to build the tests under 'make check', a target that
usually runs tests.

We do this in the top-level tests dir to make sure that the tests are
built, but this purpose is served by the existing 'make all' target.
So to reduce some duplication of logic, and reduce the number of
targets the subdirs need to implement, just have 'make check' depend
on 'make all', so we know the tests are built when we go to run them.

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

2 years agoafs: refactor PNewStatMount and PFlushMount 41/14541/8
Marcio Barbosa [Tue, 17 Aug 2021 19:52:11 +0000]
afs: refactor PNewStatMount and PFlushMount

Both functions use the same logic to find a name in a given directory.
To avoid repetition, move this logic to a separate function called
afs_LookupName().

No functional change is incurred by this commit.

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

2 years agotests: Generalize temp dir management 32/14632/4
Andrew Deason [Thu, 2 Jul 2020 02:18:04 +0000]
tests: Generalize temp dir management

Currently, afstest_BuildTestConfig calls afstest_mkdtemp (our thin
wrapper around mkdtemp) to create its temporary config dir. We may
want to make new tests, though, that create a temp dir for other
purposes. To make that easier, move a little more code into
afstest_mkdtemp, so the caller doesn't need to construct the template.

To allow callers to clean up such temporary dirs, change
afstest_UnlinkTestConfig into a more general function,
afstest_rmdtemp. Allow this new function to remove all files in a dir,
not just files one-level-deep. To avoid needing to write our own
traversal and removal logic, just run 'rm -rf' via a new function,
afstest_systemlp().

Move these temp dir-related functions from config.c into files.c,
since they are no longer specific to config dirs.

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

2 years agotests: Introduce is_command() 40/14040/12
Andrew Deason [Tue, 21 Jan 2020 21:40:12 +0000]
tests: Introduce is_command()

Add a new function (is_command), to help implementing tests that
involve running a command. This works like is_string(), except the
string value we compare against is the output of the provided command,
and we also check the exit code of the command.

Convert the existing execl() call in volser/vos-t to use this new
function.

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

2 years agotests: Introduce afstest_*_path() 19/14319/9
Andrew Deason [Fri, 3 Jul 2020 00:16:40 +0000]
tests: Introduce afstest_*_path()

Currently, several of our tests contain logic to locate files (via
srcdir or objdir), based on the C_TAP_SOURCE/BUILD environment
variables. This logic is duplicated in several places, so consolidate
the code into a couple of new functions: afstest_src_path and
afstest_obj_path. Update all callers to use these new functions.

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

2 years agotests: Introduce afstest_asprintf 20/14620/4
Andrew Deason [Wed, 14 Apr 2021 21:09:37 +0000]
tests: Introduce afstest_asprintf

Add a thin wrapper around asprintf, called afstest_asprintf (and
afstest_vasprintf), which does its own error checking. This just helps
makes tests a little less cluttered when needing to construct strings.

Adapt all asprintf callers in 'tests' to use the wrapper.

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

2 years agotests: Introduce libafstest_common 18/14318/6
Andrew Deason [Thu, 2 Jul 2020 03:42:37 +0000]
tests: Introduce libafstest_common

Currently, a few tests use the code in tests/common/ by linking
individual object files in there in addition to the test code (e.g.
linking ../common/config.o along with superuser-t.o).

This convention makes it very obnoxious to move code around in
tests/common/, since any users need to update their link lines. It
also makes it difficult for code in tests/common/ to make use of
functions in other tests/common/ files.

To fix this, just build all of the objects in tests/common/ into a
convenience library, called libafstest_common, and link the relevant
tests against that. Link a few requisite libraries (roken, rfc3961) in
libafstest_common, so each individual test doesn't need to link
against them.

Also link the TAP library itself in libafstest_common, so tests don't
have to explicitly link against it separately. To do this, convert it
into a libtool library, libafstest_tap.la.

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

2 years agoviced: Fix minor log message mistakes 24/14724/3
Mark Vitale [Mon, 22 Jun 2020 01:44:17 +0000]
viced: Fix minor log message mistakes

Fix a few minor mistakes/typos that have crept up in viced over time:

- In PrintCallBackStats, struct FEs and struct CBs are 64 bytes, not
  16 bytes. Show the actual size of the structs.

- A log message in cb_stateDiskEntryToFE is missing the trailing
  newline.

- In cb_stateVerifyHCBList, a log message mentions the non-existent
  cb_stateVerifyFCBList (instead of cb_stateVerifyHCBList)

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

2 years agorx: compare RX_ACK_TYPE_ACK as a bit-field 65/14465/5
Jeffrey Altman [Fri, 2 Oct 2020 23:51:06 +0000]
rx: compare RX_ACK_TYPE_ACK as a bit-field

The rx_ackPacket.acks array (the SACK table) consists of up to 255
octets.  Each octet stores either the value zero (RX_ACK_TYPE_NACK)
or one (RX_ACK_TYPE_ACK).  Effectively only bit-zero of each octet
is used.

The rx_ackPacket.acks array cannot be enlarged but one possible
method of encoding the ACK/NACK state for packets when the
window size is greater than 255 is to use bits 1-7 of each
octet.

This change alters the test for ACK vs NACK to be a bit comparison
instead of a equality comparison.  This change permits RX to be
compatible with any future use of bits 1-7.

No peer that treats the SACK table as bytes can ever send more
than 255 packets regardless of the advertised receive window.
Therefore, existing peers will never receive a SACK table with
more than 255 packets worth of bits.

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

2 years agoLINUX: defer afs_remunlink when current->fs==NULL 91/14691/6
Yadavendra Yadav [Wed, 7 Jul 2021 16:32:36 +0000]
LINUX: defer afs_remunlink when current->fs==NULL

afs_remunlink is called to delete a file on the fileserver after it
has been silly-renamed (due to being unlinked while the file is open).
Sometimes current->fs is NULL when this happens, typically when the
process is shutting down, after current->fs has been freed and file
handles are getting released. During afs_remunlink, we need to
interact with our cache files, and so we call dentry_open, which calls
security_file_open, which calls into the configured LSM for security
checks. Certain LSMs (e.g. Crowdstrike Falcon) will panic the kernel
in this situation if current->fs is NULL.

There's no way to skip the LSM hooks, or to flag to the LSM that we're
making an in-kernel VFS call, so the only way to avoid these panics is
to do our I/O in another thread. Fortunately, we already have a way to
defer afs_remunlink calls to a background daemon (CUnlinkedDel), since
we already do this in some cases (when someone else is holding
afs_xvcache or afs_xdcache).

So, to avoid the panic in the above scenario, defer calls to
afs_remunlink to a background daemon using CUnlinkedDel when
current->fs is NULL, and we're using a disk cache.

More details on this issue is discussed at following thread:
https://lists.openafs.org/pipermail/openafs-info/2021-March/043073.html

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

2 years agoAIX: Fix undefined symbols 07/14707/3
Andrew Deason [Fri, 16 Jul 2021 00:59:47 +0000]
AIX: Fix undefined symbols

Various pieces of our code try to use symbols in our internal
libraries that are not exported in the respective .sym file. On AIX,
this causes the following build failures:

ld: 0711-317 ERROR: Undefined symbol: .ubik_CallRock
ld: 0711-317 ERROR: Undefined symbol: DISK_function_names
ld: 0711-317 ERROR: Undefined symbol: VOTE_function_names
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[4]: *** [Makefile:45: afscp] Error 8
make[4]: Leaving directory '/.../src/libadmin/test'

ld: 0711-317 ERROR: Undefined symbol: PR_function_names
ld: 0711-317 ERROR: Undefined symbol: KAA_function_names
ld: 0711-317 ERROR: Undefined symbol: KAT_function_names
ld: 0711-317 ERROR: Undefined symbol: KAM_function_names
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[4]: *** [Makefile:117: rxstat_get_peer] Error 8
make[4]: Leaving directory '/.../src/libadmin/samples'

ld: 0711-317 ERROR: Undefined symbol: .osi_audit_cmd_Options
ld: 0711-317 ERROR: Undefined symbol: .osi_audit_open
ld: 0711-317 ERROR: Undefined symbol: .afsconf_SuperIdentity
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:71: butc] Error 8
make[3]: Leaving directory '/.../src/tbutc'

ld: 0711-317 ERROR: Undefined symbol: .pr_Initialize2
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:111: pts] Error 8
make[3]: Leaving directory '/.../src/tptserver'

ld: 0711-317 ERROR: Undefined symbol: .AFSVolListPartitions
ld: 0711-317 ERROR: Undefined symbol: .AFSVolXListPartitions
ld: 0711-317 ERROR: Undefined symbol: .RXAFS_GetStatistics64
ld: 0711-317 ERROR: Undefined symbol: .AFSVolPartitionInfo64
ld: 0711-317 ERROR: Undefined symbol: .AFSVolPartitionInfo
ld: 0711-317 ERROR: Undefined symbol: .RXAFS_GetStatistics
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:65: fsprobe_test] Error 8
make[3]: Leaving directory '/.../src/fsprobe'

ld: 0711-317 ERROR: Undefined symbol: fsprobe_Results
ld: 0711-317 ERROR: Undefined symbol: gtxframe_exitValue
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:45: scout] Error 8
make[3]: Leaving directory '/.../src/scout'

ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_toString
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_freeString
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:50: check_sysid] Error 8
make[3]: Leaving directory '/.../src/viced'

ld: 0711-317 ERROR: Undefined symbol: .GetLogLevel
make[3]: *** [Makefile:130: fileserver] Error 8
make[3]: Leaving directory '/.../src/viced'

ld: 0711-317 ERROR: Undefined symbol: .GetLogDest
ld: 0711-317 ERROR: Undefined symbol: .GetLogFilename
ld: 0711-317 ERROR: Undefined symbol: .CloseLog
make[3]: *** [Makefile:166: salvageserver] Error 8
make[3]: Leaving directory '/.../src/tsalvaged'

ld: 0711-317 ERROR: Undefined symbol: .rxkad_StringToLevel
ld: 0711-317 ERROR: Undefined symbol: .FilepathNormalize
ld: 0711-317 ERROR: Undefined symbol: .ConstructLocalPath
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:32: upserver] Error 8
make[3]: Leaving directory '/.../src/update'

ld: 0711-317 ERROR: Undefined symbol: xstat_fs_Results
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:77: xstat_fs_test] Error 8
make[3]: Leaving directory '/.../src/xstat'

ld: 0711-317 ERROR: Undefined symbol: .afsconf_DeleteKeyBySubType
ld: 0711-317 ERROR: Undefined symbol: .afsconf_DeleteKeyByType
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[3]: *** [Makefile:35: asetkey] Error 8
make[3]: Leaving directory '/.../src/aklog'

ld: 0711-317 ERROR: Undefined symbol: .afsconf_FindService
ld: 0711-317 ERROR: Undefined symbol: .afsconf_AddKey
ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetLatestKeyByTypes
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[4]: *** [Makefile:19: authcon-t] Error 8
make[4]: Leaving directory '/.../tests/auth'

ld: 0711-317 ERROR: Undefined symbol: .afsconf_AddUser
ld: 0711-317 ERROR: Undefined symbol: .afsconf_IsSuperIdentity
ld: 0711-317 ERROR: Undefined symbol: .afsconf_AddIdentity
ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetNthUser
ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetNthIdentity
ld: 0711-317 ERROR: Undefined symbol: .afsconf_DeleteUser
ld: 0711-317 ERROR: Undefined symbol: .afsconf_DeleteIdentity
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[4]: *** [Makefile:25: superuser-t] Error 8
make[4]: Leaving directory '/.../tests/auth'

ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetKeys
ld: 0711-317 ERROR: Undefined symbol: .rx_opaque_new
ld: 0711-317 ERROR: Undefined symbol: .rx_opaque_free
ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetKeyByTypes
ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetKeysByType
ld: 0711-317 ERROR: Undefined symbol: .afsconf_PutTypedKeyList
ld: 0711-317 ERROR: Undefined symbol: .afsconf_GetLatestKeysByType
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[4]: *** [Makefile:31: keys-t] Error 8
make[4]: Leaving directory '/.../tests/auth'

ld: 0711-317 ERROR: Undefined symbol: ._afsconf_Touch
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[1]: *** [Makefile:34: realms-t] Error 8
make[1]: Leaving directory '/.../tests/auth'

ld: 0711-317 ERROR: Undefined symbol: .opr_cache_get
ld: 0711-317 ERROR: Undefined symbol: .opr_cache_put
ld: 0711-317 ERROR: Undefined symbol: .opr_cache_init
ld: 0711-317 ERROR: Undefined symbol: .opr_cache_free
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[1]: *** [Makefile:16: cache-t] Error 8
make[1]: Leaving directory '/.../tests/opr'

ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_isNil
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_equal
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_hash
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_fromString
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_create
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_unpack
ld: 0711-317 ERROR: Undefined symbol: .opr_uuid_pack
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[1]: *** [Makefile:37: uuid-t] Error 8
make[1]: Leaving directory '/.../tests/opr'

ld: 0711-317 ERROR: Undefined symbol: .rxevent_Init
ld: 0711-317 ERROR: Undefined symbol: .rxevent_Post
ld: 0711-317 ERROR: Undefined symbol: .rxevent_Cancel
ld: 0711-317 ERROR: Undefined symbol: .rxevent_RaiseEvents
ld: 0711-317 ERROR: Undefined symbol: .rxevent_Put
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make[1]: *** [Makefile:18: event-t] Error 8
make[1]: Leaving directory '/.../tests/rx'

To fix these, export the relevant symbols from the library's .sym
file.

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

2 years agorxgen: rename list -> rxgen_list 02/14702/3
Andrew Deason [Thu, 15 Jul 2021 23:27:34 +0000]
rxgen: rename list -> rxgen_list

Our 'struct list' collides with a 'struct list' defined in
/usr/include/grp.h on AIX (at least on AIX 7.2). This is a very
generic structure name, so rename it to rxgen_list to avoid issues
like this.

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

2 years agovol: Introduce and use FDH_BLOCKSIZE 62/14662/4
Andrew Deason [Wed, 3 Jun 2020 20:53:48 +0000]
vol: Introduce and use FDH_BLOCKSIZE

A couple of places in src/volser currently have some logic to get the
size and blocksize of a file. The existing logic is nontrivial due to
platform-specific quirks, and ignores afs_fstat errors.

To fix these issue and consolidate the code into one place, introduce
a new function, FDH_BLOCKSIZE, which gets the file size and blksize.
Update the places in src/volser to use the new function.

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

2 years agotsm41: Fix libs for AIX 7.2 03/14703/3
Andrew Deason [Fri, 16 Jul 2021 19:02:07 +0000]
tsm41: Fix libs for AIX 7.2

AIX 7.2 doesn't seem to have libcsys, netinet.exp, sockets.exp, or
statcmd.exp available. To allow for our IMPORTS and LDFLAGS to change
depending on the AIX version, introduce the autoconf vars TSM_IMPORTS
and TSM_LIBS, which do not contain the missing libs on AIX 7.2, so we
can build on AIX 7.2.

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

2 years agoAIX: Add buildsystem support for AIX 7.2 01/14701/2
Andrew Deason [Thu, 15 Jul 2021 22:53:43 +0000]
AIX: Add buildsystem support for AIX 7.2

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

2 years agotests: Avoid WTERMSIG($?) in rx/perf-t 06/14706/2
Andrew Deason [Mon, 19 Jul 2021 18:48:01 +0000]
tests: Avoid WTERMSIG($?) in rx/perf-t

Currently, tests/rx/perf-t calls functions like WIFSIGNALED and
WTERMSIG on $?. However, functions like WTERMSIG expect the native
exit status code (that is, ${^CHILD_ERROR_NATIVE}). The $? var (aka
$CHILD_ERROR), is a synthetic value calculated by perl that stores the
term sig in the lowest 7 bits, and the exit code in the second-lowest
8 bits.

For most modern platforms, these two values tend to be the same. But
on modern AIX (and some other weird platforms, like VMS and BeOS), the
exit status integer is encoded differently. On AIX specifically, the
term sig is in the third-lowest 8 bits, so a process exiting on signal
15 would result in an exit status (${^CHILD_ERROR_NATIVE}) of 0xf000f,
but $? would be just 0xf. Calling WTERMSIG on 0xf000f returns 0xf, but
calling WTERMSIG on 0xf returns 0x0.

All of this means that running rx/perf-t causes the final test to fail
with "Server died with signal 0" (even when the process was killed by
signal 15), which is rather confusing.

To fix this, call WTERMSIG et al with ${^CHILD_ERROR_NATIVE} instead
of $?. Create a local var so we don't need to spell out
${^CHILD_ERROR_NATIVE} so many times.

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

2 years agoopr: Avoid sigwait on SIGWAITING 05/14705/2
Andrew Deason [Mon, 19 Jul 2021 04:05:38 +0000]
opr: Avoid sigwait on SIGWAITING

On AIX, calling sigwait() on a sigset containing SIGWAITING (or
SIGKILL or SIGSTOP), causes sigwait to return with an EINVAL error.
Currently, signalHandler() calls sigwait() with SIGWAITING, because
SIGWAITING is in the sigset returned by softsigSignalSet(). And so,
sigwait() returns EINVAL, and our opr_Verify in signalHandler() fails,
causing a crash.

To avoid this, remove SIGWAITING from the sigset in
softsigSignalSet(). This is AIX-specific, since the SIGWAITING signal
is AIX-specific.

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

2 years agotests: Add missing va_end in cmd/command-t 04/14704/2
Andrew Deason [Mon, 19 Jul 2021 01:55:57 +0000]
tests: Add missing va_end in cmd/command-t

Every va_start call is supposed to be paired with a matching va_end
call, but 'checkList' is missing any call to va_end. This doesn't
currently seem to cause any visible problems, but add the matching
va_end to avoid potential future issues.

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