linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>, Andy Lutomirski <luto@kernel.org>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>, X86 ML <x86@kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	dwmw@amazon.co.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -tip] kprobes/x86: Use preempt_enable() in optimized_callback()
Date: Sun, 21 Oct 2018 22:42:29 +0200	[thread overview]
Message-ID: <20181021204229.GI4931@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <154002887331.7627.10194920925792947001.stgit@devbox>

On Sat, Oct 20, 2018 at 06:47:53PM +0900, Masami Hiramatsu wrote:
> Since commit a19b2e3d7839 ("kprobes/x86: Remove IRQ disabling from
> ftrace-based/optimized kprobes”) removes local_irq_save/restore()
> from optimized_callback(), the handler does not protected against
> reschedule interrupt. If it is able to be preempted (rescheduled)
> by such interrupt, we don't need to use _no_resched macro.

must not.

> Let's use preempt_enable() instead.
> 
> Fixes: a19b2e3d7839 ("kprobes/x86: Remove IRQ disabling from ftrace-based/optimized kprobes”)
> Link: https://lkml.kernel.org/r/37CB98C2-AF9B-475B-8B2D-7B414DC491F3@vmware.com
> Reported-by: Nadav Amit <namit@vmware.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  arch/x86/kernel/kprobes/opt.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
> index eaf02f2e7300..40b16b270656 100644
> --- a/arch/x86/kernel/kprobes/opt.c
> +++ b/arch/x86/kernel/kprobes/opt.c
> @@ -179,7 +179,7 @@ optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
>  		opt_pre_handler(&op->kp, regs);
>  		__this_cpu_write(current_kprobe, NULL);
>  	}
> -	preempt_enable_no_resched();
> +	preempt_enable();
>  }

Indeed,

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

  reply	other threads:[~2018-10-21 20:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-20  9:47 [PATCH -tip] kprobes/x86: Use preempt_enable() in optimized_callback() Masami Hiramatsu
2018-10-21 20:42 ` Peter Zijlstra [this message]
2018-10-22  1:33 ` [tip:perf/core] " tip-bot for Masami Hiramatsu

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=20181021204229.GI4931@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bp@alien8.de \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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;
as well as URLs for NNTP newsgroup(s).