[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <160371675721.397.3164323953920306327.tip-bot2@tip-bot2>
Date: Mon, 26 Oct 2020 12:52:37 -0000
From: "tip-bot2 for Gabriel Krisman Bertazi" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Andy Lutomirski <luto@...nel.org>,
Gabriel Krisman Bertazi <krisman@...labora.com>,
Thomas Gleixner <tglx@...utronix.de>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: x86/cleanups] x86/compat: Simplify compat syscall userspace allocation
The following commit has been merged into the x86/cleanups branch of tip:
Commit-ID: 214f0e804358cdd13b5cbe4445189f23e30618b4
Gitweb: https://git.kernel.org/tip/214f0e804358cdd13b5cbe4445189f23e30618b4
Author: Gabriel Krisman Bertazi <krisman@...labora.com>
AuthorDate: Sat, 03 Oct 2020 23:25:28 -04:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 26 Oct 2020 13:46:46 +01:00
x86/compat: Simplify compat syscall userspace allocation
When allocating user memory space for a compat system call, don't consider
whether the originating code is IA32 or X32, just allocate from a safe
region for both, beyond the redzone. This should be safe for IA32, and has
the benefit of avoiding TIF_IA32, which is about to be removed.
Suggested-by: Andy Lutomirski <luto@...nel.org>
Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/r/20201004032536.1229030-3-krisman@collabora.com
---
arch/x86/include/asm/compat.h | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 0e327a0..f145e33 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -177,14 +177,13 @@ typedef struct user_regs_struct compat_elf_gregset_t;
static inline void __user *arch_compat_alloc_user_space(long len)
{
- compat_uptr_t sp;
-
- if (test_thread_flag(TIF_IA32)) {
- sp = task_pt_regs(current)->sp;
- } else {
- /* -128 for the x32 ABI redzone */
- sp = task_pt_regs(current)->sp - 128;
- }
+ compat_uptr_t sp = task_pt_regs(current)->sp;
+
+ /*
+ * -128 for the x32 ABI redzone. For IA32, it is not strictly
+ * necessary, but not harmful.
+ */
+ sp -= 128;
return (void __user *)round_down(sp - len, 16);
}
Powered by blists - more mailing lists