From cc7886d25bcaffe7f4412d774365d85b462366f8 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 17 Sep 2020 09:41:57 +0200 Subject: compat: lift compat_s64 and compat_u64 to lift the compat_s64 and compat_u64 definitions into common code using the COMPAT_FOR_U64_ALIGNMENT symbol for the x86 special case. Signed-off-by: Christoph Hellwig Signed-off-by: Al Viro --- include/asm-generic/compat.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/asm-generic/compat.h b/include/asm-generic/compat.h index a86f65bffab8..30f7b18a36f9 100644 --- a/include/asm-generic/compat.h +++ b/include/asm-generic/compat.h @@ -22,4 +22,12 @@ typedef u32 compat_ulong_t; typedef u32 compat_uptr_t; typedef u32 compat_aio_context_t; +#ifdef CONFIG_COMPAT_FOR_U64_ALIGNMENT +typedef s64 __attribute__((aligned(4))) compat_s64; +typedef u64 __attribute__((aligned(4))) compat_u64; +#else +typedef s64 compat_s64; +typedef u64 compat_u64; +#endif + #endif -- cgit v1.2.3 From 527c412519eb63ed354790f4291c3728815d11a6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 17 Sep 2020 09:41:58 +0200 Subject: 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 Signed-off-by: Al Viro --- include/linux/compat.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') 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 @@ -932,6 +932,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 -- cgit v1.2.3 From 80bdad3d7e3ec03f812471d9309f5f682e10f52b Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 17 Sep 2020 09:41:59 +0200 Subject: quota: simplify the quotactl compat handling Fold the misaligned u64 workarounds into the main quotactl flow instead of implementing a separate compat syscall handler. Signed-off-by: Christoph Hellwig Acked-by: Jan Kara Signed-off-by: Al Viro --- include/linux/quotaops.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 9cf0cd3dc88c..a0f6668924d3 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -27,9 +27,6 @@ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid)); } -int kernel_quotactl(unsigned int cmd, const char __user *special, - qid_t id, void __user *addr); - #if defined(CONFIG_QUOTA) #define quota_error(sb, fmt, args...) \ -- cgit v1.2.3