Re: [PATCH] bpf.2: Added missing EAGAIN error case for BPF_PROG_LOAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-07-28 22:12, Michael Weiß wrote:
> Hi Alex,
> 
> On 28.07.23 21:42, Alejandro Colomar wrote:
>> Hi Michael, Alexei,
>>
>> On 2023-07-21 14:06, Michael Weiß wrote:
>>> Since commit c3494801cd1785e2 ("bpf: check pending signals while
>>> verifying programs", bpf() may also fail with EAGAIN if the verifier
>>> detects pending signals.
>>>
>>> This was triggered in the cmld of GyroidOS when loading a cgroups
>>> device program during container start. We had a look in the man page
>>> and where confused that EAGAIN was not listed as possible error.
>>> Digging in the kernel source revealed the EAGAIN in the verifier
>>> introduced by the commit above. Further investigation showed that
>>> libbpf already wraps that case, by a retry loop.
>>>
>>> Since GyroidOS uses the system call directly and not libbpf, we missed
>>> to handle this error correctly. Thus, this hint in the man page for
>>> the bpf() system call should be helpful for others who implement on
>>> the low-level interface, too.
>>>
>>> Signed-off-by: Michael Weiß <michael.weiss@xxxxxxxxxxxxxxxxxxx>
>>
>> Thanks for the patch!  I find a few sentences have some minor wording
>> issues.  I'll propose a small change to your proposal.  Please check.
>> If you confirm it, I'll amend your commit, so you don't need to resend.
>> See below
>>
>> Cheers,
>> Alex
>>
>>> ---
>>>  man2/bpf.2 | 10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/man2/bpf.2 b/man2/bpf.2
>>> index d32435a1d..7cef7f24d 100644
>>> --- a/man2/bpf.2
>>> +++ b/man2/bpf.2
>>> @@ -991,6 +991,16 @@ and examine
>>>  .I log_buf
>>>  for the specific reason provided by the verifier.
>>>  .TP
>>> +.B EAGAIN
>>> +For
>>> +.BR BPF_PROG_LOAD ,
>>> +indicates that needed resources are blocked.
>>> +This is due to the verifier detects pending signals while it is checking
>>> +the bpf program about its validity.
>>> +In this case, just call
>>> +.BR bpf ()
>>> +again with the same parameters.
>>> +.TP
>>
>> diff --git a/man2/bpf.2 b/man2/bpf.2
>> index 7cef7f24d..ea68e1293 100644
>> --- a/man2/bpf.2
>> +++ b/man2/bpf.2
>> @@ -995,8 +995,8 @@ .SH ERRORS
>>  For
>>  .BR BPF_PROG_LOAD ,
>>  indicates that needed resources are blocked.
>> -This is due to the verifier detects pending signals while it is checking
>> -the bpf program about its validity.
>> +This happens when the verifier detects pending signals
>> +while it is checking the validity of the bpf program.
> 
> Sounds good, confirmed.

Thanks!  Patch applied.

<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/?id=ec32926e9b5aa37c4c40fc8c09497cf2a50560a7>

Cheers,
Alex

> 
> Thanks,
> Michael
> 
>>  In this case, just call
>>  .BR bpf ()
>>  again with the same parameters.
>>
>>
>>>  .B EBADF
>>>  .I fd
>>>  is not an open file descriptor.
>>

-- 
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux