x86/vdso: small fixups for map_vdso
Subsystems (4)
cover x86/vdso: small fixups for map_vdso
The first one is a fixup for arch_prctl constants uapi visability, the second is code simplification.
Dmitry Safonov (2):
x86/prctl/uapi: remove ifdef for CHECKPOINT_RESTORE x86/vdso: set vdso pointer only after success
arch/x86/entry/vdso/vma.c | 10 +++------- arch/x86/include/uapi/asm/prctl.h | 8 +++----- 2 files changed, 6 insertions(+), 12 deletions(-)
Signature · 7 lines
2.10.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/2 x86/prctl/uapi: remove ifdef for CHECKPOINT_RESTORE
As userspace knows nothing about kernel config, this ifdefs will make prctl constants invisible to userspace. Let it be clean'n'simple: remove ifdefs.
If kernel has CONFIG_CHECKPOINT_RESTORE disabled, sys_prctl() will return -EINVAL for those prctls.
--- arch/x86/include/uapi/asm/prctl.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/include/uapi/asm/prctl.h +3 -5
@@ -6,10 +6,8 @@#define ARCH_GET_FS 0x1003#define ARCH_GET_GS 0x1004 -#ifdef CONFIG_CHECKPOINT_RESTORE -# define ARCH_MAP_VDSO_X32 0x2001 -# define ARCH_MAP_VDSO_32 0x2002 -# define ARCH_MAP_VDSO_64 0x2003 -#endif +#define ARCH_MAP_VDSO_X32 0x2001 +#define ARCH_MAP_VDSO_32 0x2002 +#define ARCH_MAP_VDSO_64 0x2003#endif /* _ASM_X86_PRCTL_H */
Signature · 7 lines
2.10.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/2 x86/vdso: set vdso pointer only after success
In reply to Dmitry SafonovThose pointers were initialized before call to _install_special_mapping after the commit f7b6eb3fa072 ("x86: Set context.vdso before installing the mapping"). This is not required anymore as special mappings have their vma name and don't use arch_vma_name() after commit a62c34bd2a8a ("x86, mm: Improve _install_special_mapping and fix x86 vdso naming"). So, this way to init looks less entangled.
I even belive, we can remove null initializers:
- on failure load_elf_binary() will not start a new thread;
- arch_prctl will have the same pointers as before syscall.
--- arch/x86/entry/vdso/vma.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/entry/vdso/vma.c +3 -7
@@ -161,8 +161,6 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) } text_start = addr - image->sym_vvar_start; - current->mm->context.vdso = (void __user *)text_start; - current->mm->context.vdso_image = image;/* * MAYWRITE to allow gdb to COW and set breakpoints
@@ -189,14 +187,12 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr)if (IS_ERR (vma)) { ret =PTR_ERR (vma);do_munmap (mm, text_start, image->size); + }else { + current->mm->context.vdso = (void __user *)text_start; + current->mm->context.vdso_image = image; } up_fail: -if (ret) { - current->mm->context.vdso =NULL ; - current->mm->context.vdso_image =NULL ; - } -up_write (&mm->mmap_sem);return ret; }
Signature · 7 lines
2.10.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 2/2] x86/vdso: set vdso pointer only after success
Quoted 9 lines · Dmitry Safonov
Those pointers were initialized before call to
_install_special_mappingafter the commitf7b6eb3fa072("x86: Set context.vdso before installing the mapping"). This is not required anymore as special mappings have their vma name and don't usearch_vma_name()after commita62c34bd2a8a("x86, mm: Improve_install_special_mappingand fix x86 vdso naming"). So, this way to init looks less entangled.
I even belive, we can remove null initializers:
- on failureload_elf_binary()will not start a new thread;
-arch_prctlwill have the same pointers as before syscall.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Dmitry Safonov
merge bot[tip:x86/asm] x86/prctl/uapi: Remove #ifdef for CHECKPOINT_RESTORE
In reply to Dmitry Safonovx86/prctl/uapi: Remove #ifdef for CHECKPOINT_RESTORE
Commit-ID: a01aa6c9f40fe03c82032e7f8b3bcf1e6c93ac0e Gitweb: http://git.kernel.org/tip/a01aa6c9f40fe03c82032e7f8b3bcf1e6c93ac0e Author: Dmitry Safonov <[email protected]> AuthorDate: Thu, 27 Oct 2016 17:15:15 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 28 Oct 2016 08:15:55 +0200
x86/prctl/uapi: Remove #ifdef for CHECKPOINT_RESTORE
As userspace knows nothing about kernel config, thus #ifdefs around ABI prctl constants makes them invisible to userspace.
Let it be clean'n'simple: remove #ifdefs.
If kernel has CONFIG_CHECKPOINT_RESTORE disabled, sys_prctl() will return -EINVAL for those prctls.
--- arch/x86/include/uapi/asm/prctl.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/include/uapi/asm/prctl.h +3 -5
@@ -6,10 +6,8 @@#define ARCH_GET_FS 0x1003#define ARCH_GET_GS 0x1004 -#ifdef CONFIG_CHECKPOINT_RESTORE -# define ARCH_MAP_VDSO_X32 0x2001 -# define ARCH_MAP_VDSO_32 0x2002 -# define ARCH_MAP_VDSO_64 0x2003 -#endif +#define ARCH_MAP_VDSO_X32 0x2001 +#define ARCH_MAP_VDSO_32 0x2002 +#define ARCH_MAP_VDSO_64 0x2003#endif /* _ASM_X86_PRCTL_H */
tip-bot for Dmitry Safonov
merge bot[tip:x86/asm] x86/vdso: Set vDSO pointer only after success
In reply to Dmitry Safonovx86/vdso: Set vDSO pointer only after success
Commit-ID: 67dece7d4c5841e84a3c795e79bf0dcd5be54f55 Gitweb: http://git.kernel.org/tip/67dece7d4c5841e84a3c795e79bf0dcd5be54f55 Author: Dmitry Safonov <[email protected]> AuthorDate: Thu, 27 Oct 2016 17:15:16 +0300 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 28 Oct 2016 08:15:55 +0200
x86/vdso: Set vDSO pointer only after success
Those pointers were initialized before call to _install_special_mapping() after the commit:
f7b6eb3fa072 ("x86: Set context.vdso before installing the mapping")
This is not required anymore as special mappings have their vma name and don't use arch_vma_name() after commit:
a62c34bd2a8a ("x86, mm: Improve _install_special_mapping and fix x86 vdso naming")
So, this way to init looks less entangled.
I even belive that we can remove NULL initializers:
- on failure load_elf_binary() will not start a new thread;
- arch_prctl will have the same pointers as before syscall.
--- arch/x86/entry/vdso/vma.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/entry/vdso/vma.c +3 -7
@@ -161,8 +161,6 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr) } text_start = addr - image->sym_vvar_start; - current->mm->context.vdso = (void __user *)text_start; - current->mm->context.vdso_image = image;/* * MAYWRITE to allow gdb to COW and set breakpoints
@@ -189,14 +187,12 @@ static int map_vdso(const struct vdso_image *image, unsigned long addr)if (IS_ERR (vma)) { ret =PTR_ERR (vma);do_munmap (mm, text_start, image->size); + }else { + current->mm->context.vdso = (void __user *)text_start; + current->mm->context.vdso_image = image; } up_fail: -if (ret) { - current->mm->context.vdso =NULL ; - current->mm->context.vdso_image =NULL ; - } -up_write (&mm->mmap_sem);return ret; }