Re: [PATCH v3 1/2] ARM: ioremap: Sync PGDs for VMALLOC shadow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/17/24 14:59, Linus Walleij wrote:
[...]
+static unsigned long arm_kasan_mem_to_shadow(unsigned long addr)
+{
+	return (unsigned long)kasan_mem_to_shadow((void *)addr);
+}
+

`kasan_mem_to_shadow` function symbol is only exported with :
CONFIG_KASAN_GENERIC or defined(CONFIG_KASAN_SW_TAGS) from kasan.h

To me, the if condition you added below should be expanded with those two macros.

[...]
  void __check_vmalloc_seq(struct mm_struct *mm)
  {
  	int seq;
do {
  		seq = atomic_read(&init_mm.context.vmalloc_seq);
-		memcpy(pgd_offset(mm, VMALLOC_START),
-		       pgd_offset_k(VMALLOC_START),
-		       sizeof(pgd_t) * (pgd_index(VMALLOC_END) -
-					pgd_index(VMALLOC_START)));
+		memcpy_pgd(mm, VMALLOC_START, VMALLOC_END);
+		if (IS_ENABLED(CONFIG_KASAN_VMALLOC)) {
+			unsigned long start =
+				arm_kasan_mem_to_shadow(VMALLOC_START);
+			unsigned long end =
+				arm_kasan_mem_to_shadow(VMALLOC_END);
+			memcpy_pgd(mm, start, end);
+		}
  		/*
  		 * Use a store-release so that other CPUs that observe the
  		 * counter's new value are guaranteed to see the results of the

Otherwise it compiles with KASAN enabled, I am running some tests with your patches.

Regards,

Clément




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux