From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Aaron Merey <amerey@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uprobes: change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL
Date: Fri, 24 Jul 2020 13:11:03 +0530 [thread overview]
Message-ID: <20200724074103.GA14710@linux.vnet.ibm.com> (raw)
In-Reply-To: <20200723154420.GA32043@redhat.com>
* Oleg Nesterov <oleg@redhat.com> [2020-07-23 17:44:20]:
> If a tracee is uprobed and it hits int3 inserted by debugger, handle_swbp()
> does send_sig(SIGTRAP, current, 0) which means si_code == SI_USER. This used
> to work when this code was written, but then GDB started to validate si_code
> and now it simply can't use breakpoints if the tracee has an active uprobe:
>
>
> The tracee hits the internal breakpoint inserted by GDB to monitor shared
> library events but GDB misinterprets this SIGTRAP and reports a signal.
>
> Change handle_swbp() to use force_sig(SIGTRAP), this matches do_int3_user()
> and fixes the problem.
>
> This is the minimal fix for -stable, arch/x86/kernel/uprobes.c is equally
> wrong; it should use send_sigtrap(TRAP_TRACE) instead of send_sig(SIGTRAP),
> but this doesn't confuse GDB and needs another x86-specific patch.
>
> Reported-by: Aaron Merey <amerey@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Looks good to me.
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> ---
> kernel/events/uprobes.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index bb0862873dba..5f8b0c52fd2e 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -2199,7 +2199,7 @@ static void handle_swbp(struct pt_regs *regs)
> if (!uprobe) {
> if (is_swbp > 0) {
> /* No matching uprobe; signal SIGTRAP. */
> - send_sig(SIGTRAP, current, 0);
> + force_sig(SIGTRAP);
> } else {
> /*
> * Either we raced with uprobe_unregister() or we can't
> --
> 2.25.1.362.g51ebf55
>
>
--
Thanks and Regards
Srikar Dronamraju
next prev parent reply other threads:[~2020-07-24 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 15:44 Oleg Nesterov
2020-07-24 7:41 ` Srikar Dronamraju [this message]
2020-07-24 14:07 ` [tip: perf/urgent] uprobes: Change handle_swbp() to send SIGTRAP with si_code=SI_KERNEL, to fix GDB regression tip-bot2 for Oleg Nesterov
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=20200724074103.GA14710@linux.vnet.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=amerey@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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
Powered by JetHome