A new self test that forces MSR[TS] to be set without calling any TM instruction. This test also tries to cause a page fault at a signal handler, exactly between MSR[TS] set and tm_recheckpoint(), forcing thread->texasr to be rewritten with TEXASR[FS] = 0, which will cause a BUG when tm_recheckpoint() is called. This test is not deterministic, since it is hard to guarantee that the page access will cause a page fault. In order to force more page faults at signal context, the signal handler and the ucontext are being mapped into a MADV_DONTNEED memory chunks. Tests have shown that the bug could be exposed with few interactions in a buggy kernel. This test is configured to loop 5000x, having a good chance to hit the kernel issue in just one run. This self test takes less than two seconds to run. This test uses set/getcontext because the kernel will recheckpoint zeroed structures, causing the test to segfault, which is undesired because the test needs to rerun, so, there is a signal handler for SIGSEGV which will restart the test. v2: Uses the MADV_DONTNEED memory advice v3: Fix memcpy and 32-bits compilation v4: Does not define unused macros Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
		
			
				
	
	
		
			29 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # SPDX-License-Identifier: GPL-2.0
 | |
| SIGNAL_CONTEXT_CHK_TESTS := tm-signal-context-chk-gpr tm-signal-context-chk-fpu \
 | |
| 	tm-signal-context-chk-vmx tm-signal-context-chk-vsx
 | |
| 
 | |
| TEST_GEN_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \
 | |
| 	tm-vmxcopy tm-fork tm-tar tm-tmspr tm-vmx-unavail tm-unavailable tm-trap \
 | |
| 	$(SIGNAL_CONTEXT_CHK_TESTS) tm-sigreturn tm-signal-sigreturn-nt \
 | |
| 	tm-signal-context-force-tm
 | |
| 
 | |
| top_srcdir = ../../../../..
 | |
| include ../../lib.mk
 | |
| 
 | |
| $(TEST_GEN_PROGS): ../harness.c ../utils.c
 | |
| 
 | |
| CFLAGS += -mhtm
 | |
| 
 | |
| $(OUTPUT)/tm-syscall: tm-syscall-asm.S
 | |
| $(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
 | |
| $(OUTPUT)/tm-tmspr: CFLAGS += -pthread
 | |
| $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64
 | |
| $(OUTPUT)/tm-resched-dscr: ../pmu/lib.c
 | |
| $(OUTPUT)/tm-unavailable: CFLAGS += -O0 -pthread -m64 -Wno-error=uninitialized -mvsx
 | |
| $(OUTPUT)/tm-trap: CFLAGS += -O0 -pthread -m64
 | |
| $(OUTPUT)/tm-signal-context-force-tm: CFLAGS += -pthread -m64
 | |
| 
 | |
| SIGNAL_CONTEXT_CHK_TESTS := $(patsubst %,$(OUTPUT)/%,$(SIGNAL_CONTEXT_CHK_TESTS))
 | |
| $(SIGNAL_CONTEXT_CHK_TESTS): tm-signal.S
 | |
| $(SIGNAL_CONTEXT_CHK_TESTS): CFLAGS += -mhtm -m64 -mvsx
 |