linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf v2 0/2] bpf: fix NULL dereference during extable search
@ 2023-06-07 21:04 Krister Johansen
  2023-06-07 21:04 ` [PATCH bpf v2 1/2] selftests/bpf: add a test for subprogram extables Krister Johansen
  2023-06-07 21:04 ` [PATCH bpf v2 2/2] bpf: ensure main program has an extable Krister Johansen
  0 siblings, 2 replies; 10+ messages in thread
From: Krister Johansen @ 2023-06-07 21:04 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Mykola Lysenko,
	Shuah Khan, linux-kernel, linux-kselftest, stable

Hi,
Enclosed are a pair of patches for an oops that can occur if an exception is
generated while a bpf subprogram is running.  One of the bpf_prog_aux entries
for the subprograms are missing an extable.  This can lead to an exception that
would otherwise be handled turning into a NULL pointer bug.

The bulk of the change here is simply adding a pair of programs for the
selftest.  The proposed fix in this iteration is a 1-line change.

These changes were tested via the verifier and progs selftests and no
regressions were observed.

Changes from v1:

- Add a selftest (Feedback From Alexei Starovoitov)
- Move to a 1-line verifier change instead of searching multiple extables

Krister Johansen (2):
  Add a selftest for subprogram extables
  bpf: ensure main program has an extable

 kernel/bpf/verifier.c                         |  1 +
 .../bpf/prog_tests/subprogs_extable.c         | 35 +++++++++
 .../bpf/progs/test_subprogs_extable.c         | 71 +++++++++++++++++++
 3 files changed, 107 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/subprogs_extable.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_subprogs_extable.c

-- 
2.25.1


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

end of thread, other threads:[~2023-06-09  0:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 21:04 [PATCH bpf v2 0/2] bpf: fix NULL dereference during extable search Krister Johansen
2023-06-07 21:04 ` [PATCH bpf v2 1/2] selftests/bpf: add a test for subprogram extables Krister Johansen
2023-06-08 17:01   ` Yonghong Song
2023-06-08 17:40   ` Yonghong Song
2023-06-08 22:02     ` Alexei Starovoitov
2023-06-07 21:04 ` [PATCH bpf v2 2/2] bpf: ensure main program has an extable Krister Johansen
2023-06-08 17:38   ` Yonghong Song
2023-06-08 22:05     ` Krister Johansen
2023-06-08 22:01   ` Alexei Starovoitov
2023-06-09  0:09     ` Krister Johansen

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).