On 19/5/26 00:14, Mykyta Yatsenko wrote:
> 
> 
> On 5/18/26 3:54 PM, Leon Hwang wrote:
[...]
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index 6600e126fbfb..83de8fb9b9aa 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>> @@ -6278,7 +6278,9 @@ static int __sys_bpf(enum bpf_cmd cmd, bpfptr_t uattr, 
>> unsigned int size,
>>  
>>      memset(&attr_common, 0, sizeof(attr_common));
>>      if (cmd & BPF_COMMON_ATTRS) {
>> -            err = bpf_check_uarg_tail_zero(uattr_common, 
>> sizeof(attr_common), size_common);
>> +            err = bpf_check_uarg_tail_zero(uattr_common,
>> +                                           offsetofend(struct 
>> bpf_common_attr, log_true_size),
>> +                                           size_common);
> 
> The change looks correct.
> 
> It looks like similar behavior exists in 2 other places of this file:
> bpf_map_get_info_by_fd()
> bpf_prog_get_info_by_fd()
> 

Verify by 'pahole -C bpf_map_info/bpf_prog_info'.

Yes, there are 4 bytes padding at the end of these two structs.

> Does it make sense to fix those too, just to make sure agents follow the
> pattern correctly next time?
> 

Will post separate patches to fix them.

Thanks,
Leon


Reply via email to