bpf: fix for use after free bug in inline_bpf_loop
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: fix for use after free bug in inline_bpf_loopkernel/ | +1 | 0 replies | Applied |
| 2/2 | selftest/bpf: test for use after free bug fix in inline_bpf_looptools/ tools/ | +50 | 0 replies | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH bpf-next 0/2] bpf: fix for use after free bug in inline_bpf_loop
These two patches fix the use after free bug in inline_bpf_loop() reported by Dan Carpenter. The fix for verifier.c and the test case in test_verifier.c are split into separate commits.
While the first patch is necessary, I'm not sure about the second. The test case is somewhat fragile because of the following line:
const int len = getpagesize() - 25;
Here 25 is a magical number that allows env->prog to fit in one page before bpf_loop inlining and don't fit after the bpf_loop inlining. I'd prefer to use sizeof(struct bpf_prog) instead of this constant, but definition of the struct bpf_prog is not available in test_verifier.c.
Eduard Zingerman (2):
bpf: fix for use after free bug in inline_bpf_loop selftest/bpf: test for use after free bug fix in inline_bpf_loop
kernel/bpf/verifier.c | 2 +- tools/testing/selftests/bpf/test_verifier.c | 39 +++++++++++++++++++ .../selftests/bpf/verifier/bpf_loop_inline.c | 11 ++++++ 3 files changed, 51 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1