Commit Graph

13834 Commits

Author SHA1 Message Date
Stephan Wiesand
407c637157 make-release: create SHA256 checksums too
Check for utilities to create both MD5 and SHA256 message digest files.

Search the PATH plus some common directories for the message digest
utilities.

Exit with an error at the end of make-release when one or more message
digest files are not generated.

In addition, omit the path component in the generated files by running
the message digest utilities in the directory containing the files being
checked.

Before:

    $ make dist
    ...
    $ cat packages/openafs-1.9.1-333-g4bf33-doc.tar.gz.md5
    920793bcd7bd9bc8fbff9016ed2cc8bb  packages/openafs-1.9.1-333-g4bf33-doc.tar.gz

After:

    $ make dist
    ...
    $ cat packages/openafs-1.9.1-333-g4bf33-doc.tar.gz.md5
    920793bcd7bd9bc8fbff9016ed2cc8bb  openafs-1.9.1-333-g4bf33-doc.tar.gz

[mmeffie: Add change directories, search PATH, update commit message.]

Change-Id: I0deddc0318846a5000aec9e6b4e189d166b8a539
Reviewed-on: https://gerrit.openafs.org/14566
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-25 12:22:19 -04:00
Andrew Deason
4645618ec1 venus: Remove dedebug
This utility has never been built by default, currently does not build
(because RXAFSCB_GetDE doesn't exist), and generates many warnings.
Remove the dead code.

Change-Id: I4c91eb44b3b3c265f0741b9918601abf338b492a
Reviewed-on: https://gerrit.openafs.org/15738
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-18 16:50:37 -04:00
Cheyenne Wills
9937cce3f3 Linux-6.9: file_lock mbrs moved to file_lock_core
In the Linux 6.9 commit:
 'filelock: split common fields into struct file_lock_core' (a69ce85ec9)
several fields were relocated into a new structure, file_lock_core,
which was added as a member the file_lock structure.  The names where
changed (fl_x to flc_x).

Add a configure test to determine if the new members (flc_type, flc_pid,
and flc_flags) are available as part of the file_lock_core structure.

Add static inline getter/setter routines to handle accessing the
flc_type or flc_pid members in the file_lock_core structure, or the
fl_type, fl_pid members in the file_lock structure as appropriate. Add
static inline function to clear FL_SLEEP in the flc_flag in the
file_lock_core structure or the fl_flag in the file_lock structure as
appropriate.

Minor surrounding white space cleanup.

Change-Id: Idfc66db34bab4d5c764647fefda1b9eebb7af0b0
Reviewed-on: https://gerrit.openafs.org/15708
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-17 23:49:18 -04:00
Andrew Deason
134d6c1966 Remove more SRXAFSCB_GetDE stubs
Commit 444a971edc (afs: Remove SRXAFSCB_GetDE) removed our
SRXAFSCB_GetDE stub from src/afs, but the same thing also exists in
fsprobe and xstat. Remove those, too.

Change-Id: I8cfbe8524f16be645e50274d3690442965bcc9e5
Reviewed-on: https://gerrit.openafs.org/15737
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-17 23:07:06 -04:00
Chas Williams (CONTRACTOR)
4aafe1613d bozo: Introduce bnode_Wait()
Create bnode_Wait(), the other half of bnode_Check().

Change-Id: Ib38419ccae5861b8c2491c9d8d8b740ddf81d274
Reviewed-on: https://gerrit.openafs.org/14081
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Indira Sawant <indira.sawant@ibm.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Kailas Zadbuke <kailashsz@in.ibm.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-11 17:45:24 -04:00
Cheyenne Wills
6ace773fdc tests: rx/perf wait for server init before client
The rx/perf test can occasionally fail due to the rxperf server not
being fully initialized before the client started. This can cause test
errors, even without changes to the rx code.

 C_TAP_VERBOSE=1 make check TESTS="rx/perf"
 ...
 rx/perf

 1..4
 ok 1 - Started rxperf server
 not ok 2 - single threaded client ran successfully
 RPC: threads	30, times	1, write bytes	1048576, read bytes...
 ok 3 - multi threaded client ran succesfully
 ok 4 - Server exited succesfully
 FAILED 2 (exit status 1)

Add a routine that waits for the rx_perf server to become available.
Loop several times trying the connection via the rx_perf client, with
a short delay between retries.  If the connection cannot be established,
fail the test.

Clean up trailing whitespace on a couple of lines.

Note: This failure was observed in an OpenAFS buildbot worker that
included a make tests, and which would occasionally fail when there was
no rx related code changes. The intermittent failure could be duplicated
on a slower virtual test system, but would not fail on a faster system.

Thanks to mmeffie@sinenomine.net for the 'wait_for_server' contribution.

Change-Id: Ie11e0d726ce287c45a677f3bb799388121aafc1e
Reviewed-on: https://gerrit.openafs.org/15676
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2024-04-11 17:45:00 -04:00
Michael Meffie
e6bc50524e rxperf: Add -o option to rxperf client
Add the -o (output) option to the rxperf client specify the output file.

If not specified, the output is written to stdout, as before.

Change-Id: Ibcb375c65a0ff67afea9aba4ba7da7308a273e2d
Reviewed-on: https://gerrit.openafs.org/15731
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-04-11 14:52:22 -04:00
Cheyenne Wills
0f116d265c Linux: osi_gcpags.c remove unreferenced extern sym
Commit 'Cleanup usage of LINUX_VERSION_CODE for older kernels'
(91a576142e) removed the last references to the Linux symbol
'tasklist_lock' in osi_gcpags.c, but did not remove the declaration for
the symbol.

Remove the unused declaration for the tasklist_lock symbol.

Change-Id: I14103397d0cc0f2c15a283c2572bed07090f1a73
Reviewed-on: https://gerrit.openafs.org/15670
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-28 12:53:23 -04:00
Cheyenne Wills
2f260825b9 Linux: Remove weak attribute for key_type_keyring
The reference to the Linux symbol key_type_keyring uses a weak
attribute to assist in determining if the symbol is exported.  This
method was introduced in commit: 'keyring-updated-20080310' (b7fb842b1c)
as a way to detect if the symbol was exported by the Linux kernel.  A
later commit: 'linux-keyring-export-check-20090701' (4ca66112c2)
introduced an autoconf test that eliminated the need for using the weak
attribute, but the commit did not remove the attribute.

On a Debian-12 system on ARM64 the use of the weak attribute in this
case causes an error when loading the kernel module:
  "ERROR: could not insert 'openafs': Exec format error".
The error is due to the Linux module loader not supporting the
relocation entry type in the openafs kernel module for the
key_type_keyring.  Further investigation showed that this problem could
occur with gcc-12 on a ARM64 system (see below for additional
information).

The code in osi_groups.c uses a pointer, __key_type_keyring, to the
key_type_keyring.  When this symbol is exported by the Linux kernel, the
loader would resolve the address and __key_type_keyring would contain
the address.  If the key_type_keyring symbol was not exported,
__key_type_keyring would be set to NULL (due to the weak attribute
associated with key_type_keyring).

Remove the weak attribute for key_type_keyring when the configure
test, introduced in the 4ca66112c2 commit, determines that the symbol
is exported (EXPORTED_KEY_TYPE_KEYRING is defined).  When the symbol
isn't exported (pre Linux 2.6.22), just set the pointer,
__key_type_keyring to NULL.

NOTE:

The load error was reported on the openafs IRC channel by "clarkb"

The problem of loading the openafs kernel module was also observed
on a NixOS system as well, and is described in the NixOS ticket

  https://github.com/NixOS/nixpkgs/issues/284501

A Debian-11 system did not have a problem loading the openafs kernel
module. Investigation of the differences between Debian-11 and Debian-12
showed that the problem is due to a series of fixes in the toolchain
(in particular gcc-12) to address 'Cortex-A53 erratum #843419', which
deals with how the ARM64 ADRP instruction is used. With gcc-12, the
code generated uses a R_AARCH64_ADR_GOT for this particular case (which
isn't supported by the Linux kernel module loader).  Gcc-11 created a
R_AARCH64_ABS64 relocation entry type for the symbol.

Change-Id: I3160175c82b47e244c8cedf5ef79fdb0d0dd0002
Reviewed-on: https://gerrit.openafs.org/15668
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-28 12:51:46 -04:00
Andrew Deason
5cda275890 afs: Add prototypes for roken strlcpy/strlcat
Currently, our kernel module on AIX uses the strlcpy and strlcat from
roken, built into strlcat-kernel.o and strlcpy-kernel.o. However, we
don't declare a prototype for strlcat or strlcpy for roken's version
of these (except on LINUX).

To fix this, declare prototypes for strlcpy and strlcat in our
kernel-only roken.h for all platforms that don't define
HAVE_STRLCAT/HAVE_STRLCPY, and redefine them to rk_* variants to make
sure callers are actually using our prototypes and avoid potential
symbol conflicts. Set HAVE_STRLCAT/HAVE_STRLCPY properly to actually
reflect whether a native strlcat/strlcpy is available, and check
HAVE_STRLCAT/HAVE_STRLCPY to control whether we build our own
implementation of the strlcpy/strlcat functions. Always build
strlcat-kernel.o and strlcpy-kernel.o, instead of needing to specify
them in the platform-specific AFS_OS_OBJS; they'll just be empty if
HAVE_STRLCAT/HAVE_STRLCPY are set.

Add roken.h to afsincludes.h, so most KERNEL files will automatically
include it. Since it's now in the OS-independent afsincludes.h, we don't
need it in LINUX/osi_machdep.h, so remove that inclusion of roken.h
Fix a few files that were not properly including
afsincludes.h/sysincludes.h so all files using strlcpy/strlcat will
get roken.h and see the proper prototypes.

Change-Id: I051dbdf3b688835ffe10d278c96f0fb7451ab298
Reviewed-on: https://gerrit.openafs.org/15651
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-22 23:15:40 -04:00
Mark Vitale
2cecc4335e rx: Add 'getters' for Rx timeout values
Since aa76c8f670 'rx: Make struct rx_connection private', the fields
in struct rx_connection have been non-public.

In preparation for a future commit, implement new 'getter' routines for
the three rx_connection timeout values.  Each one is fashioned after the
pre-existing 'setters':
 - rx_GetConnDeadTime()
 - rx_GetConnIdleDeadTime()
 - rx_GetConnHardDeadTime()

Change-Id: I0c6f5370dc992316a49f7c8bff36ccf859c2c908
Reviewed-on: https://gerrit.openafs.org/15555
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2024-03-15 22:34:08 -04:00
Mark Vitale
6425e78ccb ubik: remove superfluous checks of rx_NewConnection return
Since the original IBM code import, rx_NewConnection allocates a new
rx_connection on each call by invoking rxi_AllocConnection -> rxi_Alloc.
rxi_Alloc will panic if no memory is available; therefore
rxi_AllocConnection and rx_NewConnection can never return NULL.

Remove the superfluous checks of the return from rx_NewConnection.
Add equivalent asserts to guard against future breakage.

While here, reorder operations in ubeacon_ReInitServer so we can
eliminate some temporary variables.

Change-Id: I6d00195277d689d80cc6cd7963d8b0a5e5630229
Reviewed-on: https://gerrit.openafs.org/14607
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2024-03-15 17:46:10 -04:00
Cheyenne Wills
30b18c1657 Linux 6.8: Use roken's strlcpy() in kernel module
The Linux 6.8 commit 'string: Remove strlcpy()' (d26270061a) removed the
the strlcpy function from the Linux kernel.  The replacement function,
strscpy(), cannot be used as a drop-in replacement as its currently a
Linux kernel specific function and there are differences in the returned
value.

We can use roken's strlcpy() (provided in roken/strlcpy.c).

Create a configure test to that defines its own strlcpy() to test
if the kernel doesn't provide one itself. Note, we need to use a
different function signature for strlcpy() from what the kernel might
have otherwise the test build succeeds when the kernel does provide a
strlcpy().

Update the OpenAFS kernel specific roken.h to define the prototype for
strlcpy when it's not present in the Linux kernel.  We need to match the
defines used in the 'real' roken.h so the roken/strlcpy.c can build
properly. Add defines for ROKEN_LIB_FUNCTION, ROKEN_LIB_CALL and
ROKEN_LIB_VARIABLE to the kernel roken.h

Update Linux's osi_machdep.h to include roken.h so the strlcpy protoype
is available.

Update the Linux MakefileProto to include the strcpy-kernel object
when building the kernel module.

Change-Id: I64a5743ba94134538853f51cd6e7a8df19127624
Reviewed-on: https://gerrit.openafs.org/15646
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-12 01:13:18 -04:00
Mark Vitale
15022f84b0 ubik: ensure correct election deadline
Ubik invariants (see src/ubik/ubik.p.h) document that for proper quorum
elections, the VOTE service requires:

      "#SMALLTIME and #BIGTIME must be larger than
       #RPCTIMEOUT+max(#RPCTIMEOUT, #POLLTIME)"

    Solving this for VOTE connection Rx dead timeout yields:

       Rx dead timeout < 30s

However, setting rx dead time only protects the election if a db host
goes down.  If a db server is still alive (responding with acks and
pings) but the VOTE_Beacon reply is delayed for some reason, the entire
election can still take too long and cause a loss of quorum.

Specify a hard dead time in ubeacon_NewVOTEConnection.  This ensures
that all VOTE RPCs for all ubik servers (and thus, all elections) will
end within the hard dead time,

Change-Id: I90d0cd2ec9ecd001d448068960592067e6d8dc77
Reviewed-on: https://gerrit.openafs.org/15553
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>
2024-03-09 16:59:32 -05:00
Mark Vitale
6232a99fb6 ubik: ensure correct election timeout for vlserver
Ubik invariants (see src/ubik/ubik.p.h) document that for proper quorum
elections, the VOTE service requires:

  "#SMALLTIME and #BIGTIME must be larger than
   #RPCTIMEOUT+max(#RPCTIMEOUT, #POLLTIME)"

Solving this for VOTE connection Rx dead timeout yields:

   Rx dead timeout < 30s

The current default rx_connDeadTime is 12s; if this value is in force
when VOTE client connections are created or recreated, ubik elections
will work correctly.

(Apparently, RPCTIMEOUT 20s was once intended to be used for this value,
but this constant has not been referenced by any live code since the
original IBM code import.)

However, since the original IBM code import, vlserver has set
rx_connDeadTime to 50s.  In 1.6.x and older releases, this was only done
after the ubik VOTE and DISK client connections had been established;
therefore the initial VOTE connections had the correct default
rx_connDeadTime of 12s.  However, if a VOTE client connection ever failed
(e.g., due to a down vlserver), it would be reestablished with the 50s
timeout.  Because this violates a ubik invariant, it may lead to random
quorum disturbances if further vlserver outages occur.  This is because
the election results may be delayed for up to 50s until the
multi_VOTE_Beacon to the down vlserver times out.  If the vlserver goes
down just a few seconds before the next election, this delay is just
long enough to cause the syncsite's votes to expire (SMALLTIME 60s),
triggering a temporary loss of quorum even when there are sufficient yes
votes to maintain quorum.

As of commit 3e531db9ce (vlserver: rx_SetRxDeadTime before ubik init)
introduced with OpenAFS 1.8.0, rx_connDeadTime is set to 50s for ALL
vlserver connections, including the initial ubik VOTE and DISK client
connections.  However, as explained above, this violates a ubik
invariant for the VOTE service.  This results in a consistent loss of
quorum every time a vlserver goes down within a few seconds of a new
election, even if there are sufficient votes to maintain quorum.

Create and use a new function ubeacon_NewVOTEConnection to create all
VOTE client connections with an rx dead time VOTE_RPCTIMEOUT which
complies with the ubik invariants.  This allows ubik applications like
vlserver to change rx_connDeadTime without affecting ubik election
timing.

Note: vlserver is the only in-tree ubik server affected by this issue.
Even though buserver (src/budb/server.c) also sets a problematic
rx_connDeadTime of 60s at initialization, this is immediately reset to
12s by a subsequent call to rx_InitHost.  (This buserver anomaly will be
addressed in another commit.) The other ubik servers (ptserver and
kaserver) always use the default 12s time.

Change-Id: I63e2c46b6097c9c2c89e6e858e3958846c6cb190
Reviewed-on: https://gerrit.openafs.org/14608
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-09 16:57:00 -05:00
Mark Vitale
b4a4a2ae9c rx: Define symbolic names for Rx magic numbers
Since the original IBM code import, the magic number '6' has been used
to specify the number of consecutive lost keepalives (ping acks) that
indicate a dead connection.  By implication, this also defines the
minimum number of seconds (at the minimum keeplive periodicity of 1
second) before a connection may be considered dead.

Define and use symbolic names for both uses of '6', and document their
relationship.  Both have the same assigned value '6', but
RX_PINGS_LOST_BEFORE_DEAD is use as an ordinal count, while
RX_MINDEADTIME is expressed in units of seconds.

The magic number '12' is used in a couple of places for the default
value of rx_connDeadTime.  Give this constant a name
(RX_DEFAULT_DEAD_TIME) and use it.

No functional change is incurred by this commit.

Change-Id: I8689062d25b51c557da16e27601297b6856e048a
Reviewed-on: https://gerrit.openafs.org/14621
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-09 16:56:14 -05:00
Cheyenne Wills
35c8c1bf0b Linux 6.8: Remove ctl_table sentinels
The Linux 6.8 commit 'sysctl: Remove the now superfluous sentinel
elements from ctl_table array' (c8a65501d3) was a clean up commit
that removed the sentinel entry in the ctl_table array (e.g. the
"null" entry at the end of the table).

As of Linux 6.8, including the sentinel entry (.procname =) in the
ctl_table is unnecessary, but doesn't yet break anything.  But it is
likely that including the sentinel will start to cause runtime errors in
future Linux versions very soon, so avoid the sentinel when we can, to
avoid possible problems in the future.

Define a new macro that can be used as the last entry of a ctl_table
that will either add a "null" entry, or nothing.

There is not a specific build test we can use within configure, so we
must explicitly test the Linux version to decide if we need to use a
sentinel or not when defining the macro.  We are selecting 6.8 to match
the version where the Linux kernel is removing the sentinels from the in
kernel filesystems.

Note: See the Linux merge commits 'Merge tag 'sysctl-6.8-rc1' of
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux' (a05aea98d4)
for more details behind the staged removal of the sentinels in the
ctl_table structures and the potential future change for removing the
actual check for the sentinel within the Linux kernel.

Change-Id: I0f50872e7d08dc198584623337909a180002ab30
Reviewed-on: https://gerrit.openafs.org/15645
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-06 23:35:06 -05:00
Cheyenne Wills
8e0bbe6a07 Linux 6.8: use hlist iteration for dentry children
Linux 6.8 commit 'dentry: switch the lists of children to hlist'
(da549bdd15) replaces the dentry lists d_subdirs/d_child with the hlist
d_children/d_sib.

Add an autoconf test for a d_children member in the dentry structure.

Define a macro that uses the applicable Linux function for iterating
over a dentry's children.

Change-Id: I6e8fb9a58c0afd9c383c07c294f64df1fc045585
Reviewed-on: https://gerrit.openafs.org/15632
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-06 23:31:04 -05:00
Cheyenne Wills
26bb4d143b rxgen: Declare generated PKG_OpCodeStats()
The function {PKG}_OpCodeStats() is generated by rxgen, however a
prototype for the function is not generated.

The functions h_ProcMainBody_setup() and h_HeadofOldStyleProc_setup()
in rpc_parse.c emit prototypes for {PKG}_ExecuteRequest() and
{PKG}_TranslateOpCode(), but do not emit a prototype for
{PKG}_OpCodeStats().

Update rxgen to emit a function prototype for {PKG}_OpCodeStats() in the
generated header file.

Use a variable to point to "PackagePrefix[PackageIndex]" in
h_ProcMainBody_setup to improve readability.

{PKG}_OpCodeStats(), specifically RXSTATS_OpCodeStats(), is flagged due
to a missing prototype when building against a Linux 6.8 kernel (which
sets the -Wmissing-declarations and -Wmissing-prototypes compiler flags
as default). Linux 6.8 commit:  'Makefile.extrawarn: turn on
missing-prototypes globally' (0fcb70851f). When building against a
kernel with CONFIG_WERROR=y, the build fails.

Change-Id: If660c21c1a7c452d212cc98fefc1bd61138b7c31
Reviewed-on: https://gerrit.openafs.org/15631
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-06 23:30:32 -05:00
Andrew Deason
9b2c27fc6d rxgen: Declare generated PKG_TranslateOpCode()
Ever since commit 5c77a6ca (rxgen: add *TranslateOpcode functions to
XDR code), rxgen generates a PKG_TranslateOpCode function in the
relevant .xdr.c source, which can translate an RPC opcode into the RPC
name. But we never declare this function in a header file, making it
impossible to use without compiler warnings (unless the caller
declares the function itself).

To make it possible to actually use this function, declare this
function in the generated header file.

Change-Id: I013349d28ab1cac8e8aac2ddf6b2cecb64bdcc51
Reviewed-on: https://gerrit.openafs.org/14871
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-01 00:44:17 -05:00
Cheyenne Wills
55adceba2d rx: Add static attribute to internal functions
When building against a Linux 6.8 kernel, functions that are missing
prototypes or declarations are flagged.

We can add the static attribute to functions that are not referenced
outside of the file that implements them to avoid having these functions
flagged by the compiler.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

There are no functional changes in this commit.

Change-Id: I663f0483f4b1f91ead86523de66b051053a41296
Reviewed-on: https://gerrit.openafs.org/15626
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-01 00:44:08 -05:00
Cheyenne Wills
efee796f28 afs: Add static attribute to internal functions
When building against a Linux 6.8 kernel, functions that are missing
prototypes or declarations are flagged.

We can add the static attribute to functions that are not referenced
outside of the file that implements them to avoid having these functions
flagged by the compiler.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

There are no functional changes in this commit.

Change-Id: I24c78a3167f6a81da4f62267cf901024468ae6b3
Reviewed-on: https://gerrit.openafs.org/15625
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-03-01 00:37:36 -05:00
Cheyenne Wills
36e4c02ff2 afs: fix 'ops' variable may be used uninitialized
When the function rxfs_storeInit() has the static attribute, gcc flags
the variable 'ops' as possibly uninitialized.

In function 'afs_CacheStoreDCaches',
    inlined from 'afs_CacheStoreVCache' at
     .../src/afs/afs_fetchstore.c:630:14:
     .../afs/afs_fetchstore.c:535:17: error: 'ops' may be used
     uninitialized [-Werror=maybe-uninitialized]
      535 |         code = (*ops->destroy)(&rock, code);
          |                ~^~~~~~~~~~~~~~
     ...src/afs/afs_fetchstore.c: In function 'afs_CacheStoreVCache':
     ...src/afs/afs_fetchstore.c:567:22: note: 'ops' was declared here
      567 |     struct storeOps *ops;
          |                      ^~~
     cc1: all warnings being treated as errors

This is a false positive report by the gcc compiler.

The function rxfs_storeInit() returns a 0 only when it has successfully
assigned a value to the ops variable, and afs_CacheStoreDcaches() is
only called if the return value from rxfs_storeInit() is 0.

The ops variable is only used within a block that is within a for loop,
which could leave a stray value if the variable isn't initialized within
that loop.

Assigning a NULL to ops is sufficient to avoid the compiler error, and
relocating the declaration of the ops variable into the block where it
is actually used ensures that it's always initialized before its use
within the loop.

Clean up whitespace in the statement that follows the new location for
the ops variable.

Note, this commit is being added before a commit that adds the static
attribute to the rxfs_storeInit() function which also "fixes" the
compiler error (see: afs: Add static attribute to internal functions).

Change-Id: Id2c3e68720f92ea05818419567ffe90ce0b5061a
Reviewed-on: https://gerrit.openafs.org/15630
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:55:51 -05:00
Cheyenne Wills
8528c36b96 rx: Add function prototypes to rx_prototypes.h
The prototype for rxk_NewSocketHost() is not in a header file, but is
defined in the referencing .c file. The ARCH/rx_knet.c files that
implement rxk_NewSocketHost() do not have a prototype (but when the
rx_kcommon.c implementation is used it does have a prototype, since
rx_kcommon.c is the "referencing .c file").

Add the prototype for rxk_NewSocketHost() to rx_prototypes.h and
remove the prototype from rx_kcommon.c

The prototypes for the functions rx_DebugOnOff() and rx_StatsOnOff()
are defined within rx_prototypes.h, but are within a preprocessor
conditional for AFS_NT40_ENV, however the implementation for these
2 functions do not have the preprocessor conditional.

Rearrange the prototypes for rx_DebugOnOff() and rx_StatsOnOff() so they
are outside the AFS_NT40_ENV preprocessor conditional.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

There are no functional changes in this commit.

Change-Id: I9bf48c5971b022e40575aeb50692c1fa14c286a2
Reviewed-on: https://gerrit.openafs.org/15624
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:54:09 -05:00
Cheyenne Wills
fae4003b40 afs: Remove SRXAFSCB* protos from afs_prototypes.h
The prototypes for the afscbint RPC functions (SRXAFSCB_*) implemented
in afs_callback.c are defined in 2 locations, afs_protypes.h and
afscbint.h (which is generated by rxgen).

Remove the protoypes for the SRXAFSCB_* functions from afs_prototypes.h
as they are redundant and are currently out of sync (the prototypes
for SRXAFSCB_GetCellByNum() and SRXAFSCB_TellMeAboutYourself() are
not present in afs_prototypes.h).  Also remove a redundant prototype for
afs_RXCallBackServer() which was prototyped both before and in the
middle of the SRXAFSCB* prototypes.

Since afs_callback.c only pulled in afs_prototypes.h and not afscbint.h,
add an include for afscbint.h to ensure that the all the prototypes for
the SRXAFSCB_* functions are present.

The 2 functions listed above are flagged due to missing prototypes when
building against a Linux 6.8 kernel (which sets the
-Wmissing-declarations and -Wmissing-prototypes compiler flags as
default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Change-Id: Ieb43314cbeef444d44a3af74b4dca7a7986b54ba
Reviewed-on: https://gerrit.openafs.org/15644
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:38:56 -05:00
Cheyenne Wills
575d986aa6 afs: Add afs_xioctl prototyes to afs_prototypes.h
Several .c files have external function prototypes for the afs_xioctl
function, while the implementing files do not have the prototype.

Move these prototypes into afs_prototypes.h so that the prototypes are
available to both the caller and the implementation.

Because the file holding the implementation does not have a prototypes,
afs_xioctl() is being flagged when building against a Linux 6.8 kernel
(which sets the -Wmissing-declarations and -Wmissing-prototypes compiler
flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a Linux kernel with CONFIG_WERROR=y, the build
fails.

Note that the function afs_xioctl() has platform specific
implementations.

Change-Id: I0956daace8c9036a924b928e387eb4a2ea542bf1
Reviewed-on: https://gerrit.openafs.org/15643
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-29 12:31:26 -05:00
Mark Vitale
f7591ee2f9 packaging: Remove '--with bos-restricted' option from RedHat spec file
Commit f085951d39 'Turn on bos restricted code' removed configure
option '--enable-bos-restricted-mode'.  However, the references to
restricted mode in the in-tree RedHat packaging were overlooked.

Remove the '--with bos-restricted' option from the spec file to prevent
specifying the obsolete OpenAFS configure option
'--enable-bos-restricted-mode'.

Change-Id: I9a29dd0ea1f3a1ac4145865777d1d3b751e93195
Reviewed-on: https://gerrit.openafs.org/15667
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-02-27 16:45:44 -05:00
Mark Vitale
2a099859ba cf: Remove obsolete comment "Fast restart"
Commit 8ab7a90937 'pts-supergroups-20030114' inserted new configure
option --enable-supergroups into acinclude.m4.  This unintentionally
separated the comment "# Fast restart" from its corresponding
--enable-fast-restart option.

Commit e61800b992 'Remove --enable-fast-restart configure option'
overlooked the associated comment "# Fast restart" due to the separation
introduced by the previous commit.

Commit c72622a244 'autoconf: refactor acinclude.m4' moved this vestigial
comment to its current resting place in src/cf/options.m4

Remove the vestigial comment.

No functional change is incurred by this commit.

Change-Id: I2f83e12bbbcb2d9929575f298b3d3a260b68a9ca
Reviewed-on: https://gerrit.openafs.org/15666
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-02-27 16:44:25 -05:00
Cheyenne Wills
85781d7e83 afs: Move function prototypes into headers
Several .c files contain external function prototypes, while the
implementing files do not have these prototypes.

Move these prototypes into header files so that the prototypes are
available to both the caller and the implementation.

Because the file holding the implementation does not have prototypes,
these functions are flagged when building against a Linux 6.8 kernel
(which sets the -Wmissing-declarations and -Wmissing-prototypes compiler
flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Add the prototypes for the following to afs_prototypes.h:
  exporter_add
  afs_syscall (AFS_LINUX_ENV)
  BlobScan

Remove the prototypes from the .c files where they are referenced.

Change-Id: Ifc75cafe0132bb4cb8714062253f08874be7c06d
Reviewed-on: https://gerrit.openafs.org/15642
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-22 12:49:51 -05:00
Cheyenne Wills
3683f15278 afs: Add includes to pick up function prototypes
The functions defined in LINUX/osi_crypto.c, osi_pagecopy.c,
osi_probe.c, and osi_syscall.c have function prototypes defined in
existing header files, however either due to missing includes or
preprocessor conditionals that skip the includes, these function
prototypes are not being pulled in.

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Add the necessary includes to osi_crypto.c and osi_pagecopy.c and
re-arrange the includes in osi_probe.c and osi_syscall.c to ensure that
the function prototypes are present when building the Linux kernel
module.

Change-Id: Idcb409b1c25354b1b8b3bff286000a189651bbf6
Reviewed-on: https://gerrit.openafs.org/15641
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-20 01:02:31 -05:00
Cheyenne Wills
ccc2af4297 afs: Declare init_hckernel_mutex()
The function init_hckernel_mutex() (in rand.c) is flagged due to a
missing prototype when building against a Linux 6.8 kernel (which sets
the -Wmissing-declarations and -Wmissing-prototypes compiler flags as
default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Add a function prototype for init_hckernel_mutex() to afs_osi.h and
remove the prototype from afs_osi.c

There are no functional changes with this commit.

Change-Id: Iaecfc3fa4d341ed784a28f4d9d0665a13fef7995
Reviewed-on: https://gerrit.openafs.org/15622
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-19 23:34:33 -05:00
Cheyenne Wills
612927dd1d Linux 6.8: Add function prototypes for krb5
The external files for heimdal/krb5 do not provide function prototypes
in a header file that is used when building files that we use from
heimdal/krb5 (e.g. crypto.c).

These functions are flagged due to missing prototypes when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

We cannot modify the external source files, however there is the local
OpenAFS include file, krb5_locl.h, that does contain OpenAFS specific
changes.

Add declarations to krb5_locl.h for the functions defined in the
heimdal/krb5 source.

There are no functional changes with this commit.

Change-Id: Ib935e5ae9747ef94528c47e2dbed26db94626bbf
Reviewed-on: https://gerrit.openafs.org/15621
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-19 00:03:02 -05:00
Andrew Deason
be236069e9 roken: Declare ct_memcmp in hcrypto kernel roken.h
Currently, we build roken's ct.c for our kernel module to provide
ct_memcmp(). We declare a prototype for ct_memcmp() in krb5_locl.h,
and all of our kernel callers of ct_memcmp() include krb5_locl.h, so
all callers get a prototype and avoid "implicit declaration" compiler
warnings.

However, roken's ct.c itself does not include krb5_locl.h, so it
doesn't get a prototype for ct_memcmp(). This is dangerous, since if
the prototype ever slightly differs from the implementation for any
reason, it could cause a variety of issues.

This also causes warnings when building against a Linux 6.8 kernel
(which sets the -Wmissing-declarations and -Wmissing-prototypes
compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

We cannot change ct.c, since it is an external source file. To fix
this, instead move the prototype of ct_memcmp() to our stub
kernel-only roken.h header, which is included by ct.c. Make
krb5_locl.h also include roken.h when building kernel code, so all of
the ct_memcmp() callers also get the prototype.

While we're here, add some informative comments and an include guard
to our previously-blank roken.h stub.

Written in collaboration with cwills@sinenomine.net.

Change-Id: I7feff707837c9bd111c4a46991bab3bea26ba656
Reviewed-on: https://gerrit.openafs.org/15620
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-18 22:46:09 -05:00
Cheyenne Wills
1d6cfbc5f6 afs: Add declaration for RXAFS_ResidencyCmd()
The function RXAFS_ResidencyCmd() is 'manually' defined within the
afsint.xg, so a prototype for the function is not defined.

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Add a prototype for RXAFS_ResidencyCmd

There are no functional changes with this commit

The function RXAFS_ResidencyCmd() was introduced with commit:
'rename-residency-from-mrafs-to-osd-20090427' (8655541d1e)

Change-Id: I7557d1c819de05d00898aadf073cb6e4bc397d26
Reviewed-on: https://gerrit.openafs.org/15619
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-18 15:52:27 -05:00
Cheyenne Wills
32bb900477 afs: Remove afs_DbgDisconFiles()
The function afs_DbgDisconFiles() is not referenced anywhere within the
source tree.

Remove the function afs_DbgDisconFiles().

The commit: 'disconnected-rw-20080922' (433afd4779) introduced
afs_DbgDisconFiles(), but the function was never used.

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Change-Id: Ib28eb6a167c6add2639f5db0dee8709465b02909
Reviewed-on: https://gerrit.openafs.org/15640
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-16 00:36:22 -05:00
Cheyenne Wills
379f7fc51d afs: Remove SRXAFSCB_FetchData/StoreData
Commit 'client-64bit-file-size-support-20011031' (971b18bc42) introduced
the RPC functions SRXAFSCB_FetchData() and SRXAFSCB_StoreData with RPC
numbers of 65536 and 65537 respectively.

Commit 'more-64bit-file-size-support-20011031' (c5b1a3775f) removed the
references from afscbint.xg, but did not remove the actual code. The
65536 RPC number was reassigned to SRXAFSCB_GetCE64, and the commit:
'This is mostly a rewrite of src/afs/afs_cell.c, and associated changes'
(629d08065) assigned the 65537 RPC to SRXAFSCB_GetCellByNum.

Remove the 2 functions since there are no references other than the
prototype in afs_prototypes.h.

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

Change-Id: I07eff531fc0b17f750eb69e7ac197ff4cebcd5d5
Reviewed-on: https://gerrit.openafs.org/15639
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-16 00:34:19 -05:00
Cheyenne Wills
05ca98687d afs: Remove dummy_PSetAcl()
The function dummy_PSetAcl() is not referenced anywhere within the
source tree.

Remove the function dummy_PSetAcl().

The commit: 'doxygen-comments-20081010' (4b72f8765c)
introduced the function, but dummy_PSetAcl() has never been referenced
or defined within a header file.

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Change-Id: Icba0b52335aa5b5983858a8a1964a092e016ccea
Reviewed-on: https://gerrit.openafs.org/15618
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-12 00:35:02 -05:00
Cheyenne Wills
587cfce29c afs: Remove afs_osi_UnmaskUserLoop()
The function afs_osi_UnmaskUserLoop() is not referenced anywhere within
the source tree.

Remove the function afs_osi_UnmaskUserLoop().

The commit: 'darwin-afsdb-handler-signal-mask-20040728' (9728182c00)
introduced the function, but afs_osi_UnmaskUserLoop() has never been
referenced or defined within a header file.

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Change-Id: Ie6a4c9293d612baea1df90bf12a75391d7824603
Reviewed-on: https://gerrit.openafs.org/15617
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-12 00:33:16 -05:00
Cheyenne Wills
eab2a4ae75 afs: Remove afs_MemExtendEntry()
The function afs_MemExtendEntry() is not referenced anywhere within
the source tree.

Remove the function afs_MemExtendEntry().

The commit: 'memcache: add extend-entry function' (f821c7e5c8)
introduced the function, but afs_MemExtendEntry() has never been
referenced or defined within a header file.

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Note, afsMemExtendedEntry() was a wrapper for the function
_afs_MemExtendedEntry(), which is still used.

Change-Id: Id4911a91af6d95eec037d83fff500546be85aa7f
Reviewed-on: https://gerrit.openafs.org/15616
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-12 00:32:25 -05:00
Cheyenne Wills
432ac5810e afs: Remove DFlushDCache()
The function DFlushDcache() is not referenced anywhere within the
source tree.

Remove the function DFlushDCache().

The commit: 'disconnected-shadow-directory-fixes-20090121' (4045f3d535)
removed the code reference to DFlushDCache() and the commit:
"dir: Prototype and function name cleanup" (5ad1e6cb90) removed the
function prototype.  The function was introduced in the commit:
"disconnected-flush-before-shadowing-20090119" (e1cc987ea5).

This function is flagged due to a missing prototype when building
against a Linux 6.8 kernel (which sets the -Wmissing-declarations and
-Wmissing-prototypes compiler flags as default). Linux 6.8 commit:
 "Makefile.extrawarn: turn on missing-prototypes globally" (0fcb70851f).

When building against a kernel with CONFIG_WERROR=y, the build fails.

Change-Id: I2e8e7588c13459fe5695c68bdc031d246258e6fa
Reviewed-on: https://gerrit.openafs.org/15615
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-12 00:29:50 -05:00
Cheyenne Wills
1440843b80 cf: Add function prototypes for linux conftest
The Linux 6.8 commit:
  'Makefile.extrawarn: turn on missing-prototypes globally' (0fcb70851f)

added the compiler flags -Wmissing-declarations and -Wmissing-prototypes
as defaults for all kernel modules builds.  This change causes configure
to fail for various Linux kernel tests.

Update the template used to create the conftest.c file to provide a
function declaration for conftest().

Use a 'static' attribute when defining functions used within tests.

Note: 2 configure tests (LINUX_INIT_WORK_AS_DATA and
LINUX_IOP_CREATE_TAKES_MODE_T) defined nested functions.  Relocate the
nested functions to outside the body of conftest() to avoid compiler
errors due to nested function definitions.

Change-Id: I8e7c375dda82f055556ef5cef50fba2ee5d16819
Reviewed-on: https://gerrit.openafs.org/15614
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2024-02-12 00:27:29 -05:00
Indira Sawant
e4fda3481d util: Clear owner when unlocking recursive mutex
A race condition where the pthread_recursive_mutex_t::owner that is maintained
by AFS doesn’t match with the thread that is trying to unlock.

This leads to AFS file server and ptserver crash due to assertion failure
where it was trying to unlock the grmutex.

We saw the race more often when our customer migrated their machines from
Power8 to Power9 systems and increased the SMT value from 2 to 4.

fileserver        Assertion failed! file keys.c, line 911.
ptserver          Assertion failed! file userok.c, line 78.

File: keys.c

 889 int
 890 afsconf_GetKeyByTypes(struct afsconf_dir *dir, afsconf_keyType type,
 891                       int kvno, int subType,struct afsconf_typedKey **key)
 892 {
 893     int code = 0;
 894     struct subTypeList *subTypeEntry;
 895
 896     LOCK_GLOBAL_MUTEX;
 897
…
 910 out:
 911     UNLOCK_GLOBAL_MUTEX;   <<<<
 912     return code;
 913 }

Consider a following situation,
cpu0 , cpu1 and T0, T1 and T2 are the cpus and timestamps respectively,

T0: thread1 locks grmutex performs some operations and unlocks the same,
thus has itself set as pthread_recursive_mutex_t::owner. Since presently we do
not reset it, thus, pthread_recursive_mutex_t::owner = thread0.
T1: thread0 starts on cpu0.
T2: thread1 starts on cpu1.
T3: thread0 tries to lock AFS grmutex and acquires corresponding pthread_mutex,
now before thread0 updates pthread_recursive_mutex_t::owner, a context switch
happens.
T3: thread1 on cpu1 tries to acquire grmutex and sees itself as the
pthread_recursive_mutex_t::owner, possibly as it was not reset and updated yet.
So thread1 thinks itself as the owner and proceeds.
T4: thread0 updates the pthread_recursive_mutex_t::owner this time it is also
synced across the cpu caches.
T5: thread1 tries to unlock the grmutex and crashes because now it’s not the
owner of the mutex.

Debugging:

We implemented a circular log to store certain values related to grmutex which
helped in debugging us this further.

({  \
   time_t t; \
   time(&t); \
   LOG_EVENT("%s: Unlocking TID %u: %s:%d owner %lu " \
	     "locked %d  pthread_self %u times_inside %d\n", \
              ctime(&t), (unsigned)grmutex.mut.__data.__owner,\
	      __func__    , __LINE__, \
              grmutex.owner, grmutex.locked, (unsigned)pthread_self(), \
 	      grmutex.times_inside); \
   opr_Verify(pthread_recursive_mutex_unlock(&grmutex)==0); \
})

$614 =   "Mon Sep 11 19:35:34 2023\n: Locking TID 136896:
afsconf_GetKeyByTypes:896 owner 140735030161776 locked 1
pthread_self 2305880432 times_inside 1\n\000 2\n",

$615 =   "Mon Sep 11 19:35:34 2023\n: Unlocking TID 136896:
afsconf_IsLocalRealmMatch:602 owner 140735030161776 locked 1
pthread_self 1836773744 times_inside 2\n",

$617 =   "Mon Sep 11 19:35:34 2023\n: Unlocking TID 136896:
afsconf_GetKeyByTypes:911 owner 140735030161776 locked 1
pthread_self 2305880432 times_inside 1\n\000\061\n",

Solution:

This problem was resolved after resetting thread_recursive_mutex_t::owner in
global mutex unlock function.

Thanks to Todd DeSantis for helping with debugging, review and verification of
this problem.

Change-Id: Ibe01518094388080a143e31c70ab7ce0ddfca702
Signed-off-by: Indira Sawant <indira.sawant@ibm.com>
Reviewed-on: https://gerrit.openafs.org/15604
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2023-12-28 18:05:40 -05:00
Benjamin Kaduk
d6880c7763 build: clean up some more generated files
Commit c1d39153da added a cc-wrapper
script to help generate CTF data for all objects, which is generated
by configure.  Remove it in the distclean target so we don't leave
a stray file hanging around.

Commit 48ce41a447 added a pkgbuild.sh
script, to be used to build packages for newer versions of macOS,
supplementing the buildpkg.sh that was previously used.  Clean it
up in distclean as well (buildpkg.sh was already listed).

Also clean up AFS_component_version_number.c in
libuafs/Makefile.common.in.

These issues were detected while resolving
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1048470 .

Change-Id: I0fea00924a998ee316d48cf76103ea9871a34c6b
Reviewed-on: https://gerrit.openafs.org/15605
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2023-12-23 14:59:17 -05:00
Michael Meffie
26fdb47dba CellServDB update 31 October 2023
Update all three copies in the tree, and the rpm specfile.

Change-Id: I1685af8c6bfb27c189f8fecb6bc152cf19bf2c26
Reviewed-on: https://gerrit.openafs.org/15601
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2023-12-14 12:13:18 -05:00
Ganesh Chaudhari
f379e1b255 macos: Add support for MacOS 14.X (Sonoma)
This commit introduces the new set of changes/ files required
to successfully build and package the OpenAFS source code on
MacOS 14.X "Sonoma".

Change-Id: I1e62746b0a131854eeaef31d1457885d43d0b67a
Signed-off-by: GANESH CHAUDHARI <gangovind@in.ibm.com>
Reviewed-on: https://gerrit.openafs.org/15591
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2023-11-16 13:01:44 -05:00
Cheyenne Wills
8962767a7e Linux 6.7: convert to inode a/mtime accessor funcs
The Linux 6.7 commit "fs: new accessor methods for atime and mtime"
(077c212f03) is a follow up to the Linux 6.6 commit "fs: add ctime
accessors infrastructure" (9b6304c1d5)

With the above 6.7 commit, the inode's i_atime and i_mtime are renamed
to __i_atime and __i_mtime and accessing these members should use the
new accessor functions.

This commit is similar to the OpenAFS commit "Linux 6.6: convert to
ctime accessor functions" (072c7934cd)

Add autoconf tests to detect when we need to use the new accessors and
introduce new wrapper functions to get and set an inode's atime and
mtime.

Note, unlike the (072c7934cd) commit, we need to add support for
reading an inode's atime and mtime, so this commit has the getters for
the atime and mtime members.

Change-Id: Ide818c946ed98a1401ef59864c2cdb4eccee9c99
Reviewed-on: https://gerrit.openafs.org/15597
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2023-11-16 12:20:18 -05:00
Mark Vitale
e2ec16cf94 dir: Introduce struct DirEntryFlex
The directory package as implemented in AFS-2 allocates space for each
directory entry as a DirEntry struct followed by 0-8 contiguous
DirXEntry structs, as needed. This is implemented by:

 - afs_dir_NameBlobs    calculates the number of blocks needed
 - FindBlobs		allocates and returns index of entry
 - afs_dir_GetBlob	returns pointer to 1st DirEntry struct

After this, we populate DirEntry (and any contiguous DirXEntry blocks)
with open code.  Most existing code writes the entry's name via a string
copy operation to DirEntry->name, which is only 16 bytes long.
Therefore, for dir entry names that are 16 bytes or longer, OpenAFS
routinely does string copies that look like buffer overruns.  This has
not previously caused problems because the OpenAFS code has arranged for
a sufficiently large amount of contiguous memory to be available.
However, this remains undefined behavior in the C abstract virtual
machine; thus compilers are not required to produce safe operation.

Recent changes in the OpenAFS build chain have made this approach no
longer viable:

1) Linux 6.5 commit df8fc4e934c12b 'kbuild: Enable
-fstrict-flex-arrays=3' modified the hardening of several kernel
string operations when running with CONFIG_FORTIFY_SOURCE=y.

2) gcc 13 commit 79a89108dd352cd9288f5de35481b1280c7588a5
'__builtin_dynamic_object_size: Recognize builtin' provides some
enhancements to _builtin_object_size.  The Linux commit above will now
use these when the kernel is built with gcc 13.

When OpenAFS is built under Linux 6.5 or higher and gcc 13 or higher,
the hardened strlcpy will BUG for directory entry names longer than 16
characters.

Since there are multiple places where OpenAFS writes directory names,
there are several symptoms that may manifest.  However, the first one is
usually a kernel BUG at cache manager initialization if running with
afsd -dynroot _and_ there are any cell names 15 characters or longer in
the client CellServDB.  (A 15-character cellname reaches the 16
character limit when -dyrnoot adds the RW mountpoint ".<cellname>".)

Address this by using flexible arrays (standardized with C99). A
flexible array is a variable-length array that is declared with no size
at all, e.g., name[].

Create an autoconf test to determine whether the compiler supports
flexible arrays.

Create a new struct DirEntryFlex.  If the compiler supports
flexible arrays, define name[]; otherwise retain the name[16]
definition.

Whenever we write a directory name, use DirEntryFlex so that any
hardening will be satisfied that there is sufficient space for the name.

However, the actual guarantee that this is true is still provided by the
OpenAFS directory routines mentioned above - all of these remain
unchanged.

The DirEntry struct remains unchanged for continued use in OpenAFS, as
well as for any out-of-tree users of the directory package.

Change-Id: I6da5c6c295f051be90017084e5b3a3ef24d1271f
Reviewed-on: https://gerrit.openafs.org/15573
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2023-11-09 12:24:58 -05:00
Mark Vitale
319c1ca87a dir: Allow 256-byte directory entry names in salvager
Since the original IBM code import, the DirOK test for directory entry
names has been off-by-1; it says that directory names of length MAXENAME
256 are "too-long".

Modify DirOK to properly validate directory entry names during salvage.
While here, remove MAXENAME in favor of AFSNAMEMAX.

Change-Id: I76b57899b225934ae60684d704eeb26223e5b8f3
Reviewed-on: https://gerrit.openafs.org/15574
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
2023-11-09 12:24:51 -05:00
Cheyenne Wills
a2f77c5307 Linux: Fix to use time_t instead of time64_t
In commit 'Linux 6.6: convert to ctime accessor functions' (072c7934cd)
the functiom afs_inode_set_ctime was defined to use time64_t when it
should have used a time_t as the data type for the sec parameter.
See the commit 'LINUX 5.6: define time_t and use timespec/timespec64'
(78049987aa).

The time64_t data type was introduced in Linux 3.17.  A build failure
will occur when building on kernels prior to Linux 3.17.

Change-Id: I9b3ce32f8885cde969583cfc74294cdabc54e698
Reviewed-on: https://gerrit.openafs.org/15595
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2023-11-02 12:35:31 -04:00
Cheyenne Wills
4fed232b80 Linux 6.6: Pass request_mask to generic_fillattr
The Linux 6.6 commit: "fs: pass the request_mask to generic_fillattr"
(0d72b92883) added an additional parameter to Linux's
generic_fillattr() function.

For openafs, generic_fillattr() is called from the inode_operations
method "getattr", which is implemented in afs_linux_getattr(). The value
for the request_mask parameter is an existing parameter that is passed
to the inode_operations "getattr" method.

Add an autoconf test for 4 parameters to the generic_fillattr function
and update afs_linux_getattr() to pass the request_mask to
generic_fillattr().

Change-Id: Ie1e6b15bd85931debe0fd446760674ddd0492578
Reviewed-on: https://gerrit.openafs.org/15561
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Kailas Zadbuke <kailashsz@in.ibm.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2023-10-05 12:30:15 -04:00