lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKH8qBtev58QgSNGQPaE4B7wp06W=WeH0nsiHcdeYftnmXr1Hw@mail.gmail.com>
Date:   Tue, 7 Jul 2020 16:59:45 -0700
From:   Stanislav Fomichev <sdf@...gle.com>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Alexei Starovoitov <ast@...nel.org>
Subject: Re: [PATCH bpf-next v4 1/4] bpf: add BPF_CGROUP_INET_SOCK_RELEASE hook

On Tue, Jul 7, 2020 at 4:56 PM Daniel Borkmann <daniel@...earbox.net> wrote:
>
> On 7/8/20 1:43 AM, Stanislav Fomichev wrote:
> > On Tue, Jul 7, 2020 at 2:42 PM Daniel Borkmann <daniel@...earbox.net> wrote:
> >>
> >> On 7/7/20 1:42 AM, Andrii Nakryiko wrote:
> >>> On Mon, Jul 6, 2020 at 4:02 PM Stanislav Fomichev <sdf@...gle.com> wrote:
> >>>>
> >>>> Implement BPF_CGROUP_INET_SOCK_RELEASE hook that triggers
> >>>> on inet socket release. It triggers only for userspace
> >>>> sockets, the same semantics as existing BPF_CGROUP_INET_SOCK_CREATE.
> >>>>
> >>>> The only questionable part here is the sock->sk check
> >>>> in the inet_release. Looking at the places where we
> >>>> do 'sock->sk = NULL', I don't understand how it can race
> >>>> with inet_release and why the check is there (it's been
> >>>> there since the initial git import). Otherwise, the
> >>>> change itself is pretty simple, we add a BPF hook
> >>>> to the inet_release and avoid calling it for kernel
> >>>> sockets.
> >>>>
> >>>> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> >>>> ---
> >>>>    include/linux/bpf-cgroup.h | 4 ++++
> >>>>    include/uapi/linux/bpf.h   | 1 +
> >>>>    kernel/bpf/syscall.c       | 3 +++
> >>>>    net/core/filter.c          | 1 +
> >>>>    net/ipv4/af_inet.c         | 3 +++
> >>>>    5 files changed, 12 insertions(+)
> >>>>
> >>>
> >>> Looks good overall, but I have no idea about sock->sk NULL case.
> >>
> >> +1, looks good & very useful hook. For the sock->sk NULL case here's a related
> >> discussion on why it's needed [0].
> > Thanks for the pointer! I'll resend a v5 with s/sock/sock_create/ you
> > mentioned and will clean up the commit description a bit.
>
> Already fixed up the selftest and a typo in the commit desc there & applied it.
Oh, awesome, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ