BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] enforce W^X for trampoline and dispatcher
@ 2022-09-23 21:18 Song Liu
  2022-09-23 21:18 ` [PATCH bpf-next 1/2] bpf: use bpf_prog_pack for bpf_dispatcher Song Liu
  2022-09-23 21:18 ` [PATCH bpf-next 2/2] bpf: Enforce W^X for bpf trampoline Song Liu
  0 siblings, 2 replies; 8+ messages in thread
From: Song Liu @ 2022-09-23 21:18 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, john.fastabend, kpsingh, kernel-team, haoluo,
	jlayton, Song Liu

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

 include/linux/bpf.h     |  2 +-
 include/linux/filter.h  |  5 +++++
 kernel/bpf/core.c       |  9 +++++++--
 kernel/bpf/dispatcher.c | 21 ++++++++++++++++++---
 kernel/bpf/trampoline.c | 22 +++++-----------------
 5 files changed, 36 insertions(+), 23 deletions(-)

--
2.30.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-24  1:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 21:18 [PATCH bpf-next 0/2] enforce W^X for trampoline and dispatcher Song Liu
2022-09-23 21:18 ` [PATCH bpf-next 1/2] bpf: use bpf_prog_pack for bpf_dispatcher Song Liu
2022-09-23 22:00   ` Alexei Starovoitov
2022-09-23 23:18     ` Song Liu
2022-09-23 23:23       ` Alexei Starovoitov
2022-09-24  0:51         ` Song Liu
2022-09-24  1:03           ` Alexei Starovoitov
2022-09-23 21:18 ` [PATCH bpf-next 2/2] bpf: Enforce W^X for bpf trampoline Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox