From: Arne Welzel Date: Thu, 22 Mar 2018 14:47:36 +0000 (+0100) Subject: minix/tests/arm: naive tests to cause data aborts X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/mdoc.7.txt?a=commitdiff_plain;h=35b65c5af1d53112a49b08e87ddc00d7e24625e9;p=minix.git minix/tests/arm: naive tests to cause data aborts Some assembly code to cause unaligned access as well as segmentation faults to exercise the data abort path. Change-Id: Ie419114b76a8db849537a94fda781019cf14d50d --- diff --git a/distrib/sets/lists/minix-tests/md.evbarm b/distrib/sets/lists/minix-tests/md.evbarm new file mode 100644 index 000000000..455c82335 --- /dev/null +++ b/distrib/sets/lists/minix-tests/md.evbarm @@ -0,0 +1,9 @@ +# +# Sorted using sort_set.pl in releasetools. +# to add an entry simply add it at the end of the +# file and run +# ../../../../releasetools/sort_set.pl < mi > out +# mv out mi +# +./usr/tests/minix-posix/test_arm_segfault minix-tests +./usr/tests/minix-posix/test_arm_unaligned minix-tests diff --git a/minix/tests/Makefile b/minix/tests/Makefile index c0bcc8557..4662fe872 100644 --- a/minix/tests/Makefile +++ b/minix/tests/Makefile @@ -126,6 +126,8 @@ PROGS+= test63 mod OBJS.${o} += common.o .endfor +.include "./arch/${MACHINE_ARCH}/Makefile.inc" + # LSC Make sure there is not leftover after a failed testrun clean: .PHONY .MAKE @rm -rf DIR* diff --git a/minix/tests/arch/earm/Makefile.inc b/minix/tests/arch/earm/Makefile.inc new file mode 100644 index 000000000..18c590c9b --- /dev/null +++ b/minix/tests/arch/earm/Makefile.inc @@ -0,0 +1,7 @@ +PROGS+= test_arm_segfault +PROGS+= test_arm_unaligned + +.PATH: ${.CURDIR}/arch/${MACHINE_ARCH} + +test_arm_segfault.o : test_arm_segfault.S +test_arm_unaligned.o : test_arm_unaligned.S diff --git a/minix/tests/arch/earm/test_arm_segfault.S b/minix/tests/arch/earm/test_arm_segfault.S new file mode 100644 index 000000000..db13dc544 --- /dev/null +++ b/minix/tests/arch/earm/test_arm_segfault.S @@ -0,0 +1,16 @@ +.text +.global main +main: + push {lr} + ldr r0, =0xDEADBEE0 /* Hopefully this is not mapped... */ + ldr r1, [r0] + ldr r0, =0x01010100 /* In case we survived, try something else */ + ldr r1, [r0] + + ldr r0, =msg + bl puts + + mov r0, #0 /* test should check for non-zero exit code / signal */ + pop {pc} +msg: + .ascii "ERROR - caused no segfault\n" diff --git a/minix/tests/arch/earm/test_arm_unaligned.S b/minix/tests/arch/earm/test_arm_unaligned.S new file mode 100644 index 000000000..1d4486e7f --- /dev/null +++ b/minix/tests/arch/earm/test_arm_unaligned.S @@ -0,0 +1,26 @@ +.text +.global main +main: + push {lr} + mov r0, sp + + /* This should work */ + ldr r0, [sp] + + /* Unalign it */ + add r0, #2 + + /* Try a non-word aligned word-load, this may work if SCTRL.A == 0 */ + ldr r1, [r0] + + /* Load non-word aligned dword, should die even with SCTRL.A == 0 */ + ldrd r2, r3, [r0] + + + ldr r0, =msg + bl puts + + mov r0, #0 /* test should check for non-zero exit code / signal */ + pop {pc} +msg: + .ascii "ERROR - caused no sigbus\n" diff --git a/minix/tests/arch/i386/Makefile.inc b/minix/tests/arch/i386/Makefile.inc new file mode 100644 index 000000000..e69de29bb