From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <daan.j.demeyer@gmail.com>
Cc: <bpf@vger.kernel.org>, <kernel-team@meta.com>,
<kuniyu@amazon.com>, <martin.lau@linux.dev>,
<netdev@vger.kernel.org>
Subject: Re: [PATCH bpf-next v10 2/9] bpf: Propagate modified uaddrlen from cgroup sockaddr programs
Date: Wed, 11 Oct 2023 11:58:14 -0700 [thread overview]
Message-ID: <20231011185814.53217-1-kuniyu@amazon.com> (raw)
In-Reply-To: <CAO8sHc=FfDo_LnpV_tF5aPF4BjpWkQk2jLxLWH50X0JzSQ+s6Q@mail.gmail.com>
From: Daan De Meyer <daan.j.demeyer@gmail.com>
Date: Wed, 11 Oct 2023 20:37:49 +0200
> > > @@ -1483,11 +1488,18 @@ int __cgroup_bpf_run_filter_sock_addr(struct sock *sk,
> > > if (!ctx.uaddr) {
> > > memset(&unspec, 0, sizeof(unspec));
> > > ctx.uaddr = (struct sockaddr *)&unspec;
> > > - }
> > > + ctx.uaddrlen = 0;
> > > + } else
> > > + ctx.uaddrlen = *uaddrlen;
> > >
> > > cgrp = sock_cgroup_ptr(&sk->sk_cgrp_data);
> > > - return bpf_prog_run_array_cg(&cgrp->bpf, atype, &ctx, bpf_prog_run,
> > > - 0, flags);
> > > + ret = bpf_prog_run_array_cg(&cgrp->bpf, atype, &ctx, bpf_prog_run,
> > > + 0, flags);
> > > +
> > > + if (!ret && uaddrlen)
> >
> > nit: no need to check uaddrlen here or maybe check ctx.uaddrlen.
>
> Are you sure? uaddrlen can still be NULL if uaddr is also NULL
How? In the patch 2 and 4, it seems uaddrlen always points to an
actual variable.
next prev parent reply other threads:[~2023-10-11 18:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 17:03 [PATCH bpf-next v10 0/9] Add cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 1/9] selftests/bpf: Add missing section name tests for getpeername/getsockname Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 2/9] bpf: Propagate modified uaddrlen from cgroup sockaddr programs Daan De Meyer
2023-10-11 17:35 ` Kuniyuki Iwashima
2023-10-11 18:37 ` Daan De Meyer
2023-10-11 18:58 ` Kuniyuki Iwashima [this message]
2023-10-11 19:09 ` Daan De Meyer
2023-10-11 19:45 ` Kuniyuki Iwashima
2023-10-11 17:03 ` [PATCH bpf-next v10 3/9] bpf: Add bpf_sock_addr_set_sun_path() to allow writing unix sockaddr from bpf Daan De Meyer
2023-10-11 17:58 ` Kuniyuki Iwashima
2023-10-11 17:03 ` [PATCH bpf-next v9 3/9] bpf: Add bpf_sock_addr_set_unix_addr() " Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 4/9] bpf: Implement cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 5/9] libbpf: Add support for cgroup unix socket address hooks Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 6/9] bpftool: " Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 7/9] documentation/bpf: Document " Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 8/9] selftests/bpf: Make sure mount directory exists Daan De Meyer
2023-10-11 17:03 ` [PATCH bpf-next v10 9/9] selftests/bpf: Add tests for cgroup unix socket address hooks Daan De Meyer
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=20231011185814.53217-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=bpf@vger.kernel.org \
--cc=daan.j.demeyer@gmail.com \
--cc=kernel-team@meta.com \
--cc=martin.lau@linux.dev \
--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).