netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: edumazet@google.com
Cc: ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org,
	eric.dumazet@gmail.com, bpf@vger.kernel.org,
	naveen.n.rao@linux.ibm.com, sandipan@linux.ibm.com,
	benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
	kafai@fb.com, songliubraving@fb.com, yhs@fb.com
Subject: Re: [PATCH net] powerpc/bpf: fix tail call implementation
Date: Thu, 31 Oct 2019 21:39:31 -0700 (PDT)	[thread overview]
Message-ID: <20191031.213931.1743556905343073518.davem@davemloft.net> (raw)
In-Reply-To: <20191101033444.143741-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Thu, 31 Oct 2019 20:34:44 -0700

> 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@google.com>

I am anticipating this will go via the bpf tree.

  reply	other threads:[~2019-11-01  4:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01  3:34 [PATCH net] powerpc/bpf: fix tail call implementation Eric Dumazet
2019-11-01  4:39 ` David Miller [this message]
2019-11-02  0:05 ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191031.213931.1743556905343073518.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ast@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kafai@fb.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=sandipan@linux.ibm.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).