BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] bpf: Introduce union trusted
@ 2023-07-09  2:59 Yafang Shao
  2023-07-09  2:59 ` [PATCH bpf-next 1/3] bpf: Introduce BTF_TYPE_SAFE_TRUSTED_UNION Yafang Shao
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Yafang Shao @ 2023-07-09  2:59 UTC (permalink / raw)
  To: ast, daniel, john.fastabend, andrii, martin.lau, song, yhs,
	kpsingh, sdf, haoluo, jolsa
  Cc: bpf, Yafang Shao

When we are verifying a field in a union, we may verify another field
which has the same offset. So we should annotate that field as
untrusted. In some cases we have already known that some fields
are safe and then we can add them into the union trusted allow list.

Patch #3 fixes an issue found in our dev server.

Changes:
- bpf: Fix errors in verifying a union
  https://lore.kernel.org/bpf/20230628115205.248395-1-laoar.shao@gmail.com/    

Yafang Shao (3):
  bpf: Introduce BTF_TYPE_SAFE_TRUSTED_UNION
  selftests/bpf: Add selftests for BTF_TYPE_SAFE_TRUSTED_UNION
  bpf: Fix an error in verifying a field in a union

 kernel/bpf/btf.c                              | 22 +++++++++----------
 kernel/bpf/verifier.c                         | 21 ++++++++++++++++++
 .../bpf/progs/nested_trust_failure.c          | 16 ++++++++++++++
 .../bpf/progs/nested_trust_success.c          | 15 +++++++++++++
 4 files changed, 62 insertions(+), 12 deletions(-)

-- 
2.30.1 (Apple Git-130)


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

end of thread, other threads:[~2023-07-11 14:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09  2:59 [PATCH bpf-next 0/3] bpf: Introduce union trusted Yafang Shao
2023-07-09  2:59 ` [PATCH bpf-next 1/3] bpf: Introduce BTF_TYPE_SAFE_TRUSTED_UNION Yafang Shao
2023-07-10 16:59   ` Stanislav Fomichev
2023-07-11 14:20     ` Yafang Shao
2023-07-11  2:55   ` Alexei Starovoitov
2023-07-11 14:21     ` Yafang Shao
2023-07-09  2:59 ` [PATCH bpf-next 2/3] selftests/bpf: Add selftests for BTF_TYPE_SAFE_TRUSTED_UNION Yafang Shao
2023-07-09  2:59 ` [PATCH bpf-next 3/3] bpf: Fix an error in verifying a field in a union Yafang Shao
2023-07-11  2:56   ` Alexei Starovoitov
2023-07-11 14:22     ` Yafang Shao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox