From: Xie Yuanbin <xieyuanbin1@huawei.com>
To: <ljs@kernel.org>, <akpm@linux-foundation.org>
Cc: <david@kernel.org>, <liam@infradead.org>, <liaohua4@huawei.com>,
<lilinjie8@huawei.com>, <linusw@kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<linux@armlinux.org.uk>, <mhocko@suse.com>, <rppt@kernel.org>,
<sunnanyong@huawei.com>, <surenb@google.com>, <vbabka@kernel.org>,
<xieyuanbin1@huawei.com>, <xiqi2@huawei.com>
Subject: Re: [PATCH v3 1/2] ARM: mm: fix use-after-free in __do_user_fault() under CONFIG_DEBUG_USER
Date: Tue, 7 Jul 2026 22:04:05 +0800 [thread overview]
Message-ID: <20260707140405.85568-1-xieyuanbin1@huawei.com> (raw)
In-Reply-To: <akz8aZUW23rpyrLO@lucifer>
On Tue, 7 Jul 2026 14:20:19 +0100, Lorenzo Stoakes wrote:
> Well the whole reason you're faulting here might be because a userland process
> did that right? The page tables should tell you (presumably on ARM32 :)
>
> And I hate to repeat myself, maybe you didn't read the whole thread but... just
> use mmap_write_lock(), this isn't necessary?
>
> What is this trying to achieve?
>
> You're not in a hotpath, why are you bothering to conditionally take/not take
> the lock?
I think it is not the same thing as the previous discussion regarding
which locks are needed for `show_pte()`.
Now, for this bug, we have two places that need to be fixed:
1. __do_user_fault()->show_pte();
2. do_DataAbort()->show_pte();
For the first one, it must be a user fault, the judgment of
user_mode(regs) can be omitted.
For the second one, it may be a user fault or a kernel fault. If it is
a kernel fault, it also means that this is a kernel oops.
For kernel oops, according to Russell's opinion, we do not need to fix
this bug, which means we do not need to acquire any locks, because the
kernel may die soon. However, show_pte() still needs to be retained
because it is useful for debugging the kernel.
For user faults, we need to fix it:
1. For user space addr (addr < TASK_SIZE), we need to acquire
current->mm's write lock, before show_pte(), I understand it now.
2. For kernel space addr (addr >= TASK_SIZE), maybe we can omit
show_pte()? After all, user-mode programs can access any kernel address
to trigger user faults, but we dump the page tables of kernel
addresses, would that be inappropriate,
(e.g., posing potential security risks)?
next prev parent reply other threads:[~2026-07-07 14:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 7:30 [PATCH v3 0/2] ARM: mm: fix use-after-free in show_pte() Qi Xi
2026-06-26 7:30 ` [PATCH v3 1/2] ARM: mm: fix use-after-free in __do_user_fault() under CONFIG_DEBUG_USER Qi Xi
2026-06-26 9:44 ` Russell King
2026-06-27 1:39 ` Qi Xi
2026-07-06 13:32 ` Xie Yuanbin
2026-07-07 11:48 ` Qi Xi
2026-07-07 11:57 ` Russell King
2026-07-07 12:47 ` Qi Xi
2026-07-07 12:47 ` Lorenzo Stoakes
2026-07-07 13:14 ` Xie Yuanbin
2026-07-07 13:20 ` Lorenzo Stoakes
2026-07-07 14:04 ` Xie Yuanbin [this message]
2026-07-07 15:34 ` Russell King
2026-07-10 2:32 ` Qi Xi
2026-07-11 7:27 ` Lorenzo Stoakes
2026-07-11 7:56 ` Xie Yuanbin
2026-07-11 8:05 ` Lorenzo Stoakes
2026-07-11 8:13 ` Xie Yuanbin
2026-07-07 12:46 ` Lorenzo Stoakes
2026-07-07 13:35 ` Xie Yuanbin
2026-07-11 6:43 ` Lorenzo Stoakes
2026-06-26 7:30 ` [PATCH v3 2/2] ARM: mm: protect show_pte() in do_DataAbort() fallback path Qi Xi
2026-06-26 9:45 ` Russell King
2026-06-26 10:16 ` Xie Yuanbin
2026-06-26 12:37 ` Russell King
2026-06-27 1:22 ` Xie Yuanbin
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=20260707140405.85568-1-xieyuanbin1@huawei.com \
--to=xieyuanbin1@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=liaohua4@huawei.com \
--cc=lilinjie8@huawei.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@armlinux.org.uk \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=sunnanyong@huawei.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=xiqi2@huawei.com \
/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