BPF List
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Song Liu <song@kernel.org>, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
	kpsingh@chromium.org, kernel-team@fb.com, haoluo@google.com,
	bjorn@kernel.org
Subject: Re: [PATCH v2 bpf-next 0/2] enforce W^X for trampoline and dispatcher
Date: Tue, 27 Sep 2022 08:16:27 -0400	[thread overview]
Message-ID: <57d6b6957f6e19aef509edf791266ee9f2afa20b.camel@kernel.org> (raw)
In-Reply-To: <20220926184739.3512547-1-song@kernel.org>

On Mon, 2022-09-26 at 11:47 -0700, Song Liu wrote:
> Changes v1 => v2:
> 1. Update arch_prepare_bpf_dispatcher to use a RO image and a RW buffer.
>    (Alexei) Note: I haven't found an existing test to cover this part, so
>    this part was tested manually (comparing the generated dispatcher is
>    the same).
> 
> Jeff Layton reported CPA W^X warning linux-next [1]. It turns out to be
> W^X issue with bpf trampoline and bpf dispatcher. Fix these by:
> 
> 1. Use bpf_prog_pack for bpf_dispatcher;
> 2. Set memory permission properly with bpf trampoline.
> 
> [1] https://lore.kernel.org/lkml/c84cc27c1a5031a003039748c3c099732a718aec.camel@kernel.org/
> 
> Song Liu (2):
>   bpf: use bpf_prog_pack for bpf_dispatcher
>   bpf: Enforce W^X for bpf trampoline
> 
>  arch/x86/net/bpf_jit_comp.c | 16 ++++++++--------
>  include/linux/bpf.h         |  4 ++--
>  include/linux/filter.h      |  5 +++++
>  kernel/bpf/core.c           |  9 +++++++--
>  kernel/bpf/dispatcher.c     | 27 +++++++++++++++++++++------
>  kernel/bpf/trampoline.c     | 22 +++++-----------------
>  6 files changed, 48 insertions(+), 35 deletions(-)
> 
> --
> 2.30.2

Your patch seems to have fixed the issue. You can add:

Tested-by: Jeff Layton <jlayton@kernel.org>

Thanks!

  parent reply	other threads:[~2022-09-27 12:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26 18:47 [PATCH v2 bpf-next 0/2] enforce W^X for trampoline and dispatcher Song Liu
2022-09-26 18:47 ` [PATCH v2 bpf-next 1/2] bpf: use bpf_prog_pack for bpf_dispatcher Song Liu
2022-09-26 18:47 ` [PATCH v2 bpf-next 2/2] bpf: Enforce W^X for bpf trampoline Song Liu
2022-09-27  3:50 ` [PATCH v2 bpf-next 0/2] enforce W^X for trampoline and dispatcher patchwork-bot+netdevbpf
2022-09-27 12:16 ` Jeff Layton [this message]
2022-09-28  9:42 ` Jesper Dangaard Brouer
2022-09-28 16:23   ` Song Liu

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=57d6b6957f6e19aef509edf791266ee9f2afa20b.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=song@kernel.org \
    /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