* sysenter cause a segmentation fault.
@ 2007-03-18 8:08 Ying Chu
2007-03-18 15:51 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Ying Chu @ 2007-03-18 8:08 UTC (permalink / raw)
To: linux-kernel
A simple code running on PIII 800,kernel 2.6.20 with SEP enabled
causes a segmentation fault.
The slice is as following.
#include <stdio.h>
#include <sys/syacall.h>
int main()
{
unsigned long ret=0;
__asm__ __volatile__ ("movl %1,%%eax\n\tpushl %%ecx\n\t"
"pushl %%edx\n\tpush %%ebp\n\t"
"movl %%esp,%%ebp\n\t" "sysenter\n\t"
"movl %%eax,%0"
:"=m"(ret)
:"b"(SYS_getuid));
printf("%d\n",ret);
return 0;
}
More, when i enabled Kdb and set "bp sysenter_entry",it went with a
catastrophic error errupted.
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: sysenter cause a segmentation fault.
2007-03-18 8:08 sysenter cause a segmentation fault Ying Chu
@ 2007-03-18 15:51 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2007-03-18 15:51 UTC (permalink / raw)
To: Ying Chu; +Cc: linux-kernel
"Ying Chu" <xjtuychu@gmail.com> writes:
> A simple code running on PIII 800,kernel 2.6.20 with SEP enabled
> causes a segmentation fault.
SYSENTER has a hardcoded return address, that is why you cannot be used
anywhere but in the vsyscall trampoline. In addition it doesn't work
on x86-64 for 32bit processes for AMD. The only system call method
supported without the vDSO is int 0x80. Better you just use the vDSO.
> More, when i enabled Kdb and set "bp sysenter_entry",it went with a
> catastrophic error errupted.
The stack and some other kernel state are not set up yet at this point.
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-18 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-18 8:08 sysenter cause a segmentation fault Ying Chu
2007-03-18 15:51 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox