diff -Nru openafs-1.8.10/debian/changelog openafs-1.8.10/debian/changelog --- openafs-1.8.10/debian/changelog 2024-03-31 22:22:10.000000000 +0200 +++ openafs-1.8.10/debian/changelog 2024-05-02 15:42:25.000000000 +0200 @@ -1,3 +1,9 @@ +openafs (1.8.10-2.1ubuntu4) noble; urgency=medium + + * - Fix Linux 6.8 build. LP: #2064628 + + -- Paolo Pisati Thu, 02 May 2024 13:42:25 +0000 + openafs (1.8.10-2.1ubuntu3) noble; urgency=medium * No-change rebuild for CVE-2024-3094 diff -Nru openafs-1.8.10/debian/patches/0020-roken-Use-srcdir-for-roken-post.h.patch openafs-1.8.10/debian/patches/0020-roken-Use-srcdir-for-roken-post.h.patch --- openafs-1.8.10/debian/patches/0020-roken-Use-srcdir-for-roken-post.h.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0020-roken-Use-srcdir-for-roken-post.h.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,44 @@ +From 8a631fb87d7160db384c75528e7e370c87ec4356 Mon Sep 17 00:00:00 2001 +From: Andrew Deason +Date: Tue, 13 Nov 2018 11:09:52 -0600 +Subject: [PATCH 20/36] roken: Use srcdir for roken-post.h + +roken-post.h is a source file, not a generated file in the objdir. +Specify $(srcdir) so we can work with objdir builds. + +Reviewed-on: https://gerrit.openafs.org/13387 +Tested-by: BuildBot +Reviewed-by: Michael Meffie +Reviewed-by: Cheyenne Wills +Reviewed-by: Benjamin Kaduk +(cherry picked from commit 345a739b7bb6c9c142a2b0fe584fed6c44d6c655) + +Change-Id: Ie02f0aaf373bebe74b0eaf8969b712c146a462f8 +Reviewed-on: https://gerrit.openafs.org/15638 +Tested-by: BuildBot +Reviewed-by: Andrew Deason +Tested-by: Andrew Deason +Reviewed-by: Michael Meffie +Reviewed-by: Mark Vitale +Reviewed-by: Benjamin Kaduk +Signed-off-by: Paolo Pisati +--- + src/roken/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/roken/Makefile.in b/src/roken/Makefile.in +index 8a61b19a666..e6daa6f5f5c 100644 +--- a/src/roken/Makefile.in ++++ b/src/roken/Makefile.in +@@ -75,7 +75,7 @@ err.h: ${UPSTREAM}/err.hin + $(INSTALL_DATA) $? $@ + + roken.h: $(UPSTREAM)/roken.h.in roken-post.h +- cat $(UPSTREAM)/roken.h.in roken-post.h >$@ ++ cat $(UPSTREAM)/roken.h.in $(srcdir)/roken-post.h >$@ + + # Here we have explicit rules for all the libtool objects we might need to + # build. The implicit rules don't work since the sources are in a different +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0023-LINUX-Minor-osi_vfsop.c-cleanup.patch openafs-1.8.10/debian/patches/0023-LINUX-Minor-osi_vfsop.c-cleanup.patch --- openafs-1.8.10/debian/patches/0023-LINUX-Minor-osi_vfsop.c-cleanup.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0023-LINUX-Minor-osi_vfsop.c-cleanup.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,86 @@ +From db9b2216fb942dcf4eb73f72af5e7f6ca36e4685 Mon Sep 17 00:00:00 2001 +From: Andrew Deason +Date: Tue, 24 Jul 2018 23:22:01 -0500 +Subject: [PATCH 23/36] LINUX: Minor osi_vfsop.c cleanup + +- Fix the formatting on afs_mount/afs_get_sb definitions + +- Declare a couple of functions static that are not referenced outside + of this file + +Reviewed-on: https://gerrit.openafs.org/13282 +Tested-by: BuildBot +Reviewed-by: Benjamin Kaduk +(cherry picked from commit fa15fbda0aa0c3810695d9b867d3258b60e76b7c) + +Change-Id: I8a32475bf2ddb9c7206aef679947021925697c5a +Reviewed-on: https://gerrit.openafs.org/15680 +Reviewed-by: Andrew Deason +Reviewed-by: Michael Meffie +Tested-by: Benjamin Kaduk +Reviewed-by: Benjamin Kaduk +Signed-off-by: Paolo Pisati +--- + src/afs/LINUX/osi_vfsops.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c +index b85ab3fdfbd..bb49a5ce215 100644 +--- a/src/afs/LINUX/osi_vfsops.c ++++ b/src/afs/LINUX/osi_vfsops.c +@@ -40,7 +40,7 @@ extern struct dentry_operations afs_dentry_operations; + + /* Forward declarations */ + static int afs_root(struct super_block *afsp); +-int afs_fill_super(struct super_block *sb, void *data, int silent); ++static int afs_fill_super(struct super_block *sb, void *data, int silent); + + + /* +@@ -52,19 +52,22 @@ int afs_fill_super(struct super_block *sb, void *data, int silent); + #if defined(STRUCT_FILE_SYSTEM_TYPE_HAS_MOUNT) + static struct dentry * + afs_mount(struct file_system_type *fs_type, int flags, +- const char *dev_name, void *data) { ++ const char *dev_name, void *data) ++{ + return mount_nodev(fs_type, flags, data, afs_fill_super); + } + #elif defined(GET_SB_HAS_STRUCT_VFSMOUNT) + static int + afs_get_sb(struct file_system_type *fs_type, int flags, +- const char *dev_name, void *data, struct vfsmount *mnt) { ++ const char *dev_name, void *data, struct vfsmount *mnt) ++{ + return get_sb_nodev(fs_type, flags, data, afs_fill_super, mnt); + } + #else + static struct super_block * + afs_get_sb(struct file_system_type *fs_type, int flags, +- const char *dev_name, void *data) { ++ const char *dev_name, void *data) ++{ + return get_sb_nodev(fs_type, flags, data, afs_fill_super); + } + #endif +@@ -83,7 +86,7 @@ struct file_system_type afs_fs_type = { + + struct backing_dev_info *afs_backing_dev_info; + +-int ++static int + afs_fill_super(struct super_block *sb, void *data, int silent) + { + int code = 0; +@@ -372,7 +375,7 @@ afs_put_super(struct super_block *sbp) + * statp is in user space, so we need to cobble together a statfs, then + * copy it. + */ +-int ++static int + #if defined(STATFS_TAKES_DENTRY) + afs_statfs(struct dentry *dentry, struct kstatfs *statp) + #else +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0026-cf-Avoid-nested-C-functions-built-by-autoconf.patch openafs-1.8.10/debian/patches/0026-cf-Avoid-nested-C-functions-built-by-autoconf.patch --- openafs-1.8.10/debian/patches/0026-cf-Avoid-nested-C-functions-built-by-autoconf.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0026-cf-Avoid-nested-C-functions-built-by-autoconf.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,86 @@ +From d7e71ebca6faf28c30ff5190d1396dd5fd832a63 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Thu, 17 Feb 2022 18:27:02 -0700 +Subject: [PATCH 26/36] cf: Avoid nested C functions built by autoconf + +Currently, two of the Linux-related autoconf macros try to compile code +containing nested C functions (AC_CHECK_LINUX_OPERATION and +LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID). For example, the +AC_CHECK_LINUX_OPERATION check for 'follow_link' generates this code +where 'op' is a nested function inside 'conftest': + + #include + #include + void conftest(void) + { + struct inode_operations ops; + const char *op(struct dentry *dentry, void **link_date) { + return (const char *)0; + }; + ops.follow_link = op; + } + +Nested functions are a gcc-specific feature, and are not supported by +other compilers (e.g. clang), causing these checks to always fail when +using clang, leading to incorrect configure results. + +To fix this, change AC_CHECK_LINUX_OPERATION and +LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID macros to just define the +relevant function as a proper top-level function. + +(these were discovered by forcing a clang build of both the Linux kernel +and the openafs kernel module) + +Reviewed-on: https://gerrit.openafs.org/14901 +Tested-by: BuildBot +Reviewed-by: Andrew Deason +Reviewed-by: Michael Meffie +Reviewed-by: Benjamin Kaduk +(cherry picked from commit a4878a5e26b9997e40a3b197cea5f8c3b24f2539) + +Change-Id: Ie186658167a3f9e162fe85722aa0792cbe4fcfda +Reviewed-on: https://gerrit.openafs.org/15540 +Tested-by: BuildBot +Reviewed-by: Marcio Brito Barbosa +Reviewed-by: Stephan Wiesand +Signed-off-by: Paolo Pisati +--- + src/cf/linux-test1.m4 | 5 ++++- + src/cf/linux-test4.m4 | 5 +++-- + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 +index 94bd0692cee..6695385b890 100644 +--- a/src/cf/linux-test1.m4 ++++ b/src/cf/linux-test1.m4 +@@ -199,7 +199,10 @@ AC_DEFUN([AC_CHECK_LINUX_OPERATION], + AC_CACHE_CHECK([operation $2 in $1], [ac_linux_operation], + [save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Werror" +- AC_TRY_KBUILD([$4], [struct $1 ops; $5 op($6) { return ($5)0; }; ops.$2 = op;], ++ AC_TRY_KBUILD( ++ [$4 ++ $5 op($6) { return ($5)0; };], ++ [struct $1 ops; ops.$2 = op;], + AS_VAR_SET([ac_linux_operation], [yes]), + AS_VAR_SET([ac_linux_operation], [no])) + CPPFLAGS="$save_CPPFLAGS" +diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 +index f15c6b94d7c..d8f3894fcfd 100644 +--- a/src/cf/linux-test4.m4 ++++ b/src/cf/linux-test4.m4 +@@ -492,8 +492,9 @@ AC_DEFUN([LINUX_KMEM_CACHE_CREATE_TAKES_DTOR], [ + AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[ + AC_CHECK_LINUX_BUILD([whether kmem_cache_create constructor takes a void pointer], + [ac_cv_linux_kmem_cache_create_ctor_takes_void], +- [#include ], +- [void _ctor(void *v) { }; kmem_cache_create(NULL, 0, 0, 0, _ctor);], ++ [#include ++ void _ctor(void *v) { };], ++ [kmem_cache_create(NULL, 0, 0, 0, _ctor);], + [KMEM_CACHE_CTOR_TAKES_VOID], + [define if kmem_cache_create constructor takes a single void ptr], + [-Werror]) +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0027-cf-Use-static-allocated-structs-for-cf-tests.patch openafs-1.8.10/debian/patches/0027-cf-Use-static-allocated-structs-for-cf-tests.patch --- openafs-1.8.10/debian/patches/0027-cf-Use-static-allocated-structs-for-cf-tests.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0027-cf-Use-static-allocated-structs-for-cf-tests.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,263 @@ +From 26924cd69fb5250c90a722181efc3911514ae694 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Wed, 21 Jun 2023 13:56:29 -0600 +Subject: [PATCH 27/36] cf: Use static allocated structs for cf tests + +The Linux kernel module build will issue a warning when a stack frame +exceeds a specific size via the -Wframe-larger-than= compiler flag (with +a default size of 2048 bytes on most architectures). + +At least one distribution, Oracle's Linux with the Unbreakable +Enterprise Kernel (UEK), hardens this check by changing the warning to +an error (-Werror=frame-larger-than=). + +Several of the openafs autoconf tests use objects that are allocated on +the stack when testing for structures, or members of a structure. +When the warning is changed to an error, configure fails in several +locations when testing against Linux's task_struct structure, which +exceeds 2048 bytes in size. + + openafs/conftest.dir/conftest.c:72:1: error: the frame size of 9984 + bytes is larger than 2048 bytes [-Werror=frame-larger-than=] + +Update the autoconf Linux tests that allocate structures to use a +statically allocated structure instead of one allocated on the stack. + +Reviewed-on: https://gerrit.openafs.org/15477 +Reviewed-by: Benjamin Kaduk +Tested-by: BuildBot +Reviewed-by: Andrew Deason +(cherry picked from commit a939eb7ffd2517a127aeb02ebd962e00e9acb960) + +Change-Id: Ib1d5b8218981890751187fbcf724dd6643356e98 +Reviewed-on: https://gerrit.openafs.org/15549 +Tested-by: BuildBot +Reviewed-by: Marcio Brito Barbosa +Reviewed-by: Michael Meffie +Reviewed-by: Kailas Zadbuke +Reviewed-by: Stephan Wiesand +Signed-off-by: Paolo Pisati +--- + src/cf/linux-test1.m4 | 6 ++--- + src/cf/linux-test4.m4 | 62 +++++++++++++++++++++---------------------- + 2 files changed, 34 insertions(+), 34 deletions(-) + +diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 +index 6695385b890..7bb5a677c26 100644 +--- a/src/cf/linux-test1.m4 ++++ b/src/cf/linux-test1.m4 +@@ -173,7 +173,7 @@ AC_DEFUN([AC_CHECK_LINUX_TYPE], + [AC_CHECK_LINUX_BUILD([for $1], + [ac_cv_linux_type_$1_exists], + [#include ], +- [$1 _test; ], ++ [static $1 _test; ], + AS_TR_CPP(HAVE_LINUX_$1), + [Define if kernel defines $1]) + ]) +@@ -188,7 +188,7 @@ AC_DEFUN([AC_CHECK_LINUX_TYPED_STRUCT], + [AC_CHECK_LINUX_BUILD([for $2 in $1], + [ac_cv_linux_$1_has_$2], + [#include ], +- [$1 _test; printk("%x\n", &_test.$2); ], ++ [static $1 _test; printk("%x\n", &_test.$2); ], + AS_TR_CPP($1_HAS_$2), + [Define if kernel $1 has the $2 element]) + ]) +@@ -202,7 +202,7 @@ AC_DEFUN([AC_CHECK_LINUX_OPERATION], + AC_TRY_KBUILD( + [$4 + $5 op($6) { return ($5)0; };], +- [struct $1 ops; ops.$2 = op;], ++ [static struct $1 ops; ops.$2 = op;], + AS_VAR_SET([ac_linux_operation], [yes]), + AS_VAR_SET([ac_linux_operation], [no])) + CPPFLAGS="$save_CPPFLAGS" +diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 +index d8f3894fcfd..3596b6aad0e 100644 +--- a/src/cf/linux-test4.m4 ++++ b/src/cf/linux-test4.m4 +@@ -132,7 +132,7 @@ AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [ + #ifdef HAVE_LINUX_SCHED_SIGNAL_H + #include + #endif], +- [struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);], ++ [static struct task_struct _tsk; printk("%d\n", _tsk.signal->rlim);], + [STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], + [define if your struct task_struct has signal->rlim], + []) +@@ -178,8 +178,8 @@ AC_DEFUN([LINUX_INODE_SETATTR_RETURN_TYPE], [ + AC_CHECK_LINUX_BUILD([for inode_setattr return type], + [ac_cv_linux_func_inode_setattr_returns_int], + [#include ], +- [struct inode _inode; +- struct iattr _iattr; ++ [static struct inode _inode; ++ static struct iattr _iattr; + int i; + i = inode_setattr(&_inode, &_iattr);], + [INODE_SETATTR_NOT_VOID], +@@ -192,7 +192,7 @@ AC_DEFUN([LINUX_IATTR_64BIT_TIME], [ + [ac_cv_linux_func_iattr_ctime_takes_timespec64], + [#include + #include ], +- [struct iattr _attrs; ++ [static struct iattr _attrs; + #if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64) + ktime_get_coarse_real_ts64(&_attrs.ia_ctime); + #else +@@ -210,9 +210,9 @@ AC_DEFUN([LINUX_AOP_WRITEBACK_CONTROL], [ + [#include + #include + #include ], +-[struct address_space_operations _aops; +-struct page _page; +-struct writeback_control _writeback_control; ++[static struct address_space_operations _aops; ++static struct page _page; ++static struct writeback_control _writeback_control; + (void)_aops.writepage(&_page, &_writeback_control);], + [AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL], + [define if aops.writepage takes a struct writeback_control], +@@ -239,9 +239,9 @@ AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_NAMEIDATA], [ + [ac_cv_linux_func_i_create_takes_nameidata], + [#include + #include ], +-[struct inode _inode; +-struct dentry _dentry; +-struct nameidata _nameidata; ++[static struct inode _inode; ++static struct dentry _dentry; ++static struct nameidata _nameidata; + (void)_inode.i_op->create(&_inode, &_dentry, 0, &_nameidata);], + + [IOP_CREATE_TAKES_NAMEIDATA], +@@ -255,9 +255,9 @@ AC_DEFUN([LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA], [ + [ac_cv_linux_func_i_lookup_takes_nameidata], + [#include + #include ], +-[struct inode _inode; +-struct dentry _dentry; +-struct nameidata _nameidata; ++[static struct inode _inode; ++static struct dentry _dentry; ++static struct nameidata _nameidata; + (void)_inode.i_op->lookup(&_inode, &_dentry, &_nameidata);], + [IOP_LOOKUP_TAKES_NAMEIDATA], + [define if your iops.lookup takes a nameidata argument], +@@ -270,8 +270,8 @@ AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [ + [ac_cv_linux_func_i_permission_takes_nameidata], + [#include + #include ], +-[struct inode _inode; +-struct nameidata _nameidata; ++[static struct inode _inode; ++static struct nameidata _nameidata; + (void)_inode.i_op->permission(&_inode, 0, &_nameidata);], + [IOP_PERMISSION_TAKES_NAMEIDATA], + [define if your iops.permission takes a nameidata argument], +@@ -297,8 +297,8 @@ AC_DEFUN([LINUX_IOP_I_PUT_LINK_TAKES_COOKIE], [ + [ac_cv_linux_func_i_put_link_takes_cookie], + [#include + #include ], +-[struct inode _inode; +-struct dentry _dentry; ++[static struct inode _inode; ++static struct dentry _dentry; + struct nameidata *_nameidata; + void *cookie; + (void)_inode.i_op->put_link(&_dentry, _nameidata, cookie);], +@@ -373,7 +373,7 @@ AC_DEFUN([LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK], [ + [ac_cv_key_alloc_needs_struct_task], + [#include + #include ], +- [struct task_struct *t=NULL; ++ [static struct task_struct *t=NULL; + struct key k = {}; + (void) key_alloc(NULL, NULL, k.uid, k.gid, t, 0, 0);], + [KEY_ALLOC_NEEDS_STRUCT_TASK], +@@ -427,8 +427,8 @@ AC_DEFUN([LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T], [ + AC_CHECK_LINUX_BUILD([whether file_operations.flush takes a fl_owner_t], + [ac_cv_linux_func_f_flush_takes_fl_owner_t], + [#include ], +-[struct inode _inode; +-struct file _file; ++[static struct inode _inode; ++static struct file _file; + fl_owner_t id; + (void)_inode.i_fop->flush(&_file, &id);], + [FOP_FLUSH_TAKES_FL_OWNER_T], +@@ -441,9 +441,9 @@ AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_DENTRY], [ + AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a dentry argument], + [ac_cv_linux_func_f_fsync_takes_dentry], + [#include ], +-[struct inode _inode; +-struct file _file; +-struct dentry _d; ++[static struct inode _inode; ++static struct file _file; ++static struct dentry _d; + (void)_inode.i_fop->fsync(&_file, &_d, 0);], + [FOP_FSYNC_TAKES_DENTRY], + [define if your fops.fsync takes an dentry argument], +@@ -457,8 +457,8 @@ AC_DEFUN([LINUX_FOP_F_FSYNC_TAKES_RANGE], [ + AC_CHECK_LINUX_BUILD([whether file_operations.fsync takes a range], + [ac_cv_linux_func_f_fsync_takes_range], + [#include ], +-[struct inode _inode; +-struct file _file; ++[static struct inode _inode; ++static struct file _file; + loff_t start, end; + (void)_inode.i_fop->fsync(&_file, start, end, 0);], + [FOP_FSYNC_TAKES_RANGE], +@@ -508,7 +508,7 @@ AC_DEFUN([LINUX_FS_STRUCT_FOP_HAS_SPLICE], [ + AC_CHECK_LINUX_BUILD([for splice_write and splice_read in struct file_operations], + [ac_cv_linux_fs_struct_fop_has_splice], + [#include ], +- [struct file_operations _fop; ++ [static struct file_operations _fop; + _fop.splice_write(NULL, NULL, NULL, 0, 0); + _fop.splice_read(NULL, NULL, NULL, 0, 0);], + [STRUCT_FILE_OPERATIONS_HAS_SPLICE], +@@ -558,7 +558,7 @@ AC_DEFUN([LINUX_NEW_EXPORT_OPS], [ + AC_CHECK_LINUX_BUILD([if kernel uses new export ops], + [ac_cv_linux_new_export_ops], + [#include ], +- [struct export_operations _eops; ++ [static struct export_operations _eops; + _eops.fh_to_parent(NULL, NULL, 0, 0);], + [NEW_EXPORT_OPS], + [define if kernel uses new export ops], +@@ -693,7 +693,7 @@ AC_DEFUN([LINUX_IOP_CREATE_TAKES_UMODE_T], [ + AC_CHECK_LINUX_BUILD([whether inode.i_op->create takes a umode_t argument], + [ac_cv_linux_iop_create_takes_umode_t], + [#include ], +- [struct inode_operations _i_ops; ++ [static struct inode_operations _i_ops; + int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n) + {return 0;}; + _i_ops.create = _create;], +@@ -732,7 +732,7 @@ AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [ + AC_CHECK_LINUX_BUILD([whether dentry_open takes a path argument], + [ac_cv_linux_dentry_open_takes_path], + [#include ], +- [struct path p; ++ [static struct path p; + dentry_open(&p, 0, NULL);], + [DENTRY_OPEN_TAKES_PATH], + [define if dentry_open takes a path argument], +@@ -780,8 +780,8 @@ AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_BOOL], [ + [ac_cv_linux_func_i_create_takes_bool], + [#include + #include ], +- [struct inode _inode = {}; +- struct dentry _dentry; ++ [static struct inode _inode = {}; ++ static struct dentry _dentry; + bool b = true; + (void)_inode.i_op->create(&_inode, &_dentry, 0, b);], + [IOP_CREATE_TAKES_BOOL], +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0028-cf-Add-function-prototypes-for-linux-conftest.patch openafs-1.8.10/debian/patches/0028-cf-Add-function-prototypes-for-linux-conftest.patch --- openafs-1.8.10/debian/patches/0028-cf-Add-function-prototypes-for-linux-conftest.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0028-cf-Add-function-prototypes-for-linux-conftest.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,114 @@ +From a2ace91fe8602655c646252751d6930cb6393e5c Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Wed, 7 Feb 2024 14:51:23 -0700 +Subject: [PATCH 28/36] 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. + +Reviewed-on: https://gerrit.openafs.org/15614 +Tested-by: BuildBot +Reviewed-by: Andrew Deason +Reviewed-by: Benjamin Kaduk +(cherry picked from commit 1440843b80e28db908bd8c264b8adbfb2c95b4d9) + +Change-Id: I38acb7b0cb08dec8e9bca5f3792fbf981884a74c +Reviewed-on: https://gerrit.openafs.org/15683 +Tested-by: BuildBot +Reviewed-by: Andrew Deason +Reviewed-by: Michael Meffie +Reviewed-by: Benjamin Kaduk +Signed-off-by: Paolo Pisati +--- + src/cf/linux-test1.m4 | 4 ++-- + src/cf/linux-test4.m4 | 16 ++++++++-------- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 +index 7bb5a677c26..010a4464f25 100644 +--- a/src/cf/linux-test1.m4 ++++ b/src/cf/linux-test1.m4 +@@ -16,7 +16,7 @@ _ACEOF + /* end confdefs.h */ + #include + $1 +- ++void conftest(void); + void conftest(void) + { + $2 +@@ -201,7 +201,7 @@ AC_DEFUN([AC_CHECK_LINUX_OPERATION], + CPPFLAGS="$CPPFLAGS -Werror" + AC_TRY_KBUILD( + [$4 +- $5 op($6) { return ($5)0; };], ++ static $5 op($6) { return ($5)0; };], + [static struct $1 ops; ops.$2 = op;], + AS_VAR_SET([ac_linux_operation], [yes]), + AS_VAR_SET([ac_linux_operation], [no])) +diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 +index 3596b6aad0e..7889c904a0f 100644 +--- a/src/cf/linux-test4.m4 ++++ b/src/cf/linux-test4.m4 +@@ -400,9 +400,9 @@ AC_DEFUN([LINUX_INIT_WORK_HAS_DATA], [ + AC_CHECK_LINUX_BUILD([whether INIT_WORK has a _data argument], + [ac_cv_linux_init_work_has_data], + [#include +-#include ], +-[ +-void f(struct work_struct *w) {} ++#include ++static void f(struct work_struct *w) {}], ++[ + struct work_struct *w; + int *i; + INIT_WORK(w,f,i);], +@@ -493,7 +493,7 @@ AC_DEFUN([LINUX_KMEM_CACHE_CREATE_CTOR_TAKES_VOID],[ + AC_CHECK_LINUX_BUILD([whether kmem_cache_create constructor takes a void pointer], + [ac_cv_linux_kmem_cache_create_ctor_takes_void], + [#include +- void _ctor(void *v) { };], ++ static void _ctor(void *v) { };], + [kmem_cache_create(NULL, 0, 0, 0, _ctor);], + [KMEM_CACHE_CTOR_TAKES_VOID], + [define if kmem_cache_create constructor takes a single void ptr], +@@ -667,7 +667,7 @@ AC_DEFUN([LINUX_IOP_GETATTR_TAKES_PATH_STRUCT], [ + AC_CHECK_LINUX_BUILD([whether 4.11+ inode.i_op->getattr takes a struct path argument], + [ac_cv_linux_iop_getattr_takes_path_struct], + [#include +- int _getattr(const struct path *path, struct kstat *stat, u32 request_mask, ++ static int _getattr(const struct path *path, struct kstat *stat, u32 request_mask, + unsigned int sync_mode) {return 0;}; + struct inode_operations _i_ops;], + [_i_ops.getattr = _getattr;], +@@ -692,10 +692,10 @@ AC_DEFUN([LINUX_IOP_MKDIR_TAKES_UMODE_T], [ + AC_DEFUN([LINUX_IOP_CREATE_TAKES_UMODE_T], [ + AC_CHECK_LINUX_BUILD([whether inode.i_op->create takes a umode_t argument], + [ac_cv_linux_iop_create_takes_umode_t], +- [#include ], ++ [#include ++ static int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n) ++ {return 0;};], + [static struct inode_operations _i_ops; +- int _create(struct inode *i, struct dentry *d, umode_t m, struct nameidata *n) +- {return 0;}; + _i_ops.create = _create;], + [IOP_CREATE_TAKES_UMODE_T], + [define if inode.i_op->create takes a umode_t argument], +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0032-roken-Declare-ct_memcmp-in-hcrypto-kernel-roken.h.patch openafs-1.8.10/debian/patches/0032-roken-Declare-ct_memcmp-in-hcrypto-kernel-roken.h.patch --- openafs-1.8.10/debian/patches/0032-roken-Declare-ct_memcmp-in-hcrypto-kernel-roken.h.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0032-roken-Declare-ct_memcmp-in-hcrypto-kernel-roken.h.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,95 @@ +From 982192bf6bf6298cd40d6173189ed9b4e57c752d Mon Sep 17 00:00:00 2001 +From: Andrew Deason +Date: Tue, 30 Jan 2024 20:44:48 -0600 +Subject: [PATCH 32/36] 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 +Reviewed-by: Andrew Deason +Reviewed-by: Benjamin Kaduk +(cherry picked from commit be236069e9d26339ed5f9939965bca0dd3f8bf4e) +Signed-off-by: Paolo Pisati +--- + src/crypto/hcrypto/kernel/roken.h | 17 +++++++++++++++++ + src/crypto/rfc3961/krb5_locl.h | 6 +----- + 2 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/src/crypto/hcrypto/kernel/roken.h b/src/crypto/hcrypto/kernel/roken.h +index e69de29bb2d..f8c2334685f 100644 +--- a/src/crypto/hcrypto/kernel/roken.h ++++ b/src/crypto/hcrypto/kernel/roken.h +@@ -0,0 +1,17 @@ ++#ifndef OPENAFS_HCRYPTO_KERNEL_ROKEN_H ++#define OPENAFS_HCRYPTO_KERNEL_ROKEN_H ++ ++/* ++ * This is a stub roken.h used for building roken code (or roken-using code) in ++ * the kernel. For userspace code, use a real roken.h. This just contains a few ++ * prototypes of roken functions we actually use in kernel code. ++ */ ++ ++#ifndef KERNEL ++# error "This header is for kernel code only" ++#endif ++ ++/* ct.c */ ++int ct_memcmp(const void *p1, const void *p2, size_t len); ++ ++#endif /* OPENAFS_HCRYPTO_KERNEL_ROKEN_H */ +diff --git a/src/crypto/rfc3961/krb5_locl.h b/src/crypto/rfc3961/krb5_locl.h +index eb279a95ffd..6e706737c59 100644 +--- a/src/crypto/rfc3961/krb5_locl.h ++++ b/src/crypto/rfc3961/krb5_locl.h +@@ -5,6 +5,7 @@ + #ifdef KERNEL + + #include "config.h" ++#include + + #else + #include +@@ -285,11 +286,6 @@ int copy_EncryptionKey(const krb5_keyblock *, krb5_keyblock *); + krb5_error_code krb5_enctype_to_string(krb5_context context, + krb5_enctype etype, + char **string); +-#ifdef KERNEL +-/* Roken provides this in userspace, but we're on our own in the kernel. */ +-int ct_memcmp(const void *p1, const void *p2, size_t len); +-#endif +- + + #include "crypto.h" + +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0033-Linux-6.8-Use-roken-s-strlcpy-in-kernel-module.patch openafs-1.8.10/debian/patches/0033-Linux-6.8-Use-roken-s-strlcpy-in-kernel-module.patch --- openafs-1.8.10/debian/patches/0033-Linux-6.8-Use-roken-s-strlcpy-in-kernel-module.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0033-Linux-6.8-Use-roken-s-strlcpy-in-kernel-module.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,156 @@ +From 02f7dbbcdafec3dc8fd436c272aa3ca18e68f725 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Mon, 11 Mar 2024 09:05:33 -0600 +Subject: [PATCH 33/36] 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 +Reviewed-by: Benjamin Kaduk +(cherry picked from commit 30b18c165752e6d0ce7b6daa6a90453f5e5e6d17) +Signed-off-by: Paolo Pisati +--- + src/afs/LINUX/osi_machdep.h | 1 + + src/cf/linux-kernel-func.m4 | 11 +++++++++++ + src/crypto/hcrypto/kernel/roken.h | 29 +++++++++++++++++++++++++++++ + src/external/libafsdep | 1 + + src/libafs/MakefileProto.LINUX.in | 6 ++++-- + 5 files changed, 46 insertions(+), 2 deletions(-) + +diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h +index f08ae8223d8..bd6751bf4b2 100644 +--- a/src/afs/LINUX/osi_machdep.h ++++ b/src/afs/LINUX/osi_machdep.h +@@ -77,6 +77,7 @@ + #endif + + #include "afs/sysincludes.h" ++#include "roken.h" + + #if !defined(HAVE_LINUX_TIME_T) + typedef time64_t time_t; +diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 +index 7f3000fc16f..6f9d350227c 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -252,6 +252,17 @@ AC_CHECK_LINUX_FUNC([inode_atime_mtime_accessors], + [inode_set_atime(NULL, 0, 0); + inode_set_mtime(NULL, 0, 0);]) + ++dnl Linux 6.8 removed the strlcpy() function. We test to see if we can redefine ++dnl a strlcpy() function. We use a totally different function signature to ++dnl to ensure that this fails when the kernel does provide strlcpy(). ++AC_CHECK_LINUX_FUNC([no_strlcpy], ++ [[#include ++ size_t strlcpy(char *d); ++ size_t strlcpy(char *d) { return strlen(d); }]], ++ [[static char buff[10]; ++ size_t s; ++ s = strlcpy(buff);]]) ++ + dnl Consequences - things which get set as a result of the + dnl above tests + AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"], +diff --git a/src/crypto/hcrypto/kernel/roken.h b/src/crypto/hcrypto/kernel/roken.h +index f8c2334685f..6cb06013139 100644 +--- a/src/crypto/hcrypto/kernel/roken.h ++++ b/src/crypto/hcrypto/kernel/roken.h +@@ -11,6 +11,35 @@ + # error "This header is for kernel code only" + #endif + ++/* ++ * The following function annotations are not needed when building for kernel ++ * space ++ */ ++#define ROKEN_LIB_FUNCTION ++#define ROKEN_LIB_CALL ++#define ROKEN_LIB_VARIABLE ++ ++/* ++ * Our HAVE_STRLCPY from autoconf refers to whether strlcpy() is available in ++ * userspace. Whether it's available in the kernel is another question, so ++ * override HAVE_STRLCPY here. Usually it is available (only a few cases lack ++ * it), so turn it on by default, and turn it off for a few cases below. ++ */ ++#undef HAVE_STRLCPY ++#define HAVE_STRLCPY 1 ++ ++#ifdef AFS_AIX_ENV ++# undef HAVE_STRLCPY ++#elif defined(AFS_LINUX_ENV) && defined(HAVE_LINUX_NO_STRLCPY) ++# undef HAVE_STRLCPY ++#endif ++ ++/* strlcpy.c */ ++#if defined (AFS_LINUX_ENV) && !defined(HAVE_STRLCPY) ++# define strlcpy rk_strlcpy ++ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t); ++#endif ++ + /* ct.c */ + int ct_memcmp(const void *p1, const void *p2, size_t len); + +diff --git a/src/external/libafsdep b/src/external/libafsdep +index fb365df2daf..9d36a30c091 100644 +--- a/src/external/libafsdep ++++ b/src/external/libafsdep +@@ -24,3 +24,4 @@ heimdal/krb5/crypto-evp.c + heimdal/krb5/keyblock.c + heimdal/krb5/store-int.c + heimdal/roken/ct.c ++heimdal/roken/strlcpy.c +\ No newline at end of file +diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in +index 8744ab8b616..6e62c8c97fe 100644 +--- a/src/libafs/MakefileProto.LINUX.in ++++ b/src/libafs/MakefileProto.LINUX.in +@@ -42,7 +42,8 @@ AFS_OS_OBJS = \ + osi_ioctl.o \ + osi_proc.o \ + osi_vnodeops.o \ +- osi_pagecopy.o ++ osi_pagecopy.o \ ++ strlcpy-kernel.o + + AFS_OS_PAGOBJS = \ + osi_alloc.o \ +@@ -59,7 +60,8 @@ AFS_OS_PAGOBJS = \ + osi_flush.o \ + + osi_ioctl.o \ +- osi_pag_module.o ++ osi_pag_module.o \ ++ strlcpy-kernel.o + + AFS_OS_NFSOBJS = + +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0034-afs-Add-prototypes-for-roken-strlcpy-strlcat.patch openafs-1.8.10/debian/patches/0034-afs-Add-prototypes-for-roken-strlcpy-strlcat.patch --- openafs-1.8.10/debian/patches/0034-afs-Add-prototypes-for-roken-strlcpy-strlcat.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0034-afs-Add-prototypes-for-roken-strlcpy-strlcat.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,300 @@ +From a1c004df39a121aedab99aab7350bd4ea6dbacc6 Mon Sep 17 00:00:00 2001 +From: Andrew Deason +Date: Fri, 16 Feb 2024 12:31:05 -0600 +Subject: [PATCH 34/36] 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 +Reviewed-by: Michael Meffie +Reviewed-by: Benjamin Kaduk +Tested-by: Benjamin Kaduk +(cherry picked from commit 5cda275890ef5d1781ba74299fd5d1dc7c6da3cd) +Signed-off-by: Paolo Pisati +--- + src/afs/LINUX/osi_machdep.h | 1 - + src/afs/afsincludes.h | 1 + + src/crypto/hcrypto/kernel/roken.h | 20 +++++++++++++++----- + src/dir/dir.c | 5 ++--- + src/external/libafsdep | 3 ++- + src/libafs/Makefile.common.in | 10 ++++++---- + src/libafs/MakefileProto.AIX.in | 4 +--- + src/libafs/MakefileProto.LINUX.in | 6 ++---- + src/rx/rx.c | 4 +--- + src/rx/rx_getaddr.c | 7 +++---- + src/rx/rx_packet.c | 4 +--- + src/rx/rx_rdwr.c | 4 +--- + 12 files changed, 35 insertions(+), 34 deletions(-) + +diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h +index bd6751bf4b2..f08ae8223d8 100644 +--- a/src/afs/LINUX/osi_machdep.h ++++ b/src/afs/LINUX/osi_machdep.h +@@ -77,7 +77,6 @@ + #endif + + #include "afs/sysincludes.h" +-#include "roken.h" + + #if !defined(HAVE_LINUX_TIME_T) + typedef time64_t time_t; +diff --git a/src/afs/afsincludes.h b/src/afs/afsincludes.h +index 9841f2f28a0..c01e4a9c3db 100644 +--- a/src/afs/afsincludes.h ++++ b/src/afs/afsincludes.h +@@ -18,6 +18,7 @@ + + /* AFS based headers */ + # include "afs/stds.h" ++# include "roken.h" + # ifdef AFS_AIX_ENV + # include "osi_vfs.h" + # elif defined(AFS_HPUX_ENV) || defined(AFS_NBSD_ENV) +diff --git a/src/crypto/hcrypto/kernel/roken.h b/src/crypto/hcrypto/kernel/roken.h +index 6cb06013139..f1b33e182c0 100644 +--- a/src/crypto/hcrypto/kernel/roken.h ++++ b/src/crypto/hcrypto/kernel/roken.h +@@ -20,26 +20,36 @@ + #define ROKEN_LIB_VARIABLE + + /* +- * Our HAVE_STRLCPY from autoconf refers to whether strlcpy() is available in +- * userspace. Whether it's available in the kernel is another question, so +- * override HAVE_STRLCPY here. Usually it is available (only a few cases lack +- * it), so turn it on by default, and turn it off for a few cases below. ++ * Our HAVE_STRLCPY et al from autoconf refer to whether, e.g., strlcpy() is ++ * available in userspace. Whether it's available in the kernel is another ++ * question, so set them again here. Usually they are available (they are ++ * missing only for a few cases) so define them by default, and ++ * undefine them for a few cases below. + */ + #undef HAVE_STRLCPY + #define HAVE_STRLCPY 1 ++#undef HAVE_STRLCAT ++#define HAVE_STRLCAT 1 + + #ifdef AFS_AIX_ENV + # undef HAVE_STRLCPY ++# undef HAVE_STRLCAT + #elif defined(AFS_LINUX_ENV) && defined(HAVE_LINUX_NO_STRLCPY) + # undef HAVE_STRLCPY + #endif + + /* strlcpy.c */ +-#if defined (AFS_LINUX_ENV) && !defined(HAVE_STRLCPY) ++#ifndef HAVE_STRLCPY + # define strlcpy rk_strlcpy + ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t); + #endif + ++/* strlcat.c */ ++#ifndef HAVE_STRLCAT ++# define strlcat rk_strlcat ++ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *, const char *, size_t); ++#endif ++ + /* ct.c */ + int ct_memcmp(const void *p1, const void *p2, size_t len); + +diff --git a/src/dir/dir.c b/src/dir/dir.c +index 5e8aff7db57..9ebaa3e314c 100644 +--- a/src/dir/dir.c ++++ b/src/dir/dir.c +@@ -32,9 +32,7 @@ + # include "h/kernel.h" + # endif + # endif +-# if defined(AFS_SUN5_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DARWIN80_ENV) +-# include "afs/sysincludes.h" +-# endif ++# include "afs/sysincludes.h" + # if !defined(AFS_SGI_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_OBSD48_ENV) && !defined(AFS_NBSD_ENV) + # include "h/user.h" + # endif /* AFS_SGI_ENV */ +@@ -45,6 +43,7 @@ + # ifndef AFS_LINUX_ENV + # include "netinet/in.h" + # endif ++# include "afsincludes.h" + # else /* !defined(UKERNEL) */ + # include "afs/stds.h" + # include "afs/sysincludes.h" +diff --git a/src/external/libafsdep b/src/external/libafsdep +index 9d36a30c091..a30c02e8fa3 100644 +--- a/src/external/libafsdep ++++ b/src/external/libafsdep +@@ -24,4 +24,5 @@ heimdal/krb5/crypto-evp.c + heimdal/krb5/keyblock.c + heimdal/krb5/store-int.c + heimdal/roken/ct.c +-heimdal/roken/strlcpy.c +\ No newline at end of file ++heimdal/roken/strlcat.c ++heimdal/roken/strlcpy.c +diff --git a/src/libafs/Makefile.common.in b/src/libafs/Makefile.common.in +index 664f1a9ee35..36a6d4249ea 100644 +--- a/src/libafs/Makefile.common.in ++++ b/src/libafs/Makefile.common.in +@@ -201,7 +201,9 @@ AFSAOBJS = \ + crypto-keyblock.o \ + crypto-store-int.o \ + crypto-random.o \ +- afs_uuid.o $(AFS_OS_OBJS) ++ afs_uuid.o \ ++ strlcat-kernel.o\ ++ strlcpy-kernel.o $(AFS_OS_OBJS) + + # These next two allow nfs and nonfs builds to occur in the same directory. + AFSNFSOBJS = \ +@@ -287,7 +289,9 @@ AFSPAGOBJS = \ + xdr_afsuuid.o \ + xdr.o \ + Ktoken.xdr.o \ +- afs_uuid.o $(AFS_OS_PAGOBJS) ++ afs_uuid.o \ ++ strlcat-kernel.o\ ++ strlcpy-kernel.o $(AFS_OS_PAGOBJS) + + + # Compilation rules +@@ -721,10 +725,8 @@ osi_kstat.o: $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_kstat.c + $(CRULE_NOOPT) $(TOP_SRCDIR)/afs/$(MKAFS_OSTYPE)/osi_kstat.c + strlcat-kernel.o: $(TOP_SRCDIR)/external/heimdal/roken/strlcat.c + $(CRULE_OPT) $(TOP_SRCDIR)/external/heimdal/roken/strlcat.c +-CFLAGS-strlcat-kernel.o = -DROKEN_LIB_FUNCTION="" -DROKEN_LIB_CALL="" -DROKEN_LIB_VARIABLE="" + strlcpy-kernel.o: $(TOP_SRCDIR)/external/heimdal/roken/strlcpy.c + $(CRULE_OPT) $(TOP_SRCDIR)/external/heimdal/roken/strlcpy.c +-CFLAGS-strlcpy-kernel.o = -DROKEN_LIB_FUNCTION="" -DROKEN_LIB_CALL="" -DROKEN_LIB_VARIABLE="" + + clean: + -$(RM) -rf STATIC* MODLOAD* $(AFS_OS_CLEAN) +diff --git a/src/libafs/MakefileProto.AIX.in b/src/libafs/MakefileProto.AIX.in +index d0d34f0b1f5..acb963438c8 100644 +--- a/src/libafs/MakefileProto.AIX.in ++++ b/src/libafs/MakefileProto.AIX.in +@@ -25,9 +25,7 @@ AFS_OS_OBJS = \ + osi_timeout.o \ + osi_vcache.o \ + osi_vm.o \ +- rand-fortuna-kernel.o \ +- strlcat-kernel.o \ +- strlcpy-kernel.o ++ rand-fortuna-kernel.o + + AFSNOIAUTHOBJS = \ + afs_call.o \ +diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in +index 6e62c8c97fe..28275005cdb 100644 +--- a/src/libafs/MakefileProto.LINUX.in ++++ b/src/libafs/MakefileProto.LINUX.in +@@ -42,8 +42,7 @@ AFS_OS_OBJS = \ + osi_ioctl.o \ + osi_proc.o \ + osi_vnodeops.o \ +- osi_pagecopy.o \ +- strlcpy-kernel.o ++ osi_pagecopy.o + + AFS_OS_PAGOBJS = \ + osi_alloc.o \ +@@ -60,8 +59,7 @@ AFS_OS_PAGOBJS = \ + osi_flush.o \ + + osi_ioctl.o \ +- osi_pag_module.o \ +- strlcpy-kernel.o ++ osi_pag_module.o + + AFS_OS_NFSOBJS = + +diff --git a/src/rx/rx.c b/src/rx/rx.c +index 3e8954e3580..70f3686c1d4 100644 +--- a/src/rx/rx.c ++++ b/src/rx/rx.c +@@ -31,9 +31,7 @@ + # endif + # include "afs/afs_args.h" + # include "afs/afs_osi.h" +-# ifdef RX_KERNEL_TRACE +-# include "rx_kcommon.h" +-# endif ++# include "rx_kcommon.h" + # if defined(AFS_AIX_ENV) + # include "h/systm.h" + # endif +diff --git a/src/rx/rx_getaddr.c b/src/rx/rx_getaddr.c +index 5bf7ed9c981..1a35ad61656 100644 +--- a/src/rx/rx_getaddr.c ++++ b/src/rx/rx_getaddr.c +@@ -31,11 +31,10 @@ + # include "rx_globals.h" + # endif /* AFS_NT40_ENV */ + #else /* KERNEL */ +-# ifdef UKERNEL +-# include "rx/rx_kcommon.h" +-# else /* UKERNEL */ ++# include "rx/rx_kcommon.h" ++# ifndef UKERNEL + # include "rx/rx.h" +-# endif /* UKERNEL */ ++# endif + #endif /* KERNEL */ + + #define NIFS 512 +diff --git a/src/rx/rx_packet.c b/src/rx/rx_packet.c +index 4d6407bc289..2a3fc54b742 100644 +--- a/src/rx/rx_packet.c ++++ b/src/rx/rx_packet.c +@@ -16,9 +16,7 @@ + # include "afsincludes.h" + # include "rx_kcommon.h" + # else /* defined(UKERNEL) */ +-# ifdef RX_KERNEL_TRACE +-# include "rx_kcommon.h" +-# endif ++# include "rx_kcommon.h" + # include "h/types.h" + # ifndef AFS_LINUX_ENV + # include "h/systm.h" +diff --git a/src/rx/rx_rdwr.c b/src/rx/rx_rdwr.c +index ee1c3e3d430..b620c82ec1e 100644 +--- a/src/rx/rx_rdwr.c ++++ b/src/rx/rx_rdwr.c +@@ -12,9 +12,7 @@ + + #ifdef KERNEL + # ifndef UKERNEL +-# ifdef RX_KERNEL_TRACE +-# include "rx_kcommon.h" +-# endif ++# include "rx_kcommon.h" + # if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) + # include "afs/sysincludes.h" + # else +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0035-LINUX-Make-fs-flush-invalidate-dentry.patch openafs-1.8.10/debian/patches/0035-LINUX-Make-fs-flush-invalidate-dentry.patch --- openafs-1.8.10/debian/patches/0035-LINUX-Make-fs-flush-invalidate-dentry.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0035-LINUX-Make-fs-flush-invalidate-dentry.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,203 @@ +From 748e6b7de63d01a735b7bb100095e5426f2bc7c7 Mon Sep 17 00:00:00 2001 +From: Andrew Deason +Date: Fri, 7 Apr 2023 16:09:30 -0500 +Subject: [PATCH 35/36] LINUX: Make 'fs flush*' invalidate dentry + +Our 'fs flush' and related commands (flushall, flushvolume) clear the +relevant entries in the OpenAFS stat cache and data cache, which can +fix problems if the cache ever becomes incorrect for any reason. (This +can happen after bugs, repairing corrupted volumes, disaster recovery +scenarios, and similar edge cases.) + +However, on Linux, these commands don't affect the VFS dentry cache. +If someone needs to use an 'fs flush' command to fix a problem, this +will fix the OpenAFS cache, but the Linux dcache can still be wrong. +The only way to manually flush dcache entries is to use the global +'drop_caches' mechanism, which is a very heavweight operation, only +accessible to root. + +For example: + + $ ls -l + ls: cannot access foo.1: No such file or directory + total 2 + drwxrwxr-x. 2 bin adeason 2048 Apr 6 14:20 dir + -?????????? ? ? ? ? ? foo.1 + $ fs flush . + $ ls -l + ls: cannot access foo.1: No such file or directory + total 2 + drwxrwxr-x. 2 bin adeason 2048 Apr 6 14:20 dir + -?????????? ? ? ? ? ? foo.1 + $ sudo sysctl -q -w vm.drop_caches=3 + $ ls -l + total 3 + drwxrwxr-x. 2 bin adeason 2048 Apr 6 14:20 dir + -rw-rw-r--. 1 bin adeason 29 Sep 22 2022 foo.1 + +To make the 'fs flush' commands be effective in more situations, +change afs_ResetVCache() to also invalidate the dcache entries +associated with each vcache we reset. To make things simpler and +reduce locking complexity, do this by setting d_time to 0, and don't +directly run dcache-managing functions like d_invalidate or d_drop, +etc. + +The above example now becomes: + + $ ls -l + ls: cannot access foo.1: No such file or directory + total 2 + drwxrwxr-x. 2 bin adeason 2048 Apr 6 14:20 dir + -?????????? ? ? ? ? ? foo.1 + $ fs flush . + $ ls -l + total 3 + drwxrwxr-x. 2 bin adeason 2048 Apr 6 14:20 dir + -rw-rw-r--. 1 bin adeason 29 Sep 22 2022 foo.1 + +Reviewed-on: https://gerrit.openafs.org/15391 +Reviewed-by: Cheyenne Wills +Reviewed-by: Benjamin Kaduk +Tested-by: BuildBot +(cherry picked from commit d460b616ebad763f7e480e194b2bffc28df99721) + +Change-Id: I184046469c396b0421752d91c47477ebe8eaed13 +Reviewed-on: https://gerrit.openafs.org/15515 +Reviewed-by: Andrew Deason +Tested-by: BuildBot +Tested-by: Michael Meffie +Reviewed-by: Michael Meffie +Reviewed-by: Mark Vitale +Reviewed-by: Stephan Wiesand +Signed-off-by: Paolo Pisati +--- + src/afs/LINUX/osi_compat.h | 4 +++ + src/afs/LINUX/osi_vcache.c | 53 +++++++++++++++++++++++++++++++++++ + src/afs/afs_osi.h | 6 ++++ + src/afs/afs_vcache.c | 2 ++ + src/cf/linux-kernel-struct.m4 | 3 ++ + 5 files changed, 68 insertions(+) + +diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h +index 3588799b27a..44bcb440efa 100644 +--- a/src/afs/LINUX/osi_compat.h ++++ b/src/afs/LINUX/osi_compat.h +@@ -49,6 +49,10 @@ typedef struct path afs_linux_path_t; + # define d_alias d_u.d_alias + #endif + ++#if defined(STRUCT_DENTRY_HAS_D_U_D_CHILD) ++# define d_child d_u.d_child ++#endif ++ + #if defined(STRUCT_FILE_HAS_F_PATH) + # if !defined(f_dentry) + # define f_dentry f_path.dentry +diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c +index 38fd3b4b8d5..897fd37abdd 100644 +--- a/src/afs/LINUX/osi_vcache.c ++++ b/src/afs/LINUX/osi_vcache.c +@@ -272,3 +272,56 @@ osi_ShouldDeferRemunlink(struct vcache *avc) + } + return 0; + } ++ ++/* ++ * Invalidate Linux-specific cached data for the given vcache. This doesn't ++ * handle anything with the OpenAFS disk cache or stat cache, etc; those things ++ * are handled by afs_ResetVCache(). ++ * ++ * The Linux-specific stuff we clear here is dcache entries. This means ++ * clearing d_time in all dentry's for the vcache, and all immediate children ++ * (for directories). We don't call d_invalidate() or any similar functions ++ * here; let afs_linux_dentry_revalidate() figure out what to do with the ++ * invalid dentry's whenever they are accessed. ++ * ++ * @pre AFS_GLOCK held ++ */ ++void ++osi_ResetVCache(struct vcache *avc) ++{ ++ struct dentry *dp; ++ struct inode *ip = AFSTOV(avc); ++#if defined(D_ALIAS_IS_HLIST) && !defined(HLIST_ITERATOR_NO_NODE) ++ struct hlist_node *node; ++#endif ++ ++ AFS_GUNLOCK(); ++ ++ afs_d_alias_lock(ip); ++ ++ afs_d_alias_foreach(dp, ip, node) { ++ spin_lock(&dp->d_lock); ++ ++ /* Invalidate the dentry for the given vcache. */ ++ dp->d_time = 0; ++ ++ if (S_ISDIR(ip->i_mode)) { ++ /* ++ * If the vcache is a dir, also invalidate all of its children. ++ * Note that we can lock child->d_lock while dp->d_lock is held, ++ * because 'dp' is an ancestor of 'child'. ++ */ ++ struct dentry *child; ++ list_for_each_entry(child, &dp->d_subdirs, d_child) { ++ spin_lock(&child->d_lock); ++ child->d_time = 0; ++ spin_unlock(&child->d_lock); ++ } ++ } ++ ++ spin_unlock(&dp->d_lock); ++ } ++ afs_d_alias_unlock(ip); ++ ++ AFS_GLOCK(); ++} +diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h +index f92c3f9391d..79c44a985e7 100644 +--- a/src/afs/afs_osi.h ++++ b/src/afs/afs_osi.h +@@ -149,6 +149,12 @@ extern void osi_PrePopulateVCache(struct vcache *); + extern void osi_PostPopulateVCache(struct vcache *); + extern void osi_AttachVnode(struct vcache *, int seq); + ++#ifdef AFS_LINUX_ENV ++extern void osi_ResetVCache(struct vcache *avc); ++#else ++# define osi_ResetVCache(avc) do { } while (0) ++#endif ++ + /** + * Increment the refcount on the given vcache. + * +diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c +index 6d22f6f609c..5644d61e47a 100644 +--- a/src/afs/afs_vcache.c ++++ b/src/afs/afs_vcache.c +@@ -2561,6 +2561,8 @@ afs_ResetVCache(struct vcache *avc, afs_ucred_t *acred, afs_int32 skipdnlc) + afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1); + avc->linkData = NULL; + } ++ ++ osi_ResetVCache(avc); + } + + /*! +diff --git a/src/cf/linux-kernel-struct.m4 b/src/cf/linux-kernel-struct.m4 +index 52e10acb84f..2824ec19861 100644 +--- a/src/cf/linux-kernel-struct.m4 ++++ b/src/cf/linux-kernel-struct.m4 +@@ -14,6 +14,9 @@ AC_CHECK_LINUX_STRUCT([backing_dev_info], [name], + AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h]) + AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h]) + AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h]) ++dnl linux 2.6.16 moved dentry->d_child to dentry->d_u.d_child ++dnl linux 3.19 moved it back to dentry->d_child ++AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_child], [dcache.h]) + AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h]) + AC_CHECK_LINUX_STRUCT([group_info], [gid], [cred.h]) + AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h]) +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/0036-Linux-6.8-use-hlist-iteration-for-dentry-children.patch openafs-1.8.10/debian/patches/0036-Linux-6.8-use-hlist-iteration-for-dentry-children.patch --- openafs-1.8.10/debian/patches/0036-Linux-6.8-use-hlist-iteration-for-dentry-children.patch 1970-01-01 01:00:00.000000000 +0100 +++ openafs-1.8.10/debian/patches/0036-Linux-6.8-use-hlist-iteration-for-dentry-children.patch 2024-05-02 15:42:13.000000000 +0200 @@ -0,0 +1,72 @@ +From d0648e9f0eacf0bb2894bc183ba5a0ec7fb4e399 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Mon, 12 Feb 2024 12:31:30 -0700 +Subject: [PATCH 36/36] 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 +Tested-by: BuildBot +Reviewed-by: Mark Vitale +Reviewed-by: Benjamin Kaduk +(cherry picked from commit 8e0bbe6a07523dd2e7efb3c9d1b4ad9e19fc9bb7) +Signed-off-by: Paolo Pisati +--- + src/afs/LINUX/osi_vcache.c | 10 +++++++++- + src/cf/linux-kernel-struct.m4 | 3 +++ + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c +index 897fd37abdd..43644f44b52 100644 +--- a/src/afs/LINUX/osi_vcache.c ++++ b/src/afs/LINUX/osi_vcache.c +@@ -15,6 +15,14 @@ + + #include "osi_compat.h" + ++#if defined(STRUCT_DENTRY_HAS_D_CHILDREN) ++# define afs_for_each_child(child, parent) \ ++ hlist_for_each_entry((child), &(parent)->d_children, d_sib) ++#else ++# define afs_for_each_child(child, parent) \ ++ list_for_each_entry((child), &(parent)->d_subdirs, d_child) ++#endif ++ + static void + TryEvictDirDentries(struct inode *inode) + { +@@ -312,7 +320,7 @@ osi_ResetVCache(struct vcache *avc) + * because 'dp' is an ancestor of 'child'. + */ + struct dentry *child; +- list_for_each_entry(child, &dp->d_subdirs, d_child) { ++ afs_for_each_child(child, dp) { + spin_lock(&child->d_lock); + child->d_time = 0; + spin_unlock(&child->d_lock); +diff --git a/src/cf/linux-kernel-struct.m4 b/src/cf/linux-kernel-struct.m4 +index 2824ec19861..5cd346fb52b 100644 +--- a/src/cf/linux-kernel-struct.m4 ++++ b/src/cf/linux-kernel-struct.m4 +@@ -17,6 +17,9 @@ AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h]) + dnl linux 2.6.16 moved dentry->d_child to dentry->d_u.d_child + dnl linux 3.19 moved it back to dentry->d_child + AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_child], [dcache.h]) ++dnl linux 6.8 uses hlist for dentry children and renamed ++dnl d_subdirs/d_child to d_childern/d_sib ++AC_CHECK_LINUX_STRUCT([dentry], [d_children], [dcache.h]) + AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h]) + AC_CHECK_LINUX_STRUCT([group_info], [gid], [cred.h]) + AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h]) +-- +2.43.0 + diff -Nru openafs-1.8.10/debian/patches/series openafs-1.8.10/debian/patches/series --- openafs-1.8.10/debian/patches/series 2024-02-29 11:31:06.000000000 +0100 +++ openafs-1.8.10/debian/patches/series 2024-05-02 15:42:13.000000000 +0200 @@ -13,3 +13,14 @@ 0013-dir-Introduce-struct-DirEntryFlex.patch 0014-build-clean-up-some-more-generated-files.patch 0016-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch + +0020-roken-Use-srcdir-for-roken-post.h.patch +0023-LINUX-Minor-osi_vfsop.c-cleanup.patch +0026-cf-Avoid-nested-C-functions-built-by-autoconf.patch +0027-cf-Use-static-allocated-structs-for-cf-tests.patch +0028-cf-Add-function-prototypes-for-linux-conftest.patch +0032-roken-Declare-ct_memcmp-in-hcrypto-kernel-roken.h.patch +0033-Linux-6.8-Use-roken-s-strlcpy-in-kernel-module.patch +0034-afs-Add-prototypes-for-roken-strlcpy-strlcat.patch +0035-LINUX-Make-fs-flush-invalidate-dentry.patch +0036-Linux-6.8-use-hlist-iteration-for-dentry-children.patch