blob: 97c4c0ae93032bf317576f402534dfd22197c36b [file] [log] [blame]
nethercote7fbe08a2004-11-15 19:03:27 +00001
2#include <signal.h>
3#include <stdio.h>
4#include <sys/syscall.h>
5#include <unistd.h>
6
7// Reg test for bug #93328: we were using too-big sigset types, and thus
8// trashing memory when we wrote out the 'oldset' param from sigprocmask().
9
10int main(void)
11{
sewardj1c398002005-03-23 13:09:55 +000012 int x[6], *s, *os, i, sysno;
13
14 sysno = __NR_rt_sigprocmask;
15#ifdef __NR_sigprocmask
16 sysno = __NR_sigprocmask;
17#endif
nethercote7fbe08a2004-11-15 19:03:27 +000018
19 x[0] = 0x11111111;
20 x[1] = 0x89abcdef;
21 x[2] = 0x22222222;
22 x[3] = 0x33333333;
23 x[4] = 0x0;
24 x[5] = 0x44444444;
25
26 s = &x[1];
27 os = &x[4];
28
thughes89c33d22004-11-16 12:09:43 +000029 // Make sure the system is in a known state with no signals
30 // blocked as perl has been known to leave some signals blocked
31 // when starting child processes which can cause failures in
32 // this test unless we reset things here.
sewardj1c398002005-03-23 13:09:55 +000033 syscall(sysno, SIG_SETMASK, os, NULL);
thughes89c33d22004-11-16 12:09:43 +000034
nethercote7fbe08a2004-11-15 19:03:27 +000035 fprintf(stderr, "before\n");
36 for (i = 0; i < 6; i++) {
37 fprintf(stderr, "%x ", x[i]);
38 }
39 fprintf(stderr, "\n");
40
sewardj1c398002005-03-23 13:09:55 +000041 syscall(sysno, SIG_BLOCK, s, os);
nethercote7fbe08a2004-11-15 19:03:27 +000042
43 fprintf(stderr, "after1\n");
44 for (i = 0; i < 6; i++) {
45 fprintf(stderr, "%x ", x[i]);
46 }
47 fprintf(stderr, "\n");
48
sewardj1c398002005-03-23 13:09:55 +000049 syscall(sysno, SIG_BLOCK, s, os);
nethercote7fbe08a2004-11-15 19:03:27 +000050
51 fprintf(stderr, "after2\n");
52 for (i = 0; i < 6; i++) {
53 fprintf(stderr, "%x ", x[i]);
54 }
55 fprintf(stderr, "\n");
56
57 return(0);
58}