From: Linus Torvalds <torvalds@linux-foundation.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm: avoid leaving partial pfn mappings around in error case
Date: Sun, 15 Sep 2024 12:23:31 +0200 [thread overview]
Message-ID: <CAHk-=wh7E+g_iCmCtVRQqrpN7S3VSBpEssf19s1QJHbDqfADyw@mail.gmail.com> (raw)
In-Reply-To: <8e3ffaf2-358f-479c-8de6-46e1b0bb0c5f@stanley.mountain>
On Sun, 15 Sept 2024 at 12:08, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The lru_add_drain() function at the start of zap_page_range_single() takes a
> mutex.
Yes, that shouldn't be problematic. But:
> It's the preempt_disable() in gru_fault() which is the issue. The call tree
> is:
>
> gru_fault() <- disables preempt
> -> remap_pfn_range()
> -> remap_pfn_range_notrack()
That code is very odd. It was invalid to call remap_pfn_range() with
preemption disabled even before, because it will allocate the page
tables that it fills in.
But presumably *that* never happened in practice, and so nobody
noticed how broken that code was before.
Now smatch seems to see a new problem, but I *think* it's because
smatch didn't notice the sleeping by p4d_alloc() / pud_alloc() /
pmd_alloc() because those allocations are all conditional (so smatch
doesn't see them as static violations).
Put another way: I do not believe this is a new issue, but perhaps a
"new to smatch" issue?
I do get the feeling that even despite the pmd_alloc() having that
conditional, smatch should have seen how it goes to __pmd_alloc() and
then to pmd_alloc_one() and pagetable_alloc_noprof() ->
alloc_pages_noprof().
Have you maybe disabled those warnings from before? Or is there some
other reason why smatch just considers that to be ok with preemption
disabled?
Linus
next prev parent reply other threads:[~2024-09-15 10:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-15 10:08 Dan Carpenter
2024-09-15 10:23 ` Linus Torvalds [this message]
2024-09-15 12:05 ` Dan Carpenter
2024-09-15 13:14 ` Linus Torvalds
2024-09-18 21:08 ` Dimitri Sivanich
2024-09-15 12:01 ` Lorenzo Stoakes
2024-09-15 12:09 ` Dan Carpenter
2024-09-15 12:38 ` Lorenzo Stoakes
2024-09-15 13:14 ` Dan Carpenter
2024-09-15 13:26 ` Lorenzo Stoakes
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='CAHk-=wh7E+g_iCmCtVRQqrpN7S3VSBpEssf19s1QJHbDqfADyw@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-mm@kvack.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