[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bcf81455-6b78-1ff2-d5db-3b203696b8f0@iogearbox.net>
Date: Wed, 11 Mar 2020 14:23:12 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Alexei Starovoitov <ast@...nel.org>, davem@...emloft.net
Cc: kpsingh@...gle.com, jannh@...gle.com, netdev@...r.kernel.org,
bpf@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH bpf-next] bpf: Fix trampoline generation for fmod_ret
programs
On 3/11/20 1:39 AM, Alexei Starovoitov wrote:
> fmod_ret progs are emitted as:
>
> start = __bpf_prog_enter();
> call fmod_ret
> *(u64 *)(rbp - 8) = rax
> __bpf_prog_exit(, start);
> test eax, eax
> jne do_fexit
>
> That 'test eax, eax' is working by accident. The compiler is free to use rax
> inside __bpf_prog_exit() or inside functions that __bpf_prog_exit() is calling.
> Which caused "test_progs -t modify_return" to sporadically fail depending on
> compiler version and kconfig. Fix it by using 'cmp [rbp - 8], 0' instead of
> 'test eax, eax'.
>
> Fixes: ae24082331d9 ("bpf: Introduce BPF_MODIFY_RETURN")
> Reported-by: Andrii Nakryiko <andriin@...com>
> Acked-by: Andrii Nakryiko <andriin@...com>
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
Applied, thanks!
Powered by blists - more mailing lists