[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f40c2c1-1cf3-0fea-5e2b-38bde0f2fb2c@huawei.com>
Date: Tue, 13 Aug 2024 20:30:21 +0800
From: "Liao, Chang" <liaochang1@...wei.com>
To: Oleg Nesterov <oleg@...hat.com>
CC: <mhiramat@...nel.org>, <peterz@...radead.org>, <mingo@...hat.com>,
<acme@...nel.org>, <namhyung@...nel.org>, <mark.rutland@....com>,
<alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
<irogers@...gle.com>, <adrian.hunter@...el.com>, <kan.liang@...ux.intel.com>,
<andrii@...nel.org>, <rostedt@...dmis.org>, <linux-kernel@...r.kernel.org>,
<linux-trace-kernel@...r.kernel.org>, <linux-perf-users@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] uprobes: Remove the spinlock within
handle_singlestep()
在 2024/8/12 19:29, Oleg Nesterov 写道:
> On 08/09, Liao Chang wrote:
>>
>> --- a/include/linux/uprobes.h
>> +++ b/include/linux/uprobes.h
>> @@ -75,6 +75,7 @@ struct uprobe_task {
>>
>> struct uprobe *active_uprobe;
>> unsigned long xol_vaddr;
>> + bool deny_signal;
>
> Ack, but... I can't believe I am arguing with the naming ;)
> Can we have a better name for this flag?
>
> utask->signal_denied ?
> utask->restore_sigpending ?
I prefer the name "signal_denied" as it more accurately reflects
what happened.
>
> or just
>
> utask->sigpending ?
>
> utask->deny_signal looks as if handle_singlestep/whatever should
> "deny" the pending signal cleared by uprobe_deny_signal(), while
> it fact it should restore TIF_SIGPENDING.
Make sense. I will change the name in v3.
>
> Oleg.
>
>>
>> struct return_instance *return_instances;
>> unsigned int depth;
>> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
>> index 76a51a1f51e2..77934fbd1370 100644
>> --- a/kernel/events/uprobes.c
>> +++ b/kernel/events/uprobes.c
>> @@ -1979,6 +1979,7 @@ bool uprobe_deny_signal(void)
>> WARN_ON_ONCE(utask->state != UTASK_SSTEP);
>>
>> if (task_sigpending(t)) {
>> + utask->deny_signal = true;
>> clear_tsk_thread_flag(t, TIF_SIGPENDING);
>>
>> if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) {
>> @@ -2288,9 +2289,10 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs)
>> utask->state = UTASK_RUNNING;
>> xol_free_insn_slot(current);
>>
>> - spin_lock_irq(¤t->sighand->siglock);
>> - recalc_sigpending(); /* see uprobe_deny_signal() */
>> - spin_unlock_irq(¤t->sighand->siglock);
>> + if (utask->deny_signal) {
>> + set_thread_flag(TIF_SIGPENDING);
>> + utask->deny_signal = false;
>> + }
>>
>> if (unlikely(err)) {
>> uprobe_warn(current, "execute the probed insn, sending SIGILL.");
>> --
>> 2.34.1
>>
>
>
--
BR
Liao, Chang
Powered by blists - more mailing lists