All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsa@cumulusnetworks.com>
To: Andy Lutomirski <luto@amacapital.net>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH v2] bpf: Restrict cgroup bpf hooks to the init netns
Date: Mon, 23 Jan 2017 21:05:13 -0700	[thread overview]
Message-ID: <08f3f57e-8c51-c893-01ad-3ce23db8166d@cumulusnetworks.com> (raw)
In-Reply-To: <CALCETrVZqqfMO+=HGgebbAJ0TY6c3XSyY1G-Ve+g3VQiEfGwyA@mail.gmail.com>

On 1/23/17 8:37 PM, Andy Lutomirski wrote:
> Yes, it is a bug because cgroup+bpf causes unwitting programs to be
> subject to BPF code installed by a different, potentially unrelated
> process.  That's a new situation.  The failure can happen when a
> privileged supervisor (whoever runs ip vrf) runs a clueless or
> unprivileged program (the thing calling unshare()).

There are many, many ways to misconfigure networking and to run programs in a context or with an input argument that causes the program to not work at all, not work as expected or stop working. This situation is no different. 

For example, the only aspect of BPF_PROG_TYPE_CGROUP_SOCK filters that are namespace based is the ifindex. You brought up the example of changing namespaces where the ifindex is not defined. Alexei mentioned an example where interfaces can be moved to another namespace breaking any ifindex based programs. Another example is the interface can be deleted. Deleting an interface with sockets bound to it does not impact the program in any way - no notification, no wakeup, nothing. The sockets just don't work.

The point of using a management tool like ip is to handle the details to make things sane -- which is the consistent with the whole point of ip netns vs running unshare -n.

> 
> If the way cgroup+bpf worked was that a program did a prctl() or
> similar to opt in to being managed by a provided cgroup-aware BPF
> program, then I'd agree with everything you're saying.  But that's not
> at all how this code works.

I don't want an opt-in approach. The program does not need to know or even care that it has some restriction. Today, someone runs 'ip netns exec NAME COMMAND' the command does not need to know or care that the network namespace was changed on it. Same with 'ip vrf exec' -- it is a network policy that is forced on the program by the user.

  reply	other threads:[~2017-01-24  4:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 20:36 [PATCH v2] bpf: Restrict cgroup bpf hooks to the init netns Andy Lutomirski
2017-01-23 21:03 ` David Ahern
2017-01-23 21:49   ` Andy Lutomirski
2017-01-24  2:09 ` Alexei Starovoitov
2017-01-24  2:31   ` David Ahern
2017-01-24  2:39     ` Andy Lutomirski
2017-01-24  4:10       ` David Ahern
2017-01-24  4:16         ` Andy Lutomirski
2017-01-24  2:42   ` Andy Lutomirski
2017-01-24  3:13     ` Alexei Starovoitov
2017-01-24  3:37       ` Andy Lutomirski
2017-01-24  4:05         ` David Ahern [this message]
2017-01-24  4:32           ` Andy Lutomirski
2017-01-24 17:48             ` Alexei Starovoitov
2017-01-24 18:54               ` Andy Lutomirski
2017-01-24 20:29                 ` David Ahern
2017-01-24 21:24                   ` Andy Lutomirski
2017-01-24 21:34                     ` David Ahern
2017-01-25  0:11                     ` Alexei Starovoitov
2017-01-25  0:19                       ` David Ahern
2017-01-25 20:28                       ` Andy Lutomirski
2017-01-26  0:45                         ` Eric W. Biederman
2017-01-28 14:43                           ` Tejun Heo
2017-01-24 22:18                 ` Tejun Heo

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=08f3f57e-8c51-c893-01ad-3ce23db8166d@cumulusnetworks.com \
    --to=dsa@cumulusnetworks.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.