diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-02-07 13:01:19 +0100 |
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2024-02-07 13:02:20 +0100 |
| commit | 0e85f1ae4ac6dae238b0f35232d1aa52e1b6943f (patch) | |
| tree | 75b387bc359637c15b90ababb1ff073ca68b5bd8 /arch/x86/include/asm/kmsan.h | |
| parent | 2c8ba564a42c7418a726367c73d7c88454848fdc (diff) | |
| parent | f8e4806e0dfa8796b3d7076a7fe054455a59c38b (diff) | |
Merge drm/drm-next into drm-misc-next
Backmerging to update drm-misc-next to the state of v6.8-rc3. Also
fixes a build problem with xe.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'arch/x86/include/asm/kmsan.h')
| -rw-r--r-- | arch/x86/include/asm/kmsan.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/x86/include/asm/kmsan.h b/arch/x86/include/asm/kmsan.h index 8fa6ac0e2d76..d91b37f5b4bb 100644 --- a/arch/x86/include/asm/kmsan.h +++ b/arch/x86/include/asm/kmsan.h @@ -64,6 +64,7 @@ static inline bool kmsan_virt_addr_valid(void *addr) { unsigned long x = (unsigned long)addr; unsigned long y = x - __START_KERNEL_map; + bool ret; /* use the carry flag to determine if x was < __START_KERNEL_map */ if (unlikely(x > y)) { @@ -79,7 +80,21 @@ static inline bool kmsan_virt_addr_valid(void *addr) return false; } - return pfn_valid(x >> PAGE_SHIFT); + /* + * pfn_valid() relies on RCU, and may call into the scheduler on exiting + * the critical section. However, this would result in recursion with + * KMSAN. Therefore, disable preemption here, and re-enable preemption + * below while suppressing reschedules to avoid recursion. + * + * Note, this sacrifices occasionally breaking scheduling guarantees. + * Although, a kernel compiled with KMSAN has already given up on any + * performance guarantees due to being heavily instrumented. + */ + preempt_disable(); + ret = pfn_valid(x >> PAGE_SHIFT); + preempt_enable_no_resched(); + + return ret; } #endif /* !MODULE */ |
