[PATCH bpf-next v2 0/3] bpf: Handle MEM_RCU type properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patch set [1] added rcu support for bpf programs. In [1], a rcu
pointer is considered to be trusted and not null. This is actually
not true in some cases. The rcu pointer could be null, and for non-null
rcu pointer, it may have reference count of 0. This small patch set
fixed this problem. Patch 1 is the kernel fix. Patch 2 adjusted
selftests properly. Patch 3 added documentation for newly-introduced
KF_RCU flag.

  [1] https://lore.kernel.org/all/20221124053201.2372298-1-yhs@xxxxxx/

Changelogs:
  v1 -> v2:
    - rcu ptr could be NULL.
    - non_null_rcu_ptr->rcu_field can be marked as MEM_RCU as well.
    - Adjust the code to avoid existing error message change.

Yonghong Song (3):
  bpf: Handle MEM_RCU type properly
  selftests/bpf: Fix rcu_read_lock test with new MEM_RCU semantics
  docs/bpf: Add KF_RCU documentation

 Documentation/bpf/kfuncs.rst                  |  9 +++
 include/linux/bpf_verifier.h                  |  2 +-
 include/linux/btf.h                           |  1 +
 kernel/bpf/helpers.c                          | 14 +++++
 kernel/bpf/verifier.c                         | 45 ++++++++++-----
 .../selftests/bpf/progs/rcu_read_lock.c       | 55 +++++++++++++++----
 6 files changed, 102 insertions(+), 24 deletions(-)

-- 
2.30.2





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux