On 14/11/2023 10:31, Zachary Leaf wrote:
[...]
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 8a052c4bb11c..bad24f30e53f 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -3950,28 +3950,163 @@ static int set_info_rec_size(struct bpf_prog_info *info) return 0; } +static void +convert_compat_prog_info_in(struct bpf_prog_info *dest,
const struct compat_bpf_prog_info *cinfo)
+{
- copy_field(dest, cinfo, type);
- copy_field(dest, cinfo, id);
- memcpy(dest->tag, cinfo->tag, BPF_TAG_SIZE);
- copy_field(dest, cinfo, jited_prog_len);
- copy_field(dest, cinfo, xlated_prog_len);
- copy_field(dest, cinfo, jited_prog_insns);
- copy_field(dest, cinfo, xlated_prog_insns);
- copy_field(dest, cinfo, load_time);
- copy_field(dest, cinfo, created_by_uid);
- copy_field(dest, cinfo, nr_map_ids);
- copy_field(dest, cinfo, map_ids);
- strncpy((char *)dest->name, (char *)cinfo->name, BPF_OBJ_NAME_LEN);
Sorry forgot to mention in v4 - no need for casts here, name is already a char[] (since it is indeed a string). Same thing in the out function.
Kevin