<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/seccomp, branch v5.1.16</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.1.16</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.1.16'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2019-05-16T17:35:33+00:00</updated>
<entry>
<title>selftests/seccomp: Handle namespace failures gracefully</title>
<updated>2019-05-16T17:35:33+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2019-04-11T23:56:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=af6a4f3ccd4df9087e0a44d783a565a38722a56a'/>
<id>urn:sha1:af6a4f3ccd4df9087e0a44d783a565a38722a56a</id>
<content type='text'>
commit 9dd3fcb0ab73cb1e00b8562ef027a38521aaff87 upstream.

When running without USERNS or PIDNS the seccomp test would hang since
it was waiting forever for the child to trigger the user notification
since it seems the glibc() abort handler makes a call to getpid(),
which would trap again. This changes the getpid filter to getppid, and
makes sure ASSERTs execute to stop from spawning the listener.

Reported-by: Shuah Khan &lt;shuah@kernel.org&gt;
Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Cc: stable@vger.kernel.org # &gt; 5.0
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>selftests/seccomp: Prepare for exclusive seccomp flags</title>
<updated>2019-04-25T22:55:48+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2019-04-24T16:32:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4ee0776760af03f181e6b80baf5fb1cc1a980f50'/>
<id>urn:sha1:4ee0776760af03f181e6b80baf5fb1cc1a980f50</id>
<content type='text'>
Some seccomp flags will become exclusive, so the selftest needs to
be adjusted to mask those out and test them individually for the "all
flags" tests.

Cc: stable@vger.kernel.org # v5.0+
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Acked-by: James Morris &lt;jamorris@linux.microsoft.com&gt;
</content>
</entry>
<entry>
<title>selftests/seccomp: Actually sleep for 1/10th second</title>
<updated>2019-02-13T15:52:42+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2019-01-27T09:43:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ed492c2ad46450791c80f5e260f48d36e3a044eb'/>
<id>urn:sha1:ed492c2ad46450791c80f5e260f48d36e3a044eb</id>
<content type='text'>
Clang noticed that some none-zero sleep()s were actually using zero
anyway. This switches to nanosleep() to gain sub-second granularity.

seccomp_bpf.c:2625:9: warning: implicit conversion from 'double' to
      'unsigned int' changes value from 0.1 to 0 [-Wliteral-conversion]
                sleep(0.1);
                ~~~~~ ^~~

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: unshare userns in seccomp pidns testcases</title>
<updated>2019-02-13T15:48:29+00:00</updated>
<author>
<name>Tycho Andersen</name>
<email>tycho@tycho.ws</email>
</author>
<published>2019-01-19T00:12:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=30d53a5860cf6743db011719d414456b10773d6a'/>
<id>urn:sha1:30d53a5860cf6743db011719d414456b10773d6a</id>
<content type='text'>
The pid ns cannot be unshare()d as an unprivileged user without owning the
userns as well. Let's unshare the userns so that we can subsequently
unshare the pidns.

This also means that we don't need to set the no new privs bit as in the
other test cases, since we're unsharing the userns.

Signed-off-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: set NO_NEW_PRIVS bit in seccomp user tests</title>
<updated>2019-02-13T15:48:12+00:00</updated>
<author>
<name>Tycho Andersen</name>
<email>tycho@tycho.ws</email>
</author>
<published>2019-01-19T00:12:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c7140706cb8affe0155c62b13c59940597825bac'/>
<id>urn:sha1:c7140706cb8affe0155c62b13c59940597825bac</id>
<content type='text'>
seccomp() doesn't allow users who aren't root in their userns to attach
filters unless they have the nnp bit set, so let's set it so that these
tests can pass when run as an unprivileged user.

This idea stolen from the other seccomp tests, which use this trick :)

Signed-off-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: skip seccomp get_metadata test if not real root</title>
<updated>2019-02-13T15:34:55+00:00</updated>
<author>
<name>Tycho Andersen</name>
<email>tycho@tycho.ws</email>
</author>
<published>2019-01-19T00:12:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3aa415dd2128e478ea3225b59308766de0e94d6b'/>
<id>urn:sha1:3aa415dd2128e478ea3225b59308766de0e94d6b</id>
<content type='text'>
The get_metadata() test requires real root, so let's skip it if we're not
real root.

Note that I used XFAIL here because that's what the test does later if
CONFIG_CHEKCKPOINT_RESTORE happens to not be enabled. After looking at the
code, there doesn't seem to be a nice way to skip tests defined as TEST(),
since there's no return code (I tried exit(KSFT_SKIP), but that didn't work
either...). So let's do it this way to be consistent, and easier to fix
when someone comes along and fixes it.

Signed-off-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: fix typo in seccomp_bpf.c</title>
<updated>2019-02-13T15:34:40+00:00</updated>
<author>
<name>Tycho Andersen</name>
<email>tycho@tycho.ws</email>
</author>
<published>2019-01-19T00:12:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0b54b443a9de2db726625b2bd535fadca5b137a6'/>
<id>urn:sha1:0b54b443a9de2db726625b2bd535fadca5b137a6</id>
<content type='text'>
There used to be an explanation here because it could trigger lockdep
previously, but now we're not doing recursive locking, so it really is just
for grins.

Signed-off-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: don't kill child immediately in get_metadata() test</title>
<updated>2019-02-13T15:34:16+00:00</updated>
<author>
<name>Tycho Andersen</name>
<email>tycho@tycho.ws</email>
</author>
<published>2019-01-19T00:12:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fb024a07c69f81e97f3fd252b9102f5816066884'/>
<id>urn:sha1:fb024a07c69f81e97f3fd252b9102f5816066884</id>
<content type='text'>
This this test forks a child, and then the parent waits for a write() to a
pipe signalling the child is ready to be attached to. If something in the
child ASSERTs before it does this write, the test will hang waiting for it.
Instead, let's EXPECT, so that execution continues until we do the write.
Any failure after that is fine and can ASSERT.

Signed-off-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/seccomp: Enhance per-arch ptrace syscall skip tests</title>
<updated>2019-01-25T22:13:35+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2019-01-25T18:33:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ed5f13261cb65b02c611ae9971677f33581d4286'/>
<id>urn:sha1:ed5f13261cb65b02c611ae9971677f33581d4286</id>
<content type='text'>
Passing EPERM during syscall skipping was confusing since the test wasn't
actually exercising the errno evaluation -- it was just passing a literal
"1" (EPERM). Instead, expand the tests to check both direct value returns
(positive, 45000 in this case), and errno values (negative, -ESRCH in this
case) to check both fake success and fake failure during syscall skipping.

Reported-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Fixes: a33b2d0359a0 ("selftests/seccomp: Add tests for basic ptrace actions")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/seccomp: Abort without user notification support</title>
<updated>2019-01-17T18:00:23+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2019-01-17T00:35:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3d244c192afeee7dd4f5fb1b916ea4e47420d401'/>
<id>urn:sha1:3d244c192afeee7dd4f5fb1b916ea4e47420d401</id>
<content type='text'>
In the face of missing user notification support, the self test needs
to stop executing a test (ASSERT_*) instead of just reporting and
continuing (EXPECT_*). This adjusts the user notification tests to do
that where needed.

Reported-by: Shuah Khan &lt;shuah@kernel.org&gt;
Fixes: 6a21cc50f0c7 ("seccomp: add a return code to trap to userspace")
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Tycho Andersen &lt;tycho@tycho.ws&gt;
Tested-by: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;shuah@kernel.org&gt;
</content>
</entry>
</feed>
