summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Laß2021-02-19 16:12:58 +0100
committerMichael Laß2021-02-19 16:12:58 +0100
commit6e12ff010a73c6f610c37dc72668a001c710cab9 (patch)
treeac47480762448f8e3f48b3fb5192fc032c937e52
parent84897ed5bfa857b7dc37a8e6132ff3df9af75b9d (diff)
downloadaur-openafs-modules-dkms.tar.gz
Prepare for Linux 5.11
-rw-r--r--.SRCINFO18
-rw-r--r--0001-Avoid-duplicate-definitions-of-globals.patch4
-rw-r--r--0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch4
-rw-r--r--0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch4
-rw-r--r--0004-LINUX-5.8-use-lru_cache_add.patch4
-rw-r--r--0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch4
-rw-r--r--0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch73
-rw-r--r--0007-Linux-Refactor-test-for-32bit-compat.patch212
-rw-r--r--0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch98
-rw-r--r--PKGBUILD25
10 files changed, 423 insertions, 23 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7a7e3b5c363..63a0d33c208 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = openafs-modules-dkms
pkgdesc = Kernel module for OpenAFS (dkms)
pkgver = 1.8.7
- pkgrel = 1
+ pkgrel = 2
url = http://www.openafs.org
arch = i686
arch = x86_64
@@ -22,13 +22,19 @@ pkgbase = openafs-modules-dkms
source = 0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
source = 0004-LINUX-5.8-use-lru_cache_add.patch
source = 0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+ source = 0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
+ source = 0007-Linux-Refactor-test-for-32bit-compat.patch
+ source = 0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
sha256sums = 53543a561fce67714fec9f2a6bf408c5cc1d061c7dc9d1459458275e8ccbfa79
sha256sums = 5ea5e184f9b44f5ed45817d2b5a10149d15c8c54f49e0b5b4b773652673cb9b0
- sha256sums = 18634d85ca4dec3366533a2767e652dab27202667de1d04f578f40a94d8ec15a
- sha256sums = 4b9d269e2b3c214f9240917b9d895b41e09c1afdbef75e30a0db02a240bf9b0e
- sha256sums = 9e630d2029c113f482c321007522ce887273250c4125aa6fee1229aa78e8f8c3
- sha256sums = 6deaa098e7e6113c426d9449c5b6252c76dfbe4a67705420215ae501de8e9f0d
- sha256sums = 3a0a022a8a4cb1034e60dec9c55727e1be846080f5923a7edcc7e18fe6b57606
+ sha256sums = 89d423281ae4664467ff583d664cd014362f0f829f2bb1ef76809593626b55e0
+ sha256sums = cceb2501cca12956644718c64db1c8c0e8d460afbbde302045427f0610b60a92
+ sha256sums = 729f14132a917c2397f4dc713d31c74c0a278c7359c5dd4edc3758fb08e534c4
+ sha256sums = 73b69cea6eef193457091090fe2c6ae090040537395618dcb47c770196bc14ef
+ sha256sums = aef54d871c376648ef712e9cc224aa65ef012762a28778d53d509a72f99d174e
+ sha256sums = 38eaec2c4e08d45b4aa130ec581ed1e265950553432d8dd878f99decc54416de
+ sha256sums = c62380c6284f7da43234c7c2bea8503851cd455e0c06d688bbafb1d77cdbd476
+ sha256sums = ebb0c7ddd0fde966e35c277c7474abc39772a1bbaa601e7a678c95aad31bfb48
pkgname = openafs-modules-dkms
diff --git a/0001-Avoid-duplicate-definitions-of-globals.patch b/0001-Avoid-duplicate-definitions-of-globals.patch
index a2f77c7e0ed..960bddf48a8 100644
--- a/0001-Avoid-duplicate-definitions-of-globals.patch
+++ b/0001-Avoid-duplicate-definitions-of-globals.patch
@@ -1,7 +1,7 @@
From ac4debb46bc0b95ff2f98d416703bc8df60b8415 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 22 May 2020 12:16:48 -0600
-Subject: [PATCH 1/5] Avoid duplicate definitions of globals
+Subject: [PATCH 1/8] Avoid duplicate definitions of globals
GCC 10 changed a default flag from -fcommon to -fno-common. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678 for some background.
@@ -349,5 +349,5 @@ index 853c2121e..d58ecf014 100644
printf("[%s] Returned from LWP_WaitProcess()\n", rn);
if (waitCode) {
--
-2.30.0
+2.30.1
diff --git a/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch b/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
index c4f60ce4c9a..43d5ee53cab 100644
--- a/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
+++ b/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
@@ -1,7 +1,7 @@
From 509169ed302741e2499fbb116ed08408c08d3999 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:33:51 -0600
-Subject: [PATCH 2/5] LINUX 5.8: Replace kernel_setsockopt with new funcs
+Subject: [PATCH 2/8] LINUX 5.8: Replace kernel_setsockopt with new funcs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -155,5 +155,5 @@ index 9fbb563f3..50607c8f5 100644
return (osi_socket *)sockp;
}
--
-2.30.0
+2.30.1
diff --git a/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch b/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
index 8b8a9f342bf..42937a90daf 100644
--- a/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
+++ b/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
@@ -1,7 +1,7 @@
From 2daa3a8f5771539203d9eb8c4e23b01ed7c65a16 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:34:42 -0600
-Subject: [PATCH 3/5] LINUX 5.8: do not set name field in backing_dev_info
+Subject: [PATCH 3/8] LINUX 5.8: do not set name field in backing_dev_info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -45,5 +45,5 @@ index 8bbb5f225..ca1d5c83b 100644
#else
/* used for inodes backing_dev_info field, also */
--
-2.30.0
+2.30.1
diff --git a/0004-LINUX-5.8-use-lru_cache_add.patch b/0004-LINUX-5.8-use-lru_cache_add.patch
index 1388afd8eea..397c131c72e 100644
--- a/0004-LINUX-5.8-use-lru_cache_add.patch
+++ b/0004-LINUX-5.8-use-lru_cache_add.patch
@@ -1,7 +1,7 @@
From d1c503f83a2cf85c6fbf7aab24728a5f0787c54c Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:35:06 -0600
-Subject: [PATCH 4/5] LINUX 5.8: use lru_cache_add
+Subject: [PATCH 4/8] LINUX 5.8: use lru_cache_add
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -104,5 +104,5 @@ index 78ff48294..11d071806 100644
dnl e.g. ip_sock_set_mtu_discover, ip_sock_set_recverr
AC_CHECK_LINUX_FUNC([ip_sock_set],
--
-2.30.0
+2.30.1
diff --git a/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch b/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
index 0f2a5b8e3ab..e991702fef4 100644
--- a/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+++ b/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
@@ -1,7 +1,7 @@
From c3b7278663c0e88daa611e7c1cc250e63639a496 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 21 Aug 2020 10:37:51 -0600
-Subject: [PATCH 5/5] LINUX 5.9: Remove HAVE_UNLOCKED_IOCTL/COMPAT_IOCTL
+Subject: [PATCH 5/8] LINUX 5.9: Remove HAVE_UNLOCKED_IOCTL/COMPAT_IOCTL
Linux-5.9-rc1 commit 'fs: remove the HAVE_UNLOCKED_IOCTL and
HAVE_COMPAT_IOCTL defines' (4e24566a) removed the two referenced macros
@@ -165,5 +165,5 @@ index 36a4f685e..ba4f1e6af 100644
.open = afs_linux_open,
.flush = afs_linux_flush,
--
-2.30.0
+2.30.1
diff --git a/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch b/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
new file mode 100644
index 00000000000..501beaf5e7c
--- /dev/null
+++ b/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
@@ -0,0 +1,73 @@
+From 95a8c71f80e6d0aa83297fedf9f808ee01c32623 Mon Sep 17 00:00:00 2001
+From: Andrew Deason <adeason@sinenomine.net>
+Date: Thu, 28 Jan 2021 16:59:47 -0600
+Subject: [PATCH 6/8] LINUX: Fix includes for fatal_signal_pending test
+
+Commit 8b6ae289 (LINUX: Avoid lookup ENOENT on fatal signals) added a
+configure test for fatal_signal_pending(). However, this check fails
+incorrectly ever since Linux 4.11, because fatal_signal_pending() was moved
+from linux/sched.h to linux/sched/signal.h in Linux commit 2a1f062a
+(sched/headers: Move signal wakeup [...]). Fix this by including
+linux/sched/signal.h if we have it during the configure test.
+
+A false negative on this configure test doesn't break the build, but
+it disables one of our safeguards preventing incorrect negative
+dentries at runtime. The function fatal_signal_pending() hasn't
+changed in quite some time (except for what header it lives in); it
+was introduced in Linux 2.6.25 via Linux commit f776d12d (Add
+fatal_signal_pending). So to try to avoid this mistake again in the
+future, make it so a missing fatal_signal_pending() breaks the build
+if we're on Linux 2.6.25+.
+
+Reviewed-on: https://gerrit.openafs.org/14508
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+(cherry picked from commit 0c1465e4f3310daa54f1e799f76237604222666d)
+
+Change-Id: I1334c060f8ab5733461ebf7c191dffa7be830021
+Reviewed-on: https://gerrit.openafs.org/14509
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_vnodeops.c | 2 ++
+ src/cf/linux-kernel-func.m4 | 7 ++++++-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index ba4f1e6af..4d0f55c95 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1206,6 +1206,8 @@ filter_enoent(int code)
+ if (code == ENOENT && fatal_signal_pending(current)) {
+ return EINTR;
+ }
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
++# error fatal_signal_pending not available, but it should be
+ #endif
+ return code;
+ }
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index 11d071806..e45a30540 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -42,8 +42,13 @@ AC_CHECK_LINUX_FUNC([d_make_root],
+ AC_CHECK_LINUX_FUNC([do_sync_read],
+ [#include <linux/fs.h>],
+ [do_sync_read(NULL, NULL, 0, NULL);])
++dnl - fatal_signal_pending introduced in 2.6.25
++dnl - moved from linux/sched.h to linux/sched/signal.h in 4.11
+ AC_CHECK_LINUX_FUNC([fatal_signal_pending],
+- [#include <linux/sched.h>],
++ [#include <linux/sched.h>
++ #ifdef HAVE_LINUX_SCHED_SIGNAL_H
++ # include <linux/sched/signal.h>
++ #endif],
+ [fatal_signal_pending(NULL);])
+ AC_CHECK_LINUX_FUNC([file_dentry],
+ [#include <linux/fs.h>],
+--
+2.30.1
+
diff --git a/0007-Linux-Refactor-test-for-32bit-compat.patch b/0007-Linux-Refactor-test-for-32bit-compat.patch
new file mode 100644
index 00000000000..89137c7c8d0
--- /dev/null
+++ b/0007-Linux-Refactor-test-for-32bit-compat.patch
@@ -0,0 +1,212 @@
+From 7efd65a984e5b50904e556992f533c460d9fcf9e Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 29 Jan 2021 11:32:36 -0700
+Subject: [PATCH 7/8] Linux: Refactor test for 32bit compat
+
+Refactor the preprocessor checks for determining the method to test for
+32bit compatibility (64bit kernel performing work for a 32bit task) into
+a common inline function, 'afs_in_compat_syscall' that is defined in
+LINUX/osi_machdep.h. Update osi_ioctl.c and afs_syscall.c to use
+afs_in_compat_syscall.
+
+Add include afs/sysincludes into osi_machdep.h to ensure linux/compat.h
+is pulled for the functions called in afs_in_compat_syscall.
+
+Reviewed-on: https://gerrit.openafs.org/14500
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 32cc6b0796495e596262d84c428172a511f757c4)
+
+Change-Id: I746e5777737d49381c4a74627b79d2a61cbd4f8e
+Reviewed-on: https://gerrit.openafs.org/14510
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_ioctl.c | 14 ++------
+ src/afs/LINUX/osi_machdep.h | 40 +++++++++++++++++++++
+ src/afs/afs_syscall.c | 70 +++----------------------------------
+ 3 files changed, 47 insertions(+), 77 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_ioctl.c b/src/afs/LINUX/osi_ioctl.c
+index 9ba076a1b..7d355674d 100644
+--- a/src/afs/LINUX/osi_ioctl.c
++++ b/src/afs/LINUX/osi_ioctl.c
+@@ -43,21 +43,13 @@ afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ {
+
+ struct afsprocdata sysargs;
+-#ifdef NEED_IOCTL32
+- struct afsprocdata32 sysargs32;
+-#endif
+
+ if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL;
+
+ #ifdef NEED_IOCTL32
+-# if defined(AFS_S390X_LINUX26_ENV)
+- if (test_thread_flag(TIF_31BIT))
+-# elif defined(AFS_AMD64_LINUX20_ENV)
+- if (test_thread_flag(TIF_IA32))
+-# else
+- if (test_thread_flag(TIF_32BIT))
+-# endif /* AFS_S390X_LINUX26_ENV */
+- {
++ if (afs_in_compat_syscall()) {
++ struct afsprocdata32 sysargs32;
++
+ if (copy_from_user(&sysargs32, (void *)arg,
+ sizeof(struct afsprocdata32)))
+ return -EFAULT;
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 784829627..9ecdaf0bf 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -76,6 +76,8 @@
+ #include "h/cred.h"
+ #endif
+
++#include "afs/sysincludes.h"
++
+ #if !defined(HAVE_LINUX_TIME_T)
+ typedef time64_t time_t;
+ #endif
+@@ -157,6 +159,44 @@ static inline long copyinstr(char *from, char *to, int count, int *length) {
+ }
+ #define copyout(F, T, C) (copy_to_user ((char*)(T), (char*)(F), (C)) > 0 ? EFAULT : 0)
+
++/*
++ * Test to see for 64/32bit compatibility mode
++ * Return non-zero if in a 64bit kernel and handing a 32bit syscall
++ */
++#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
++static inline int
++afs_in_compat_syscall(void)
++{
++# if defined(AFS_SPARC64_LINUX26_ENV)
++ return test_thread_flag(TIF_32BIT);
++# elif defined(AFS_SPARC64_LINUX24_ENV)
++ return (current->thread.flags & SPARC_FLAG_32BIT) != 0;
++# elif defined(AFS_SPARC64_LINUX20_ENV)
++ return (current->tss.flags & SPARC_FLAG_32BIT) != 0;
++# elif defined(AFS_AMD64_LINUX26_ENV)
++ return test_thread_flag(TIF_IA32);
++# elif defined(AFS_AMD64_LINUX20_ENV)
++ return (current->thread.flags & THREAD_IA32) != 0;
++# elif defined(AFS_PPC64_LINUX26_ENV)
++# if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
++ return (current->thread_info->flags & _TIF_32BIT) != 0;
++# else
++ return (task_thread_info(current)->flags & _TIF_32BIT) != 0;
++# endif
++# elif defined(AFS_PPC64_LINUX20_ENV)
++ return (current->thread.flags & PPC_FLAG_32BIT) != 0;
++# elif defined(AFS_S390X_LINUX26_ENV)
++ return test_thread_flag(TIF_31BIT);
++# elif defined(AFS_S390X_LINUX20_ENV)
++ return (current->thread.flags & S390_FLAG_31BIT) != 0;
++# elif defined(AFS_ARM64_LINUX26_ENV)
++ return is_compat_task();
++# else
++# error afs_in_compat_syscall not done for this linux
++# endif
++}
++#endif /* AFS_LINUX_64BIT_KERNEL */
++
+ /* kernel print statements */
+ #define printf(args...) printk(args)
+ #define uprintf(args...) printk(args)
+diff --git a/src/afs/afs_syscall.c b/src/afs/afs_syscall.c
+index ce6afdf9a..9414f38b8 100644
+--- a/src/afs/afs_syscall.c
++++ b/src/afs/afs_syscall.c
+@@ -114,40 +114,9 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst)
+ #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
+
+ #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+- struct afs_ioctl32 dst32;
+-
+-#ifdef AFS_SPARC64_LINUX26_ENV
+- if (test_thread_flag(TIF_32BIT))
+-#elif defined(AFS_SPARC64_LINUX24_ENV)
+- if (current->thread.flags & SPARC_FLAG_32BIT)
+-#elif defined(AFS_SPARC64_LINUX20_ENV)
+- if (current->tss.flags & SPARC_FLAG_32BIT)
+-
+-#elif defined(AFS_AMD64_LINUX26_ENV)
+- if (test_thread_flag(TIF_IA32))
+-#elif defined(AFS_AMD64_LINUX20_ENV)
+- if (current->thread.flags & THREAD_IA32)
+-
+-#elif defined(AFS_PPC64_LINUX26_ENV)
+-#if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
+- if (current->thread_info->flags & _TIF_32BIT)
+-#else
+- if (task_thread_info(current)->flags & _TIF_32BIT)
+-#endif
+-#elif defined(AFS_PPC64_LINUX20_ENV)
+- if (current->thread.flags & PPC_FLAG_32BIT)
+-
+-#elif defined(AFS_S390X_LINUX26_ENV)
+- if (test_thread_flag(TIF_31BIT))
+-#elif defined(AFS_S390X_LINUX20_ENV)
+- if (current->thread.flags & S390_FLAG_31BIT)
+-#elif defined(AFS_ARM64_LINUX26_ENV)
+- if (is_compat_task())
++ if (afs_in_compat_syscall()) {
++ struct afs_ioctl32 dst32;
+
+-#else
+-#error pioctl32 not done for this linux
+-#endif
+- {
+ AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
+ if (!code)
+ afs_ioctl32_to_afs_ioctl(&dst32, dst);
+@@ -391,40 +360,9 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst)
+ #endif /* AFS_SUN5_64BIT_ENV */
+
+ #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+- struct iparam32 dst32;
+-
+-#ifdef AFS_SPARC64_LINUX26_ENV
+- if (test_thread_flag(TIF_32BIT))
+-#elif defined(AFS_SPARC64_LINUX24_ENV)
+- if (current->thread.flags & SPARC_FLAG_32BIT)
+-#elif defined(AFS_SPARC64_LINUX20_ENV)
+- if (current->tss.flags & SPARC_FLAG_32BIT)
+-
+-#elif defined(AFS_AMD64_LINUX26_ENV)
+- if (test_thread_flag(TIF_IA32))
+-#elif defined(AFS_AMD64_LINUX20_ENV)
+- if (current->thread.flags & THREAD_IA32)
+-
+-#elif defined(AFS_PPC64_LINUX26_ENV)
+-#if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
+- if (current->thread_info->flags & _TIF_32BIT)
+-#else
+- if (task_thread_info(current)->flags & _TIF_32BIT)
+-#endif
+-#elif defined(AFS_PPC64_LINUX20_ENV)
+- if (current->thread.flags & PPC_FLAG_32BIT)
+-
+-#elif defined(AFS_S390X_LINUX26_ENV)
+- if (test_thread_flag(TIF_31BIT))
+-#elif defined(AFS_S390X_LINUX20_ENV)
+- if (current->thread.flags & S390_FLAG_31BIT)
+-#elif defined(AFS_ARM64_LINUX26_ENV)
+- if (is_compat_task())
++ if (afs_in_compat_syscall()) {
++ struct iparam32 dst32;
+
+-#else
+-#error iparam32 not done for this linux platform
+-#endif
+- {
+ AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
+ if (!code)
+ iparam32_to_iparam(&dst32, dst);
+--
+2.30.1
+
diff --git a/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch b/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
new file mode 100644
index 00000000000..87b7285fed0
--- /dev/null
+++ b/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
@@ -0,0 +1,98 @@
+From 2d85a5b7a1011386d66cc36512a54e80b6cfa515 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 22 Jan 2021 07:57:55 -0700
+Subject: [PATCH 8/8] Linux 5.11: Test 32bit compat with in_compat_syscall
+
+Linux 5.11 removed the TIF_IA32 thread flag with commit:
+ x86: Reclaim TIF_IA32 and TIF_X32 (8d71d2bf6efec)
+
+The flag TIF_IA32 was being used by openafs to determine if the task was
+handling a syscall request from a 32 bit process. Building against a
+Linux 5.11 kernel results in a build failure as TIF_IA32 is undefined.
+
+The function 'in_compat_syscall' was introduced in Linux 4.6 as
+the preferred method to determine if a syscall needed to handle a
+compatible call (e.g. 32bit application).
+
+To resolve the build problem, use 'in_compat_syscall' if present (Linux
+4.6 and later) to determine if the syscall needs to handle a
+compatibility mode call.
+
+Add autoconf check for in_compat_syscall.
+
+Notes about in_compat_syscall:
+
+In Linux 4.6 'in_compat_syscall' was defined for all architectures with
+a generic return of 'is_compat_task', but allows architecture specific
+overriding implementations (x86 and sparc).
+
+At 4.6 (and later), the function 'is_compat_task' is defined only for
+the following architectures to return:
+
+Arch Returns
+======= ==============================
+arm64 test_thread_flag(TIF_32BIT);
+mips test_thread_flag(TIF_32BIT_ADDR)
+parisc test_ti_thread_flag(task_thread_info(t), TIF_32BIT)
+powerpc is_32bit_task()
+s390 test_thread_flag(TIF_31BIT)
+sparc test_thread_flag(TIF_32BIT)
+
+If the Linux kernel is not built with compat mode, is_compat_task and
+in_compat_syscall is set to always return 0
+
+Linux commit that introduced in_compat_syscall:
+ compat: add in_compat_syscall to ask whether we're in a compat syscall
+ (5180e3e24fd3e8e7)
+
+Reviewed-on: https://gerrit.openafs.org/14499
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+(cherry picked from commit 78ef922612bef5f5fd6904896e84b9d2ea802404)
+
+Change-Id: I4eca62f19ae58fd830915feff5098cec2825f099
+Reviewed-on: https://gerrit.openafs.org/14511
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Tested-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_machdep.h | 4 +++-
+ src/cf/linux-kernel-func.m4 | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 9ecdaf0bf..066c1885f 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -167,7 +167,9 @@ static inline long copyinstr(char *from, char *to, int count, int *length) {
+ static inline int
+ afs_in_compat_syscall(void)
+ {
+-# if defined(AFS_SPARC64_LINUX26_ENV)
++# if defined(HAVE_LINUX_IN_COMPAT_SYSCALL)
++ return in_compat_syscall();
++# elif defined(AFS_SPARC64_LINUX26_ENV)
+ return test_thread_flag(TIF_32BIT);
+ # elif defined(AFS_SPARC64_LINUX24_ENV)
+ return (current->thread.flags & SPARC_FLAG_32BIT) != 0;
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index e45a30540..5b4060238 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -157,6 +157,12 @@ AC_CHECK_LINUX_FUNC([lru_cache_add_file],
+ [#include <linux/swap.h>],
+ [lru_cache_add_file(NULL);])
+
++dnl Linux 4.6 introduced in_compat_syscall as replacement for is_compat_task
++dnl for certain platforms.
++AC_CHECK_LINUX_FUNC([in_compat_syscall],
++ [#include <linux/compat.h>],
++ [in_compat_syscall();])
++
+ dnl lru_cache_add exported in Linux 5.8
+ dnl replaces lru_cache_add_file
+ AC_CHECK_LINUX_FUNC([lru_cache_add],
+--
+2.30.1
+
diff --git a/PKGBUILD b/PKGBUILD
index c11f4f0af8d..9cabea00430 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,7 +7,7 @@
pkgname=openafs-modules-dkms
_srcname=openafs
pkgver=1.8.7
-pkgrel=1
+pkgrel=2
pkgdesc="Kernel module for OpenAFS (dkms)"
arch=('i686' 'x86_64' 'armv7h')
url="http://www.openafs.org"
@@ -22,14 +22,20 @@ source=("http://openafs.org/dl/openafs/${pkgver}/${_srcname}-${pkgver}-src.tar.b
0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
0004-LINUX-5.8-use-lru_cache_add.patch
- 0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch)
+ 0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+ 0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
+ 0007-Linux-Refactor-test-for-32bit-compat.patch
+ 0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch)
sha256sums=('53543a561fce67714fec9f2a6bf408c5cc1d061c7dc9d1459458275e8ccbfa79'
'5ea5e184f9b44f5ed45817d2b5a10149d15c8c54f49e0b5b4b773652673cb9b0'
- '18634d85ca4dec3366533a2767e652dab27202667de1d04f578f40a94d8ec15a'
- '4b9d269e2b3c214f9240917b9d895b41e09c1afdbef75e30a0db02a240bf9b0e'
- '9e630d2029c113f482c321007522ce887273250c4125aa6fee1229aa78e8f8c3'
- '6deaa098e7e6113c426d9449c5b6252c76dfbe4a67705420215ae501de8e9f0d'
- '3a0a022a8a4cb1034e60dec9c55727e1be846080f5923a7edcc7e18fe6b57606')
+ '89d423281ae4664467ff583d664cd014362f0f829f2bb1ef76809593626b55e0'
+ 'cceb2501cca12956644718c64db1c8c0e8d460afbbde302045427f0610b60a92'
+ '729f14132a917c2397f4dc713d31c74c0a278c7359c5dd4edc3758fb08e534c4'
+ '73b69cea6eef193457091090fe2c6ae090040537395618dcb47c770196bc14ef'
+ 'aef54d871c376648ef712e9cc224aa65ef012762a28778d53d509a72f99d174e'
+ '38eaec2c4e08d45b4aa130ec581ed1e265950553432d8dd878f99decc54416de'
+ 'c62380c6284f7da43234c7c2bea8503851cd455e0c06d688bbafb1d77cdbd476'
+ 'ebb0c7ddd0fde966e35c277c7474abc39772a1bbaa601e7a678c95aad31bfb48')
prepare() {
cd "${srcdir}/${_srcname}-${pkgver}"
@@ -45,6 +51,11 @@ prepare() {
# Compatibility with Linux 5.9
patch -p1 < "${srcdir}"/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+ # Compatibility with Linux 5.11
+ patch -p1 < "${srcdir}"/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
+ patch -p1 < "${srcdir}"/0007-Linux-Refactor-test-for-32bit-compat.patch
+ patch -p1 < "${srcdir}"/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
+
# Only needed when changes to configure were made
./regen.sh -q
}