Re: [PATCH bpf-next] selftests/bpf: fix uprobe_multi compilation error

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

 



On 27/09/2024 00:44, Eduard Zingerman wrote:
> On Thu, 2024-09-26 at 15:49 +0100, Alan Maguire wrote:
>> When building selftests, the following was seen:
>>
>> uprobe_multi.c: In function ‘trigger_uprobe’:
>> uprobe_multi.c:108:40: error: ‘MADV_PAGEOUT’ undeclared (first use in this function)
>>   108 |                 madvise(addr, page_sz, MADV_PAGEOUT);
>>       |                                        ^~~~~~~~~~~~
>> uprobe_multi.c:108:40: note: each undeclared identifier is reported only once for each function it appears in
>> make: *** [Makefile:850: bpf-next/tools/testing/selftests/bpf/uprobe_multi] Error 1
>>
>> ...even with updated UAPI headers. It seems the above value is
>> defined in UAPI <linux/mman.h> but including that file triggers
>> other redefinition errors.  Simplest solution is to add a
>> guarded definition, as was done for MADV_POPULATE_READ.
>>
>> Fixes: 3c217a182018 ("selftests/bpf: add build ID tests")
>> Signed-off-by: Alan Maguire <alan.maguire@xxxxxxxxxx>
>> ---
> 
> I was curious why this error is not triggered on my local machine or CI.
> MADV_PAGEOUT is indeed defined in UAPI.
> Selftests build picks it from host system header, which is
> /usr/include/bits/mman-linux.h for my Fedora 40 setup.
> The MADV_PAGEOUT was added by commit [1] back in 2019
> (and should be available from Linux 5.4, I guess Alan uses a very old kernel).
> 
> I think that at some point in time we should adjust selftests to use
> UAPI headers that come from the kernel being tested, not from the host.
> Until that happens, I think this fix is fine.
> 


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux