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  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:   Thu, 6 Feb 2020 17:52:20 +0000
From:   Quentin Monnet <quentin@...valent.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>,
        daniel@...earbox.net, ast@...com
Cc:     bpf@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH bpf] bpftool: Don't crash on missing xlated program
 instructions

2020-02-06 11:29 UTC+0100 ~ Toke Høiland-Jørgensen <toke@...hat.com>
> Turns out the xlated program instructions can also be missing if
> kptr_restrict sysctl is set. This means that the previous fix to check the
> jited_prog_insns pointer was insufficient; add another check of the
> xlated_prog_insns pointer as well.
> 
> Fixes: 5b79bcdf0362 ("bpftool: Don't crash on missing jited insns or ksyms")
> Fixes: cae73f233923 ("bpftool: use bpf_program__get_prog_info_linear() in prog.c:do_dump()")
> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
> ---
>   tools/bpf/bpftool/prog.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index a3521deca869..b352ab041160 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
> @@ -536,7 +536,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
>   		buf = (unsigned char *)(info->jited_prog_insns);
>   		member_len = info->jited_prog_len;
>   	} else {	/* DUMP_XLATED */
> -		if (info->xlated_prog_len == 0) {
> +		if (info->xlated_prog_len == 0 || !info->xlated_prog_insns) {
>   			p_err("error retrieving insn dump: kernel.kptr_restrict set?");
>   			return -1;
>   		}
> 

The fix looks good, thanks!

Reviewed-by: Quentin Monnet <quentin@...valent.com>

Powered by blists - more mailing lists