Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mte/kasan: Implementing KASAN memory protection for ARM64 hardware MTE
1. Add mte_tags.c, which will call arm64_mte to implement tagging of memory blocks by operating registers 2. please use arm64/mte, it default enable MM_KASAN_MTE_TAGS, run log: ➜ NX git:(mm) ✗ qemu-system-aarch64 -cpu max -nographic \ -machine virt,virtualization=on,gic-version=3,mte=on \ -chardev stdio,id=con,mux=on, -serial chardev:con \ -mon chardev=con,mode=readline -kernel ./nuttx/nuttx -s - Ready to Boot Primary CPU - Boot from EL2 - Boot from EL1 - Boot to C runtime for OS Initialize mm_initialize: Heap: name=Umem, start=0x403f2000 size=130080768 mm_addregion: [Umem] Region 1: base=0x403f23a0 size=130079840 mm_malloc: Allocated 0xf8000000403f23e0, size 144 mm_malloc: Allocated 0xfe000000403f2470, size 80 mm_malloc: Allocated 0xfe000000403f24c0, size 64 mm_malloc: Allocated 0xfe000000403f2500, size 96 mm_malloc: Allocated 0xff000000403f2560, size 96 mm_malloc: Allocated 0xf7000000403f25c0, size 96 mm_malloc: Allocated 0xff000000403f2620, size 96 mm_malloc: Allocated 0xfe000000403f2680, size 96 mm_malloc: Allocated 0xfe000000403f26e0, size 64 mm_malloc: Allocated 0xf1000000403f2720, size 64 mm_malloc: Allocated 0xf9000000403f2760, size 336 mm_malloc: Allocated 0xf6000000403f28b0, size 8208 mm_malloc: Allocated 0xf4000000403f48c0, size 1584 mm_malloc: Allocated 0xfa000000403f4ef0, size 64 mm_malloc: Allocated 0xf8000000403f4f30, size 64 mm_malloc: Allocated 0xfe000000403f4f70, size 8208 mm_malloc: Allocated 0xfe000000403f6f80, size 80 mm_malloc: Allocated 0xfe000000403f6fd0, size 96 mm_malloc: Allocated 0xf7000000403f7030, size 96 mm_malloc: Allocated 0xf7000000403f7090, size 336 mm_malloc: Allocated 0xfc000000403f71e0, size 96 mm_malloc: Allocated 0xfd000000403f7240, size 912 NuttShell (NSH) nsh> nsh> mtetest mm_malloc: Allocated 0xf4000000403f75d0, size 1584 mm_malloc: Allocated 0xfd000000403f7c00, size 64 mm_malloc: Allocated 0xff000000403f7c40, size 64 mm_malloc: Allocated 0xfe000000403f7c80, size 8208 Spawning process for test: mtetest1 mm_malloc: Allocated 0xf4000000403f9c90, size 1584 mm_malloc: Allocated 0xfb000000403fa2c0, size 64 mm_malloc: Allocated 0xf5000000403fa300, size 64 mm_malloc: Allocated 0xfd000000403fa340, size 8208 Running test: mtetest1 mm_free: Freeing 0xf5000000403fa300 mm_free: Freeing 0xfb000000403fa2c0 mm_free: Freeing 0xfd000000403fa340 mm_free: Freeing 0xf4000000403f9c90 Test 'mtetest1' completed Spawning process for test: mtetest2 mm_malloc: Allocated 0xf9000000403f9c90, size 1584 mm_malloc: Allocated 0xfd000000403fa2c0, size 64 mm_malloc: Allocated 0xfd000000403fa300, size 64 mm_malloc: Allocated 0xfb000000403fa340, size 8208 Running test: mtetest2 mm_free: Freeing 0xfd000000403fa300 mm_free: Freeing 0xfd000000403fa2c0 mm_free: Freeing 0xfb000000403fa340 mm_free: Freeing 0xf9000000403f9c90 Test 'mtetest2' completed Spawning process for test: mtetest3 mm_malloc: Allocated 0xf5000000403f9c90, size 1584 mm_malloc: Allocated 0xf7000000403fa2c0, size 64 mm_malloc: Allocated 0xfd000000403fa300, size 64 mm_malloc: Allocated 0xf4000000403fa340, size 8208 Running test: mtetest3 mm_free: Freeing 0xfd000000403fa300 mm_free: Freeing 0xf7000000403fa2c0 mm_free: Freeing 0xf4000000403fa340 mm_free: Freeing 0xf5000000403f9c90 Test 'mtetest3' completed Spawning process for test: mtetest4 mm_malloc: Allocated 0xf8000000403f9c90, size 1584 mm_malloc: Allocated 0xfb000000403fa2c0, size 64 mm_malloc: Allocated 0xf4000000403fa300, size 64 mm_malloc: Allocated 0xfe000000403fa340, size 8208 Running test: mtetest4 mm_free: Freeing 0xf4000000403fa300 mm_free: Freeing 0xfb000000403fa2c0 mm_free: Freeing 0xfe000000403fa340 mm_free: Freeing 0xf8000000403f9c90 Test 'mtetest4' completed Spawning process for test: mtetest5 mm_malloc: Allocated 0xf2000000403f9c90, size 1584 mm_malloc: Allocated 0xf5000000403fa2c0, size 64 mm_malloc: Allocated 0xf8000000403fa300, size 64 mm_malloc: Allocated 0xfb000000403fa340, size 8208 Running test: mtetest5 mm_free: Freeing 0xf8000000403fa300 mm_free: Freeing 0xf5000000403fa2c0 mm_free: Freeing 0xfb000000403fa340 mm_free: Freeing 0xf2000000403f9c90 Test 'mtetest5' completed Spawning process for test: Thread switch MTE test mm_malloc: Allocated 0xf4000000403f9c90, size 1584 mm_malloc: Allocated 0xff000000403fa2c0, size 64 mm_malloc: Allocated 0xfe000000403fa300, size 64 mm_malloc: Allocated 0xfb000000403fa340, size 8208 Running test: Thread switch MTE test mm_malloc: Allocated 0xf2000000403fc350, size 352 mm_malloc: Allocated 0xf4000000403fc4b0, size 8208 mm_malloc: Allocated 0xf4000000403fe4c0, size 352 mm_malloc: Allocated 0xfa000000403fe620, size 8208 Process 1 holding lock Process 2 holding lock Process 1 holding lock again default_fatal_handler: (IFSC/DFSC) for Data/Instruction aborts: synchronous tag check fault arm64_exception_handler: CurrentEL: MODE_EL1 arm64_exception_handler: ESR_ELn: 0x96000011 arm64_exception_handler: FAR_ELn: 0x6000000403ee2f0 arm64_exception_handler: ELR_ELn: 0x402b3e98 print_ec_cause: DABT (current EL) print_ec_cause: Data Abort taken without a change in Exception level Signed-off-by: wangmingrong1 <[email protected]>
- Loading branch information