From 6668ed271eaefaa63e686bdfbedaeb7b8e492722 Mon Sep 17 00:00:00 2001 From: Kumar Kartikeya Dwivedi Date: Fri, 4 Sep 2026 10:43:19 +0200 Subject: selftests/bpf: Reject graph kptr use after RCU unlock Add a sleepable verifier test that loads a graph-node local kptr in an explicit RCU read-side critical section, then passes its node to bpf_rbtree_remove() after the section ends. Before the verifier fix, the stale NON_OWN_REF flag makes the node look like a live borrowed reference and the program is accepted. After the fix, the pointer is demoted without NON_OWN_REF and the graph kfunc argument is rejected. Also exercise a graph kptr loaded while a spin lock provides implicit RCU protection. The pointer must be invalidated when the lock is released, which guards the required ordering between non-owning-reference invalidation and RCU demotion. Update the existing fault-protected load test state description. The post-unlock pointer no longer carries NON_OWN_REF, but remains readable because the load is rewritten to use BPF_PROBE_MEM. Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20260904084325.52250-7-memxor@gmail.com Signed-off-by: Alexei Starovoitov --- Documentation/netlink/specs/fou.yaml | 134 +++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 Documentation/netlink/specs/fou.yaml (limited to 'Documentation/netlink/specs/fou.yaml') diff --git a/Documentation/netlink/specs/fou.yaml b/Documentation/netlink/specs/fou.yaml new file mode 100644 index 000000000..331f1b342 --- /dev/null +++ b/Documentation/netlink/specs/fou.yaml @@ -0,0 +1,134 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +--- +name: fou + +protocol: genetlink-legacy + +doc: | + Foo-over-UDP. + +c-family-name: fou-genl-name +c-version-name: fou-genl-version +max-by-define: true +kernel-policy: global + +definitions: + - + type: enum + name: encap-type + name-prefix: fou-encap- + enum-name: + entries: [unspec, direct, gue] + +attribute-sets: + - + name: fou + name-prefix: fou-attr- + attributes: + - + name: unspec + type: unused + value: 0 + - + name: port + type: u16 + byte-order: big-endian + - + name: af + type: u8 + - + name: ipproto + type: u8 + checks: + min: 1 + - + name: type + type: u8 + - + name: remcsum-nopartial + type: flag + - + name: local-v4 + type: u32 + - + name: local-v6 + type: binary + checks: + exact-len: 16 + - + name: peer-v4 + type: u32 + - + name: peer-v6 + type: binary + checks: + exact-len: 16 + - + name: peer-port + type: u16 + byte-order: big-endian + - + name: ifindex + type: s32 + +operations: + list: + - + name: unspec + doc: unused + value: 0 + + - + name: add + doc: Add port. + attribute-set: fou + + dont-validate: [strict, dump] + flags: [admin-perm] + + do: + request: &all_attrs + attributes: + - port + - ipproto + - type + - remcsum-nopartial + - local-v4 + - peer-v4 + - local-v6 + - peer-v6 + - peer-port + - ifindex + + - + name: del + doc: Delete port. + attribute-set: fou + + dont-validate: [strict, dump] + flags: [admin-perm] + + do: + request: &select_attrs + attributes: + - af + - ifindex + - port + - peer-port + - local-v4 + - peer-v4 + - local-v6 + - peer-v6 + + - + name: get + doc: Get tunnel info. + attribute-set: fou + dont-validate: [strict, dump] + + do: + request: *select_attrs + reply: *all_attrs + + dump: + reply: *all_attrs -- cgit v1.3.1