From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-rt-devel@lists.linux.dev,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ryan Roberts <ryan.roberts@arm.com>,
Mark Brown <broonie@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
Joey Gouly <joey.gouly@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: BUG: debug_exception_enter() disables preemption and may call sleeping functions on aarch64 with RT
Date: Wed, 12 Feb 2025 12:21:45 +0100 [thread overview]
Message-ID: <20250212112145.BIE8_6T2@linutronix.de> (raw)
In-Reply-To: <Z6vvyKZ5eoAS435b@uudg.org>
On 2025-02-11 21:48:08 [-0300], Luis Claudio R. Goncalves wrote:
> > Couldn't you delay sending signals until after the preempt-disable
> > section?
>
> Looking at do_debug_exception,
>
> void do_debug_exception(unsigned long addr_if_watchpoint, unsigned long esr,
> struct pt_regs *regs)
> {
> const struct fault_info *inf = esr_to_debug_fault_info(esr);
> unsigned long pc = instruction_pointer(regs);
>
> debug_exception_enter(regs);
>
> if (user_mode(regs) && !is_ttbr0_addr(pc))
> arm64_apply_bp_hardening();
>
> if (inf->fn(addr_if_watchpoint, esr, regs)) {
> arm64_notify_die(inf->name, regs, inf->sig, inf->code, pc, esr);
> }
>
> debug_exception_exit(regs);
> }
> NOKPROBE_SYMBOL(do_debug_exception);
>
>
> Do you mean executing the
>
> arm64_notify_die(inf->name, regs, inf->sig, inf->code, pc, esr);
>
> after re-enabling the preemption or do you mean something more
> sophisticated?
single_step_handler() and brk_handler() can both send signals. If
inf->fn returns != 0 (which seems to be only be possible for
brk_handler() out of the possible four callbacks) this this
arm64_notify_die() sends a signal.
So we have three potential signal delivers. It shouldn't matter if the
signal is sent within the preempt-disable section or outside because the
signal will be queued for current and delivered on the return to
userland. So would just need to save the details and do it outside. Now
that I actually looked at the code, this might lead to a bit of a mess
so splitting out the signal part and avoiding the preempt-off part might
better which would be the rework that Mark was talking about.
> Luis
Sebastian
next prev parent reply other threads:[~2025-02-12 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 14:22 Luis Claudio R. Goncalves
2025-02-10 12:49 ` Mark Rutland
2025-02-10 14:06 ` Sebastian Andrzej Siewior
2025-02-12 0:48 ` Luis Claudio R. Goncalves
2025-02-12 11:21 ` Sebastian Andrzej Siewior [this message]
2025-02-11 14:34 ` Luis Claudio R. Goncalves
2025-02-12 0:35 ` Luis Claudio R. Goncalves
2025-02-12 12:40 ` Mark Rutland
2025-02-12 13:07 ` Mark Rutland
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=20250212112145.BIE8_6T2@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=ardb@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=lgoncalv@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=rostedt@goodmis.org \
--cc=ryan.roberts@arm.com \
--cc=will@kernel.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
all inboxes | Powered by JetHome®