netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Josef Bacik <josef@toxicpanda.com>
Cc: Alexei Starovoitov <ast@fb.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,
	Josef Bacik <jbacik@fb.com>
Subject: Re: [PATCH 1/2] bpf: add a bpf_override_function helper
Date: Wed, 15 Nov 2017 08:34:56 +0100	[thread overview]
Message-ID: <20171115073456.2dx4l2onbxn3ekzu@gmail.com> (raw)
In-Reply-To: <20171113155752.yhzxm4kpihg4ns65@destiny>


* Josef Bacik <josef@toxicpanda.com> wrote:

> > > Then 'not crashing kernel' requirement will be preserved.
> > > btrfs or whatever else we will be testing with override_return
> > > will be functioning in 'stress test' mode and if bpf program
> > > is not careful and returns error all the time then one particular
> > > subsystem (like btrfs) will not be functional, but the kernel
> > > will not be crashing.
> > > Thoughts?
> > 
> > Yeah, that approach sounds much better to me: it should be fundamentally be 
> > opt-in, and should be documented that it should not be possible to crash the 
> > kernel via changing the return value.
> > 
> > I'd make it a bit clearer in the naming what the purpose of the annotation is: for 
> > example would BPF_ALLOW_ERROR_INJECTION() work for you guys? I.e. I think it 
> > should generally be used to change actual integer error values - or at most user 
> > pointers, but not kernel pointers. Not enforced in a type safe manner, but the 
> > naming should give enough hints?
> > 
> > Such return-injection BFR programs can still totally confuse user-space obviously: 
> > for example returning an IO error could corrupt application data - but that's the 
> > nature of such facilities and similar results could already be achieved via ptrace 
> > as well. But the result of a BPF program should never be _worse_ than ptrace, in 
> > terms of kernel integrity.
> > 
> > Note that with such a safety mechanism in place no kernel message has to be 
> > generated either I suspect.
> > 
> > In any case, my NAK would be lifted with such an approach.
> 
> I'm going to want to annotate kmalloc, so it's still going to be possible to
> make things go horribly wrong, is this still going to be ok with you?  Obviously
> I want to use this for btrfs, but really what I used this for originally was an
> NBD problem where I had to do special handling for getting EINTR back from
> kernel_sendmsg, which was a pain to trigger properly without this patch.  Opt-in
> is going to make it so we're just flagging important function calls anwyay
> because those are the ones that fail rarely and that we want to test, which puts
> us back in the same situation you are worried about, so it doesn't make much
> sense to me to do it this way.  Thanks,

I suppose - let's see how it goes? The important factor is the opt-in aspect I 
believe.

Technically the kernel should never crash on a kmalloc() failure either, although 
obviously things can go horribly wrong from user-space's perspective.

Thanks,

	Ingo

  reply	other threads:[~2017-11-15  7:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 20:28 [PATCH 0/2][v5] Add the ability to do BPF directed error injection Josef Bacik
2017-11-07 20:28 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-08  2:28   ` Daniel Borkmann
2017-11-10  9:34   ` Ingo Molnar
2017-11-10 17:14     ` Josef Bacik
2017-11-11  8:14       ` Ingo Molnar
2017-11-11 11:51         ` Josef Bacik
2017-11-12  6:49         ` Alexei Starovoitov
2017-11-12 10:38           ` Ingo Molnar
2017-11-13 15:57             ` Josef Bacik
2017-11-15  7:34               ` Ingo Molnar [this message]
2017-11-07 20:28 ` [PATCH 2/2] samples/bpf: add a test for bpf_override_return Josef Bacik
2017-11-08  2:29   ` Daniel Borkmann
2017-11-07 21:43 ` [PATCH 0/2][v5] Add the ability to do BPF directed error injection Alexei Starovoitov
2017-11-10  9:06   ` David Miller
2017-11-10  9:20   ` Peter Zijlstra
2017-11-11  3:18 ` David Miller
2017-11-11  8:16   ` Ingo Molnar
2017-11-11  9:25     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2017-11-02 14:37 [PATCH 0/2][v4] " Josef Bacik
2017-11-02 14:37 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-02 23:12   ` Daniel Borkmann
2017-11-03 14:31     ` Josef Bacik
2017-11-03 16:52       ` Daniel Borkmann
2017-11-03 21:07         ` Alexei Starovoitov
2017-11-01 17:00 [PATCH 0/2][v3] Add the ability to do BPF directed error injection Josef Bacik
2017-11-01 17:00 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-01 17:18   ` Alexei Starovoitov
2017-11-02  1:08   ` Daniel Borkmann
2017-10-31 15:45 [PATCH 0/2][v2] Add the ability to do BPF directed error injection Josef Bacik
2017-10-31 15:45 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-11-01  4:47   ` Alexei Starovoitov
2017-10-30 21:19 [PATCH 0/2] Add the ability to do BPF directed error injection Josef Bacik
2017-10-30 21:19 ` [PATCH 1/2] bpf: add a bpf_override_function helper Josef Bacik
2017-10-31  1:35   ` Alexei Starovoitov

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=20171115073456.2dx4l2onbxn3ekzu@gmail.com \
    --to=mingo@kernel.org \
    --cc=ast@fb.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=jbacik@fb.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.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).