Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3638007imu; Mon, 7 Jan 2019 06:58:44 -0800 (PST) X-Google-Smtp-Source: ALg8bN5YCX+5sYKUdhCHQB2lmsb4YR89xOK/uoNcXAM0p0yr4wxwGevFdmApvZK4Iml2u47mOJHh X-Received: by 2002:a17:902:4d46:: with SMTP id o6mr59086849plh.302.1546873124000; Mon, 07 Jan 2019 06:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546873123; cv=none; d=google.com; s=arc-20160816; b=UyaA5hc4ry7fsZdaHgqD3UZNWefe7IMujOw/aj6fXljNcHke8rfNcp2uCvJ9040Wsf 3Bs3uohTdjVmX86UGC6sqGi8+oNiLn+rB3FLzUnQQRlFfhJRU9hTyrcWRaICx7NNJuqp 0CGImo7EUpabFT/VOMc3vAoU7EjRM4nrkPDNhWJJzJhGqRNp75TcVEZo0rl2SSJTPYWJ Q5sdjUmroIHAQsATgs1VoLrhKmvsQgjw7+KiL2iJbiGGk/ub7hMEp3Fzj/lr8xXrvr9O IuGTa1OPCeLFNJWZgfv/DCqsuUMIipjvYlAITe5goQusq4jAQmyNt2f6zSctcFbM1tb/ VUiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=A8FKJ4B1FFfc+QSjZQillPCgTS6sp0GxRUAJ4+ssX8E=; b=kieknhekcbFHBEjybWjSnNcR32ZzOePjZuoWMmso/w2ZLS4CcqQ+dZtoNDB3i/mulX eqCfi1LKYs97dJMYxGSfRH33VyOh0hSJUXH3MsibUqxRrks29U175/q1N8varcktd+Yd 8x0SGslXux65YrOHCsvJVtq3AovlpRfFP6JABbUww4plY1xUJs0x3C0PMU80FKBgMUM8 F2hRRkbp0dmXHcxqyuKrNSGguEc5SHiNMNyUNw3JK5agtdtxVHQVoBX5InMfYv9aAFgK LjVDkNWwvSM8H+R2JYh2FyV4SuehujVYeW3yfzLQbU8gUub9FDReuM577Ml0m2KUgzhZ /ALg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ma6PEGfA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si6039532pgh.469.2019.01.07.06.58.28; Mon, 07 Jan 2019 06:58:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ma6PEGfA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729164AbfAGOzl (ORCPT + 99 others); Mon, 7 Jan 2019 09:55:41 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:34345 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727597AbfAGOzk (ORCPT ); Mon, 7 Jan 2019 09:55:40 -0500 Received: by mail-wr1-f66.google.com with SMTP id j2so747168wrw.1 for ; Mon, 07 Jan 2019 06:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=A8FKJ4B1FFfc+QSjZQillPCgTS6sp0GxRUAJ4+ssX8E=; b=Ma6PEGfAyixtcpSj0vsWS7MUzLw2FdYV0bxIJHjwFCrCnmnoHfz8MmGqrrnvjhzS/h s9o2TNU65XRuPcsOIBQpm5rYR8Za7KO+ta6OhyjM3YKIC1Z9MHlBtG7oVrXgBBUOPdnd Cwc0doeYS6QHOh1sPUh16iPz/J4s08tNQGyQlpcBK162qMNDclmklog8wo0mQZ1grbfV vn+u8KAiYPiTKhXGft5pEtFjt/hJKItbN/FUeoVd1RZoRWGaySlPNoSzC6FxX8B2jT3i Ai1sHR3o9/OihyajeTk30Hn14UOTWyHgju8sUe6Bvs1Mt+XsI3sQCorSmdidUsCN8VFZ TjWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=A8FKJ4B1FFfc+QSjZQillPCgTS6sp0GxRUAJ4+ssX8E=; b=FjcVcFZMW0KyXZqhd2djfTHl8gc3IkPEFZxwLKt8vAFuhR6L6BE7bA8WLiEm8O7xJf KsRGzr9pGGREWT5dCySgixb2mYZy0IJwHV17BGMWDwLHPh2fsB16XdEYEY4zoOecxdcb hdSIMQEusrUy3RAvVvyFf8fVJumqhbQSBa172FAIzsKtO5b220xYdZP8GzPDg6GVf2QX 9vR7o99JFvJdqZqK89wereuXcHmGHE14lPISsMZ3s3u5It6pYqUeP105PL3lS0P3w9m1 M42L5OsREw+BYhJar+t1n3yqaWRPnt7Qz88KXZFNKrx6r1+ogshBhg2PoRgFkBGlNNDI 6mXg== X-Gm-Message-State: AJcUukeG5xzkEtCXsB/eKPCjpVAi16bln2fjbqCA6k7iRLYnDu9GoO+H lNbXyZxhVChCfCqX/oTUl9Vzl1s8aw== X-Received: by 2002:adf:f308:: with SMTP id i8mr11022232wro.219.1546872938326; Mon, 07 Jan 2019 06:55:38 -0800 (PST) Received: from localhost (host89-130-dynamic.43-79-r.retail.telecomitalia.it. [79.43.130.89]) by smtp.gmail.com with ESMTPSA id 125sm9702383wmm.26.2019.01.07.06.55.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 06:55:37 -0800 (PST) Date: Mon, 7 Jan 2019 15:55:36 +0100 From: Andrea Righi To: Masami Hiramatsu Cc: Ingo Molnar , peterz@infradead.org, Mathieu Desnoyers , linux-kernel , Steven Rostedt Subject: Re: [PATCH 2/2] kprobes: Mark ftrace mcount handler functions nokprobe Message-ID: <20190107145536.GA1944@xps-13> References: <154686789378.15479.2886543882215785247.stgit@devbox> <154686795211.15479.15577152313750689302.stgit@devbox> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <154686795211.15479.15577152313750689302.stgit@devbox> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 07, 2019 at 10:32:32PM +0900, Masami Hiramatsu wrote: > Mark ftrace mcount handler functions nokprobe since > probing on these functions with kretprobe pushes > return address incorrectly on kretprobe shadow stack. > > Signed-off-by: Masami Hiramatsu > Reported-by: Francis Deslauriers > --- > kernel/trace/ftrace.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index f0ff24173a0b..ad4babad4a03 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -6250,7 +6250,7 @@ void ftrace_reset_array_ops(struct trace_array *tr) > tr->ops->func = ftrace_stub; > } > > -static inline void > +static nokprobe_inline void I think we need to #include , otherwise: CC kernel/trace/ftrace.o kernel/trace/ftrace.c:6219:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’ static nokprobe_inline void ^~~~ kernel/trace/ftrace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 3a58ad280d83..0333241034d5 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include Thanks, -Andrea > __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, > struct ftrace_ops *ignored, struct pt_regs *regs) > { > @@ -6310,11 +6310,13 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, > { > __ftrace_ops_list_func(ip, parent_ip, NULL, regs); > } > +NOKPROBE_SYMBOL(ftrace_ops_list_func); > #else > static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) > { > __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); > } > +NOKPROBE_SYMBOL(ftrace_ops_no_ops); > #endif > > /* > @@ -6341,6 +6343,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, > preempt_enable_notrace(); > trace_clear_recursion(bit); > } > +NOKPROBE_SYMBOL(ftrace_ops_assist_func); > > /** > * ftrace_ops_get_func - get the function a trampoline should call