Debian Patches

Status for openafs/1.8.10-2.1

Patch Description Author Forwarded Bugs Origin Last update
0003-Catch-up-to-roken-s-rename-of-base64-symbols.patch Catch up to roken's rename of base64 symbols
Upstream roken (i.e., heimdal) renamed their base64 encode/decode
routines to have a rk_ prefix in 2014, but upstream OpenAFS hasn't
pulled in an update to their bundled heimdal files since then.
So, upstream is still using the old name, whereas we are trying
to link against a more modern libroken, and must use the new names.
Benjamin Kaduk <kaduk@mit.edu> no 2016-12-11
0005-tests-skip-vos-tests-when-a-vlserver-is-already-runn.patch tests: skip vos tests when a vlserver is already running
The vos tests start a temporary vlserver process, which is problematic
when the local system already has an installed vlserver. Attempt to
temporarily bind a socket to the vlserver port, and if unable to bind
with an EADDRINUSE error, assume the vlserver is already running and
skip these tests.

(cherry picked from commit bf1b3e2fc12a7502cfd74eb109eeb7131f7230d3)
Michael Meffie <mmeffie@sinenomine.net> no 2020-01-10
0007-Temporarily-disable-flaky-test.patch Temporarily disable flaky test
The volser test consistently fails on the armhf buildd but succeeds
on the porterbox. The nature of the test in question suggests that
the issue in the test triggers only on a machine with a specific
network configuration using specific addresses in 10.0.0.0/8, which
should help track down the issue causing the test to fail on the buildd.
Benjamin Kaduk <kaduk@mit.edu> no 2020-03-24
0004-Disable-rx-perf-test.patch Disable rx/perf test
It hardcodes a port number on which to run the testing service,
which may conflict with some buildd services and result in failing
autotests.
Benjamin Kaduk <kaduk@mit.edu> no 2022-03-12
0005-gcc-Avoid-false-positive-use-after-free-in-crypto.patch gcc: Avoid false positive use-after-free in crypto
Due to a bug in gcc-12 and gcc-13, several warnings are generated for a
use-after-free in crypto.c, which leads to a build failure with
--enable-checking:

src/external/heimdal/krb5/crypto.c:1157:9: error: pointer ‘p’ may be
used after ‘realloc’ [-Werror=use-after-free]
1157 | free(p);
| ^~~~~~~
src/external/heimdal/krb5/crypto.c:1155:20: note: call to ‘realloc’
here
1155 | result->data = realloc(p, sz);
| ^~~~~~~~~~~~~~

However, reviewing the code around these warnings shows that the
use-after-free warnings are incorrectly generated (false positive). The
documentation for realloc states that realloc will return a NULL and not
alter the storage passed if there was an error allocating and the size
passed is non-zero.

There is a possible work-around for the false positive. One can use a
variable that is not a member of a structure to hold and test the value
returned from realloc, then update the structure member from that
variable.

However, the code that is producing the message is in a heimdal external
file, so we cannot modify the source. So just use the compiler flag
-Wno-use-after-free to avoid the warning/error.

Update configure to add tests for the -Wno-use-after-free flag, update
the Makefile to add the flag for CFLAGS.crypto.lo, and update CODING
for the new exception.

Because this is an important check, only disable the warning if the
compiler exhibits this specific bug. We do this by adding specific
configure tests for the compiler bug and conditionally set a CFLAG
variable if the bug is present.

following code using gcc-12 (with -O0) or gcc-13 (not sensitive to the
optimization level):

somestruct->somepointer = realloc(ptr, somesize);
if (somestruct->somepointer == NULL && somesize != 0) {
free(ptr); << gets flagged as use-after-free
handle enomem...
}

However the following doesn't get flagged:

char *tmpptr = realloc(ptr, somesize);
if (tmpptr == NULL && somesize != 0) {
free(ptr);
handle enomem...
}
somestruct->somepointer = tmpptr;

The GCC ticket https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110501
has been marked as confirmed.

(cherry picked from commit f2003ed68c2fecf679d0b04146427258d39369ea)

(cherry picked from commit 6fc1d81eb7f8c06f5fea54403419b30b4d95fb97)
Cheyenne Wills <cwills@sinenomine.net> no 2023-07-03
0006-Linux-6.5-Replace-generic_file_splice_read.patch Linux 6.5: Replace generic_file_splice_read
The Linux 6.5 commit:
'splice: Remove generic_file_splice_read()' (c6585011bc)
replaces the function generic_file_splice_read() with the function
filemap_splice_read().

The Linux function 'filemap_splice_read()' was introduced with the
Linux 6.3 commits:

'splice: Add a func to do a splice from a buffered file without
ITER_PIPE' (07073eb01c)
'splice: Export filemap/direct_splice_read()' (7c8e01ebf2)

With updates in Linux 6.5:
'splice: Fix filemap_splice_read() to use the correct inode'
(c37222082f) -- which fixes a problem in the code.
'splice: Make filemap_splice_read() check s_maxbytes' (83aeff881e)

Due to the fact that there could be problems with splice support prior
to Linux 6.5 (where filemap_splice_read()'s use was expanded to
additional filesystems other than just cifs), we only want to use
'filemap_splice_read()' in Linux 6.5 and later.

The LINUX/osi_vnodeops.c file is updated to use 'filemap_splice_read()',
for Linux 6.5 and later, for the splice_read member of the
file_operations structure.

(cherry picked from commit 0e06eb78f293bb295b0fe12da24abd8dc1160149)

(cherry picked from commit fef245769366efe8694ddadd1e1f2ed5ef8608f4)
Cheyenne Wills <cwills@sinenomine.net> no 2023-07-09
0007-Linux-6.5-Use-register_sysctl.patch Linux 6.5: Use register_sysctl()
The linux 6.5 commit:
"sysctl: Remove register_sysctl_table" (b8cbc0855a)
removed the Linux function register_sysctl_table(). The replacement
function is register_sysctl(), which offers a simpler interface.

Add an autoconf test for the Linux function register_sysctl and add a
call to register_sysctl when available.

Notes:
The Linux function register_sysctl was added in Linux 3.3 with the
commit:
'sysctl: Add register_sysctl for normal sysctl users' (fea478d410)
with a note that it is a simpler interface.

The function register_sysctl_table was marked as deprecated with the
Linux 6.3 commit:
'proc_sysctl: enhance documentation' (1dc8689e4c)

(cherry picked from commit fb31d299e6caa015f6288ba9186da6277d3d6a8d)

(cherry picked from commit 63801cfd1fc06ec3259fcfd67229f3a3c70447ed)
Cheyenne Wills <cwills@sinenomine.net> no 2023-07-13
0008-hcrypto-rename-abort-to-_afscrypto_abort.patch hcrypto: rename abort to _afscrypto_abort
The Linux 6.5 commit:
panic: make function declarations visible (d9cdb43189)
added a declaration for abort into panic.h.

When building the Linux kernel module, the build fails with the
following:

src/crypto/hcrypto/kernel/config.h:95:20: error: static declaration of
‘abort’ follows non-static declaration
95 | static_inline void abort(void) {osi_Panic("hckernel aborting\n"
);}
| ^~~~~
...
from ./include/linux/wait.h:9,
from /openafs/src/afs/sysincludes.h:118,
from /openafs/src/crypto/hcrypto/kernel/config.h:30:
./include/linux/panic.h:36:6: note: previous declaration of ‘abort’
with type ‘void(void)’
36 | void abort(void);
| ^~~~~

Update the declaration in hcrypto/kernel/config.h to change the function
name from abort to _afscrypto_abort and use a preprocessor define to
map abort to _afscrypto_abort.

(cherry picked from commit c4c16890d9d2829f6bef1ef58feafb30b1d59da3)

(cherry picked from commit 538f450033a67e251b473ff92238b3124b85fc72)
Cheyenne Wills <cwills@sinenomine.net> no 2023-07-09
0009-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch LINUX: Pass an array of structs to register_sysctl
The Linux 6.6 commit "sysctl: Add size to register_sysctl" (9edbfe92a0)
renamed the Linux function register_sysctl() to register_sysctl_sz() and
added a size parameter. For backward compatibility, a macro,
register_sysctl, is provided. The macro calculates the size of the
ctl_table being registered and passes the size to register_sysctl_sz.
However, in order to perform the size calculation, an array of ctl_table
structures must be passed as the 2nd parameter.

This change only affects the autoconf test used to determine if Linux
provides register_sysctl.

Update the autoconf test for register_sysctl to use an actual ctl_table
structure for the 2nd parameter instead of a NULL.

(cherry picked from commit 76879b28798840fa0df441c328ada9667f06b154)

(cherry picked from commit 5b647bf17a878271e1ce9882e41663770ee73528)
Cheyenne Wills <cwills@sinenomine.net> no 2023-09-06
0010-linux-Replace-fop-iterate-with-fop-iterate_shared.patch linux: Replace fop iterate with fop iterate_shared
The Linux 6.5 commit:
'vfs: get rid of old '->iterate' directory operation' (3e32715496)
removed the filesystem_operations iterate method. The replacement
method, iterate_shared, was introduced with the Linux 4.6 commit:
'introduce a parallel variant of ->iterate()' (6192269444)

The above commits indicate that the iterate_shared is an "almost"
drop-in replacement for iterate. The vfs documentation for
iterate_shared has caveats on the implementation (serializing in-core
per-inode or per-dentry modifications and using d_alloc_parallel if
doing dcache pre-seeding). A wrapper is provided to assist filesystems
with the migration from iterate to iterate_shared. Until it can be
verified that afs_linux_readdir meets the above requirements, we will
use the wrapper (ref 3e32715496 commit)

Add configure tests for the iterate_shared file_operations member and
for the wrap_directory_iterator function.

Update osi_vnodeops.c to use iterate_shared and the wrapper if they are
both available.

(cherry picked from commit 7437f4d37719ea53711e06ac9675dad1abd6769e)

(cherry picked from commit 6de0a646036283266e1d4aeb583e426005ca5ad4)
Cheyenne Wills <cwills@sinenomine.net> no 2023-08-29
0011-Linux-6.6-convert-to-ctime-accessor-functions.patch Linux 6.6: convert to ctime accessor functions
The Linux 6.6 commit "fs: add ctime accessors infrastructure"
(9b6304c1d5) added accessor functions for an inode's ctime member.
A follow on commit "fs: rename i_ctime field to __i_ctime" (13bc244578)
changed the name of the inode member ctime to __i_ctime to indicate it's
a private member.

Add an autoconf test for the ctime accessor function
'inode_set_ctime()'.

Add an afs_inode_set_ctime to LINUX/osi_machdep.h that is either defined
as a macro to Linux's inode_set_ctime, or implements a static inline
function to set a inode's ctime.

Convert the setting of an inode's ctime to use afs_inode_set_ctime().

For more information behind the Linux change, see the commit message
for:
"Merge tag 'v6.6-vfs.ctime'
of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs" (615e95831)

(cherry picked from commit 072c7934cd1b99052882f02294f7036d422b6cf1)

Conflicts:
src/cf/linux-kernel-func.m4 (context)

(cherry picked from commit 6413fdbc913834f2884989e5811841f4ccea2b5f)
Cheyenne Wills <cwills@sinenomine.net> no 2023-10-05
0012-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch 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().

(cherry picked from commit 4fed232b80fb1ad6c0e1dfb42ed8d8e1e6821dd7)

(cherry picked from commit 4f1d8104d17d2b4e95c7abaf5498db6b80aefa8f)
Cheyenne Wills <cwills@sinenomine.net> no 2023-09-18
0013-dir-Introduce-struct-DirEntryFlex.patch 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.

(cherry picked from commit e2ec16cf941b0aadfbd54fc2f52edd58b62e232d)
Mark Vitale <mvitale@sinenomine.net> no 2023-09-15
0014-build-clean-up-some-more-generated-files.patch build: clean up some more generated files
Commit c1d39153da00d5525b2f7874b2d214a7f1b1bb86 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 48ce41a447c354b8a20b769e4aa5b502ba5bcc09 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 .
Benjamin Kaduk <kaduk@mit.edu> no 2023-12-22

All known versions for source package 'openafs'

Links