diff options
author | Michael Laß | 2024-01-10 22:10:32 +0100 |
---|---|---|
committer | Michael Laß | 2024-01-10 22:10:32 +0100 |
commit | d0d02bd73898681920696799462647831f777c9a (patch) | |
tree | a9b131f2bf41a5481066af0693b8fcb7d52c3e74 | |
parent | 9b730cd33f59e6465ff0d8ac246aea9571eae504 (diff) | |
download | aur-d0d02bd73898681920696799462647831f777c9a.tar.gz |
Prepare for Linux 6.7
-rw-r--r-- | .SRCINFO | 24 | ||||
-rw-r--r-- | 0001-Linux-6.5-Replace-generic_file_splice_read.patch | 4 | ||||
-rw-r--r-- | 0002-LINUX-Make-sysctl-definitions-more-concise.patch | 4 | ||||
-rw-r--r-- | 0003-Linux-6.5-Use-register_sysctl.patch | 4 | ||||
-rw-r--r-- | 0004-hcrypto-rename-abort-to-_afscrypto_abort.patch | 4 | ||||
-rw-r--r-- | 0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch | 4 | ||||
-rw-r--r-- | 0006-dir-Introduce-struct-DirEntryFlex.patch | 236 | ||||
-rw-r--r-- | 0006-dir-Introduce-struct-DirEntryMax.patch | 184 | ||||
-rw-r--r-- | 0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch | 6 | ||||
-rw-r--r-- | 0008-Linux-6.6-convert-to-ctime-accessor-functions.patch | 8 | ||||
-rw-r--r-- | 0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch | 8 | ||||
-rw-r--r-- | 0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch | 144 | ||||
-rw-r--r-- | PKGBUILD | 31 |
13 files changed, 432 insertions, 229 deletions
@@ -1,7 +1,7 @@ pkgbase = openafs-modules pkgdesc = Kernel module for OpenAFS pkgver = 1.8.10 - pkgrel = 5 + pkgrel = 6 url = http://www.openafs.org install = openafs-modules.install arch = i686 @@ -20,19 +20,21 @@ pkgbase = openafs-modules source = 0003-Linux-6.5-Use-register_sysctl.patch source = 0004-hcrypto-rename-abort-to-_afscrypto_abort.patch source = 0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch - source = 0006-dir-Introduce-struct-DirEntryMax.patch + source = 0006-dir-Introduce-struct-DirEntryFlex.patch source = 0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch source = 0008-Linux-6.6-convert-to-ctime-accessor-functions.patch source = 0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch + source = 0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch sha256sums = 9fec11364623549e8db7374072f5c8f01b841f6bfe7e85673cbce35ff43ffb07 - sha256sums = 9a726876e8a3f99db09cf16df994d01d31673df1953796c6fcd0bc95e3ecafa1 - sha256sums = 7ef226084bc37dd9298ff39c9bc903796ea07841efedc3906bcc4a744e96e57d - sha256sums = b1fa6425438478c79dd97dab6e32e3a8e6ed706f96c9f67c53ede367f9d1ee63 - sha256sums = 34312040d7139dd34341f567cf57e5c3ac4e1622b8a7289146f0a1204479b8a0 - sha256sums = 71ed1aee8d0b8a47ae3c1bceb82121666d8ac4b575475032e0342c45b2d380fc - sha256sums = 9422f8950311a5b2aba2a7b9b429bfe0652b2f41aaa4519a39c7b92a35513c3f - sha256sums = 8ab1ce60ef99c0a3538842f3b8e376c377ec4ca6867d1ccef7379edbb73e102d - sha256sums = 0dd8946890016f3a87869eeb79e1eedf34892d1d00903cb044b70a2e43dd81d8 - sha256sums = ae67a9390f7c9d22cc4fd06964ee5010d90fd5e4cc64ed5137aaf0b36ecfbd32 + sha256sums = 91cf2ee76afaacd7f85ec3cc9bcf35920f54e8b11b68b3b3d8036af742a44e4d + sha256sums = 0779c389864cf514a04734abd318a4e98db88889b04b2fdbe8e2a3816cb872eb + sha256sums = e22896c9cff526e01336849e2032c235707450cf93f6131a8a7e3c86d84e8e5c + sha256sums = 5dacbca5a5afa6ff99b2976fcc70fa760a4f5e9286c21a05ec233b09ce37bb11 + sha256sums = 5213e96c818842210736927e9ef5669fb6b35e6755bb71995fadf3c2ba44e04c + sha256sums = ee60fa3f52a397510eb5c6e2e664eb4e66e9620180a74e54d9c8e9677691f8f0 + sha256sums = 2f2bea9c8a9ea6122af2456725faa41b014687b1681a3c20a0918adf879bfb86 + sha256sums = 12f2f983dd7845758a1d0e6ab1c85358c5660022137dc4f00c3a3d4f8443e7f3 + sha256sums = 37abfa35b2b78956e258137fc66197c118084802f1fb17d4ab9546010c693e6d + sha256sums = cf47ce835da5015d4b0621223a4edad5b096790a4aecac2f6141b70164598243 pkgname = openafs-modules diff --git a/0001-Linux-6.5-Replace-generic_file_splice_read.patch b/0001-Linux-6.5-Replace-generic_file_splice_read.patch index 4844e6280103..95b878cecb32 100644 --- a/0001-Linux-6.5-Replace-generic_file_splice_read.patch +++ b/0001-Linux-6.5-Replace-generic_file_splice_read.patch @@ -1,7 +1,7 @@ From c971e62f522699a0785d7cd028d93dbf203e793c Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Sun, 9 Jul 2023 18:52:23 -0600 -Subject: [PATCH 1/9] Linux 6.5: Replace generic_file_splice_read +Subject: [PATCH 01/10] Linux 6.5: Replace generic_file_splice_read The Linux 6.5 commit: 'splice: Remove generic_file_splice_read()' (c6585011bc) @@ -63,5 +63,5 @@ index ccec38289..dd8b39d5d 100644 .release = afs_linux_release, .fsync = afs_linux_fsync, -- -2.42.1 +2.43.0 diff --git a/0002-LINUX-Make-sysctl-definitions-more-concise.patch b/0002-LINUX-Make-sysctl-definitions-more-concise.patch index bd28eb585ae4..c206b52788f0 100644 --- a/0002-LINUX-Make-sysctl-definitions-more-concise.patch +++ b/0002-LINUX-Make-sysctl-definitions-more-concise.patch @@ -1,7 +1,7 @@ From 17e481aa89cdc480d700cf9741331e12e5944049 Mon Sep 17 00:00:00 2001 From: Andrew Deason <adeason@sinenomine.net> Date: Thu, 18 Jul 2019 22:56:48 -0500 -Subject: [PATCH 2/9] LINUX: Make sysctl definitions more concise +Subject: [PATCH 02/10] LINUX: Make sysctl definitions more concise Our sysctl definitions are quite verbose, and adding new ones involves copying a bunch of lines. Make these a little easier to specify, by @@ -314,5 +314,5 @@ index 8e7dd70e1..894c49412 100644 return -1; -- -2.42.1 +2.43.0 diff --git a/0003-Linux-6.5-Use-register_sysctl.patch b/0003-Linux-6.5-Use-register_sysctl.patch index ae34a129e344..ddec4dca84f4 100644 --- a/0003-Linux-6.5-Use-register_sysctl.patch +++ b/0003-Linux-6.5-Use-register_sysctl.patch @@ -1,7 +1,7 @@ From c96d401d9e044e412ea162d530273476de34211a Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Thu, 13 Jul 2023 10:54:22 -0600 -Subject: [PATCH 3/9] Linux 6.5: Use register_sysctl() +Subject: [PATCH 03/10] Linux 6.5: Use register_sysctl() The linux 6.5 commit: "sysctl: Remove register_sysctl_table" (b8cbc0855a) @@ -103,5 +103,5 @@ index ee22158db..811954915 100644 dnl above tests AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"], -- -2.42.1 +2.43.0 diff --git a/0004-hcrypto-rename-abort-to-_afscrypto_abort.patch b/0004-hcrypto-rename-abort-to-_afscrypto_abort.patch index 8362bf2389b6..6306fadf74dd 100644 --- a/0004-hcrypto-rename-abort-to-_afscrypto_abort.patch +++ b/0004-hcrypto-rename-abort-to-_afscrypto_abort.patch @@ -1,7 +1,7 @@ From 25bebacfd7bf4461cb49bae9cae2a1e97b9cd1c5 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Sun, 9 Jul 2023 18:45:15 -0600 -Subject: [PATCH 4/9] hcrypto: rename abort to _afscrypto_abort +Subject: [PATCH 04/10] hcrypto: rename abort to _afscrypto_abort MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69,5 +69,5 @@ index 9623fa9e7..ea0f60b64 100644 static_inline ssize_t read(int d, void *buf, size_t nbytes) {return -1;} static_inline int close(int d) {return -1;} -- -2.42.1 +2.43.0 diff --git a/0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch b/0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch index bd4981819d21..4793e9632d40 100644 --- a/0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch +++ b/0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch @@ -1,7 +1,7 @@ From bb5b276d6036735cfacad9b27e8d0e50eb2ef819 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Tue, 29 Aug 2023 14:58:10 -0600 -Subject: [PATCH 5/9] linux: Replace fop iterate with fop iterate_shared +Subject: [PATCH 05/10] linux: Replace fop iterate with fop iterate_shared The Linux 6.5 commit: 'vfs: get rid of old '->iterate' directory operation' (3e32715496) @@ -122,5 +122,5 @@ index 8082308e8..52e10acb8 100644 AC_CHECK_LINUX_STRUCT([file_operations], [read_iter], [fs.h]) AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h]) -- -2.42.1 +2.43.0 diff --git a/0006-dir-Introduce-struct-DirEntryFlex.patch b/0006-dir-Introduce-struct-DirEntryFlex.patch new file mode 100644 index 000000000000..1f1c52dac5b7 --- /dev/null +++ b/0006-dir-Introduce-struct-DirEntryFlex.patch @@ -0,0 +1,236 @@ +From d8d6ce951cc2f937cfe9369ab940c278909c26d2 Mon Sep 17 00:00:00 2001 +From: Mark Vitale <mvitale@sinenomine.net> +Date: Fri, 15 Sep 2023 15:01:56 -0400 +Subject: [PATCH 06/10] dir: Introduce struct DirEntryFlex +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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. + +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> +(cherry picked from commit e2ec16cf941b0aadfbd54fc2f52edd58b62e232d) + +Change-Id: Ibf6d3549ba1e941c957e98ef4875152d865c9358 +Reviewed-on: https://gerrit.openafs.org/15599 +Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> +Reviewed-by: Andrew Deason <adeason@sinenomine.net> +Reviewed-by: Mark Vitale <mvitale@sinenomine.net> +Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de> +Tested-by: BuildBot <buildbot@rampaginggeek.com> +Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> +(cherry picked from commit fd527549c2d2b29a955f8c0427ac67c5d49ef38c) +--- + acinclude.m4 | 1 + + src/afs/LINUX/osi_vnodeops.c | 4 ++-- + src/afs/afs_dynroot.c | 4 ++-- + src/cf/c-flexible-array.m4 | 16 ++++++++++++++++ + src/dir/dir.c | 4 ++-- + src/dir/dir.h | 26 ++++++++++++++++++++++++++ + 6 files changed, 49 insertions(+), 6 deletions(-) + create mode 100644 src/cf/c-flexible-array.m4 + +diff --git a/acinclude.m4 b/acinclude.m4 +index 16339682d..812bece98 100644 +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -56,6 +56,7 @@ OPENAFS_HCRYPTO + OPENAFS_CURSES + OPENAFS_C_ATTRIBUTE + OPENAFS_C_PRAGMA ++OPENAFS_C_FLEXIBLE_ARRAY + OPENAFS_MORE_ROKEN_CHECKS + OPENAFS_NETDB_CHECKS + OPENAFS_ROKEN_HEADERS +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index fb62752e6..dc1e32f98 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -426,7 +426,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) + int code; + int offset; + afs_int32 dirpos; +- struct DirEntry *de; ++ struct DirEntryFlex *de; + struct DirBuffer entry; + ino_t ino; + int len; +@@ -531,7 +531,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) + goto unlock_out; + } + +- de = (struct DirEntry *)entry.data; ++ de = entry.data; + ino = afs_calc_inum (avc->f.fid.Cell, avc->f.fid.Fid.Volume, + ntohl(de->fid.vnode)); + len = strlen(de->name); +diff --git a/src/afs/afs_dynroot.c b/src/afs/afs_dynroot.c +index 281b168eb..37200abc1 100644 +--- a/src/afs/afs_dynroot.c ++++ b/src/afs/afs_dynroot.c +@@ -228,7 +228,7 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP, + { + char *dirBase = (char *)dirHeader; + struct PageHeader *pageHeader; +- struct DirEntry *dirEntry; ++ struct DirEntryFlex *dirEntry; + int sizeOfEntry, i, t1, t2; + int curPage = *curPageP; + int curChunk = *curChunkP; +@@ -257,7 +257,7 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP, + dirHeader->alloMap[curPage] = EPP - 1; + } + +- dirEntry = (struct DirEntry *)(pageHeader + curChunk); ++ dirEntry = (struct DirEntryFlex *)(pageHeader + curChunk); + dirEntry->flag = 1; + dirEntry->length = 0; + dirEntry->next = 0; +diff --git a/src/cf/c-flexible-array.m4 b/src/cf/c-flexible-array.m4 +new file mode 100644 +index 000000000..e281166f8 +--- /dev/null ++++ b/src/cf/c-flexible-array.m4 +@@ -0,0 +1,16 @@ ++AC_DEFUN([OPENAFS_C_FLEXIBLE_ARRAY],[ ++ dnl Check to see if the compiler support C99 flexible arrays, e.g., var[] ++ AC_MSG_CHECKING([for C99 flexible arrays]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ++ struct flexarraytest { ++ int flag; ++ int numbers[]; ++ }; ++ ]], [[]]) ++ ], ++ [AC_MSG_RESULT([yes]) ++ AC_DEFINE([HAVE_FLEXIBLE_ARRAY], [1], ++ [Define to 1 if your compiler supports C99 flexible arrays.]) ++ ],[AC_MSG_RESULT([no])] ++ ) ++]) +diff --git a/src/dir/dir.c b/src/dir/dir.c +index bc5bb046d..5e8aff7db 100644 +--- a/src/dir/dir.c ++++ b/src/dir/dir.c +@@ -99,7 +99,7 @@ afs_dir_Create(dir_file_t dir, char *entry, void *voidfid) + int blobs, firstelt; + int i; + struct DirBuffer entrybuf, prevbuf, headerbuf; +- struct DirEntry *ep; ++ struct DirEntryFlex *ep; + struct DirHeader *dhp; + int code; + size_t rlen; +@@ -127,7 +127,7 @@ afs_dir_Create(dir_file_t dir, char *entry, void *voidfid) + /* First, we fill in the directory entry. */ + if (afs_dir_GetBlob(dir, firstelt, &entrybuf) != 0) + return EIO; +- ep = (struct DirEntry *)entrybuf.data; ++ ep = entrybuf.data; + + ep->flag = FFIRST; + ep->fid.vnode = htonl(vfid[1]); +diff --git a/src/dir/dir.h b/src/dir/dir.h +index f5c8eef42..ad6db07e6 100644 +--- a/src/dir/dir.h ++++ b/src/dir/dir.h +@@ -51,6 +51,32 @@ struct DirHeader { + unsigned short hashTable[NHASHENT]; + }; + ++/* ++ * This struct is just a copy of DirEntry, but with name defined as a flexible ++ * array if possible. ++ * ++ * Using this helps us convince safety-minded string functions (e.g. ++ * _FORTIFY_SOURCE) that an OpenAFS directory entry name really does fit ++ * in the allotted space, and thus avoid undefined behavior. ++ */ ++struct DirEntryFlex { ++ char flag; ++ char length; /* currently unused */ ++ unsigned short next; ++ struct MKFid fid; ++#ifdef HAVE_FLEXIBLE_ARRAY ++ char name[]; ++#else ++ char name[16]; ++#endif ++}; ++ ++/* ++ * This struct was the original format for directory entries in very early ++ * versions of AFS. But now it just represents the minimum possible on-disk ++ * representation of a directory entry. The 16-character limit was relieved by ++ * the introduction of extension struct DirXEntry in AFS-2. ++*/ + struct DirEntry { + /* A directory entry */ + char flag; +-- +2.43.0 + diff --git a/0006-dir-Introduce-struct-DirEntryMax.patch b/0006-dir-Introduce-struct-DirEntryMax.patch deleted file mode 100644 index b33a97dfb55c..000000000000 --- a/0006-dir-Introduce-struct-DirEntryMax.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 6578eb24b6f71d3f6e5b489658d47ad2f18ff2ac Mon Sep 17 00:00:00 2001 -From: Mark Vitale <mvitale@sinenomine.net> -Date: Fri, 15 Sep 2023 15:01:56 -0400 -Subject: [PATCH 6/9] dir: Introduce struct DirEntryMax - -Since the introduction of AFS3, the directory package has allocated -space for each directory entry by allocating a DirEntry struct followed -by 0-8 contiguous DirEntryX 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 DirEntryX blocks) -with open code. Most existing code write the entry's name via a string -copy operation to DirEntry->name, which is only 16 bytes long. The -maximum supported directory name is AFSNAMEMAX 256 (+1 for the required -terminating nul). Therefore, for dir entry names that are 16 bytes or -longer, OpenAFS routinely does string copies that look like buffer -overruns, but are "safe" (barring undefined behavior) due to the -guaranteed presence of sufficient additional DirEntryX blocks. - -Recent changes in the OpenAFS build chain have made this approach no -longer viable: - -1) -Linux 6.3 commit 439a1bcac648fe9b59210cde8991fb2acf37bdab 'fortify: Use -__builtin_dynamic_object_size() when available' 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.3 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>".) - -Create a new overlay struct - DirEntryMax - with a name size of -AFSNAMEMAX + 1. Whenever we write a directory name, cast the existing -DirEntry pointer to DirEntryMax 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. - -Change-Id: I6da5c6c295f051be90017084e5b3a3ef24d1271f ---- - src/afs/LINUX/osi_vnodeops.c | 4 ++-- - src/afs/afs_dynroot.c | 4 ++-- - src/dir/dir.c | 4 ++-- - src/dir/dir.h | 34 +++++++++++++++++++++++++++++++++- - 4 files changed, 39 insertions(+), 7 deletions(-) - -diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c -index fb62752e6..4e33a189e 100644 ---- a/src/afs/LINUX/osi_vnodeops.c -+++ b/src/afs/LINUX/osi_vnodeops.c -@@ -426,7 +426,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) - int code; - int offset; - afs_int32 dirpos; -- struct DirEntry *de; -+ struct DirEntryMax *de; - struct DirBuffer entry; - ino_t ino; - int len; -@@ -531,7 +531,7 @@ afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) - goto unlock_out; - } - -- de = (struct DirEntry *)entry.data; -+ de = entry.data; - ino = afs_calc_inum (avc->f.fid.Cell, avc->f.fid.Fid.Volume, - ntohl(de->fid.vnode)); - len = strlen(de->name); -diff --git a/src/afs/afs_dynroot.c b/src/afs/afs_dynroot.c -index 281b168eb..79f5d9254 100644 ---- a/src/afs/afs_dynroot.c -+++ b/src/afs/afs_dynroot.c -@@ -228,7 +228,7 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP, - { - char *dirBase = (char *)dirHeader; - struct PageHeader *pageHeader; -- struct DirEntry *dirEntry; -+ struct DirEntryMax *dirEntry; - int sizeOfEntry, i, t1, t2; - int curPage = *curPageP; - int curChunk = *curChunkP; -@@ -257,7 +257,7 @@ afs_dynroot_addDirEnt(struct DirHeader *dirHeader, int *curPageP, - dirHeader->alloMap[curPage] = EPP - 1; - } - -- dirEntry = (struct DirEntry *)(pageHeader + curChunk); -+ dirEntry = (struct DirEntryMax *)(pageHeader + curChunk); - dirEntry->flag = 1; - dirEntry->length = 0; - dirEntry->next = 0; -diff --git a/src/dir/dir.c b/src/dir/dir.c -index bc5bb046d..b31a9ac46 100644 ---- a/src/dir/dir.c -+++ b/src/dir/dir.c -@@ -99,7 +99,7 @@ afs_dir_Create(dir_file_t dir, char *entry, void *voidfid) - int blobs, firstelt; - int i; - struct DirBuffer entrybuf, prevbuf, headerbuf; -- struct DirEntry *ep; -+ struct DirEntryMax *ep; - struct DirHeader *dhp; - int code; - size_t rlen; -@@ -127,7 +127,7 @@ afs_dir_Create(dir_file_t dir, char *entry, void *voidfid) - /* First, we fill in the directory entry. */ - if (afs_dir_GetBlob(dir, firstelt, &entrybuf) != 0) - return EIO; -- ep = (struct DirEntry *)entrybuf.data; -+ ep = entrybuf.data; - - ep->flag = FFIRST; - ep->fid.vnode = htonl(vfid[1]); -diff --git a/src/dir/dir.h b/src/dir/dir.h -index f5c8eef42..a26dab0c0 100644 ---- a/src/dir/dir.h -+++ b/src/dir/dir.h -@@ -11,6 +11,8 @@ - - #define __AFS_DIR_H - -+#include <afs/afsint.h> -+ - #define AFS_PAGESIZE 2048 /* bytes per page */ - #define NHASHENT 128 /* entries in the hash tbl */ - #define MAXPAGES 128 /* max pages in a dir */ -@@ -51,7 +53,37 @@ struct DirHeader { - unsigned short hashTable[NHASHENT]; - }; - --struct DirEntry { -+/* -+ * This struct is just a copy of DirEntry with the maximum supported name -+ * length. It provides a more logical view of a maximum directory entry name -+ * which consists of a DirEntry struct followed by 8 consecutive DirEntryX -+ * structs. -+ * -+ * Using this helps us convince safety-minded string functions (e.g. -+ * CONFIG_FORTIFY_SOURCE) that an OpenAFS directory entry name really does fit -+ * in the allotted space, and thus avoid undefined behavior. -+ * -+ * NOTE: The size of name[] should be considered an upper bound for the current -+ * users of the directory package. (The directory package limit for an entry -+ * are actually much higher; up to an entire directory page.) However, the -+ * actual amount of space available/allocated for a given directory entry name -+ * may often be smaller. -+ */ -+struct DirEntryMax { -+ /* A directory entry - the biggest. */ -+ char flag; -+ char length; -+ unsigned short next; -+ struct MKFid fid; -+ char name[AFSNAMEMAX + 1]; /* max possible plus terminating NUL */ -+}; -+ -+/* -+ * This struct formerly described the format of directory entries in AFS2. -+ * Since the introduction of DirEntryX in AFS3, DirEntry merely describes the -+ * minimum possible directory entry. -+*/ -+ struct DirEntry { - /* A directory entry */ - char flag; - char length; /* currently unused */ --- -2.42.1 - diff --git a/0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch b/0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch index e608d56d1004..2d4ff432a702 100644 --- a/0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch +++ b/0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch @@ -1,7 +1,7 @@ -From 3ea74b4e38a47c8dd3b2cde5445c5db7021267b1 Mon Sep 17 00:00:00 2001 +From c90ef42fcbe39270e8bfc3089e2cf1ce7ecbce16 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Wed, 6 Sep 2023 11:41:55 -0600 -Subject: [PATCH 7/9] LINUX: Pass an array of structs to register_sysctl +Subject: [PATCH 07/10] 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 @@ -57,5 +57,5 @@ index 145725575..105e58cce 100644 dnl Linux 6.5 removed the file_operations method 'iterate'. Filesystems should dnl using the iterate_shared method (introduced in linux 4.6). Linux 6.4 -- -2.42.1 +2.43.0 diff --git a/0008-Linux-6.6-convert-to-ctime-accessor-functions.patch b/0008-Linux-6.6-convert-to-ctime-accessor-functions.patch index 482fe7f2bb97..f6611f8c0a76 100644 --- a/0008-Linux-6.6-convert-to-ctime-accessor-functions.patch +++ b/0008-Linux-6.6-convert-to-ctime-accessor-functions.patch @@ -1,7 +1,7 @@ -From 381607a5840eac886bbc6737e19acf5b942fe671 Mon Sep 17 00:00:00 2001 +From 767e4924190a6db61a98a633894c25c74af39fd5 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Thu, 5 Oct 2023 14:44:49 -0600 -Subject: [PATCH 8/9] Linux 6.6: convert to ctime accessor functions +Subject: [PATCH 08/10] 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. @@ -70,7 +70,7 @@ index 2220e0530..f9ceb359e 100644 #define gop_lookupname osi_lookupname diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c -index 4e33a189e..1eb99d1d4 100644 +index dc1e32f98..903b5dd5c 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1144,8 +1144,7 @@ vattr2inode(struct inode *ip, struct vattr *vp) @@ -101,5 +101,5 @@ index 105e58cce..dc26b6056 100644 dnl above tests AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"], -- -2.42.1 +2.43.0 diff --git a/0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch b/0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch index 1a961517969f..4d81dcaf80c6 100644 --- a/0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch +++ b/0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch @@ -1,7 +1,7 @@ -From 0f36a779b39e7b020f2ea841b59bfe06ddf9773f Mon Sep 17 00:00:00 2001 +From 75ada815f0177b2e90ee8e2f8b08124eb9abf604 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills <cwills@sinenomine.net> Date: Mon, 18 Sep 2023 12:23:01 -0600 -Subject: [PATCH 9/9] Linux 6.6: Pass request_mask to generic_fillattr +Subject: [PATCH 09/10] 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 @@ -39,7 +39,7 @@ Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de> 3 files changed, 18 insertions(+) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c -index 1eb99d1d4..8a49781b9 100644 +index 903b5dd5c..86dd7b473 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1195,7 +1195,11 @@ afs_linux_getattr(struct mnt_idmap *idmap, const struct path *path, struct kstat @@ -88,5 +88,5 @@ index 0d6b645f4..f15c6b94d 100644 + []) +]) -- -2.42.1 +2.43.0 diff --git a/0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch b/0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch new file mode 100644 index 000000000000..f410dd938ee1 --- /dev/null +++ b/0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch @@ -0,0 +1,144 @@ +From 99d55938f14c517c1c81e5d91fed38ac2ad8a4b9 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills <cwills@sinenomine.net> +Date: Thu, 9 Nov 2023 10:38:29 -0700 +Subject: [PATCH 10/10] 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" (072c7934cd1) + +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 (072c7934cd1) 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. + +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> +(cherry picked from commit 8962767a7e27f8db9dc9001999edf573be706d66) + +Change-Id: If5f58df74f37749b7dfdc52172a8e9573d849ecd +Reviewed-on: https://gerrit.openafs.org/15600 +Reviewed-by: Andrew Deason <adeason@sinenomine.net> +Reviewed-by: Mark Vitale <mvitale@sinenomine.net> +Reviewed-by: Michael Meffie <mmeffie@sinenomine.net> +Tested-by: BuildBot <buildbot@rampaginggeek.com> +Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> +(cherry picked from commit 6edf9d350c6ffd9d5e51fb8106701c1bc2f6a4d9) +--- + src/afs/LINUX/osi_file.c | 5 ++--- + src/afs/LINUX/osi_machdep.h | 29 +++++++++++++++++++++++++++++ + src/afs/LINUX/osi_vnodeops.c | 6 ++---- + src/cf/linux-kernel-func.m4 | 8 ++++++++ + 4 files changed, 41 insertions(+), 7 deletions(-) + +diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c +index b8bdce7e7..6dbfc155f 100644 +--- a/src/afs/LINUX/osi_file.c ++++ b/src/afs/LINUX/osi_file.c +@@ -175,9 +175,8 @@ afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat) + { + AFS_STATCNT(osi_Stat); + astat->size = i_size_read(OSIFILE_INODE(afile)); +- astat->mtime = OSIFILE_INODE(afile)->i_mtime.tv_sec; +- astat->atime = OSIFILE_INODE(afile)->i_atime.tv_sec; +- ++ astat->mtime = afs_inode_get_mtime_sec(OSIFILE_INODE(afile)); ++ astat->atime = afs_inode_get_atime_sec(OSIFILE_INODE(afile)); + return 0; + } + +diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h +index f9ceb359e..f08ae8223 100644 +--- a/src/afs/LINUX/osi_machdep.h ++++ b/src/afs/LINUX/osi_machdep.h +@@ -128,6 +128,35 @@ afs_inode_set_ctime(struct inode *inode, time64_t sec, long nsec) + inode->i_ctime.tv_nsec = nsec; + } + #endif ++#if defined(HAVE_LINUX_INODE_ATIME_MTIME_ACCESSORS) ++# define afs_inode_set_atime(inode, sec, nsec) inode_set_atime((inode), (sec), (nsec)) ++# define afs_inode_get_atime_sec(inode) inode_get_atime_sec((inode)) ++# define afs_inode_set_mtime(inode, sec, nsec) inode_set_mtime((inode), (sec), (nsec)) ++# define afs_inode_get_mtime_sec(inode) inode_get_mtime_sec((inode)) ++#else ++static inline void ++afs_inode_set_atime(struct inode *inode, time_t sec, long nsec) ++{ ++ inode->i_atime.tv_sec = sec; ++ inode->i_atime.tv_nsec = nsec; ++} ++static inline time_t ++afs_inode_get_atime_sec(struct inode *inode) ++{ ++ return inode->i_atime.tv_sec; ++} ++static inline void ++afs_inode_set_mtime(struct inode *inode, time_t sec, long nsec) ++{ ++ inode->i_mtime.tv_sec = sec; ++ inode->i_mtime.tv_nsec = nsec; ++} ++static inline time_t ++afs_inode_get_mtime_sec(struct inode *inode) ++{ ++ return inode->i_mtime.tv_sec; ++} ++#endif /* HAVE_LINUX_INODE_ATIME_MTIME_ACCESSORS */ + + #undef gop_lookupname + #define gop_lookupname osi_lookupname +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 86dd7b473..7e85aa552 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -1136,14 +1136,12 @@ vattr2inode(struct inode *ip, struct vattr *vp) + ip->i_uid = afs_make_kuid(vp->va_uid); + ip->i_gid = afs_make_kgid(vp->va_gid); + i_size_write(ip, vp->va_size); +- ip->i_atime.tv_sec = vp->va_atime.tv_sec; +- ip->i_atime.tv_nsec = 0; +- ip->i_mtime.tv_sec = vp->va_mtime.tv_sec; ++ afs_inode_set_atime(ip, vp->va_atime.tv_sec, 0); + /* Set the mtime nanoseconds to the sysname generation number. + * This convinces NFS clients that all directories have changed + * any time the sysname list changes. + */ +- ip->i_mtime.tv_nsec = afs_sysnamegen; ++ afs_inode_set_mtime(ip, vp->va_mtime.tv_sec, afs_sysnamegen); + afs_inode_set_ctime(ip, vp->va_ctime.tv_sec, 0); + } + +diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 +index dc26b6056..7f3000fc1 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -244,6 +244,14 @@ AC_CHECK_LINUX_FUNC([inode_set_ctime], + [#include <linux/fs.h>], + [inode_set_ctime(NULL, 0, 0);]) + ++dnl Linux 6.7 requires the use of a getter/setter for accessing a inode's ++dnl atime and mtime members. Test for the setters. Assummes that the ++dnl getters are present if the setters are. ++AC_CHECK_LINUX_FUNC([inode_atime_mtime_accessors], ++ [#include <linux/fs.h>], ++ [inode_set_atime(NULL, 0, 0); ++ inode_set_mtime(NULL, 0, 0);]) ++ + 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"], +-- +2.43.0 + @@ -6,7 +6,7 @@ pkgname=openafs-modules _srcname=openafs pkgver=1.8.10 -pkgrel=5 +pkgrel=6 pkgdesc="Kernel module for OpenAFS" arch=('i686' 'x86_64' 'armv7h') url="http://www.openafs.org" @@ -22,20 +22,22 @@ source=(http://openafs.org/dl/openafs/${pkgver}/${_srcname}-${pkgver}-src.tar.bz 0003-Linux-6.5-Use-register_sysctl.patch 0004-hcrypto-rename-abort-to-_afscrypto_abort.patch 0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch - 0006-dir-Introduce-struct-DirEntryMax.patch + 0006-dir-Introduce-struct-DirEntryFlex.patch 0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch 0008-Linux-6.6-convert-to-ctime-accessor-functions.patch - 0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch) + 0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch + 0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch) sha256sums=('9fec11364623549e8db7374072f5c8f01b841f6bfe7e85673cbce35ff43ffb07' - '9a726876e8a3f99db09cf16df994d01d31673df1953796c6fcd0bc95e3ecafa1' - '7ef226084bc37dd9298ff39c9bc903796ea07841efedc3906bcc4a744e96e57d' - 'b1fa6425438478c79dd97dab6e32e3a8e6ed706f96c9f67c53ede367f9d1ee63' - '34312040d7139dd34341f567cf57e5c3ac4e1622b8a7289146f0a1204479b8a0' - '71ed1aee8d0b8a47ae3c1bceb82121666d8ac4b575475032e0342c45b2d380fc' - '9422f8950311a5b2aba2a7b9b429bfe0652b2f41aaa4519a39c7b92a35513c3f' - '8ab1ce60ef99c0a3538842f3b8e376c377ec4ca6867d1ccef7379edbb73e102d' - '0dd8946890016f3a87869eeb79e1eedf34892d1d00903cb044b70a2e43dd81d8' - 'ae67a9390f7c9d22cc4fd06964ee5010d90fd5e4cc64ed5137aaf0b36ecfbd32') + '91cf2ee76afaacd7f85ec3cc9bcf35920f54e8b11b68b3b3d8036af742a44e4d' + '0779c389864cf514a04734abd318a4e98db88889b04b2fdbe8e2a3816cb872eb' + 'e22896c9cff526e01336849e2032c235707450cf93f6131a8a7e3c86d84e8e5c' + '5dacbca5a5afa6ff99b2976fcc70fa760a4f5e9286c21a05ec233b09ce37bb11' + '5213e96c818842210736927e9ef5669fb6b35e6755bb71995fadf3c2ba44e04c' + 'ee60fa3f52a397510eb5c6e2e664eb4e66e9620180a74e54d9c8e9677691f8f0' + '2f2bea9c8a9ea6122af2456725faa41b014687b1681a3c20a0918adf879bfb86' + '12f2f983dd7845758a1d0e6ab1c85358c5660022137dc4f00c3a3d4f8443e7f3' + '37abfa35b2b78956e258137fc66197c118084802f1fb17d4ab9546010c693e6d' + 'cf47ce835da5015d4b0621223a4edad5b096790a4aecac2f6141b70164598243') # Heuristic to determine version of installed kernel # You can modify this if the heuristic fails @@ -56,13 +58,16 @@ prepare() { patch -p1 < "${srcdir}"/0003-Linux-6.5-Use-register_sysctl.patch patch -p1 < "${srcdir}"/0004-hcrypto-rename-abort-to-_afscrypto_abort.patch patch -p1 < "${srcdir}"/0005-linux-Replace-fop-iterate-with-fop-iterate_shared.patch - patch -p1 < "${srcdir}"/0006-dir-Introduce-struct-DirEntryMax.patch + patch -p1 < "${srcdir}"/0006-dir-Introduce-struct-DirEntryFlex.patch # Patches for Linux 6.6 patch -p1 < "${srcdir}"/0007-LINUX-Pass-an-array-of-structs-to-register_sysctl.patch patch -p1 < "${srcdir}"/0008-Linux-6.6-convert-to-ctime-accessor-functions.patch patch -p1 < "${srcdir}"/0009-Linux-6.6-Pass-request_mask-to-generic_fillattr.patch + # Patches for Linux 6.7 + patch -p1 < "${srcdir}"/0010-Linux-6.7-convert-to-inode-a-mtime-accessor-funcs.patch + # Only needed when changes to configure were made ./regen.sh -q } |