[LTP] [PATCH] kallsyms: Add the capture of the SIGBUS signal
Chenghao Duan
duanchenghao@kylinos.cn
Wed Nov 26 04:10:38 CET 2025
When user-space accesses a kernel virtual address on the LoongArch
architecture, a ade(address error) exception is generated, and the
SIGBUS signal is returned to user-space within the exception handler.
Signed-off-by: Chenghao Duan <duanchenghao@kylinos.cn>
---
testcases/kernel/security/kallsyms/kallsyms.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/security/kallsyms/kallsyms.c b/testcases/kernel/security/kallsyms/kallsyms.c
index 45b3e18d4..6a970f8c8 100644
--- a/testcases/kernel/security/kallsyms/kallsyms.c
+++ b/testcases/kernel/security/kallsyms/kallsyms.c
@@ -62,7 +62,7 @@ static int ranges_size, ranges_len;
static void segv_handler(int sig)
{
- if (sig == SIGSEGV)
+ if (sig == SIGSEGV || sig == SIGBUS)
segv_caught++;
else
tst_res(TFAIL, "Unexpected signal %s", strsignal(sig));
@@ -143,6 +143,7 @@ static void setup(void)
memset(&sa, 0, sizeof(sa));
sa.sa_handler = segv_handler;
sigaction(SIGSEGV, &sa, NULL);
+ sigaction(SIGBUS, &sa, NULL);
nr_symbols = read_kallsyms(NULL, 0);
sym_table = SAFE_CALLOC(nr_symbols, sizeof(*sym_table));
--
2.25.1
More information about the ltp
mailing list