Skip to content

Commit

Permalink
x86 vDSO: don't use disabled vDSO for signal trampoline
Browse files Browse the repository at this point in the history
If the vDSO was not mapped, don't use it as the "restorer" for a signal
handler.  Whether we have a pointer in mm->context.vdso depends on what
happened at exec time, so we shouldn't check any global flags now.

Background:

Currently, every 32-bit exec gets the vDSO mapped even if it's disabled
(the process just doesn't get told about it).  Because it's in fact
always there, the bug that this patch fixes cannot happen now.  With
the second patch, it won't be mapped at all when it's disabled, which is
one of the things that people might really want when they disable it (so
nothing they didn't ask for goes into their address space).

The 32-bit signal handler setup when SA_RESTORER is not used refers to
current->mm->context.vdso without regard to whether the vDSO has been
disabled when the process was exec'd.  This patch fixes this not to use
it when it's null, which becomes possible after the second patch. (This
never happens in normal use, because glibc's sigaction call uses
SA_RESTORER unless glibc detected the vDSO.)

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Roland McGrath authored and Ingo Molnar committed Apr 17, 2008
1 parent 85eb69a commit 1a3e4ca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/x86/ia32/ia32_signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
restorer = ka->sa.sa_restorer;
} else {
/* Return stub is in 32bit vsyscall page */
if (current->binfmt->hasvdso)
if (current->mm->context.vdso)
restorer = VDSO32_SYMBOL(current->mm->context.vdso,
sigreturn);
else
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
goto give_sigsegv;
}

if (current->binfmt->hasvdso)
if (current->mm->context.vdso)
restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn);
else
restorer = &frame->retcode;
Expand Down

0 comments on commit 1a3e4ca

Please sign in to comment.