Skip to content

Commit 3c25226

Browse files
committed
LoongArch: Make KASAN usable for variable cpu_vabits
Currently, KASAN on LoongArch assume the CPU VA bits is 48, which is true for Loongson-3 series, but not for Loongson-2 series (only 40 or lower), this patch fix that issue and make KASAN usable for variable cpu_vabits. Solution is very simple: Just define XRANGE_SHADOW_SHIFT which means valid address length from VA_BITS to min(cpu_vabits, VA_BITS). Cc: [email protected] Signed-off-by: Kanglong Wang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent d2f8671 commit 3c25226

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/loongarch/include/asm/kasan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define XRANGE_SHIFT (48)
1717

1818
/* Valid address length */
19-
#define XRANGE_SHADOW_SHIFT (PGDIR_SHIFT + PAGE_SHIFT - 3)
19+
#define XRANGE_SHADOW_SHIFT min(cpu_vabits, VA_BITS)
2020
/* Used for taking out the valid address */
2121
#define XRANGE_SHADOW_MASK GENMASK_ULL(XRANGE_SHADOW_SHIFT - 1, 0)
2222
/* One segment whole address space size */

0 commit comments

Comments
 (0)