From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: Karl Mehltretter <kmehltretter@gmail.com>,
Yoshinori Sato <yoshinori.sato@nifty.com>,
Rich Felker <dalias@libc.org>
Cc: Peter Xu <peterx@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sh: mm: fix double mmap_lock release on SIGBUS and SIGSEGV faults
Date: Fri, 16 Oct 2026 15:50:34 +0200 [thread overview]
Message-ID: <f46a2ef98217b3cb6bd374b9bdf0bcb2e3227940.camel@physik.fu-berlin.de> (raw)
In-Reply-To: <atHwnaEUDihOsGUQ@gmail.com>
Hi Karl,
On Fri, 2026-10-16 at 11:46 +0200, Karl Mehltretter wrote:
> On Mon, Sep 28, 2026 at 02:19:37AM +0100, Karl Mehltretter wrote:
> > A process that survives the signal keeps an mm with a corrupted
> > mmap_lock. With CONFIG_DEBUG_RWSEMS and lockdep, stress-ng --msync
> > (which catches SIGBUS) reports within a minute:
> >
> > WARNING: bad unlock balance detected!
> > stress-ng-msync/54 is trying to release lock (&mm->mmap_lock) at:
> > mm_fault_error+0xd0/0x16c
> > ...
> > DEBUG_RWSEMS_WARN_ON(tmp < 0): count = 0xffffff00, ...
> >
> > and without them, find_vma() warns that mmap_lock is not held right
> > after it was taken. Seen on a custom QEMU model of the SH7785LCR, in
> > both 29-bit and 32-bit mode.
> >
> > Drop the release from do_sigbus(), whose only caller is
> > mm_fault_error(), and use bad_area_nosemaphore() for VM_FAULT_SIGSEGV.
> > bad_area() has no users left and goes away.
> >
> > Fixes: fb027ada051a ("sh/mm: use helper fault_signal_pending()")
> > Cc: stable@vger.kernel.org
> > Assisted-by: LLM
> > Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> > ---
> >
> > Notes:
> > Tested in QEMU on a custom SH7785LCR model, not on hardware.
> > Reproducer: Debian sh4 stress-ng 0.22.01 --msync
> >
>
> A friendly ping on this fix.
>
> I have now also reproduced it with stock QEMU 11.0.2 on the upstream
> r2d machine (SH7751R): the unpatched kernel warns after a caught SIGBUS,
> while the patched kernel does not.
>
> Also, the stress-ng command in the review notes is incorrect. Use:
>
> stress-ng --msync 1 --timeout 60s
I'm trying to get this reviewed in the weekend. I'm not forgetting about
patches as I'll always check what's on patchwork and pick everything up
that I haven't taken yet [1].
Adrian
> [1] https://patchwork.kernel.org/project/linux-sh/list/
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
prev parent reply other threads:[~2026-10-16 13:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 0:19 Karl Mehltretter
2026-10-16 9:46 ` Karl Mehltretter
2026-10-16 13:50 ` John Paul Adrian Glaubitz [this message]
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=f46a2ef98217b3cb6bd374b9bdf0bcb2e3227940.camel@physik.fu-berlin.de \
--to=glaubitz@physik.fu-berlin.de \
--cc=akpm@linux-foundation.org \
--cc=dalias@libc.org \
--cc=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=peterx@redhat.com \
--cc=yoshinori.sato@nifty.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
all inboxes | Powered by JetHome®