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]
Date:   Wed, 12 Jan 2022 01:09:46 +0800
From:   Wei Fu <fuweid89@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     andrii@...nel.org, ast@...nel.org, bpf@...r.kernel.org,
        daniel@...earbox.net, john.fastabend@...il.com, kafai@...com,
        kpsingh@...nel.org, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org, songliubraving@...com, yhs@...com,
        fuweid89@...il.com
Subject: Re: [PATCH bpf] tools/bpf: only set obj->skeleton without err

On Sun, Jan 09, 2022 at 06:04:45PM -0800, Andrii Nakryiko wrote:
> On Sat, Jan 8, 2022 at 12:40 AM Wei Fu <fuweid89@...il.com> wrote:
> >
> > After `bpftool gen skeleton`, the ${bpf_app}.skel.h will provide that
> > ${bpf_app_name}__open helper to load bpf. If there is some error
> > like ENOMEM, the ${bpf_app_name}__open will rollback(free) the allocated
> > object, including `bpf_object_skeleton`.
> >
> > Since the ${bpf_app_name}__create_skeleton set the obj->skeleton first
> > and not rollback it when error, it will cause double-free in
> > ${bpf_app_name}__destory at ${bpf_app_name}__open. Therefore, we should
> > set the obj->skeleton before return 0;
> >
> > Signed-off-by: Wei Fu <fuweid89@...il.com>
> > ---
> >  tools/bpf/bpftool/gen.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> 
> Great catch! Added (please add it yourself in the future):
> 
> Fixes: 5dc7a8b21144 ("bpftool, selftests/bpf: Embed object file inside
> skeleton")
> 
> Also reworded the subject a bit. Pushed to bpf-next.

Sure! Thanks for the review.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ