[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200727214359.nchjgej4mfihefcp@kafai-mbp>
Date: Mon, 27 Jul 2020 14:43:59 -0700
From: Martin KaFai Lau <kafai@...com>
To: KP Singh <kpsingh@...omium.org>
CC: KP Singh <kpsingh@...gle.com>, <bpf@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-security-module@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Paul Turner <pjt@...gle.com>, Jann Horn <jannh@...gle.com>,
Florent Revest <revest@...omium.org>
Subject: Re: [RFC PATCH bpf-next] bpf: POC on local_storage charge and
uncharge map_ops
On Mon, Jul 27, 2020 at 10:26:53PM +0200, KP Singh wrote:
> Thanks for this, I was able to update the series with this patch and it works.
> One minor comment though.
>
> I was wondering how should I send it as a part of the series. I will keep the
> original commit description + mention this thread and add your Co-Developed-by:
> tag and then you can add your Signed-off-by: as well.
Sounds good to me.
Thanks for verifying the idea. Feel free to make changes or clean up on
this RFC.
> I am not sure of the
> canonical way here and am open to suggestions :)
>
> - KP
>
> On 25.07.20 03:30, Martin KaFai Lau wrote:
> > It is a direct replacement of the patch 3 in discussion [1]
> > and to test out the idea on adding
> > map_local_storage_charge, map_local_storage_uncharge,
> > and map_owner_storage_ptr.
> >
> > It is only compiler tested to demo the idea.
> >
> > [1]: https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.ozlabs.org_project_netdev_patch_20200723115032.460770-2D4-2Dkpsingh-40chromium.org_&d=DwICaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=VQnoQ7LvghIj0gVEaiQSUw&m=NZVmomh5sMPlIAqLmFQ_MXlMILuq1Z7TQqntbPoZ0ew&s=MLVevCJz2eNWswxXXF3jFYdAV2UG-xJEi0I1PkLL-fw&e=
> >
> > Signed-off-by: Martin KaFai Lau <kafai@...com>
> > ---
> > include/linux/bpf.h | 10 ++
> > include/net/bpf_sk_storage.h | 51 +++++++
> > include/uapi/linux/bpf.h | 8 +-
>
> [...]
>
> > +
> > +static void sk_storage_uncharge(struct bpf_local_storage_map *smap,
> > + void *owner, u32 size)
> > +{
> > + struct sock *sk = owner;
> > +
> > + atomic_sub(size, &sk->sk_omem_alloc);
> > +}
> > +
> > +static struct bpf_local_storage __rcu **
> > +sk_storage_ptr(struct bpf_local_storage_map *smap, void *owner)
>
> Do we need an smap pointer here? It's not being used and is also not
> used for inode as well.
You are correct. No, it is not needed.
I threw in there merely because it is a map_ops. It is unused
and can be removed.
> > +{
> > + struct sock *sk = owner;
> > +
> > + return &sk->sk_bpf_storage;
> > +}
> > +
Powered by blists - more mailing lists