BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH bpf-next 0/3] Strip away modifiers from BPF skeleton global variables
@ 2020-07-01  6:45 Andrii Nakryiko
  2020-07-01  6:45 ` [PATCH bpf-next 1/3] libbpf: support stripping modifiers for btf_dump Andrii Nakryiko
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Andrii Nakryiko @ 2020-07-01  6:45 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Anton Protopopov

Fix bpftool logic of stripping away const/volatile modifiers for all global
variables during BPF skeleton generation. See patch #1 for details on when
existing logic breaks and why it's important. Support special .strip_mods=true
mode in btf_dump. Add selftests validating that everything works as expected.

Recent example of when this has caused problems can be found in [0].

  [0] https://github.com/iovisor/bcc/pull/2994#issuecomment-650588533

Cc: Anton Protopopov <a.s.protopopov@gmail.com>

Andrii Nakryiko (3):
  libbpf: support stripping modifiers for btf_dump
  selftests/bpf: add selftest validating btf_dump's mod-stripping output
  tools/bpftool: strip away modifiers from global variables

 tools/bpf/bpftool/gen.c                       | 13 ++---
 tools/lib/bpf/btf.h                           |  6 +++
 tools/lib/bpf/btf_dump.c                      | 18 +++++--
 .../selftests/bpf/prog_tests/btf_dump.c       |  5 +-
 .../selftests/bpf/prog_tests/skeleton.c       |  6 +--
 .../bpf/progs/btf_dump_test_case_strip_mods.c | 50 +++++++++++++++++++
 .../selftests/bpf/progs/test_skeleton.c       |  6 ++-
 7 files changed, 84 insertions(+), 20 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/btf_dump_test_case_strip_mods.c

-- 
2.24.1


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

end of thread, back to index

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01  6:45 [PATCH bpf-next 0/3] Strip away modifiers from BPF skeleton global variables Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 1/3] libbpf: support stripping modifiers for btf_dump Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 2/3] selftests/bpf: add selftest testin btf_dump's mod-stripping output Andrii Nakryiko
2020-07-01  6:47   ` Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 2/3] selftests/bpf: add selftest validating " Andrii Nakryiko
2020-07-01  6:45 ` [PATCH bpf-next 3/3] tools/bpftool: strip away modifiers from global variables Andrii Nakryiko
2020-07-01 15:01 ` [PATCH bpf-next 0/3] Strip away modifiers from BPF skeleton " Alexei Starovoitov
2020-07-01 16:08   ` Andrii Nakryiko
2020-07-01 16:36     ` Alexei Starovoitov
2020-07-01 18:15       ` Andrii Nakryiko

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git