Re: [3.1 patch] x86: default to vsyscall=native

From: richard -rw- weinberger
Date: Thu Oct 06 2011 - 11:37:42 EST


On Thu, Oct 6, 2011 at 5:06 AM, Andrew Lutomirski <luto@xxxxxxx> wrote:
> I'll see how ugly the patch to get this all correct is.  It may not be
> all that pretty because we won't be able to use sys_gettimeofday
> anymore.

BTW: The attached program triggers the issue.

on 3.1-rc8+:
# ./sig.dyn
faulting address: 0xdeadbeef
# ./sig.static
[ 19.075106] sig.static[863] vsyscall fault (exploit attempt?)
ip:ffffffffff600000 cs:33 sp:7fff9e53d8c8 ax:ffffffffff600000 si:0
di:deadbeef
faulting address: 0x0

I guess UML is not the only user of this feature...

--
Thanks,
//richard
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/time.h>

static void sighandler(int sig, siginfo_t *si, void *uc)
{
printf("faulting address: 0x%lx\n", (unsigned long)si->si_addr);

exit(1);
}

int main()
{
struct sigaction sa;

sa.sa_sigaction = (void *)sighandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO| SA_NODEFER;
sigaction(SIGSEGV, &sa, NULL);

gettimeofday((void *)0xdeadbeef, NULL);

return 0;
}