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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 6 Jun 2022 15:46:18 -0700
From:   Stanislav Fomichev <sdf@...gle.com>
To:     Martin KaFai Lau <kafai@...com>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org
Subject: Re: [PATCH bpf-next v8 03/11] bpf: per-cgroup lsm flavor

On Sat, Jun 4, 2022 at 1:27 AM Martin KaFai Lau <kafai@...com> wrote:
>
> On Fri, Jun 03, 2022 at 11:11:58PM -0700, Martin KaFai Lau wrote:
> > > @@ -549,9 +655,15 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp,
> > >     bpf_cgroup_storages_assign(pl->storage, storage);
> > >     cgrp->bpf.flags[atype] = saved_flags;
> > >
> > > +   if (type == BPF_LSM_CGROUP && !old_prog) {
> > hmm... I think this "!old_prog" test should not be here.
> >
> > In allow_multi, old_prog can be NULL but it still needs
> > to bump the shim_link's refcnt by calling
> > bpf_trampoline_link_cgroup_shim().
> >
> > This is a bit tricky.  Does it make sense ?
> I think I read the "!"old_prog upside-down.  I think I got the
> intention here now after reading some latter patches.
> It is to save a bpf_trampoline_link_cgroup_shim() and unlink
> for the replace case ?  I would prefer not to do this.
> It is quite confusing to read and does not save much.

Ok, let me try to drop it!


> > > +           err = bpf_trampoline_link_cgroup_shim(new_prog, &tgt_info, atype);
> > > +           if (err)
> > > +                   goto cleanup;
> > > +   }
> > > +
> > >     err = update_effective_progs(cgrp, atype);
> > >     if (err)
> > > -           goto cleanup;
> > > +           goto cleanup_trampoline;
> > >
> > >     if (old_prog)
> > Then it needs a bpf_trampoline_unlink_cgroup_shim(old_prog) here.
> >
> > >             bpf_prog_put(old_prog);
> > > @@ -560,6 +672,10 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp,
> > >     bpf_cgroup_storages_link(new_storage, cgrp, type);
> > >     return 0;
> > >
> > > +cleanup_trampoline:
> > > +   if (type == BPF_LSM_CGROUP && !old_prog)
> > The "!old_prog" test should also be removed.
> >
> > > +           bpf_trampoline_unlink_cgroup_shim(new_prog);
> > > +
> > >  cleanup:
> > >     if (old_prog) {
> > >             pl->prog = old_prog;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ