netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@fb.com>
To: David Ahern <dsahern@gmail.com>, Jakub Kicinski <kubakici@wp.pl>,
	Martin KaFai Lau <kafai@fb.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: <netdev@vger.kernel.org>, Daniel Borkmann <daniel@iogearbox.net>,
	<kernel-team@fb.com>
Subject: Re: [PATCH v2 net-next 0/8] Introduce bpf ID
Date: Thu, 1 Jun 2017 14:48:00 -0700	[thread overview]
Message-ID: <affe7228-edf1-5307-2c0c-3ddb0cf247ae@fb.com> (raw)
In-Reply-To: <5e8b1713-0220-5c53-210d-8040efd36cfb@gmail.com>

On 6/1/17 11:52 AM, David Ahern wrote:
> On 6/1/17 12:27 PM, Alexei Starovoitov wrote:
>> 'I want to retrieve original instructions' is not a problem. It's a
>> push for 'solution'. Explaining 'why' you want to see original
>> instructions would describe the actual problem.
>
> I have explained this.
>
> You are creating this hyper-complex almost completely invisible
> infrastructure. You are enabling binary blobs that can bypass the
> network stack and modify packets with almost no introspection on what is
> happening. BPF code can from a variety of sources -- OS vendors,
> upstream repos, 3rd party vendors (eg., H/W vendors), and "in-house"
> development. Each will swear to the end that any observed problem is not
> with their code. In my experience, it falls on to the OS and kernel
> experts to figure out why Linux is breaking something. To do that we
> need tools to look at what code is running where and something that can
> be used in production environments not requiring a disruption to the
> service that the box is providing.

You saw patch 7/8, right?
since I'm not following what exactly you're concerned about.
This patch set provided a way to retrieve post-verifier, post-blinding
instruction stream that gives users a way to know exactly what is 
running. Original instruction stream is not the one that is executed.
It's merely an interface between kernel and user space.
Before that stage the clang/llvm did many code transformations and
optimizations on original source code and after that verifier,
context rewriter, inliner, constant blinding did transformations on
these insns as well.

If there is a bug somewhere in all these transformations it can be
anywhere in clang, llvm optimizer, llvm codegen, elf or bcc loader
and in kernel side transformations. Yes. There can be bugs, but we
cannot keep all these stages in the kernel. I don't mind dumping
insn stream for debugging while doing these stages (just like llvm
has -print-before-all flag), but keeping all the intermediate stages
don't make sense to me. In that sense 'original instruction stream'
to me is one of the intermediate stages where source code in C
crossed user->kernel boundary.
I'd rather store more information about original C code than
this user->kernel instruction stream. That's where CTF is heading.
To provide info about types, names, etc. For both progs and maps.

I don't mind storing even that 'original instruction stream' _if_
there is a solid reason. I just didn't hear one so far.
I can imagine somebody saying that there is a bug in context rewriter
and xlated_prog_insns are accessing wrong field. That's bad, but how
keeping original_prog_insns will help such case?
And how such bug is different from llvm generating wrong code ?
If there is a bug anywhere in that transformation pipeline I'd want
to give original source code and final outcome to support people.
In practice everything is more complex, since maps are dynamic,
tail_calls are dynamic, the code flow changes. Debugging is not easy
and this patch set is the first step toward better debuggability.
I'm all for it, but statements like "without original insns
it's not debuggable" are concerning, since we either don't
explain the APIs well enough or understanding of the use case
is missing on our side.

  parent reply	other threads:[~2017-06-01 21:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 18:58 [PATCH v2 net-next 0/8] Introduce bpf ID Martin KaFai Lau
2017-05-31 18:58 ` [PATCH v2 net-next 1/8] bpf: Introduce bpf_prog ID Martin KaFai Lau
2017-05-31 18:58 ` [PATCH v2 net-next 2/8] bpf: Introduce bpf_map ID Martin KaFai Lau
2017-05-31 18:58 ` [PATCH v2 net-next 3/8] bpf: Add BPF_(PROG|MAP)_GET_NEXT_ID command Martin KaFai Lau
2017-05-31 18:58 ` [PATCH v2 net-next 4/8] bpf: Add BPF_PROG_GET_FD_BY_ID Martin KaFai Lau
2017-05-31 18:58 ` [PATCH v2 net-next 5/8] bpf: Add BPF_MAP_GET_FD_BY_ID Martin KaFai Lau
2017-05-31 18:59 ` [PATCH v2 net-next 6/8] bpf: Add jited_len to struct bpf_prog Martin KaFai Lau
2017-05-31 18:59 ` [PATCH v2 net-next 7/8] bpf: Add BPF_OBJ_GET_INFO_BY_FD Martin KaFai Lau
2017-05-31 18:59 ` [PATCH v2 net-next 8/8] bpf: Test for bpf ID Martin KaFai Lau
2017-05-31 23:35 ` [PATCH v2 net-next 0/8] Introduce " David Miller
2017-06-03  1:08   ` Martin KaFai Lau
2017-06-01  2:22 ` Jakub Kicinski
2017-06-01 13:55   ` David Ahern
2017-06-01 17:24     ` Alexei Starovoitov
2017-06-01 17:51       ` David Ahern
2017-06-01 18:27         ` Alexei Starovoitov
2017-06-01 18:33           ` David Miller
2017-06-01 18:57             ` Jakub Kicinski
2017-06-01 18:52           ` David Ahern
2017-06-01 18:56             ` David Miller
2017-06-01 19:00             ` Jakub Kicinski
2017-06-01 21:48             ` Alexei Starovoitov [this message]
2017-06-02 11:39               ` David Ahern

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=affe7228-edf1-5307-2c0c-3ddb0cf247ae@fb.com \
    --to=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=dsahern@gmail.com \
    --cc=hannes@stressinduktion.org \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.com \
    --cc=kubakici@wp.pl \
    --cc=netdev@vger.kernel.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).