Received: by 10.213.65.68 with SMTP id h4csp72820imn; Mon, 12 Mar 2018 07:07:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELuA8vEIQ5DBY+yWc51vtOEM/9iIbNf0eysG6FU+qRJjWBH4sm+BYbv2jM6x6e8UvmX9JSIr X-Received: by 10.101.101.206 with SMTP id y14mr6562346pgv.297.1520863674994; Mon, 12 Mar 2018 07:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520863674; cv=none; d=google.com; s=arc-20160816; b=ZPc4RV8ByVH0Pz3llwVuLaj4FtNvRHpA/4lFjfvyRHLFc9lQ4+fOSYEH+kxeH3tWgl zLK61VZWQRX7+0V8e9ceCES/i5LcRUF8fQ6RDRC/oljaJ5Fnc5esIqqGAphjLHkqoyJq E7yfMm3Y1Ahz22ecgQE6j4ylsjaD5IvOcPLkjlTfoccTRS4iGu4FidGiwBk6DiqHlK08 hk2CbVhnKV3jfOp1co/M/w5lsfhCEsi395d3quXlTsbBjOgHwQQGCR962sdUHD19BEvj 3c7BkDXunMn6gAf/Cpg8K/3x+tEoUMq+l4G5hemwiJTnsXdN4CSGrC6GplkSTzP/pw1r apBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=iKby2AyootBXscAo+pbUPwYaLbvheM9sDsGfVCisTBU=; b=sN2Ii+BJ3HmD2GZV9sceCt2MMXs4Hx60qMpKNtl2ziu1/bZ/H1Ree6X+ZixthowUC7 Ec+vukn3BFkQ1ZgJyqS7o6W2a0ugte1Dueavcqz6/OVCDYFdULqH4Wn3IIdfKf6joarb oLhEAO2amxOGhe0VIdgiDUmZCVyQKjap85wFUQEDUEjKpEMafIom7CQhycWoYrffnFUi IEolHSuDcfM7RUWOfxeXVjihhtoVblFHC1kSABw/3W2i57fTFWg2d8k/qJhZAQ4v+g02 d82cYhXcnOqRp0zwmRtYzOo9HKysWMhCFdSkMbcwsdqZm+AlAwjLR+1dMk+yHAGCmDHe JAZQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si6021569pld.484.2018.03.12.07.07.40; Mon, 12 Mar 2018 07:07:54 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752117AbeCLOGc (ORCPT + 99 others); Mon, 12 Mar 2018 10:06:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:51914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751238AbeCLOG3 (ORCPT ); Mon, 12 Mar 2018 10:06:29 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 18F33208FE; Mon, 12 Mar 2018 14:06:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18F33208FE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org Date: Mon, 12 Mar 2018 23:06:25 +0900 From: Masami Hiramatsu To: Daniel Borkmann Cc: Alexei Starovoitov , Josef Bacik , rostedt@goodmis.org, mingo@redhat.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, kernel-team@fb.com, linux-btrfs@vger.kernel.org, darrick.wong@oracle.com, Josef Bacik , Akinobu Mita Subject: Re: [BUGFIX PATCH bpf-next] error-injection: Fix to prohibit jump optimization Message-Id: <20180312230625.cea180f66d44dc1ea4930fa7@kernel.org> In-Reply-To: References: <152084884886.1536.4464134247603910765.stgit@devbox> <20180312192738.77061ec53f9437d960b437d9@kernel.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Mar 2018 11:44:21 +0100 Daniel Borkmann wrote: > Hi Masami, > > On 03/12/2018 11:27 AM, Masami Hiramatsu wrote: > > On Mon, 12 Mar 2018 19:00:49 +0900 > > Masami Hiramatsu wrote: > > > >> Since the kprobe which was optimized by jump can not change > >> the execution path, the kprobe for error-injection must not > >> be optimized. To prohibit it, set a dummy post-handler as > >> officially stated in Documentation/kprobes.txt. > > > > Note that trace-probe based BPF is not affected, because it > > ensures the trace-probe is based on ftrace, which is not > > jump optimized. > > Thanks for the fix! I presume this should go via bpf instead of bpf-next > tree since 4b1a29a7f542 ("error-injection: Support fault injection framework") > is in Linus' tree as well. Unless there are objection I would rather route > it that way so it would be for 4.16. Ah, right! It should go into 4.16. It should be applicable cleanly either tree since there is only the above commit on kernel/fail_function.c :) Thanks, > > Thanks, > Daniel > > > Thanks, > > > >> > >> Fixes: 4b1a29a7f542 ("error-injection: Support fault injection framework") > >> Signed-off-by: Masami Hiramatsu > >> --- > >> kernel/fail_function.c | 10 ++++++++++ > >> 1 file changed, 10 insertions(+) > >> > >> diff --git a/kernel/fail_function.c b/kernel/fail_function.c > >> index 21b0122cb39c..1d5632d8bbcc 100644 > >> --- a/kernel/fail_function.c > >> +++ b/kernel/fail_function.c > >> @@ -14,6 +14,15 @@ > >> > >> static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs); > >> > >> +static void fei_post_handler(struct kprobe *kp, struct pt_regs *regs, > >> + unsigned long flags) > >> +{ > >> + /* > >> + * A dummy post handler is required to prohibit optimizing, because > >> + * jump optimization does not support execution path overriding. > >> + */ > >> +} > >> + > >> struct fei_attr { > >> struct list_head list; > >> struct kprobe kp; > >> @@ -56,6 +65,7 @@ static struct fei_attr *fei_attr_new(const char *sym, unsigned long addr) > >> return NULL; > >> } > >> attr->kp.pre_handler = fei_kprobe_handler; > >> + attr->kp.post_handler = fei_post_handler; > >> attr->retval = adjust_error_retval(addr, 0); > >> INIT_LIST_HEAD(&attr->list); > >> } > >> > > > > > -- Masami Hiramatsu