Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/vdso: Track each mm's loaded vDSO image as well as its base

As we start to do more intelligent things with the vDSO at
runtime (as opposed to just at mm initialization time), we'll
need to know which vDSO is in use.

In principle, we could guess based on the mm type, but that's
over-complicated and error-prone. Instead, just track it in the
mmu context.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/c99ac48681bad709ca7ad5ee899d9042a3af6b00.1451446564.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Andy Lutomirski and committed by
Ingo Molnar
352b78c6 1745cbc5

+3 -1
+1
arch/x86/entry/vdso/vma.c
··· 121 121 122 122 text_start = addr - image->sym_vvar_start; 123 123 current->mm->context.vdso = (void __user *)text_start; 124 + current->mm->context.vdso_image = image; 124 125 125 126 /* 126 127 * MAYWRITE to allow gdb to COW and set breakpoints
+2 -1
arch/x86/include/asm/mmu.h
··· 19 19 #endif 20 20 21 21 struct mutex lock; 22 - void __user *vdso; 22 + void __user *vdso; /* vdso base address */ 23 + const struct vdso_image *vdso_image; /* vdso image in use */ 23 24 24 25 atomic_t perf_rdpmc_allowed; /* nonzero if rdpmc is allowed */ 25 26 } mm_context_t;