[PATCH v6 1/2] x86/fred/signal: Prevent immediate repeat of single step trap on return from SIGTRAP handler

2025-06-09 Thread Xin Li (Intel)
-off-by: Xin Li (Intel) Cc: sta...@vger.kernel.org --- Change in v6: *) Add TB from Sohil. Change in v5: *) Accurately rephrase the shortlog (hpa). Change in v4: *) Add a selftest to the patch set (Dave Hansen). Change in v3: *) Use "#ifdef CONFIG_X86_FRED" instead of IS_ENABLED(CONFI

[PATCH v6 2/2] selftests/x86: Add a test to detect infinite SIGTRAP handler loop

2025-06-09 Thread Xin Li (Intel)
Signed-off-by: Xin Li (Intel) Cc: sta...@vger.kernel.org --- Changes in v6: *) Replace a "sub $128, %rsp" with "add $-128, %rsp" (hpa). *) Declared loop_count_on_same_ip inside sigtrap() (Sohil). *) s/sigtrap/SIGTRAP (Sohil). Changes in v5: *) Do "sub $-128, %rsp&quo

[PATCH v6 0/2] x86/fred: Prevent immediate repeat of single step trap on return from SIGTRAP handler

2025-06-09 Thread Xin Li (Intel)
/ Changes in v6: *) Replace a "sub $128, %rsp" with "add $-128, %rsp" (hpa). *) Declared loop_count_on_same_ip inside sigtrap() (Sohil). *) s/sigtrap/SIGTRAP (Sohil). *) Add TB from Sohil to the first patch. Xin Li (Intel) (2): x86/fred/signal: Prevent immediate repeat of

[PATCH v5 2/2] selftests/x86: Add a test to detect infinite sigtrap handler loop

2025-06-06 Thread Xin Li (Intel)
. 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

[PATCH v5 1/2] x86/fred/signal: Prevent immediate repeat of single step trap on return from SIGTRAP handler

2025-06-06 Thread Xin Li (Intel)
-step trap upon completion of ERETU. Therefore, another #DB is triggered before any user space instruction is executed, which leads to an infinite loop in which the SIGTRAP handler keeps being invoked on the same user space IP. Suggested-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li (Intel) Cc

[PATCH v5 0/2] x86/fred: Prevent immediate repeat of single step trap on return from SIGTRAP handler

2025-06-06 Thread Xin Li (Intel)
-...@zytor.com/ Changes in v5: *) Accurately rephrase the shortlog (hpa). *) Do "sub $-128, %rsp" rather than "add $128, %rsp", which is more efficient in code size (hpa). *) Add TB from Sohil. *) Add Cc: sta...@vger.kernel.org to all patches. Xin Li (Intel) (2): x86/

[PATCH v4 2/2] selftests/x86: Add a test to detect infinite sigtrap handler loop

2025-06-05 Thread Xin Li (Intel)
. 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

[PATCH v4 1/2] x86/fred/signal: Prevent single-step upon ERETU completion

2025-06-05 Thread Xin Li (Intel)
. Therefore, another #DB is triggered before any user space instruction is executed, which leads to an infinite loop in which the SIGTRAP handler keeps being invoked on the same user space IP. Suggested-by: H. Peter Anvin (Intel) Signed-off-by: Xin Li (Intel) Cc: sta...@vger.kernel.org --- Change

[PATCH v4 0/2] x86/fred: Prevent single-step upon ERETU completion

2025-06-05 Thread Xin Li (Intel)
. [1] https://lore.kernel.org/lkml/20250523050153.3308237-1-...@zytor.com/ [2] https://lore.kernel.org/lkml/20250530230707.2528916-1-...@zytor.com/ This patch set is based on tip/x86/urgent branch as of today. Xin Li (Intel) (2): x86/fred/signal: Prevent single-step upon ERETU completion

[PATCH v1 1/1] selftests/x86: Add a test to detect infinite sigtrap handler loop

2025-05-30 Thread Xin Li (Intel)
. This test checks for that specific scenario—verifying whether the kernel correctly prevents an infinite SIGTRAP loop in this edge case. Signed-off-by: Xin Li (Intel) --- tools/testing/selftests/x86/Makefile | 2 +- .../selftests/x86/test_sigtrap_handler.c | 80 +++ 2