* [PATCH] mm/fault, arch: faulthandler_disabled() also check irqs_disabled()
@ 2026-03-23 10:01 Xin Zhao
0 siblings, 0 replies; only message in thread
From: Xin Zhao @ 2026-03-23 10:01 UTC (permalink / raw)
To: tglx, peterz, akpm, bigeasy; +Cc: linux-mm, kuba, linux-kernel, jackzxcui1989
in_atomic() cannot determine whether it is in a context where interrupts
are disabled. In a context with interrupts disabled, sleeping is not
allowed. Page fault handling may lead to sleeping, which can cause issues.
faulthandler_disabled() checks irqs_disabled() to avoid this situation.
Signed-off-by: Xin Zhao <jackzxcui1989@163.com>
---
include/linux/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 1f3804245..71fea4497 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -305,7 +305,7 @@ static inline bool pagefault_disabled(void)
* !CONFIG_PREEMPT_COUNT, this is like a NOP. So the handler won't be disabled.
* in_atomic() will report different values based on !CONFIG_PREEMPT_COUNT.
*/
-#define faulthandler_disabled() (pagefault_disabled() || in_atomic())
+#define faulthandler_disabled() (pagefault_disabled() || in_atomic() || irqs_disabled())
DEFINE_LOCK_GUARD_0(pagefault, pagefault_disable(), pagefault_enable())
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-23 10:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 10:01 [PATCH] mm/fault, arch: faulthandler_disabled() also check irqs_disabled() Xin Zhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox