[PATCH 8/9] test: self: setjmp: make compatible with ASAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ASAN currently flags the setjmp selftest. Use the newly exported fiber
API to fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 test/self/setjmp.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/self/setjmp.c b/test/self/setjmp.c
index deac584d736d..0c7bc003361b 100644
--- a/test/self/setjmp.c
+++ b/test/self/setjmp.c
@@ -76,11 +76,16 @@ static void test_setjmp_loop(void)
 
 }
 
+static void *main_stack;
+static u32 main_stack_size;
+
 static void __noreturn initjmp_entry(void)
 {
 	volatile u32 arr[256];
 	int i;
 
+	finish_switch_fiber(NULL, &main_stack, &main_stack_size);
+
 	for (i = 0; i < ARRAY_SIZE(arr); i++)
 		writel(i, &arr[i]);
 
@@ -89,11 +94,13 @@ static void __noreturn initjmp_entry(void)
 	if (i == 0)
 		initjmp_entry();
 
+	start_switch_fiber(NULL, main_stack, main_stack_size);
 	longjmp(jbuf, 0x1337);
 }
 
 static void test_initjmp(void)
 {
+	void *fake_stack_save = NULL;
 	void *stack;
 	jmp_buf ijbuf;
 
@@ -114,11 +121,14 @@ static void test_initjmp(void)
 	case 0x1337:
 		break;
 	case 0:
+		start_switch_fiber(&fake_stack_save, stack, CONFIG_STACK_SIZE);
 		longjmp(ijbuf, 0x42);
 	default:
 		failed_tests++;
 	}
 
+	finish_switch_fiber(fake_stack_save, &main_stack, &main_stack_size);
+
 	free(stack);
 }
 
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux