members of system:administrators to be able to write to readonly servers
- Support linux kernels up to version 5.6rc2
- Additional sundry changes; see upstream NEWS
+ * Pull in additional patches from upstream:
+ - Support linux kernel 5.6 release
+ - Recognize ppc64le in configure's OS-detection logic
-- Benjamin Kaduk <kaduk@mit.edu> Sat, 21 Mar 2020 10:23:31 -0700
--- /dev/null
+From: Yadavendra Yadav <yadayada@in.ibm.com>
+Date: Fri, 6 Dec 2019 15:23:34 +0530
+Subject: afs: Add ppc64le changes in osconf.m4 file.
+
+If swig package is installed on a ppc64le system, build fails for
+"libuafs" while running "shlib-build". "shlib-build" gets executed for
+builing ukernel.so and this is triggered if "LIBUAFS_BUILD_PERL" is not
+empty. Having "swig" package on system sets "LIBUAFS_BUILD_PERL" to
+'LIBUAFS_BUILD_PERL' value. The reason for build failure was inside
+"shlib-build", 'linker' was not set (it was empty). 'linker' value is
+set based on SHLIB_LINKER, which was not defined in osconf.m4 if build
+system is ppc64le.
+
+To fix this add ppc64le_linux26 case in osconf.m4 file.
+
+Change-Id: I79d2f78b2af34207c81f4f5ab05fdc387404acad
+Reviewed-on: https://gerrit.openafs.org/13980
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit f9c716fca1becea5a41fbe86535759ef817c924d)
+---
+ src/cf/osconf.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4
+index 29a79d7..5f0d73f 100644
+--- a/src/cf/osconf.m4
++++ b/src/cf/osconf.m4
+@@ -230,7 +230,7 @@ case $AFS_SYSNAME in
+ SHLIB_LINKER="${CC} -shared"
+ ;;
+
+- ppc64_linux26)
++ ppc64_linux26|ppc64le_linux26)
+ MT_CFLAGS='-pthread -D_REENTRANT'
+ PAM_OPTMZ=-O2
+ PAM_CFLAGS="-Dlinux -DLINUX_PAM -fPIC"
--- /dev/null
+From: Andrew Deason <adeason@sinenomine.net>
+Date: Mon, 2 Mar 2020 16:17:55 -0600
+Subject: LINUX: Avoid building rand-fortuna-kernel.o
+
+Currently, we build rand-fortuna-kernel.o for libafs on all platforms,
+even though we only use the fortuna RNG on AIX, DragonFlyBSD, HP-UX,
+and Irix. Everywhere else, our RAND_bytes() in
+src/crypto/hcrypto/kernel/rand.c uses osi_readRandom() instead of
+going through heimdal.
+
+Building rand-fortuna.c causes occasional build headaches for the
+kernel on Linux (see cc7f942, "LINUX: Disable kernel fortuna large
+frame errors"). The most recent instance of this is that Linux 5.6
+removes the definition for struct timeval, which is referenced in
+rand-fortuna.c.
+
+The Linux kernel is constantly changing, and so trying to keep
+rand-fortuna.c building on Linux seems like a waste of ongoing effort.
+So, just stop building rand-fortuna-kernel.o on Linux. The original
+intent of building this file on all platforms was to avoid bitrot, so
+still keep building rand-fortuna-kernel.o on all other platforms even
+when it's not used; just avoid it on Linux specifically, the platform
+that requires the most effort.
+
+To accomplish this, move rand-fortuna-kernel.o from AFSAOBJS to
+AFS_OS_OBJS, and remove it from the Linux-only AFSPAGOBJS.
+
+[1.8.x: The 1.8 branch does not contain the commits that introduced
+-Wno-error=frame-larger-than= (cc7f942a and 54150f38), so we can skip
+removing the references to -Wno-error=frame-larger-than=.]
+
+Reviewed-on: https://gerrit.openafs.org/14084
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit b8088b49dec23da19406fcb014e7100695dc8322)
+
+Change-Id: Iad0d1af5ffd79c576ddbc253b0037b9772187350
+Reviewed-on: https://gerrit.openafs.org/14094
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Tested-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+(cherry picked from commit 355ea43f0d1b7feae1b3af58bc33af12838db7c3)
+---
+ src/crypto/hcrypto/kernel/rand.c | 13 ++++++++++++-
+ src/libafs/Makefile.common.in | 2 --
+ src/libafs/MakefileProto.AIX.in | 3 ++-
+ src/libafs/MakefileProto.DARWIN.in | 4 ++--
+ src/libafs/MakefileProto.DFBSD.in | 3 ++-
+ src/libafs/MakefileProto.FBSD.in | 3 +++
+ src/libafs/MakefileProto.HPUX.in | 3 ++-
+ src/libafs/MakefileProto.IRIX.in | 3 ++-
+ src/libafs/MakefileProto.LINUX.in | 1 -
+ src/libafs/MakefileProto.NBSD.in | 3 ++-
+ src/libafs/MakefileProto.OBSD.in | 3 ++-
+ src/libafs/MakefileProto.SOLARIS.in | 3 ++-
+ 12 files changed, 31 insertions(+), 13 deletions(-)
+
+diff --git a/src/crypto/hcrypto/kernel/rand.c b/src/crypto/hcrypto/kernel/rand.c
+index 8106486..72cc418 100644
+--- a/src/crypto/hcrypto/kernel/rand.c
++++ b/src/crypto/hcrypto/kernel/rand.c
+@@ -15,6 +15,15 @@
+ */
+ afs_kmutex_t hckernel_mutex;
+
++/*
++ * For these platforms, we use the fortuna RNG from heimdal (seeded from afsd
++ * userspace on startup). Otherwise, we rely on osi_readRandom() as the source
++ * of random data.
++ */
++#if defined(AFS_AIX_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI_ENV)
++# define USE_FORTUNA
++#endif
++
+ /* Called from osi_Init(); will only run once. */
+ void
+ init_hckernel_mutex(void)
+@@ -25,8 +34,10 @@ init_hckernel_mutex(void)
+ void
+ RAND_seed(const void *indata, size_t size)
+ {
++#ifdef USE_FORTUNA
+ const RAND_METHOD *m = RAND_fortuna_method();
+ m->seed(indata, size);
++#endif
+ }
+
+ int
+@@ -34,7 +45,7 @@ RAND_bytes(void *outdata, size_t size)
+ {
+ if (size == 0)
+ return 0;
+-#if defined(AFS_AIX_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI_ENV)
++#ifdef USE_FORTUNA
+ const RAND_METHOD *m = RAND_fortuna_method();
+ return m->bytes(outdata, size);
+ #else
+diff --git a/src/libafs/Makefile.common.in b/src/libafs/Makefile.common.in
+index 0b8505a..b4e0016 100644
+--- a/src/libafs/Makefile.common.in
++++ b/src/libafs/Makefile.common.in
+@@ -72,7 +72,6 @@ depsrcs:
+
+ AFSAOBJS = \
+ sha256-kernel.o \
+- rand-fortuna-kernel.o \
+ rand-timer-kernel.o \
+ afs_atomlist.o \
+ afs_lhash.o \
+@@ -217,7 +216,6 @@ AFSNONFSOBJS = \
+ # init daemons call pioctl
+ AFSPAGOBJS = \
+ sha256-kernel.o \
+- rand-fortuna-kernel.o \
+ rand-timer-kernel.o \
+ md5.o \
+ evp.o \
+diff --git a/src/libafs/MakefileProto.AIX.in b/src/libafs/MakefileProto.AIX.in
+index 5c2b746..697ba7a 100644
+--- a/src/libafs/MakefileProto.AIX.in
++++ b/src/libafs/MakefileProto.AIX.in
+@@ -24,7 +24,8 @@ AFS_OS_OBJS = \
+ osi_sleep.o \
+ osi_timeout.o \
+ osi_vcache.o \
+- osi_vm.o
++ osi_vm.o \
++ rand-fortuna-kernel.o
+
+ AFSNOIAUTHOBJS = \
+ afs_call.o \
+diff --git a/src/libafs/MakefileProto.DARWIN.in b/src/libafs/MakefileProto.DARWIN.in
+index 0592913..fc09454 100644
+--- a/src/libafs/MakefileProto.DARWIN.in
++++ b/src/libafs/MakefileProto.DARWIN.in
+@@ -28,8 +28,8 @@ AFS_OS_OBJS = \
+ osi_vcache.o \
+ osi_vm.o \
+ osi_vnodeops.o \
+- osi_module.o
+-
++ osi_module.o \
++ rand-fortuna-kernel.o
+
+ #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
+
+diff --git a/src/libafs/MakefileProto.DFBSD.in b/src/libafs/MakefileProto.DFBSD.in
+index 41e1b51..9c06a50 100644
+--- a/src/libafs/MakefileProto.DFBSD.in
++++ b/src/libafs/MakefileProto.DFBSD.in
+@@ -20,7 +20,8 @@ AFS_OS_OBJS = \
+ osi_vcache.o \
+ osi_vm.o \
+ osi_vnodeops.o \
+- osi_module.o
++ osi_module.o \
++ rand-fortuna-kernel.o
+
+ #AFS_OS_NFSOBJS = \
+ # osi_vfsops_nfs.o
+diff --git a/src/libafs/MakefileProto.FBSD.in b/src/libafs/MakefileProto.FBSD.in
+index 4c3c0cd..e0616af 100644
+--- a/src/libafs/MakefileProto.FBSD.in
++++ b/src/libafs/MakefileProto.FBSD.in
+@@ -31,6 +31,9 @@ SRCS+= \
+ osi_vnodeops.c \
+ osi_module.c
+
++AFS_OS_OBJS = \
++ rand-fortuna-kernel.o
++
+ #AFS_OS_NFSOBJS = \
+ # osi_vfsops_nfs.o
+
+diff --git a/src/libafs/MakefileProto.HPUX.in b/src/libafs/MakefileProto.HPUX.in
+index 929884e..0925a3f 100644
+--- a/src/libafs/MakefileProto.HPUX.in
++++ b/src/libafs/MakefileProto.HPUX.in
+@@ -24,7 +24,8 @@ AFS_OS_OBJS = \
+ osi_sleep.o \
+ osi_vcache.o \
+ osi_vnodeops.o \
+- osi_vm.o
++ osi_vm.o \
++ rand-fortuna-kernel.o
+
+ AFS_OS_NFSOBJS = \
+ <ia64_hpux1123 hp_ux1123>
+diff --git a/src/libafs/MakefileProto.IRIX.in b/src/libafs/MakefileProto.IRIX.in
+index 310db13..4142b41 100644
+--- a/src/libafs/MakefileProto.IRIX.in
++++ b/src/libafs/MakefileProto.IRIX.in
+@@ -26,7 +26,8 @@ AFS_OS_OBJS = \
+ osi_sleep.o \
+ osi_vcache.o \
+ osi_vm.o \
+- osi_vnodeops.o
++ osi_vnodeops.o \
++ rand-fortuna-kernel.o
+
+ AFS_OS_NFSOBJS = \
+ osi_vfsops_nfs.o
+diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in
+index ed687f1..d98fa05 100644
+--- a/src/libafs/MakefileProto.LINUX.in
++++ b/src/libafs/MakefileProto.LINUX.in
+@@ -82,7 +82,6 @@ CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
+ -DHAVE_CONFIG_H
+ CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+-CFLAGS_rand-fortuna-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+ CFLAGS_aes.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
+diff --git a/src/libafs/MakefileProto.NBSD.in b/src/libafs/MakefileProto.NBSD.in
+index 892dea2..f166933 100644
+--- a/src/libafs/MakefileProto.NBSD.in
++++ b/src/libafs/MakefileProto.NBSD.in
+@@ -24,7 +24,8 @@ AFS_OS_OBJS = \
+ osi_sleep.o \
+ osi_vcache.o \
+ osi_vm.o \
+- osi_vnodeops.o
++ osi_vnodeops.o \
++ rand-fortuna-kernel.o
+
+ AFS_OS_NFSOBJS = \
+ osi_vfsops_nfs.o
+diff --git a/src/libafs/MakefileProto.OBSD.in b/src/libafs/MakefileProto.OBSD.in
+index 3e3beaa..69871cc 100644
+--- a/src/libafs/MakefileProto.OBSD.in
++++ b/src/libafs/MakefileProto.OBSD.in
+@@ -44,7 +44,8 @@ AFS_OS_OBJS = \
+ osi_sleep.o \
+ osi_vcache.o \
+ osi_vm.o \
+- osi_vnodeops.o
++ osi_vnodeops.o \
++ rand-fortuna-kernel.o
+
+ #AFS_OS_NFSOBJS = osi_vfsops_nfs.o
+
+diff --git a/src/libafs/MakefileProto.SOLARIS.in b/src/libafs/MakefileProto.SOLARIS.in
+index 602fed5..5d7e070 100644
+--- a/src/libafs/MakefileProto.SOLARIS.in
++++ b/src/libafs/MakefileProto.SOLARIS.in
+@@ -26,7 +26,8 @@ AFS_OS_OBJS = \
+ osi_sleep.o \
+ osi_vcache.o \
+ osi_vm.o \
+- osi_vnodeops.o
++ osi_vnodeops.o \
++ rand-fortuna-kernel.o
+
+ AFS_OS_NFSOBJS = \
+ osi_vfsops_nfs.o
--- /dev/null
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Tue, 3 Mar 2020 15:39:49 -0700
+Subject: LINUX 5.6: define time_t and use timespec/timespec64
+
+The time_t type and the structure timeval were removed for use in kernel
+space code in Linux commits:
+ 412c53a680a97cb1ae2c0ab60230e193bee86387
+ y2038: remove unused time32 interfaces
+ c766d1472c70d25ad475cf56042af1652e792b23
+ y2038: hide timeval/timespec/itimerval/itimerspec types
+
+Add an autoconf test for the time_t type.
+
+If time_t is missing, define the time_t type when building the kernel
+module.
+
+Change the vattr structure in LINUX/osi_vfs.h to use timespec/timespec64
+instead of the timeval structure.
+
+Conditionalize the definition of gettimeofday (needed by rand-fortuna.c) in
+crypto/hcrypto/kernel/config.h. It is unused by the Linux kernel module
+and the function uses struct timeval that is no longer available.
+
+Reviewed-on: https://gerrit.openafs.org/14083
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 78049987aa3e84865e2e7e0f3dd3b54d66258e74)
+
+Change-Id: Iff80c161441356d19b5962956dd524792b7bf629
+Reviewed-on: https://gerrit.openafs.org/14095
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+(cherry picked from commit 17d38e31e6f2e237a7fb4dfb46841060296310b6)
+---
+ src/afs/LINUX/osi_machdep.h | 4 ++++
+ src/afs/LINUX/osi_vfs.h | 12 +++++++++---
+ src/afs/LINUX/osi_vnodeops.c | 6 +++---
+ src/afs/VNOPS/afs_vnop_attrs.c | 4 ++--
+ src/cf/linux-kernel-type.m4 | 1 +
+ src/crypto/hcrypto/kernel/config.h | 7 +++++++
+ 6 files changed, 26 insertions(+), 8 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 6832c3e..1864cec 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -76,6 +76,10 @@
+ #include "h/cred.h"
+ #endif
+
++#if !defined(HAVE_LINUX_TIME_T)
++typedef time64_t time_t;
++#endif
++
+ #if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64)
+ static inline time_t osi_Time(void) {
+ struct timespec64 xtime;
+diff --git a/src/afs/LINUX/osi_vfs.h b/src/afs/LINUX/osi_vfs.h
+index f771dad..b300679 100644
+--- a/src/afs/LINUX/osi_vfs.h
++++ b/src/afs/LINUX/osi_vfs.h
+@@ -70,9 +70,15 @@ typedef struct vattr {
+ dev_t va_rdev;
+ ino_t va_nodeid; /* Inode number */
+ nlink_t va_nlink; /* link count for file. */
+- struct timeval va_atime;
+- struct timeval va_mtime;
+- struct timeval va_ctime;
++#if defined(IATTR_TAKES_64BIT_TIME)
++ struct timespec64 va_atime;
++ struct timespec64 va_mtime;
++ struct timespec64 va_ctime;
++#else
++ struct timespec va_atime;
++ struct timespec va_mtime;
++ struct timespec va_ctime;
++#endif
+ } vattr_t;
+
+ #define VATTR_NULL(A) memset(A, 0, sizeof(struct vattr))
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index d8487af..0363521 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1008,15 +1008,15 @@ iattr2vattr(struct vattr *vattrp, struct iattr *iattrp)
+ vattrp->va_size = iattrp->ia_size;
+ if (iattrp->ia_valid & ATTR_ATIME) {
+ vattrp->va_atime.tv_sec = iattrp->ia_atime.tv_sec;
+- vattrp->va_atime.tv_usec = 0;
++ vattrp->va_atime.tv_nsec = 0;
+ }
+ if (iattrp->ia_valid & ATTR_MTIME) {
+ vattrp->va_mtime.tv_sec = iattrp->ia_mtime.tv_sec;
+- vattrp->va_mtime.tv_usec = 0;
++ vattrp->va_mtime.tv_nsec = 0;
+ }
+ if (iattrp->ia_valid & ATTR_CTIME) {
+ vattrp->va_ctime.tv_sec = iattrp->ia_ctime.tv_sec;
+- vattrp->va_ctime.tv_usec = 0;
++ vattrp->va_ctime.tv_nsec = 0;
+ }
+ }
+
+diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c
+index 05a38ce..a22331a 100644
+--- a/src/afs/VNOPS/afs_vnop_attrs.c
++++ b/src/afs/VNOPS/afs_vnop_attrs.c
+@@ -141,7 +141,7 @@ afs_CopyOutAttrs(struct vcache *avc, struct vattr *attrs)
+ attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec =
+ attrs->va_ctime.tv_nsec = 0;
+ attrs->va_gen = hgetlo(avc->f.m.DataVersion);
+-#elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV)
++#elif defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV) || defined(AFS_LINUX26_ENV)
+ attrs->va_atime.tv_nsec = attrs->va_mtime.tv_nsec =
+ attrs->va_ctime.tv_nsec =
+ (hgetlo(avc->f.m.DataVersion) & 0x7ffff) * 1000;
+@@ -433,7 +433,7 @@ afs_VAttrToAS(struct vcache *avc, struct vattr *av,
+ #endif
+ mask |= AFS_SETMODTIME;
+ #ifndef AFS_SGI_ENV
+-#if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
++#if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) || defined(AFS_LINUX26_ENV)
+ if (av->va_mtime.tv_nsec == -1)
+ #else
+ if (av->va_mtime.tv_usec == -1)
+diff --git a/src/cf/linux-kernel-type.m4 b/src/cf/linux-kernel-type.m4
+index ae59fcc..444317d 100644
+--- a/src/cf/linux-kernel-type.m4
++++ b/src/cf/linux-kernel-type.m4
+@@ -3,4 +3,5 @@ dnl Type existence checks
+ AC_CHECK_LINUX_TYPE([struct vfs_path], [dcache.h])
+ AC_CHECK_LINUX_TYPE([kuid_t], [uidgid.h])
+ AC_CHECK_LINUX_TYPE([struct proc_ops], [proc_fs.h])
++AC_CHECK_LINUX_TYPE([time_t], [types.h])
+ ])
+diff --git a/src/crypto/hcrypto/kernel/config.h b/src/crypto/hcrypto/kernel/config.h
+index 6fec83d..dd7608d 100644
+--- a/src/crypto/hcrypto/kernel/config.h
++++ b/src/crypto/hcrypto/kernel/config.h
+@@ -98,8 +98,15 @@ static_inline int close(int d) {return -1;}
+ #ifdef HAVE_ARC4RANDOM
+ # undef HAVE_ARC4RANDOM
+ #endif
++
++#if !defined(AFS_LINUX26_ENV)
++/*
++ * gettimeofday is only used in rand-fortuna.c, not built for Linux.
++ * Linux 5.6 removes the native struct timeval, so this stub would not build.
++ */
+ static_inline int gettimeofday(struct timeval *tp, void *tzp)
+ {if (tp == NULL) return -1; tp->tv_sec = osi_Time(); tp->tv_usec = 0; return 0;}
++#endif
+
+ #if defined(KERNEL) && (defined(AFS_SUN5_ENV) || defined(AFS_ARM64_LINUX26_ENV))
+ /*
0003-Catch-up-to-roken-s-rename-of-base64-symbols.patch
+0002-afs-Add-ppc64le-changes-in-osconf.m4-file.patch
+0003-LINUX-Avoid-building-rand-fortuna-kernel.o.patch
+0004-LINUX-5.6-define-time_t-and-use-timespec-timespec64.patch