Received: by 10.213.65.16 with SMTP id m16csp282518imf; Mon, 12 Mar 2018 03:45:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELtJWlhC6X8qvKtsHAf5aJgp7XgdcizwiK6LcBP8Nh0CKfolwJLT2rFWkz9G4FhjeWgqhlIk X-Received: by 2002:a17:902:b703:: with SMTP id d3-v6mr160592pls.209.1520851543573; Mon, 12 Mar 2018 03:45:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520851543; cv=none; d=google.com; s=arc-20160816; b=LmCAIHGAh97wHT1Ej/shrn2JIvMThUsqKMuW50mLdDNhqyppJ0nv1NnpE7jIqycgYC 66Hma93de7KtV3LXZcEjjOcNz6oOGlK+Nni3v2e9tR3RRM11ktvpGh9z8UXOvFKHH+C+ cVYyjSO2X5twZ29KcVS4OkLvFU+GYVAjbv5eBGr538syLDAcvMEEsXZ5tHRm0QfM88t4 keFKDcWBftadHKOF+XT0wI5bSlGit40lfsHTF2GU4cj9FJK6YsggdEvZjMLvGkyXmnqX umuk9Jn24uCa9G+j99+L5zAAMl5AVpCC2lw4Ps88+UAdBckbA/yOHXbjYworZhI5q4fW Dbkw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=yifdNUgS+/wgirD4nbTHi45sBmZAXvR2iINjzMHZ9yM=; b=NPKyp5qY9LbwkZlPBu5WwHf9bEqUnWvcnLqtgI9Em+En04tjm+xz4yoRYWgUye3E4R K4YpFaIPuNSslu/LjPoIgd+/HQHOB/6/7BaI7GIhPEZsxnFzK9D2U4h9iQSjVWkz4gdn GsIb49UQ5j4VKiyYBmPmPKk8OSHPOA0b2LHu1Jalw8lLMMPN8WYo9Ez3qgcSJ2FYjjTB 5+dbuxR1+lPCQ3k4rL4K0/jsLwOADiqhfAiKAhqC+STe06ja8B2MQ37atIblnzuskNQe ipmWXdJXbyTUWlUJTkKjqbBU1iUXBH9oMrbY0irb98LHJtBKZKhKUpQJ7aNA6Hb/FJGa a9Jw== 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 n25si2939854pgc.87.2018.03.12.03.45.28; Mon, 12 Mar 2018 03:45:43 -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 S1752603AbeCLKod (ORCPT + 99 others); Mon, 12 Mar 2018 06:44:33 -0400 Received: from www62.your-server.de ([213.133.104.62]:48565 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751229AbeCLKoc (ORCPT ); Mon, 12 Mar 2018 06:44:32 -0400 Received: from [85.7.107.67] (helo=linux.home) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256) (Exim 4.85_2) (envelope-from ) id 1evKwI-00068o-7n; Mon, 12 Mar 2018 11:44:22 +0100 Subject: Re: [BUGFIX PATCH bpf-next] error-injection: Fix to prohibit jump optimization To: Masami Hiramatsu 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 References: <152084884886.1536.4464134247603910765.stgit@devbox> <20180312192738.77061ec53f9437d960b437d9@kernel.org> From: Daniel Borkmann Message-ID: Date: Mon, 12 Mar 2018 11:44:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20180312192738.77061ec53f9437d960b437d9@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.99.3/24386/Mon Mar 12 09:10:47 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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); >> } >> > >