From: Xin Zhao <jackzxcui1989@163.com>
To: tglx@linutronix.de, peterz@infradead.org,
akpm@linux-foundation.org, bigeasy@linutronix.de
Cc: linux-mm@kvack.org, kuba@kernel.org,
linux-kernel@vger.kernel.org, jackzxcui1989@163.com
Subject: [PATCH] mm/fault, arch: faulthandler_disabled() also check irqs_disabled()
Date: Mon, 23 Mar 2026 18:01:00 +0800 [thread overview]
Message-ID: <20260323100100.1031582-1-jackzxcui1989@163.com> (raw)
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
next reply other threads:[~2026-03-23 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 10:01 Xin Zhao [this message]
2026-03-31 8:28 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260323100100.1031582-1-jackzxcui1989@163.com \
--to=jackzxcui1989@163.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox