Skip to content

Commit 279ed89

Browse files
committed
selftests/seccomp: Rename user_trap_syscall() to user_notif_syscall()
The user_trap_syscall() helper creates a filter with SECCOMP_RET_USER_NOTIF. To avoid confusion with SECCOMP_RET_TRAP, rename the helper to user_notif_syscall(). Cc: Andy Lutomirski <[email protected]> Cc: Will Drewry <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Song Liu <[email protected]> Cc: Yonghong Song <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: John Fastabend <[email protected]> Cc: KP Singh <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent cf8918d commit 279ed89

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

tools/testing/selftests/seccomp/seccomp_bpf.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,7 +3167,7 @@ TEST(get_metadata)
31673167
ASSERT_EQ(0, kill(pid, SIGKILL));
31683168
}
31693169

3170-
static int user_trap_syscall(int nr, unsigned int flags)
3170+
static int user_notif_syscall(int nr, unsigned int flags)
31713171
{
31723172
struct sock_filter filter[] = {
31733173
BPF_STMT(BPF_LD+BPF_W+BPF_ABS,
@@ -3213,7 +3213,7 @@ TEST(user_notification_basic)
32133213

32143214
/* Check that we get -ENOSYS with no listener attached */
32153215
if (pid == 0) {
3216-
if (user_trap_syscall(__NR_getppid, 0) < 0)
3216+
if (user_notif_syscall(__NR_getppid, 0) < 0)
32173217
exit(1);
32183218
ret = syscall(__NR_getppid);
32193219
exit(ret >= 0 || errno != ENOSYS);
@@ -3230,13 +3230,13 @@ TEST(user_notification_basic)
32303230
EXPECT_EQ(seccomp(SECCOMP_SET_MODE_FILTER, 0, &prog), 0);
32313231

32323232
/* Check that the basic notification machinery works */
3233-
listener = user_trap_syscall(__NR_getppid,
3234-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3233+
listener = user_notif_syscall(__NR_getppid,
3234+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
32353235
ASSERT_GE(listener, 0);
32363236

32373237
/* Installing a second listener in the chain should EBUSY */
3238-
EXPECT_EQ(user_trap_syscall(__NR_getppid,
3239-
SECCOMP_FILTER_FLAG_NEW_LISTENER),
3238+
EXPECT_EQ(user_notif_syscall(__NR_getppid,
3239+
SECCOMP_FILTER_FLAG_NEW_LISTENER),
32403240
-1);
32413241
EXPECT_EQ(errno, EBUSY);
32423242

@@ -3305,12 +3305,12 @@ TEST(user_notification_with_tsync)
33053305
/* these were exclusive */
33063306
flags = SECCOMP_FILTER_FLAG_NEW_LISTENER |
33073307
SECCOMP_FILTER_FLAG_TSYNC;
3308-
ASSERT_EQ(-1, user_trap_syscall(__NR_getppid, flags));
3308+
ASSERT_EQ(-1, user_notif_syscall(__NR_getppid, flags));
33093309
ASSERT_EQ(EINVAL, errno);
33103310

33113311
/* but now they're not */
33123312
flags |= SECCOMP_FILTER_FLAG_TSYNC_ESRCH;
3313-
ret = user_trap_syscall(__NR_getppid, flags);
3313+
ret = user_notif_syscall(__NR_getppid, flags);
33143314
close(ret);
33153315
ASSERT_LE(0, ret);
33163316
}
@@ -3328,8 +3328,8 @@ TEST(user_notification_kill_in_middle)
33283328
TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
33293329
}
33303330

3331-
listener = user_trap_syscall(__NR_getppid,
3332-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3331+
listener = user_notif_syscall(__NR_getppid,
3332+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
33333333
ASSERT_GE(listener, 0);
33343334

33353335
/*
@@ -3382,8 +3382,8 @@ TEST(user_notification_signal)
33823382

33833383
ASSERT_EQ(socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair), 0);
33843384

3385-
listener = user_trap_syscall(__NR_gettid,
3386-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3385+
listener = user_notif_syscall(__NR_gettid,
3386+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
33873387
ASSERT_GE(listener, 0);
33883388

33893389
pid = fork();
@@ -3452,8 +3452,8 @@ TEST(user_notification_closed_listener)
34523452
TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
34533453
}
34543454

3455-
listener = user_trap_syscall(__NR_getppid,
3456-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3455+
listener = user_notif_syscall(__NR_getppid,
3456+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
34573457
ASSERT_GE(listener, 0);
34583458

34593459
/*
@@ -3489,8 +3489,8 @@ TEST(user_notification_child_pid_ns)
34893489
SKIP(return, "kernel missing CLONE_NEWUSER support");
34903490
};
34913491

3492-
listener = user_trap_syscall(__NR_getppid,
3493-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3492+
listener = user_notif_syscall(__NR_getppid,
3493+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
34943494
ASSERT_GE(listener, 0);
34953495

34963496
pid = fork();
@@ -3529,8 +3529,8 @@ TEST(user_notification_sibling_pid_ns)
35293529
TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
35303530
}
35313531

3532-
listener = user_trap_syscall(__NR_getppid,
3533-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3532+
listener = user_notif_syscall(__NR_getppid,
3533+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
35343534
ASSERT_GE(listener, 0);
35353535

35363536
pid = fork();
@@ -3597,8 +3597,8 @@ TEST(user_notification_fault_recv)
35973597

35983598
ASSERT_EQ(unshare(CLONE_NEWUSER), 0);
35993599

3600-
listener = user_trap_syscall(__NR_getppid,
3601-
SECCOMP_FILTER_FLAG_NEW_LISTENER);
3600+
listener = user_notif_syscall(__NR_getppid,
3601+
SECCOMP_FILTER_FLAG_NEW_LISTENER);
36023602
ASSERT_GE(listener, 0);
36033603

36043604
pid = fork();
@@ -3649,7 +3649,7 @@ TEST(user_notification_continue)
36493649
TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
36503650
}
36513651

3652-
listener = user_trap_syscall(__NR_dup, SECCOMP_FILTER_FLAG_NEW_LISTENER);
3652+
listener = user_notif_syscall(__NR_dup, SECCOMP_FILTER_FLAG_NEW_LISTENER);
36533653
ASSERT_GE(listener, 0);
36543654

36553655
pid = fork();
@@ -3743,7 +3743,7 @@ TEST(user_notification_filter_empty)
37433743
if (pid == 0) {
37443744
int listener;
37453745

3746-
listener = user_trap_syscall(__NR_mknod, SECCOMP_FILTER_FLAG_NEW_LISTENER);
3746+
listener = user_notif_syscall(__NR_mknod, SECCOMP_FILTER_FLAG_NEW_LISTENER);
37473747
if (listener < 0)
37483748
_exit(EXIT_FAILURE);
37493749

@@ -3799,7 +3799,7 @@ TEST(user_notification_filter_empty_threaded)
37993799
int listener, status;
38003800
pthread_t thread;
38013801

3802-
listener = user_trap_syscall(__NR_dup, SECCOMP_FILTER_FLAG_NEW_LISTENER);
3802+
listener = user_notif_syscall(__NR_dup, SECCOMP_FILTER_FLAG_NEW_LISTENER);
38033803
if (listener < 0)
38043804
_exit(EXIT_FAILURE);
38053805

0 commit comments

Comments
 (0)