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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 8 Mar 2019 05:32:14 +0000
From:   Yonghong Song <yhs@...com>
To:     "Nikita V. Shirokov" <tehnerd@...nerd.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 bpf]: libbpf: fixing leak when kernel does not support
 btf



On 3/7/19 9:18 PM, Nikita V. Shirokov wrote:
> we could end up in situation when we have object file w/ all btf
> info but kernel does not support btf yet. in this situation currently
> libbpf just set obj->btf to NULL w/o freeing it first.
> this patch if fixing it by making sure to run btf__free first
> 
> v2->v3:
>   - adding "Fixes" tag
> 
> v1->v2:
>   - adding netdev to cc
> 
> Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
> Signed-off-by: Nikita V. Shirokov <tehnerd@...nerd.com>

Acked-by: Yonghong Song <yhs@...com>

> ---
>   tools/lib/bpf/libbpf.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index f5eb60379c8d..d5b830d60601 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -838,6 +838,8 @@ static int bpf_object__elf_collect(struct bpf_object *obj, int flags)
>   			if (IS_ERR(obj->btf) || btf__load(obj->btf)) {
>   				pr_warning("Error loading ELF section %s: %ld. Ignored and continue.\n",
>   					   BTF_ELF_SEC, PTR_ERR(obj->btf));
> +				if (!IS_ERR(obj->btf))
> +					btf__free(obj->btf);
>   				obj->btf = NULL;
>   			}
>   		} else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ