mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
the old style sigprocmask system call correctly without corrupting memory when we copy out the new (larger) signal mask into the user provided old (smaller) signal mask. It therefore makes no sense to run it on amd64 or any other platform which only has the newer rt_sigprocmask system call, and indeed it wasn't working because we weren't passing the extra argument which that call expects. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4990
62 lines
1.3 KiB
C
62 lines
1.3 KiB
C
|
|
#include <signal.h>
|
|
#include <stdio.h>
|
|
#include <sys/syscall.h>
|
|
#include <unistd.h>
|
|
|
|
// Reg test for bug #93328: we were using too-big sigset types, and thus
|
|
// trashing memory when we wrote out the 'oldset' param from sigprocmask().
|
|
|
|
int main(void)
|
|
{
|
|
int x[6], *s, *os, i;
|
|
|
|
#ifdef __NR_sigprocmask
|
|
|
|
x[0] = 0x11111111;
|
|
x[1] = 0x89abcdef;
|
|
x[2] = 0x22222222;
|
|
x[3] = 0x33333333;
|
|
x[4] = 0x0;
|
|
x[5] = 0x44444444;
|
|
|
|
s = &x[1];
|
|
os = &x[4];
|
|
|
|
// Make sure the system is in a known state with no signals
|
|
// blocked as perl has been known to leave some signals blocked
|
|
// when starting child processes which can cause failures in
|
|
// this test unless we reset things here.
|
|
syscall(__NR_sigprocmask, SIG_SETMASK, os, NULL);
|
|
|
|
fprintf(stderr, "before\n");
|
|
for (i = 0; i < 6; i++) {
|
|
fprintf(stderr, "%x ", x[i]);
|
|
}
|
|
fprintf(stderr, "\n");
|
|
|
|
syscall(__NR_sigprocmask, SIG_BLOCK, s, os);
|
|
|
|
fprintf(stderr, "after1\n");
|
|
for (i = 0; i < 6; i++) {
|
|
fprintf(stderr, "%x ", x[i]);
|
|
}
|
|
fprintf(stderr, "\n");
|
|
|
|
syscall(__NR_sigprocmask, SIG_BLOCK, s, os);
|
|
|
|
fprintf(stderr, "after2\n");
|
|
for (i = 0; i < 6; i++) {
|
|
fprintf(stderr, "%x ", x[i]);
|
|
}
|
|
fprintf(stderr, "\n");
|
|
|
|
#else
|
|
|
|
fprintf(stderr, "__NR_sigprocmask not supported on this platform\n");
|
|
|
|
#endif
|
|
|
|
return(0);
|
|
}
|