diff options
author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2022-11-18 04:55:54 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-18 06:11:32 +0300 |
commit | f73e601aafb2ad9f2b2012b969f86f4a41141a7d (patch) | |
tree | cd2a208ade233b9f7a94c0eb6f8bb79ec24d37cd /virt | |
parent | d48995723c9a1c4896206be382c72d722accbfbc (diff) | |
download | linux-f73e601aafb2ad9f2b2012b969f86f4a41141a7d.tar.xz |
bpf: Populate field_offs for inner_map_meta
Far too much code simply assumes that both btf_record and btf_field_offs
are set to valid pointers together, or both are unset. They go together
hand in hand as btf_record describes the special fields and
btf_field_offs is compact representation for runtime copying/zeroing.
It is very difficult to make this clear in the code when the only
exception to this universal invariant is inner_map_meta which is used
as reg->map_ptr in the verifier. This is simply a bug waiting to happen,
as in verifier context we cannot easily distinguish if PTR_TO_MAP_VALUE
is coming from an inner map, and if we ever end up using field_offs for
any reason in the future, we will silently ignore the special fields for
inner map case (as NULL is not an error but unset field_offs).
Hence, simply copy field_offs from inner map together with btf_record.
While at it, refactor code to unwind properly on errors with gotos.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20221118015614.2013203-5-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions