File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
tools/testing/selftests/seccomp Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1903,6 +1903,32 @@ FIXTURE_TEARDOWN(TRACE_syscall)
1903
1903
teardown_trace_fixture (_metadata , self -> tracer );
1904
1904
}
1905
1905
1906
+ TEST (negative_ENOSYS )
1907
+ {
1908
+ /* Untraced negative syscalls should return ENOSYS. */
1909
+ errno = 0 ;
1910
+ EXPECT_EQ (-1 , syscall (-1 ));
1911
+ EXPECT_EQ (errno , ENOSYS );
1912
+ errno = 0 ;
1913
+ EXPECT_EQ (-1 , syscall (-101 ));
1914
+ EXPECT_EQ (errno , ENOSYS );
1915
+ }
1916
+
1917
+ TEST_F (TRACE_syscall , negative_ENOSYS )
1918
+ {
1919
+ /*
1920
+ * There should be no difference between an "internal" skip
1921
+ * and userspace asking for syscall "-1".
1922
+ */
1923
+ errno = 0 ;
1924
+ EXPECT_EQ (-1 , syscall (-1 ));
1925
+ EXPECT_EQ (errno , ENOSYS );
1926
+ /* And no difference for "still not valid but not -1". */
1927
+ errno = 0 ;
1928
+ EXPECT_EQ (-1 , syscall (-101 ));
1929
+ EXPECT_EQ (errno , ENOSYS );
1930
+ }
1931
+
1906
1932
TEST_F (TRACE_syscall , syscall_allowed )
1907
1933
{
1908
1934
/* getppid works as expected (no changes). */
You can’t perform that action at this time.
0 commit comments