blob: 0c69f115fdb24ad06d078cdd16f255f03d71fba1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// RUN: %clangxx_msan -std=c++11 -O0 -g %s -o %t
// RUN: %run %t __
// RUN: not %run %t A_ 2>&1 | FileCheck %s
// RUN: not %run %t AH 2>&1 | FileCheck %s
// RUN: not %run %t B_ 2>&1 | FileCheck %s
// RUN: not %run %t BH 2>&1 | FileCheck %s
// RUN: not %run %t C_ 2>&1 | FileCheck %s
// RUN: not %run %t CH 2>&1 | FileCheck %s
#include <assert.h>
#include <signal.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <sanitizer/msan_interface.h>
void handler(int) {}
void action(int, siginfo_t *, void *) {}
int main(int argc, char **argv) {
char T = argv[1][0];
char H = argv[1][1];
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
if (H == 'H') {
sa.sa_handler = handler;
} else {
sa.sa_sigaction = action;
sa.sa_flags = SA_SIGINFO;
}
if (T == 'A') {
if (H == 'H')
__msan_poison(&sa.sa_handler, sizeof(sa.sa_handler));
else
__msan_poison(&sa.sa_sigaction, sizeof(sa.sa_sigaction));
}
if (T == 'B')
__msan_poison(&sa.sa_flags, sizeof(sa.sa_flags));
if (T == 'C')
__msan_poison(&sa.sa_mask, sizeof(sa.sa_mask));
// CHECK: use-of-uninitialized-value
int res = sigaction(SIGUSR1, &sa, nullptr);
assert(res == 0);
return 0;
}
|