All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v1 0/6] Fixes for bad PTR_TO_BTF_ID offset
@ 2022-03-01  6:57 Kumar Kartikeya Dwivedi
  2022-03-01  6:57 ` [PATCH bpf-next v1 1/6] bpf: Add check_func_arg_reg_off function Kumar Kartikeya Dwivedi
                   ` (5 more replies)
  0 siblings, 6 replies; 32+ messages in thread
From: Kumar Kartikeya Dwivedi @ 2022-03-01  6:57 UTC (permalink / raw)
  To: bpf; +Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko

This set fixes a bug related to bad var_off being permitted for kfunc call in
case of PTR_TO_BTF_ID, consolidates offset checks for all register types allowed
as helper or kfunc arguments into a common shared helper, and introduces a
couple of other checks to harden the kfunc release logic and prevent future
bugs. Some selftests are also included that fail in absence of these fixes,
serving as demonstration of the issues being fixed.

Kumar Kartikeya Dwivedi (6):
  bpf: Add check_func_arg_reg_off function
  bpf: Fix PTR_TO_BTF_ID var_off check
  bpf: Disallow negative offset in check_ptr_off_reg
  bpf: Harden register offset checks for release kfunc
  selftests/bpf: Update tests for new errstr
  selftests/bpf: Add tests for kfunc register offset checks

 include/linux/bpf_verifier.h                  |  3 +
 kernel/bpf/btf.c                              | 24 ++++--
 kernel/bpf/verifier.c                         | 75 ++++++++++-------
 net/bpf/test_run.c                            | 11 +++
 .../selftests/bpf/verifier/bounds_deduction.c |  2 +-
 tools/testing/selftests/bpf/verifier/calls.c  | 82 +++++++++++++++++++
 tools/testing/selftests/bpf/verifier/ctx.c    |  8 +-
 7 files changed, 167 insertions(+), 38 deletions(-)

-- 
2.35.1


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

end of thread, other threads:[~2022-03-03  0:14 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  6:57 [PATCH bpf-next v1 0/6] Fixes for bad PTR_TO_BTF_ID offset Kumar Kartikeya Dwivedi
2022-03-01  6:57 ` [PATCH bpf-next v1 1/6] bpf: Add check_func_arg_reg_off function Kumar Kartikeya Dwivedi
2022-03-01  6:57 ` [PATCH bpf-next v1 2/6] bpf: Fix PTR_TO_BTF_ID var_off check Kumar Kartikeya Dwivedi
2022-03-01  6:57 ` [PATCH bpf-next v1 3/6] bpf: Disallow negative offset in check_ptr_off_reg Kumar Kartikeya Dwivedi
2022-03-01  6:57 ` [PATCH bpf-next v1 4/6] bpf: Harden register offset checks for release kfunc Kumar Kartikeya Dwivedi
2022-03-02  3:20   ` Martin KaFai Lau
2022-03-02  9:42     ` Kumar Kartikeya Dwivedi
2022-03-02 21:56       ` Martin KaFai Lau
2022-03-02 22:30         ` Kumar Kartikeya Dwivedi
2022-03-02 22:44           ` Alexei Starovoitov
2022-03-02 23:00             ` Kumar Kartikeya Dwivedi
2022-03-02 23:17               ` Alexei Starovoitov
2022-03-02 23:29                 ` Kumar Kartikeya Dwivedi
2022-03-02 23:39                   ` Alexei Starovoitov
2022-03-02 23:31             ` Martin KaFai Lau
2022-03-01  6:57 ` [PATCH bpf-next v1 5/6] selftests/bpf: Update tests for new errstr Kumar Kartikeya Dwivedi
2022-03-02 22:45   ` Alexei Starovoitov
2022-03-02 23:02     ` Kumar Kartikeya Dwivedi
2022-03-01  6:57 ` [PATCH bpf-next v1 6/6] selftests/bpf: Add tests for kfunc register offset checks Kumar Kartikeya Dwivedi
2022-03-01 11:40   ` kernel test robot
2022-03-01 11:57     ` Kumar Kartikeya Dwivedi
2022-03-01 11:57       ` Kumar Kartikeya Dwivedi
2022-03-02 22:47       ` Alexei Starovoitov
2022-03-02 22:47         ` Alexei Starovoitov
2022-03-02 23:14         ` Kumar Kartikeya Dwivedi
2022-03-02 23:14           ` Kumar Kartikeya Dwivedi
2022-03-02 23:20           ` Alexei Starovoitov
2022-03-02 23:20             ` Alexei Starovoitov
2022-03-02 23:26           ` Nathan Chancellor
2022-03-02 23:26             ` Nathan Chancellor
2022-03-02 23:37             ` Kumar Kartikeya Dwivedi
2022-03-02 23:37               ` Kumar Kartikeya Dwivedi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.