Skip to content

Commit 2667e36

Browse files
Merge patch series "RISC-V kasan rework"
Alexandre Ghiti <alexghiti@rivosinc.com> says: As described in patch 2, our current kasan implementation is intricate, so I tried to simplify the implementation and mimic what arm64/x86 are doing. In addition it fixes UEFI bootflow with a kasan kernel and kasan inline instrumentation: all kasan configurations were tested on a large ubuntu kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. inline ubuntu config + uefi: sv39: OK sv48: OK sv57: OK outline ubuntu config + uefi: sv39: OK sv48: OK sv57: OK Actually 1 test always fails with KASAN_KUNIT_TEST that I have to check: KASAN failure expected in "set_bit(nr, addr)", but none occurrred Note that Palmer recently proposed to remove COMMAND_LINE_SIZE from the userspace abi https://lore.kernel.org/lkml/20221211061358.28035-1-palmer@rivosinc.com/T/ so that we can finally increase the command line to fit all kasan kernel parameters. All of this should hopefully fix the syzkaller riscv build that has been failing for a few months now, any test is appreciated and if I can help in any way, please ask. * b4-shazam-merge: riscv: Unconditionnally select KASAN_VMALLOC if KASAN riscv: Fix ptdump when KASAN is enabled riscv: Fix EFI stub usage of KASAN instrumented strcmp function riscv: Move DTB_EARLY_BASE_VA to the kernel address space riscv: Rework kasan population functions riscv: Split early and final KASAN population functions Link: https://lore.kernel.org/r/20230203075232.274282-1-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2 parents 2e75ab3 + 864046c commit 2667e36

5 files changed

Lines changed: 298 additions & 247 deletions

File tree

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ config RISCV
120120
select HAVE_SYSCALL_TRACEPOINTS
121121
select IRQ_DOMAIN
122122
select IRQ_FORCED_THREADING
123+
select KASAN_VMALLOC if KASAN
123124
select MODULES_USE_ELF_RELA if MODULES
124125
select MODULE_SECTIONS if MODULES
125126
select OF

arch/riscv/kernel/image-vars.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
* linked at. The routines below are all implemented in assembler in a
2424
* position independent manner
2525
*/
26-
__efistub_strcmp = strcmp;
27-
2826
__efistub__start = _start;
2927
__efistub__start_kernel = _start_kernel;
3028
__efistub__end = _end;

arch/riscv/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]
5757
EXPORT_SYMBOL(empty_zero_page);
5858

5959
extern char _start[];
60-
#define DTB_EARLY_BASE_VA PGDIR_SIZE
60+
#define DTB_EARLY_BASE_VA (ADDRESS_SPACE_END - (PTRS_PER_PGD / 2 * PGDIR_SIZE) + 1)
6161
void *_dtb_early_va __initdata;
6262
uintptr_t _dtb_early_pa __initdata;
6363

0 commit comments

Comments
 (0)