[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <91aba3b7-ab80-f748-dfac-9933ff095139@iogearbox.net>
Date: Sat, 2 Nov 2019 01:05:55 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Eric Dumazet <edumazet@...gle.com>,
Alexei Starovoitov <ast@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
bpf <bpf@...r.kernel.org>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Sandipan Das <sandipan@...ux.ibm.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>
Subject: Re: [PATCH net] powerpc/bpf: fix tail call implementation
On 11/1/19 4:34 AM, Eric Dumazet wrote:
> We have seen many crashes on powerpc hosts while loading bpf programs.
>
> The problem here is that bpf_int_jit_compile() does a first pass
> to compute the program length.
>
> Then it allocates memory to store the generated program and
> calls bpf_jit_build_body() a second time (and a third time
> later)
>
> What I have observed is that the second bpf_jit_build_body()
> could end up using few more words than expected.
>
> If bpf_jit_binary_alloc() put the space for the program
> at the end of the allocated page, we then write on
> a non mapped memory.
>
> It appears that bpf_jit_emit_tail_call() calls
> bpf_jit_emit_common_epilogue() while ctx->seen might not
> be stable.
>
> Only after the second pass we can be sure ctx->seen wont be changed.
>
> Trying to avoid a second pass seems quite complex and probably
> not worth it.
>
> Fixes: ce0761419faef ("powerpc/bpf: Implement support for tail calls")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>
> Cc: Sandipan Das <sandipan@...ux.ibm.com>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Cc: Martin KaFai Lau <kafai@...com>
> Cc: Song Liu <songliubraving@...com>
> Cc: Yonghong Song <yhs@...com>
> Cc: netdev@...r.kernel.org
> Cc: bpf@...r.kernel.org
Applied, thanks!
Powered by blists - more mailing lists