SHA256
1
0
forked from pool/openafs
openafs/avoid_double_param_in_arm64_kernel.patch
Christof Hanke 882dc0c539 Accepting request 604055 from home:Guillaume_G:branches:openSUSE:Factory:ARM
- Update to 1.8.0
- Fix AArch64 build by updating spec and backporting patches:
  * add_support_fo_arm64_linux26.patch
  * dont_require_AFS_SYSCALL.patch
  * add_AFS_STRINGIZE_macro.patch
  * avoid_double_param_in_arm64_kernel.patch

OBS-URL: https://build.opensuse.org/request/show/604055
OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=15
2018-05-07 04:15:49 +00:00

63 lines
2.9 KiB
Diff

From b792dea0f1f83673b0b045adf608412901b3024c Mon Sep 17 00:00:00 2001
From: Andrew Deason <adeason@sinenomine.net>
Date: Sun, 8 Mar 2015 11:47:28 -0500
Subject: [PATCH] hcrypto: Avoid 'double' param in arm64 kernel code
Currently, the RAND_add function in hcrypto uses a floating point
argument (specifically, a 'double'), as well as any implementations of
RAND_add. On Linux arm64, we cannot use floating point code in the
kernel, since the kernel module is compiled with -mgeneral-regs-only,
which prevents the use of floating point registers. No code in the
tree actually makes use of this argument, but its mere presence is
enough to cause an error with at least some versions of gcc with
certain arguments.
To get around this, simply change all instances of 'double' in hcrypto
to be a void pointer instead. This allows the code to compile as long
as nobody actually uses that argument in the kernel. If the code is
changed such that we do actually use that argument, the argument will
be a void* and so will probably (hopefully) cause a compiler error,
and the code will need to be examined to make sure this workaround
doesn't break anything.
We already do this on Solaris, which has similar issues for different
compiler versions and compiler flags. Add arm64 Linux to the cases
where we do this, but restrict this to kernel code only, to try to
avoid doing this more often than necessary.
Change-Id: Ifd10786cd9ac6c9d5152b927e180b7362131f359
Reviewed-on: https://gerrit.openafs.org/11939
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
---
src/crypto/hcrypto/kernel/config.h | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/crypto/hcrypto/kernel/config.h b/src/crypto/hcrypto/kernel/config.h
index 81c2944..b610434 100644
--- a/src/crypto/hcrypto/kernel/config.h
+++ b/src/crypto/hcrypto/kernel/config.h
@@ -98,7 +98,16 @@ static_inline int close(int d) {return -1;}
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;}
-#ifdef AFS_SUN5_ENV
-/* workaround to allow --disable-optimize-kernel on Solaris */
-#define double int
+#if defined(KERNEL) && (defined(AFS_SUN5_ENV) || defined(AFS_ARM64_LINUX26_ENV))
+/*
+ * Some functions such as RAND_add take a 'double' as an argument, but floating
+ * point code generally cannot be used in kernelspace. We never actually use
+ * that argument in kernel code, but just that it exists as an argument is
+ * enough to break the kernel code on Linux (on arm64) and Solaris (depending
+ * on the compiler version and flags). Change all instances of double to void*
+ * to avoid this; if someone does try to use that argument, hopefully the fact
+ * that it is now a void* will flag an error at compile time before it causes
+ * any further problems.
+ */
+# define double void*
#endif
--
1.7.1