summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-17 10:41:58 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2020-09-17 20:00:46 +0300
commit527c412519eb63ed354790f4291c3728815d11a6 (patch)
treed0fee0cb3bc9bd021f293e3fc8ba46d63f237b32
parentcc7886d25bcaffe7f4412d774365d85b462366f8 (diff)
downloadlinux-527c412519eb63ed354790f4291c3728815d11a6.tar.xz
compat: add a compat_need_64bit_alignment_fixup() helper
Add a helper to check if the calling syscall needs a fixup for non-natural 64-bit type alignment in the compat ABI. This will only return true for i386 syscalls on x86_64. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/x86/include/asm/compat.h1
-rw-r--r--include/linux/compat.h9
2 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index bf547701f41f..0e327a01f50f 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -209,6 +209,7 @@ static inline bool in_compat_syscall(void)
return in_32bit_syscall();
}
#define in_compat_syscall in_compat_syscall /* override the generic impl */
+#define compat_need_64bit_alignment_fixup in_ia32_syscall
#endif
struct compat_siginfo;
diff --git a/include/linux/compat.h b/include/linux/compat.h
index d38c4d7e83bd..f0026a344482 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -933,6 +933,15 @@ static inline bool in_compat_syscall(void) { return false; }
#endif /* CONFIG_COMPAT */
/*
+ * Some legacy ABIs like the i386 one use less than natural alignment for 64-bit
+ * types, and will need special compat treatment for that. Most architectures
+ * don't need that special handling even for compat syscalls.
+ */
+#ifndef compat_need_64bit_alignment_fixup
+#define compat_need_64bit_alignment_fixup() false
+#endif
+
+/*
* A pointer passed in from user mode. This should not
* be used for syscall parameters, just declare them
* as pointers because the syscall entry code will have