]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/x86: Add a test to detect infinite SIGTRAP handler loop
authorXin Li (Intel) <xin@zytor.com>
Mon, 9 Jun 2025 08:40:54 +0000 (01:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:37 +0000 (11:07 +0100)
commitcdc1749775cd4da34a538e0482398af7b742e00f
tree0a8f7f7eaa0c62086741e4eac47d19e70522294a
parent1c1b786ffe52133109ba7ec77553872367ba3ff9
selftests/x86: Add a test to detect infinite SIGTRAP handler loop

commit f287822688eeb44ae1cf6ac45701d965efc33218 upstream.

When FRED is enabled, if the Trap Flag (TF) is set without an external
debugger attached, it can lead to an infinite loop in the SIGTRAP
handler.  To avoid this, the software event flag in the augmented SS
must be cleared, ensuring that no single-step trap remains pending when
ERETU completes.

This test checks for that specific scenario—verifying whether the kernel
correctly prevents an infinite SIGTRAP loop in this edge case when FRED
is enabled.

The test should _always_ pass with IDT event delivery, thus no need to
disable the test even when FRED is not enabled.

Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Cc:stable@vger.kernel.org
Link: https://lore.kernel.org/all/20250609084054.2083189-3-xin%40zytor.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/x86/Makefile
tools/testing/selftests/x86/sigtrap_loop.c [new file with mode: 0644]