[PATCH v3 1/2] ARM: mm: fix use-after-free in __do_user_fault() under CONFIG_DEBUG_USER
Lorenzo Stoakes
ljs at kernel.org
Tue Jul 7 06:20:19 PDT 2026
On Tue, Jul 07, 2026 at 09:14:09PM +0800, Xie Yuanbin wrote:
> On Tue, 7 Jul 2026 12:57:45 +0100, Russell King wrote:
> > No. This information is useful debug for kernel oops.
>
> For kernel oops, I think it should be `!user_mode(regs)`, Qi Xi's reply:
>
> On Tue, 7 Jul 2026 19:48:12 +0800, Qi Xi wrote:
> > For do_DataAbort() fallback:
> >
> > if (user_mode(regs)) {
> > if (addr < TASK_SIZE) {
> > mmap_read_lock(current->mm);
> > show_pte(KERN_ALERT, current->mm, addr);
> > mmap_read_unlock(current->mm);
> > }
> > } else {
> > show_pte(KERN_ALERT, current->mm, addr);
> > }
>
> changes nothing to kernel oops. It only skip show_pte() for user-mode
> faults, and the fault addr is a kernel address, which means a user
> program is trying to access a kernel address.
> I think it is reasonable to skip show_pte() in this case?
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?
Thanks, Lorenzo
More information about the linux-arm-kernel
mailing list