[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201108051730.2042693-4-dima@arista.com>
Date: Sun, 8 Nov 2020 05:17:13 +0000
From: Dmitry Safonov <dima@...sta.com>
To: linux-kernel@...r.kernel.org
Cc: Dmitry Safonov <0x7f454c46@...il.com>,
Dmitry Safonov <dima@...sta.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Arnd Bergmann <arnd@...db.de>, Borislav Petkov <bp@...en8.de>,
Catalin Marinas <catalin.marinas@....com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Guo Ren <guoren@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
Ingo Molnar <mingo@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
Russell King <linux@...linux.org.uk>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Thomas Gleixner <tglx@...utronix.de>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Will Deacon <will@...nel.org>, x86@...nel.org,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 03/19] arm64: Use in_compat_task() in arch_setup_additional_pages()
Instead of providing compat_arch_setup_additional_pages(), check if the
task is compatible from personality, which is set earlier in
load_elf_binary(). That will align code with powerpc and sparc, also
it'll allow to completely remove compat_arch_setyp_addtional_pages()
macro after doing the same for x86, simiplifying the binfmt code
in the end.
Cc: linux-arm-kernel@...ts.infradead.org
Signed-off-by: Dmitry Safonov <dima@...sta.com>
---
arch/arm64/include/asm/elf.h | 5 -----
arch/arm64/kernel/vdso.c | 21 ++++++++++-----------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index d1073ffa7f24..a81953bcc1cf 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -237,11 +237,6 @@ do { \
#else
#define COMPAT_ARCH_DLINFO
#endif
-struct linux_binprm;
-extern int aarch32_setup_additional_pages(struct linux_binprm *bprm,
- int uses_interp);
-#define compat_arch_setup_additional_pages \
- aarch32_setup_additional_pages
#endif /* CONFIG_COMPAT */
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index cee5d04ea9ad..1b710deb84d6 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -401,29 +401,24 @@ static int aarch32_sigreturn_setup(struct mm_struct *mm)
return PTR_ERR_OR_ZERO(ret);
}
-int aarch32_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+static int aarch32_setup_additional_pages(struct linux_binprm *bprm,
+ int uses_interp)
{
struct mm_struct *mm = current->mm;
int ret;
- if (mmap_write_lock_killable(mm))
- return -EINTR;
-
ret = aarch32_kuser_helpers_setup(mm);
if (ret)
- goto out;
+ return ret;
if (IS_ENABLED(CONFIG_COMPAT_VDSO)) {
ret = __setup_additional_pages(VDSO_ABI_AA32, mm, bprm,
uses_interp);
if (ret)
- goto out;
+ return ret;
}
- ret = aarch32_sigreturn_setup(mm);
-out:
- mmap_write_unlock(mm);
- return ret;
+ return aarch32_sigreturn_setup(mm);
}
#endif /* CONFIG_COMPAT */
@@ -460,7 +455,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
if (mmap_write_lock_killable(mm))
return -EINTR;
- ret = __setup_additional_pages(VDSO_ABI_AA64, mm, bprm, uses_interp);
+ if (is_compat_task())
+ ret = aarch32_setup_additional_pages(bprm, uses_interp);
+ else
+ ret = __setup_additional_pages(VDSO_ABI_AA64, mm, bprm, uses_interp);
+
mmap_write_unlock(mm);
return ret;
--
2.28.0
Powered by blists - more mailing lists