<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/openat2/openat2_test.c, branch v6.19.5</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.5</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.5'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-11-27T22:24:31+00:00</updated>
<entry>
<title>selftests: complete kselftest include centralization</title>
<updated>2025-11-27T22:24:31+00:00</updated>
<author>
<name>Bala-Vignesh-Reddy</name>
<email>reddybalavignesh9979@gmail.com</email>
</author>
<published>2025-10-16T10:44:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e6fbd1759c9ece5044d3470f30a5e2166dc9de89'/>
<id>urn:sha1:e6fbd1759c9ece5044d3470f30a5e2166dc9de89</id>
<content type='text'>
This follow-up patch completes centralization of kselftest.h and
ksefltest_harness.h includes in remaining seltests files, replacing all
relative paths with a non-relative paths using shared -I include path in
lib.mk

Tested with gcc-13.3 and clang-18.1, and cross-compiled successfully on
riscv, arm64, x86_64 and powerpc arch.

[reddybalavignesh9979@gmail.com: add selftests include path for kselftest.h]
  Link: https://lkml.kernel.org/r/20251017090201.317521-1-reddybalavignesh9979@gmail.com
Link: https://lkml.kernel.org/r/20251016104409.68985-1-reddybalavignesh9979@gmail.com
Signed-off-by: Bala-Vignesh-Reddy &lt;reddybalavignesh9979@gmail.com&gt;
Suggested-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Link: https://lore.kernel.org/lkml/20250820143954.33d95635e504e94df01930d0@linux-foundation.org/
Reviewed-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Cc: David Hildenbrand &lt;david@redhat.com&gt;
Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Günther Noack &lt;gnoack@google.com&gt;
Cc: Jakub Kacinski &lt;kuba@kernel.org&gt;
Cc: Liam Howlett &lt;liam.howlett@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: Michal Hocko &lt;mhocko@suse.com&gt;
Cc: Mickael Salaun &lt;mic@digikod.net&gt;
Cc: Ming Lei &lt;ming.lei@redhat.com&gt;
Cc: Paolo Abeni &lt;pabeni@redhat.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Simon Horman &lt;horms@kernel.org&gt;
Cc: Suren Baghdasaryan &lt;surenb@google.com&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/openat2: Fix build warnings on ppc64</title>
<updated>2024-05-29T18:26:11+00:00</updated>
<author>
<name>Michael Ellerman</name>
<email>mpe@ellerman.id.au</email>
</author>
<published>2024-05-21T03:03:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=84b6df4c49a1cc2854a16937acd5fd3e6315d083'/>
<id>urn:sha1:84b6df4c49a1cc2854a16937acd5fd3e6315d083</id>
<content type='text'>
Fix warnings like:

  openat2_test.c: In function ‘test_openat2_flags’:
  openat2_test.c:303:73: warning: format ‘%llX’ expects argument of type
  ‘long long unsigned int’, but argument 5 has type ‘__u64’ {aka ‘long
  unsigned int’} [-Wformat=]

By switching to unsigned long long for u64 for ppc64 builds.

Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Reviewed-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/openat2: Fix wrong format specifier</title>
<updated>2023-10-13T20:08:16+00:00</updated>
<author>
<name>Maciej Wieczor-Retman</name>
<email>maciej.wieczor-retman@intel.com</email>
</author>
<published>2023-10-13T11:36:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=287d29827ffc97e6978fa030b7412330a93dd38a'/>
<id>urn:sha1:287d29827ffc97e6978fa030b7412330a93dd38a</id>
<content type='text'>
Compiling openat2 selftest after adding a __printf() attribute to
ksft_print_msg() exposes a -Wformat warning in test_openat2_flags().
The wrong format specifier is used for printing test.how-&gt;flags
variable.

Change the format specifier to %llX so it matches the printed variable.

Signed-off-by: Maciej Wieczor-Retman &lt;maciej.wieczor-retman@intel.com&gt;
Reviewed-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: openat2: Skip testcases that fail with EOPNOTSUPP</title>
<updated>2022-01-27T23:31:07+00:00</updated>
<author>
<name>Cristian Marussi</name>
<email>cristian.marussi@arm.com</email>
</author>
<published>2022-01-26T10:27:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ac9e0a250bb155078601a5b999aab05f2a04d1ab'/>
<id>urn:sha1:ac9e0a250bb155078601a5b999aab05f2a04d1ab</id>
<content type='text'>
Skip testcases that fail since the requested valid flags combination is not
supported by the underlying filesystem.

Cc: Aleksa Sarai &lt;cyphar@cyphar.com&gt;
Signed-off-by: Cristian Marussi &lt;cristian.marussi@arm.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: openat2: Fix testing failure for O_LARGEFILE flag</title>
<updated>2021-08-25T19:46:13+00:00</updated>
<author>
<name>Baolin Wang</name>
<email>baolin.wang@linux.alibaba.com</email>
</author>
<published>2021-08-25T01:49:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d538ddb97e066571e4fc58b832f40739621b42bb'/>
<id>urn:sha1:d538ddb97e066571e4fc58b832f40739621b42bb</id>
<content type='text'>
The openat2 test suite fails on ARM64 because the definition of
O_LARGEFILE is different on ARM64. Fix the problem by defining
the correct O_LARGEFILE definition on ARM64.

"openat2 unexpectedly returned # 3['.../tools/testing/selftests/openat2']
with 208000 (!= 208000)
not ok 102 openat2 with incompatible flags (O_PATH | O_LARGEFILE) fails
with -22 (Invalid argument)"

Fixed change log to improve formatting and clarity:
Shuah Khan &lt;skhan@linuxfoundation.org&gt;

Signed-off-by: Baolin Wang &lt;baolin.wang@linux.alibaba.com&gt;
Reviewed-by: Aleksa Sarai &lt;cyphar@cyphar.com&gt;
Acked-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>test: add openat2() test for invalid upper 32 bit flag value</title>
<updated>2021-05-28T15:44:37+00:00</updated>
<author>
<name>Christian Brauner</name>
<email>christian.brauner@ubuntu.com</email>
</author>
<published>2021-05-28T09:24:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=15845cbcd12a571869c6703892427f9e5839d5fb'/>
<id>urn:sha1:15845cbcd12a571869c6703892427f9e5839d5fb</id>
<content type='text'>
Test that openat2() rejects unknown flags in the upper 32 bit range.

Link: https://lore.kernel.org/r/20210528092417.3942079-4-brauner@kernel.org
Cc: Richard Guy Briggs &lt;rgb@redhat.com&gt;
Cc: Aleksa Sarai &lt;cyphar@cyphar.com&gt;
Cc: linux-fsdevel@vger.kernel.org
Reviewed-by: Richard Guy Briggs &lt;rgb@redhat.com&gt;
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
</content>
</entry>
<entry>
<title>selftests: openat2: add RESOLVE_ conflict test</title>
<updated>2020-12-03T09:16:28+00:00</updated>
<author>
<name>Aleksa Sarai</name>
<email>cyphar@cyphar.com</email>
</author>
<published>2020-10-27T23:50:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4e62d55d77bbdb33d821f5e16306caab38d42267'/>
<id>urn:sha1:4e62d55d77bbdb33d821f5e16306caab38d42267</id>
<content type='text'>
Now that we reject conflicting RESOLVE_ flags, add a selftest to avoid
regressions.

Signed-off-by: Aleksa Sarai &lt;cyphar@cyphar.com&gt;
Link: https://lore.kernel.org/r/20201027235044.5240-3-cyphar@cyphar.com
Signed-off-by: Christian Brauner &lt;christian.brauner@ubuntu.com&gt;
</content>
</entry>
<entry>
<title>selftests: add openat2(2) selftests</title>
<updated>2020-01-18T14:19:18+00:00</updated>
<author>
<name>Aleksa Sarai</name>
<email>cyphar@cyphar.com</email>
</author>
<published>2020-01-18T12:08:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b28a10aedcd4d175470171a32f4f20b0a60a612b'/>
<id>urn:sha1:b28a10aedcd4d175470171a32f4f20b0a60a612b</id>
<content type='text'>
Test all of the various openat2(2) flags. A small stress-test of a
symlink-rename attack is included to show that the protections against
".."-based attacks are sufficient.

The main things these self-tests are enforcing are:

  * The struct+usize ABI for openat2(2) and copy_struct_from_user() to
    ensure that upgrades will be handled gracefully (in addition,
    ensuring that misaligned structures are also handled correctly).

  * The -EINVAL checks for openat2(2) are all correctly handled to avoid
    userspace passing unknown or conflicting flag sets (most
    importantly, ensuring that invalid flag combinations are checked).

  * All of the RESOLVE_* semantics (including errno values) are
    correctly handled with various combinations of paths and flags.

  * RESOLVE_IN_ROOT correctly protects against the symlink rename(2)
    attack that has been responsible for several CVEs (and likely will
    be responsible for several more).

Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Aleksa Sarai &lt;cyphar@cyphar.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
</feed>
