Skip to content

Commit 2a79651

Browse files
q2venkuba-moo
authored andcommitted
selftest: af_unix: Add test case for backtrack after finalising SCC.
syzkaller reported a KMSAN splat in __unix_walk_scc() while backtracking edge_stack after finalising SCC. Let's add a test case exercising the path. Signed-off-by: Kuniyuki Iwashima <[email protected]> Signed-off-by: Shigeru Yoshida <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 927fa5b commit 2a79651

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

tools/testing/selftests/net/af_unix/scm_rights.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
FIXTURE(scm_rights)
1616
{
17-
int fd[16];
17+
int fd[32];
1818
};
1919

2020
FIXTURE_VARIANT(scm_rights)
2121
{
22-
char name[16];
22+
char name[32];
2323
int type;
2424
int flags;
2525
bool test_listener;
@@ -172,6 +172,8 @@ static void __create_sockets(struct __test_metadata *_metadata,
172172
const FIXTURE_VARIANT(scm_rights) *variant,
173173
int n)
174174
{
175+
ASSERT_LE(n * 2, sizeof(self->fd) / sizeof(self->fd[0]));
176+
175177
if (variant->test_listener)
176178
create_listeners(_metadata, self, n);
177179
else
@@ -283,4 +285,23 @@ TEST_F(scm_rights, cross_edge)
283285
close_sockets(8);
284286
}
285287

288+
TEST_F(scm_rights, backtrack_from_scc)
289+
{
290+
create_sockets(10);
291+
292+
send_fd(0, 1);
293+
send_fd(0, 4);
294+
send_fd(1, 2);
295+
send_fd(2, 3);
296+
send_fd(3, 1);
297+
298+
send_fd(5, 6);
299+
send_fd(5, 9);
300+
send_fd(6, 7);
301+
send_fd(7, 8);
302+
send_fd(8, 6);
303+
304+
close_sockets(10);
305+
}
306+
286307
TEST_HARNESS_MAIN

0 commit comments

Comments
 (0)