linux-next: manual merge of the net-next tree with the net tree

From: Stephen Rothwell
Date: Sun Nov 13 2022 - 17:51:06 EST


Hi all,

Today's linux-next merge of the net-next tree got a conflict in:

include/linux/bpf.h

between commit:

1f6e04a1c7b8 ("bpf: Fix offset calculation error in __copy_map_value and zero_map_value")

from the net tree and commits:

aa3496accc41 ("bpf: Refactor kptr_off_tab into btf_record")
f71b2f64177a ("bpf: Refactor map->off_arr handling")

from the net-next tree.

I fixed it up (I think - see below) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging. You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc include/linux/bpf.h
index c1bd1bd10506,798aec816970..000000000000
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@@ -311,13 -356,14 +356,14 @@@ static inline void bpf_obj_memcpy(struc
return;
}

- for (i = 0; i < map->off_arr->cnt; i++) {
- u32 next_off = map->off_arr->field_off[i];
+ for (i = 0; i < foffs->cnt; i++) {
+ u32 next_off = foffs->field_off[i];
+ u32 sz = next_off - curr_off;

- memcpy(dst + curr_off, src + curr_off, next_off - curr_off);
- curr_off = next_off + map->off_arr->field_sz[i];
+ memcpy(dst + curr_off, src + curr_off, sz);
- curr_off += foffs->field_sz[i];
++ curr_off = next_off + foffs->field_sz[i];
}
- memcpy(dst + curr_off, src + curr_off, map->value_size - curr_off);
+ memcpy(dst + curr_off, src + curr_off, size - curr_off);
}

static inline void copy_map_value(struct bpf_map *map, void *dst, void *src)
@@@ -340,13 -386,19 +386,19 @@@ static inline void bpf_obj_memzero(stru
return;
}

- for (i = 0; i < map->off_arr->cnt; i++) {
- u32 next_off = map->off_arr->field_off[i];
+ for (i = 0; i < foffs->cnt; i++) {
+ u32 next_off = foffs->field_off[i];
+ u32 sz = next_off - curr_off;

- memset(dst + curr_off, 0, next_off - curr_off);
- curr_off = next_off + map->off_arr->field_sz[i];
+ memset(dst + curr_off, 0, sz);
- curr_off += foffs->field_sz[i];
++ curr_off = next_off + foffs->field_sz[i];
}
- memset(dst + curr_off, 0, map->value_size - curr_off);
+ memset(dst + curr_off, 0, size - curr_off);
+ }
+
+ static inline void zero_map_value(struct bpf_map *map, void *dst)
+ {
+ bpf_obj_memzero(map->field_offs, dst, map->value_size);
}

void copy_map_value_locked(struct bpf_map *map, void *dst, void *src,

Attachment: pgpWvxnUG4yz5.pgp
Description: OpenPGP digital signature