<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/tools/testing/selftests/x86/fsgsbase.c, branch linux-rolling-stable</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2025-02-26T12:05:28Z</updated>
<entry>
<title>selftests/x86: Consolidate redundant signal helper functions</title>
<updated>2025-02-26T12:05:28Z</updated>
<author>
<name>Chang S. Bae</name>
<email>chang.seok.bae@intel.com</email>
</author>
<published>2025-02-26T01:07:21Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=dbd6b649e7d5b66c7fa95a65d67b59cf5b45f0ac'/>
<id>urn:sha1:dbd6b649e7d5b66c7fa95a65d67b59cf5b45f0ac</id>
<content type='text'>
The x86 selftests frequently register and clean up signal handlers, but
the sethandler() and clearhandler() functions have been redundantly
copied across multiple .c files.

Move these functions to helpers.h to enable reuse across tests,
eliminating around 250 lines of duplicate code.

Converge the error handling by using ksft_exit_fail_msg(), which is
functionally equivalent with err() within the selftest framework.

This change is a prerequisite for the upcoming xstate selftest, which
requires signal handling for registering and cleaning up handlers.

Signed-off-by: Chang S. Bae &lt;chang.seok.bae@intel.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20250226010731.2456-2-chang.seok.bae@intel.com
</content>
</entry>
<entry>
<title>selftests/x86: remove (or use) unused variables and functions</title>
<updated>2024-07-11T17:23:55Z</updated>
<author>
<name>John Hubbard</name>
<email>jhubbard@nvidia.com</email>
</author>
<published>2024-07-04T07:24:30Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7d17b29b0e4b9a97426873f72e9cc6d35cfaf88f'/>
<id>urn:sha1:7d17b29b0e4b9a97426873f72e9cc6d35cfaf88f</id>
<content type='text'>
When building with clang, via:

    make LLVM=1 -C tools/testing/selftests

...quite a few functions are variables are generating "unused" warnings.
Fix the warnings by deleting the unused items.

One item, the "nerrs" variable in vsdo_restorer.c's main(), is unused
but probably wants to be returned from main(), as a non-zero result.
That result is also unused right now, so another option would be to
delete it entirely, but this way, main() also gets fixed. It was missing
a return value.

Acked-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Signed-off-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Fix GS == 1, 2, and 3 tests</title>
<updated>2020-11-24T12:46:16Z</updated>
<author>
<name>Andy Lutomirski</name>
<email>luto@kernel.org</email>
</author>
<published>2020-11-02T19:51:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=716572b0003ef67a4889bd7d85baf5099c5a0248'/>
<id>urn:sha1:716572b0003ef67a4889bd7d85baf5099c5a0248</id>
<content type='text'>
Setting GS to 1, 2, or 3 causes a nonsensical part of the IRET microcode
to change GS back to zero on a return from kernel mode to user mode. The
result is that these tests fail randomly depending on when interrupts
happen. Detect when this happens and let the test pass.

Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/7567fd44a1d60a9424f25b19a998f12149993b0d.1604346596.git.luto@kernel.org
</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Test PTRACE_PEEKUSER for GSBASE with invalid LDT GS</title>
<updated>2020-08-26T18:54:18Z</updated>
<author>
<name>Andy Lutomirski</name>
<email>luto@kernel.org</email>
</author>
<published>2020-08-26T17:00:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=1b9abd1755ad947d7c9913e92e7837b533124c90'/>
<id>urn:sha1:1b9abd1755ad947d7c9913e92e7837b533124c90</id>
<content type='text'>
This tests commit:

  8ab49526b53d ("x86/fsgsbase/64: Fix NULL deref in 86_fsgsbase_read_task")

Unpatched kernels will OOPS.

Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/c618ae86d1f757e01b1a8e79869f553cb88acf9a.1598461151.git.luto@kernel.org
</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Reap a forgotten child</title>
<updated>2020-08-26T18:54:17Z</updated>
<author>
<name>Andy Lutomirski</name>
<email>luto@kernel.org</email>
</author>
<published>2020-08-26T17:00:45Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ab2dd173330a3f07142e68cd65682205036cd00f'/>
<id>urn:sha1:ab2dd173330a3f07142e68cd65682205036cd00f</id>
<content type='text'>
The ptrace() test forgot to reap its child.  Reap it.

Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/e7700a503f30e79ab35a63103938a19893dbeff2.1598461151.git.luto@kernel.org
</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Add a missing memory constraint</title>
<updated>2020-07-01T13:27:20Z</updated>
<author>
<name>Andy Lutomirski</name>
<email>luto@kernel.org</email>
</author>
<published>2020-06-26T17:24:28Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=8e259031c67a5ea0666428edb64c89e8c6ebd18e'/>
<id>urn:sha1:8e259031c67a5ea0666428edb64c89e8c6ebd18e</id>
<content type='text'>
The manual call to set_thread_area() via int $0x80 was missing any
indication that the descriptor was a pointer, causing gcc to
occasionally generate wrong code.  Add the missing constraint.

Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lkml.kernel.org/r/432968af67259ca92d68b774a731aff468eae610.1593192140.git.luto@kernel.org

</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Fix a comment in the ptrace_write_gsbase test</title>
<updated>2020-07-01T13:27:20Z</updated>
<author>
<name>Andy Lutomirski</name>
<email>luto@kernel.org</email>
</author>
<published>2020-06-26T17:24:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=979c2c4247cafd8a91628a7306b6871efbd12fdb'/>
<id>urn:sha1:979c2c4247cafd8a91628a7306b6871efbd12fdb</id>
<content type='text'>
A comment was unclear.  Fix it.

Fixes: 5e7ec8578fa3 ("selftests/x86/fsgsbase: Test ptracer-induced GS base write with FSGSBASE")
Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lkml.kernel.org/r/901034a91a40169ec84f1f699ea86704dff762e4.1593192140.git.luto@kernel.org

</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Test ptracer-induced GS base write with FSGSBASE</title>
<updated>2020-06-18T13:47:07Z</updated>
<author>
<name>Chang S. Bae</name>
<email>chang.seok.bae@intel.com</email>
</author>
<published>2020-05-28T20:14:02Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=5e7ec8578fa3dada50c50f5b234fa8d154b76349'/>
<id>urn:sha1:5e7ec8578fa3dada50c50f5b234fa8d154b76349</id>
<content type='text'>
This validates that GS selector and base are independently preserved in
ptrace commands.

Suggested-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Chang S. Bae &lt;chang.seok.bae@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Tony Luck &lt;tony.luck@intel.com&gt;
Link: https://lkml.kernel.org/r/20200528201402.1708239-17-sashal@kernel.org


</content>
</entry>
<entry>
<title>selftests/x86/fsgsbase: Test GS selector on ptracer-induced GS base write</title>
<updated>2020-06-18T13:47:06Z</updated>
<author>
<name>Chang S. Bae</name>
<email>chang.seok.bae@intel.com</email>
</author>
<published>2020-05-28T20:14:01Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=291fd83569e10f3d305cd8adb62f6ec00f759dc6'/>
<id>urn:sha1:291fd83569e10f3d305cd8adb62f6ec00f759dc6</id>
<content type='text'>
The test validates that the selector is not changed when a ptracer writes
the ptracee's GS base.

Originally-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Chang S. Bae &lt;chang.seok.bae@intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Tony Luck &lt;tony.luck@intel.com&gt;
Link: https://lkml.kernel.org/r/20200528201402.1708239-16-sashal@kernel.org


</content>
</entry>
<entry>
<title>Revert "x86/ptrace: Prevent ptrace from clearing the FS/GS selector" and fix the test</title>
<updated>2019-07-15T15:12:31Z</updated>
<author>
<name>Andy Lutomirski</name>
<email>luto@kernel.org</email>
</author>
<published>2019-07-15T14:21:44Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c7ca0b614513afba57824cae68447f9c32b1ee61'/>
<id>urn:sha1:c7ca0b614513afba57824cae68447f9c32b1ee61</id>
<content type='text'>
This reverts commit 48f5e52e916b55fb73754833efbacc7f8081a159.

The ptrace ABI change was a prerequisite to the proposed design for
FSGSBASE.  Since FSGSBASE support has been reverted, and since I'm not
convinced that the ABI was ever adequately tested, revert the ABI change as
well.

This also modifies the test case so that it tests the preexisting behavior.

Signed-off-by: Andy Lutomirski &lt;luto@kernel.org&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lkml.kernel.org/r/fca39c478ea7fb15bc76fe8a36bd180810a067f6.1563200250.git.luto@kernel.org

</content>
</entry>
</feed>
