From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Hugh Dickins <hughd@google.com>,
Nicholas Piggin <npiggin@gmail.com>,
Guenter Roeck <linux@roeck-us.net>,
Juergen Gross <jgross@suse.com>,
Jeremy Fitzhardinge <jeremy@goop.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
kasan-dev@googlegroups.com, sparclinux@vger.kernel.org,
xen-devel@lists.xenproject.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org
Subject: [PATCH v1 1/4] kasan: Avoid sleepable page allocation from atomic context
Date: Mon, 7 Apr 2025 17:11:27 +0200 [thread overview]
Message-ID: <ad1b313b6e3e1a84d2df6f686680ad78ae99710c.1744037648.git.agordeev@linux.ibm.com> (raw)
In-Reply-To: <cover.1744037648.git.agordeev@linux.ibm.com>
apply_to_page_range() enters lazy MMU mode and then invokes
kasan_populate_vmalloc_pte() callback on each page table walk
iteration. The lazy MMU mode may only be entered only under
protection of the page table lock. However, the callback can
go into sleep when trying to allocate a single page.
Change __get_free_page() allocation mode from GFP_KERNEL to
GFP_ATOMIC to avoid scheduling out while in atomic context.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
mm/kasan/shadow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c
index 88d1c9dcb507..edfa77959474 100644
--- a/mm/kasan/shadow.c
+++ b/mm/kasan/shadow.c
@@ -301,7 +301,7 @@ static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr,
if (likely(!pte_none(ptep_get(ptep))))
return 0;
- page = __get_free_page(GFP_KERNEL);
+ page = __get_free_page(GFP_ATOMIC);
if (!page)
return -ENOMEM;
--
2.45.2
next prev parent reply other threads:[~2025-04-07 15:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 15:11 [PATCH v1 0/4] mm: Fix apply_to_pte_range() vs lazy MMU mode Alexander Gordeev
2025-04-07 15:11 ` Alexander Gordeev [this message]
2025-04-11 6:40 ` [PATCH v1 1/4] kasan: Avoid sleepable page allocation from atomic context Nicholas Piggin
2025-04-11 6:54 ` Nicholas Piggin
2025-04-07 15:11 ` [PATCH v1 2/4] mm: Cleanup apply_to_pte_range() routine Alexander Gordeev
2025-04-11 6:46 ` Nicholas Piggin
2025-04-14 14:17 ` Alexander Gordeev
2025-04-07 15:11 ` [PATCH v1 3/4] mm: Protect kernel pgtables in apply_to_pte_range() Alexander Gordeev
2025-04-11 6:53 ` Nicholas Piggin
2025-04-07 15:11 ` [PATCH v1 4/4] mm: Allow detection of wrong arch_enter_lazy_mmu_mode() context Alexander Gordeev
2025-04-11 7:16 ` Nicholas Piggin
2025-04-07 18:35 ` [PATCH v1 0/4] mm: Fix apply_to_pte_range() vs lazy MMU mode Andrew Morton
2025-04-11 7:12 ` Nicholas Piggin
2025-04-11 12:04 ` Alexander Gordeev
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=ad1b313b6e3e1a84d2df6f686680ad78ae99710c.1744037648.git.agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=jeremy@goop.org \
--cc=jgross@suse.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=ryabinin.a.a@gmail.com \
--cc=sparclinux@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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;
as well as URLs for NNTP newsgroup(s).