Re: [PATCH] bpf.h: fix clang compiler warning with unpriv_ebpf_notify()

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

 



On Mon, May 09, 2022 at 01:36:23PM -0700, Luis Chamberlain wrote:
> The recent commit "bpf: Move BPF sysctls from kernel/sysctl.c to BPF core"
> triggered 0-day to issue an email for what seems to have been an old
> clang warning. So this issue should have existed before as well, from
> what I can tell. The issue is that clang expects a forward declaration
> for routines declared as weak while gcc does not.
> 
> This can be reproduced with 0-day's x86_64-randconfig-c007
> https://download.01.org/0day-ci/archive/20220424/202204240008.JDntM9cU-lkp@xxxxxxxxx/config
> 
> And using:
> 
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 SHELL=/bin/bash kernel/bpf/syscall.o
> Compiler will be installed in /home/mcgrof/0day
> make --keep-going HOSTCC=/home/mcgrof/0day/clang/bin/clang CC=/home/mcgrof/0day/clang/bin/clang LD=/home/mcgrof/0day/clang/bin/ld.lld HOSTLD=/home/mcgrof/0day/clang/bin/ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump OBJSIZE=llvm-size READELF=llvm-readelf HOSTCXX=clang++ HOSTAR=llvm-ar CROSS_COMPILE=x86_64-linux-gnu- --jobs=24 W=1 ARCH=x86_64 SHELL=/bin/bash kernel/bpf/syscall.o
>   DESCEND objtool
>   CALL    scripts/atomic/check-atomics.sh
>   CALL    scripts/checksyscalls.sh
>   CC      kernel/bpf/syscall.o
> kernel/bpf/syscall.c:4944:13: warning: no previous prototype for function 'unpriv_ebpf_notify' [-Wmissing-prototypes]
> void __weak unpriv_ebpf_notify(int new_state)
>             ^
> kernel/bpf/syscall.c:4944:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> void __weak unpriv_ebpf_notify(int new_state)
> ^
> static
> 
> Fixes: 2900005ea287 ("bpf: Move BPF sysctls from kernel/sysctl.c to BPF core")
> Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx>
> ---
> 
> Daniel,
> 
> Given what we did fore 2900005ea287 ("bpf: Move BPF sysctls from
> kernel/sysctl.c to BPF core") where I had pulled pr/bpf-sysctl a
> while ago into sysctl-next and then merged the patch in question,
> should I just safely carry this patch onto sysctl-next? Let me know
> how you'd like to proceed.
> 
> Also, it wasn't clear if putting this forward declaration on
> bpf.h was your ideal preference.

After testing this on sysctl-testing without issues going to move this
to sysctl-next now.

  Luis



[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