cvs commit: src/lib/libc/i386/sys Makefile.inc getcontext.S
Peter Wemm
peter at FreeBSD.org
Wed Sep 3 17:20:42 PDT 2003
peter 2003/09/03 17:20:40 PDT
FreeBSD src repository
Modified files:
lib/libc/i386/sys Makefile.inc
Added files:
lib/libc/i386/sys getcontext.S
Log:
Make getcontext(2) work on i386. It needs a small wrapper in libc
otherwise the return from the syscall stub for getcontext will pop off
the return value for the caller to the getcontext stub and it will appear
as though the setcontext() syscall returned instead of the getcontext().
The same bug exists on amd64, a fix is coming there too.
The bug can be demonstrated with this test code fragment:
main()
{
ucontext_t top;
if (getcontext(&top) == 0) {
write(2, "PING!\n", 6);
/* Cause a return value of 1 from getcontext this time */
top.uc_mcontext.mc_eax = 1;
setcontext(&top);
err(1, "setcontext() returned");
}
write(2, "PONG!\n", 6);
_exit(0);
}
Revision Changes Path
1.27 +2 -2 src/lib/libc/i386/sys/Makefile.inc
1.1 +50 -0 src/lib/libc/i386/sys/getcontext.S (new)
More information about the cvs-src
mailing list