[PATCH v4 01/55] selftests/mm: hugetlb-read-hwpoison: add SIGBUS handler
From: Mike Rapoport
Date: Mon May 11 2026 - 12:44:31 EST
From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
Injection of a memory error with madvise() causes SIGBUS, which terminates
the hugetlb-read-hwpoison test prematurely.
Add a dummy SIGBUS handler to allow the test to continue regardless of
SIGBUS.
Tested-by: Sarthak Sharma <sarthak.sharma@xxxxxxx>
Tested-by: Li Wang <li.wang@xxxxxxxxx>
Reviewed-by: Li Wang <li.wang@xxxxxxxxx>
Tested-by: Luiz Capitulino <luizcap@xxxxxxxxxx>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---
tools/testing/selftests/mm/hugetlb-read-hwpoison.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/mm/hugetlb-read-hwpoison.c b/tools/testing/selftests/mm/hugetlb-read-hwpoison.c
index 46230462ad48..ad3198b444ce 100644
--- a/tools/testing/selftests/mm/hugetlb-read-hwpoison.c
+++ b/tools/testing/selftests/mm/hugetlb-read-hwpoison.c
@@ -10,6 +10,7 @@
#include <sys/statfs.h>
#include <errno.h>
#include <stdbool.h>
+#include <signal.h>
#include "kselftest.h"
@@ -261,6 +262,10 @@ static int create_hugetlbfs_file(struct statfs *file_stat)
return -1;
}
+static void sigbus_handler(int sig)
+{
+}
+
int main(void)
{
int fd;
@@ -273,6 +278,7 @@ int main(void)
};
size_t i;
+ signal(SIGBUS, sigbus_handler);
for (i = 0; i < ARRAY_SIZE(wr_chunk_sizes); ++i) {
printf("Write/read chunk size=0x%lx\n",
wr_chunk_sizes[i]);
--
2.53.0