Add API to change vdso blob type with arch_prctl. As this is useful yet only by needs of CRIU, expose this interface under CONFIG_CHECKPOINT_RESTORE.
Cc: Andy Lutomirski <l...@kernel.org> Cc: Ingo Molnar <mi...@redhat.com> Cc: Thomas Gleixner <t...@linutronix.de> Cc: "H. Peter Anvin" <h...@zytor.com> Signed-off-by: Dmitry Safonov <dsafo...@virtuozzo.com> --- arch/x86/include/uapi/asm/prctl.h | 6 ++++++ arch/x86/kernel/process_64.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/x86/include/uapi/asm/prctl.h b/arch/x86/include/uapi/asm/prctl.h index 3ac5032fae09..ae135de547f5 100644 --- a/arch/x86/include/uapi/asm/prctl.h +++ b/arch/x86/include/uapi/asm/prctl.h @@ -6,4 +6,10 @@ #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 + #endif /* _ASM_X86_PRCTL_H */ diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 6e789ca1f841..64459c88b3d9 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -49,6 +49,7 @@ #include <asm/debugreg.h> #include <asm/switch_to.h> #include <asm/xen/hypervisor.h> +#include <asm/vdso.h> asmlinkage extern void ret_from_fork(void); @@ -577,6 +578,15 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) break; } +#ifdef CONFIG_CHECKPOINT_RESTORE + case ARCH_MAP_VDSO_X32: + return do_map_vdso(VDSO_X32, addr, false); + case ARCH_MAP_VDSO_32: + return do_map_vdso(VDSO_32, addr, false); + case ARCH_MAP_VDSO_64: + return do_map_vdso(VDSO_64, addr, false); +#endif + default: ret = -EINVAL; break; -- 2.8.2