Skip to content

Commit bcdadd7

Browse files
mdouchapevik
authored andcommitted
Update tests to new taint check API
Reviewed-by: Petr Vorel <[email protected]> Signed-off-by: Martin Doucha <[email protected]> [ pvorel: update af_alg07, bpf_prog04 ] Signed-off-by: Petr Vorel <[email protected]>
1 parent 85a7c65 commit bcdadd7

File tree

11 files changed

+13
-27
lines changed

11 files changed

+13
-27
lines changed

testcases/cve/cve-2017-17053.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <unistd.h>
2323
#include <stdio.h>
2424

25-
#include "tst_taint.h"
2625
#include "lapi/syscalls.h"
2726

2827
#define EXEC_USEC 5000000
@@ -85,8 +84,6 @@ static void install_sighandler(void)
8584

8685
static void setup(void)
8786
{
88-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
89-
9087
shm = SAFE_MMAP(NULL, sizeof(struct shm_data),
9188
PROT_READ | PROT_WRITE,
9289
MAP_SHARED | MAP_ANONYMOUS, -1, 0);
@@ -154,6 +151,7 @@ static struct tst_test test = {
154151
.setup = setup,
155152
.cleanup = cleanup,
156153
.test_all = run,
154+
.taint_check = TST_TAINT_W | TST_TAINT_D,
157155
.tags = (const struct tst_tag[]) {
158156
{"linux-git", "ccd5b3235180"},
159157
{"CVE", "2017-17053"},

testcases/kernel/crypto/af_alg07.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ static void setup(void)
4343
{
4444
uid = getuid();
4545
gid = getgid();
46-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
4746

4847
fd = SAFE_OPEN("tmpfile", O_RDWR | O_CREAT, 0644);
4948

@@ -110,6 +109,7 @@ static struct tst_test test = {
110109
.test_all = run,
111110
.setup = setup,
112111
.cleanup = cleanup,
112+
.taint_check = TST_TAINT_W | TST_TAINT_D,
113113
.tags = (const struct tst_tag[]) {
114114
{"linux-git", "9060cb719e61"},
115115
{"CVE", "2019-8912"},

testcases/kernel/pty/pty05.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "lapi/tty.h"
2323

2424
#include "tst_test.h"
25-
#include "tst_taint.h"
2625
#include "tst_fuzzy_sync.h"
2726

2827
#define BUF_SIZE 1
@@ -33,8 +32,6 @@ static char buf[BUF_SIZE];
3332

3433
static void setup(void)
3534
{
36-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
37-
3835
fzsync_pair.exec_loops = 100000;
3936
tst_fzsync_pair_init(&fzsync_pair);
4037
}
@@ -99,6 +96,7 @@ static struct tst_test test = {
9996
.test_all = run,
10097
.setup = setup,
10198
.cleanup = cleanup,
99+
.taint_check = TST_TAINT_W | TST_TAINT_D,
102100
.tags = (const struct tst_tag[]) {
103101
{"linux-git", "82f2341c94d27"},
104102
{"CVE", "2017-2636"},

testcases/kernel/sound/snd_seq01.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include "tst_test.h"
2424
#include "tst_fuzzy_sync.h"
25-
#include "tst_taint.h"
2625

2726
static int fd = -1;
2827
static int client_id;
@@ -64,7 +63,6 @@ static void setup(void)
6463
{
6564
struct snd_seq_queue_info qconf = { .queue = 0 };
6665

67-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
6866
errno = 0;
6967
fd = open("/dev/snd/seq", O_RDWR);
7068

@@ -126,6 +124,7 @@ static struct tst_test test = {
126124
.setup = setup,
127125
.cleanup = cleanup,
128126
.timeout = 120,
127+
.taint_check = TST_TAINT_W | TST_TAINT_D,
129128
.tags = (const struct tst_tag[]) {
130129
{"linux-git", "d15d662e89fc"},
131130
{"CVE", "2018-7566"},

testcases/kernel/sound/snd_timer01.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "config.h"
2020
#include "tst_test.h"
21-
#include "tst_taint.h"
2221
#include "tst_fuzzy_sync.h"
2322
#include "tst_safe_macros.h"
2423
#include "tst_safe_pthread.h"
@@ -71,7 +70,6 @@ static void setup(void)
7170
tst_brk(TCONF, "The file '/dev/snd/timer' is not exist");
7271

7372
tst_fzsync_pair_init(&fzsync_pair);
74-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
7573
snd_fd = SAFE_OPEN("/dev/snd/timer",
7674
O_RDONLY|O_CREAT|O_NOCTTY|O_SYNC|O_LARGEFILE, 0);
7775
}
@@ -140,6 +138,7 @@ static struct tst_test test = {
140138
.test_all = run,
141139
.setup = setup,
142140
.cleanup = cleanup,
141+
.taint_check = TST_TAINT_W | TST_TAINT_D,
143142
.tags = (const struct tst_tag[]) {
144143
{"linux-git", "d11662f4f798"},
145144
{"linux-git", "ba3021b2c79b"},

testcases/kernel/syscalls/bpf/bpf_prog04.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ static int load_prog(int fd)
8585

8686
static void setup(void)
8787
{
88-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
89-
9088
rlimit_bump_memlock();
9189
memcpy(msg, MSG, sizeof(MSG));
9290
}
@@ -127,6 +125,7 @@ static struct tst_test test = {
127125
.setup = setup,
128126
.test_all = run,
129127
.min_kver = "3.18",
128+
.taint_check = TST_TAINT_W | TST_TAINT_D,
130129
.caps = (struct tst_cap []) {
131130
TST_CAP(TST_CAP_DROP, CAP_SYS_ADMIN),
132131
{}

testcases/kernel/syscalls/connect/connect02.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
#include "tst_test.h"
3737
#include "tst_net.h"
38-
#include "tst_taint.h"
3938

4039
static int listenfd = -1, fd = -1, confd1 = -1, confd2 = -1, confd3 = -1;
4140
static struct sockaddr_in6 bind_addr;
@@ -46,8 +45,6 @@ static void setup(void)
4645
{
4746
socklen_t size = sizeof(bind_addr);
4847

49-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
50-
5148
tst_init_sockaddr_inet6_bin(&bind_addr, &in6addr_any, 0);
5249
tst_init_sockaddr_inet_bin(&bind_addr4, INADDR_ANY, 0);
5350
memset(&reset_addr, 0, sizeof(reset_addr));
@@ -132,6 +129,7 @@ static struct tst_test test = {
132129
.test_all = run,
133130
.setup = setup,
134131
.cleanup = cleanup,
132+
.taint_check = TST_TAINT_W | TST_TAINT_D,
135133
.tags = (const struct tst_tag[]) {
136134
{"linux-git", "9d538fa60bad"},
137135
{"linux-git", "82c9ae440857"},

testcases/kernel/syscalls/sendmsg/sendmsg03.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <sched.h>
2323
#include "tst_test.h"
2424
#include "tst_fuzzy_sync.h"
25-
#include "tst_taint.h"
2625

2726
#define IOVEC_COUNT 4
2827
#define PACKET_SIZE 100
@@ -39,7 +38,6 @@ static void setup(void)
3938
{
4039
int i;
4140

42-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
4341
SAFE_UNSHARE(CLONE_NEWUSER);
4442
SAFE_UNSHARE(CLONE_NEWNET);
4543
sockfd = SAFE_SOCKET(AF_INET, SOCK_RAW, IPPROTO_ICMP);
@@ -106,6 +104,7 @@ static struct tst_test test = {
106104
.test_all = run,
107105
.setup = setup,
108106
.cleanup = cleanup,
107+
.taint_check = TST_TAINT_W | TST_TAINT_D,
109108
.tags = (const struct tst_tag[]) {
110109
{"linux-git", "8f659a03a0ba"},
111110
{"CVE", "2017-17712"},

testcases/kernel/syscalls/setsockopt/setsockopt05.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Check that UDP fragmentation offload doesn't cause memory corruption
1010
* if the userspace process turns off UFO in between two send() calls.
1111
* Kernel crash fixed in:
12-
*
12+
*
1313
* commit 85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa
1414
* Author: Willem de Bruijn <[email protected]>
1515
* Date: Thu Aug 10 12:29:19 2017 -0400
@@ -27,7 +27,6 @@
2727

2828
#include "tst_test.h"
2929
#include "tst_net.h"
30-
#include "tst_taint.h"
3130

3231
#define BUFSIZE 4000
3332

@@ -40,8 +39,6 @@ static void setup(void)
4039
int sock;
4140
struct ifreq ifr;
4241

43-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
44-
4542
SAFE_UNSHARE(CLONE_NEWUSER);
4643
SAFE_UNSHARE(CLONE_NEWNET);
4744
SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
@@ -62,6 +59,7 @@ static void run(void)
6259
{
6360
int sock, i;
6461
char buf[BUFSIZE];
62+
6563
memset(buf, 0x42, BUFSIZE);
6664

6765
for (i = 0; i < 1000; i++) {
@@ -84,6 +82,7 @@ static void run(void)
8482
static struct tst_test test = {
8583
.test_all = run,
8684
.setup = setup,
85+
.taint_check = TST_TAINT_W | TST_TAINT_D,
8786
.needs_kconfigs = (const char *[]) {
8887
"CONFIG_USER_NS=y",
8988
"CONFIG_NET_NS=y",

testcases/kernel/syscalls/setsockopt/setsockopt06.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
#include "tst_test.h"
2626
#include "tst_fuzzy_sync.h"
27-
#include "tst_taint.h"
2827
#include "lapi/if_packet.h"
2928
#include "lapi/if_ether.h"
3029

@@ -36,8 +35,6 @@ static void setup(void)
3635
int real_uid = getuid();
3736
int real_gid = getgid();
3837

39-
tst_taint_init(TST_TAINT_W | TST_TAINT_D);
40-
4138
SAFE_UNSHARE(CLONE_NEWUSER);
4239
SAFE_UNSHARE(CLONE_NEWNET);
4340
SAFE_FILE_PRINTF("/proc/self/setgroups", "deny");
@@ -122,6 +119,7 @@ static struct tst_test test = {
122119
.test_all = run,
123120
.setup = setup,
124121
.cleanup = cleanup,
122+
.taint_check = TST_TAINT_W | TST_TAINT_D,
125123
.needs_kconfigs = (const char *[]) {
126124
"CONFIG_USER_NS=y",
127125
"CONFIG_NET_NS=y",

0 commit comments

Comments
 (0)