Commit 7f3646aa authored by Roland McGrath's avatar Roland McGrath Committed by Ingo Molnar

x86 vDSO: use vdso-syms.lds

This patch changes the kernel's references to addresses in the vDSO image
to be based on the symbols defined by vdso-syms.lds instead of the old
vdso-syms.o symbols.  This is all wrapped up in a macro defined by the new
asm-x86/vdso.h header; that's the only place in the kernel source that has
to know the details of the scheme for getting vDSO symbol values.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5b930493
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
# #
# files to link into the vdso # files to link into the vdso
# vdso-start.o has to be first vobjs-y := vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
vobjs-y := vdso-start.o vdso-note.o vclock_gettime.o vgetcpu.o vvar.o
# files to link into kernel # files to link into kernel
obj-y := vma.o vdso.o vdso-syms.o obj-y := vma.o vdso.o vdso-syms.o
......
.globl vdso_kernel_start
vdso_kernel_start:
...@@ -11,23 +11,20 @@ ...@@ -11,23 +11,20 @@
#include <asm/vsyscall.h> #include <asm/vsyscall.h>
#include <asm/vgtod.h> #include <asm/vgtod.h>
#include <asm/proto.h> #include <asm/proto.h>
#include "voffset.h" #include <asm/vdso.h>
int vdso_enabled = 1; #include "vextern.h" /* Just for VMAGIC. */
#define VEXTERN(x) extern typeof(__ ## x) *vdso_ ## x;
#include "vextern.h"
#undef VEXTERN #undef VEXTERN
extern char vdso_kernel_start[], vdso_start[], vdso_end[]; int vdso_enabled = 1;
extern char vdso_start[], vdso_end[];
extern unsigned short vdso_sync_cpuid; extern unsigned short vdso_sync_cpuid;
struct page **vdso_pages; struct page **vdso_pages;
static inline void *var_ref(void *vbase, char *var, char *name) static inline void *var_ref(void *p, char *name)
{ {
unsigned offset = var - &vdso_kernel_start[0] + VDSO_TEXT_OFFSET;
void *p = vbase + offset;
if (*(void **)p != (void *)VMAGIC) { if (*(void **)p != (void *)VMAGIC) {
printk("VDSO: variable %s broken\n", name); printk("VDSO: variable %s broken\n", name);
vdso_enabled = 0; vdso_enabled = 0;
...@@ -62,9 +59,8 @@ static int __init init_vdso_vars(void) ...@@ -62,9 +59,8 @@ static int __init init_vdso_vars(void)
vdso_enabled = 0; vdso_enabled = 0;
} }
#define V(x) *(typeof(x) *) var_ref(vbase, (char *)RELOC_HIDE(&x, 0), #x)
#define VEXTERN(x) \ #define VEXTERN(x) \
V(vdso_ ## x) = &__ ## x; *(typeof(__ ## x) **) var_ref(VDSO64_SYMBOL(vbase, x), #x) = &__ ## x;
#include "vextern.h" #include "vextern.h"
#undef VEXTERN #undef VEXTERN
return 0; return 0;
......
#ifndef _ASM_X86_VDSO_H
#define _ASM_X86_VDSO_H 1
extern const char VDSO64_PRELINK[];
/*
* Given a pointer to the vDSO image, find the pointer to VDSO64_name
* as that symbol is defined in the vDSO sources or linker script.
*/
#define VDSO64_SYMBOL(base, name) ({ \
extern const char VDSO64_##name[]; \
(void *) (VDSO64_##name - VDSO64_PRELINK + (unsigned long) (base)); })
#endif /* asm-x86/vdso.h */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment