On 30/10/2023 13:48, Zachary Leaf wrote:
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 02403abf8ed4..17d436970520 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);
- strncpy((char *)dest->tag, (char *)cinfo->tag, BPF_TAG_SIZE);
I'm not sure this array is actually interpreted as a string. bpf_prog_get_info_by_fd() does a full memcpy(). That may explain why it is typed as u8 and not char. Interestingly a full memcpy() is done for name too, though it is looking a lot like a string...
Kevin
- 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);
[...]