netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@fb.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>, <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>, <daniel@iogearbox.net>,
	<linux-btrfs@vger.kernel.org>, <darrick.wong@oracle.com>,
	Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH v10 1/5] add infrastructure for tagging functions as error injectable
Date: Wed, 20 Dec 2017 09:22:00 -0800	[thread overview]
Message-ID: <5402c8bd-149c-04c2-1e7c-143559c35fe3@fb.com> (raw)
In-Reply-To: <20171220161342.44443047f186b7a62efdfe1a@kernel.org>

On 12/19/17 11:13 PM, Masami Hiramatsu wrote:
> On Tue, 19 Dec 2017 18:14:17 -0800
> Alexei Starovoitov <ast@fb.com> wrote:
>
>> On 12/18/17 10:29 PM, Masami Hiramatsu wrote:
>>>>
>>>> +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
>>>> +#ifdef CONFIG_BPF_KPROBE_OVERRIDE
>>>
>>> BTW, CONFIG_BPF_KPROBE_OVERRIDE is also confusable name.
>>> Since this feature override a function to just return with
>>> some return value (as far as I understand, or would you
>>> also plan to modify execution path inside a function?),
>>> I think it should be better CONFIG_BPF_FUNCTION_OVERRIDE or
>>> CONFIG_BPF_EXECUTION_OVERRIDE.
>>
>> I don't think such renaming makes sense.
>> The feature is overriding kprobe by changing how kprobe returns.
>> It doesn't override BPF_FUNCTION or BPF_EXECUTION.
>
> No, I meant this is BPF's feature which override FUNCTION, so
> BPF is a kind of namespace. (Is that only for a function entry
> because it can not tweak stackframe at this morment?)
>
>> The kernel enters and exists bpf program as normal.
>
> Yeah, but that bpf program modifies instruction pointer, am I correct?

no. bpf side is asking kprobe side to modify it.
bpf cannot do such things as modifying IP or any other register
directly.

>>
>>> Indeed, BPF is based on kprobes, but it seems you are limiting it
>>> with ftrace (function-call trace) (I'm not sure the reason why),
>>> so using "kprobes" for this feature seems strange for me.
>>
>> do you have an idea how kprobe override can happen when kprobe
>> placed in the middle of the function?
>
> For example, if you know a basic block in the function, maybe
> you can skip a block or something like that. But nowadays
> it is somewhat hard because optimizer mixed it up.

still missing how that can work...

  parent reply	other threads:[~2017-12-20 17:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15 19:12 [PATCH v10 0/5] Add the ability to do BPF directed error injection Josef Bacik
2017-12-15 19:12 ` [PATCH v10 1/5] add infrastructure for tagging functions as error injectable Josef Bacik
2017-12-18  9:11   ` Masami Hiramatsu
2017-12-19  6:29   ` Masami Hiramatsu
2017-12-20  2:14     ` Alexei Starovoitov
2017-12-20  7:13       ` Masami Hiramatsu
2017-12-20 10:09         ` Daniel Borkmann
2017-12-20 17:22         ` Alexei Starovoitov [this message]
2017-12-20 11:00   ` Masami Hiramatsu
2017-12-20 17:33     ` Alexei Starovoitov
2017-12-15 19:12 ` [PATCH v10 2/5] btrfs: make open_ctree " Josef Bacik
2017-12-15 19:12 ` [PATCH v10 3/5] bpf: add a bpf_override_function helper Josef Bacik
2017-12-15 20:34   ` Alexei Starovoitov
2017-12-15 20:53     ` Daniel Borkmann
2017-12-18  9:51   ` Masami Hiramatsu
2017-12-18 15:09     ` Daniel Borkmann
2017-12-19  6:38       ` Masami Hiramatsu
2017-12-15 19:12 ` [PATCH v10 4/5] samples/bpf: add a test for bpf_override_return Josef Bacik
2017-12-15 19:12 ` [PATCH v10 5/5] btrfs: allow us to inject errors at io_ctl_init Josef Bacik

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=5402c8bd-149c-04c2-1e7c-143559c35fe3@fb.com \
    --to=ast@fb.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=darrick.wong@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jbacik@fb.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.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).