Re: net/bpf/test_run.c:511:1: warning: 'retain' attribute ignored

From: Jiri Olsa
Date: Wed Mar 19 2025 - 10:53:44 EST


On Wed, Mar 19, 2025 at 07:30:45PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 81e4f8d68c66da301bb881862735bd74c6241a19
> commit: 7bdcedd5c8fb88e7176b93812b139eca5fe0aa46 bpf: Harden __bpf_kfunc tag against linker kfunc removal
> date: 9 months ago
> config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20250319/202503191909.SHOCLBzK-lkp@xxxxxxxxx/config)
> compiler: mips-linux-gcc (GCC) 11.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250319/202503191909.SHOCLBzK-lkp@xxxxxxxxx/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202503191909.SHOCLBzK-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):

hi,
we hit similar issue before:
https://lore.kernel.org/bpf/CAMuHMdUaYP3-2JHk-OE9B-AWNU3ikhBdLyWDm0R8DwQpUS9eCw@xxxxxxxxxxxxxx/

solution was to upgrade gcc

jirka


>
> >> net/bpf/test_run.c:511:1: warning: 'retain' attribute ignored [-Wattributes]
> 511 | {
> | ^
> net/bpf/test_run.c:557:1: warning: 'retain' attribute ignored [-Wattributes]
> 557 | {
> | ^
> net/bpf/test_run.c:566:1: warning: 'retain' attribute ignored [-Wattributes]
> 566 | {
> | ^
> net/bpf/test_run.c:573:1: warning: 'retain' attribute ignored [-Wattributes]
> 573 | {
> | ^
> net/bpf/test_run.c:579:1: warning: 'retain' attribute ignored [-Wattributes]
> 579 | {
> | ^
> net/bpf/test_run.c:608:1: warning: 'retain' attribute ignored [-Wattributes]
> 608 | {
> | ^
> net/bpf/test_run.c:613:1: warning: 'retain' attribute ignored [-Wattributes]
> 613 | {
> | ^
> net/bpf/test_run.c:619:1: warning: 'retain' attribute ignored [-Wattributes]
> 619 | {
> | ^
> net/bpf/test_run.c:623:1: warning: 'retain' attribute ignored [-Wattributes]
> 623 | {
> | ^
> --
> >> net/core/filter.c:11863:1: warning: 'retain' attribute ignored [-Wattributes]
> 11863 | {
> | ^
> net/core/filter.c:11876:1: warning: 'retain' attribute ignored [-Wattributes]
> 11876 | {
> | ^
> net/core/filter.c:11889:1: warning: 'retain' attribute ignored [-Wattributes]
> 11889 | {
> | ^
> net/core/filter.c:11910:1: warning: 'retain' attribute ignored [-Wattributes]
> 11910 | {
> | ^
> net/core/filter.c:12096:1: warning: 'retain' attribute ignored [-Wattributes]
> 12096 | {
> | ^
> --
> >> net/core/xdp.c:713:1: warning: 'retain' attribute ignored [-Wattributes]
> 713 | {
> | ^
> net/core/xdp.c:736:1: warning: 'retain' attribute ignored [-Wattributes]
> 736 | {
> | ^
> net/core/xdp.c:769:1: warning: 'retain' attribute ignored [-Wattributes]
> 769 | {
> | ^
> --
> >> net/ipv4/tcp_cong.c:455:1: warning: 'retain' attribute ignored [-Wattributes]
> 455 | {
> | ^
> net/ipv4/tcp_cong.c:469:1: warning: 'retain' attribute ignored [-Wattributes]
> 469 | {
> | ^
> net/ipv4/tcp_cong.c:495:1: warning: 'retain' attribute ignored [-Wattributes]
> 495 | {
> | ^
> net/ipv4/tcp_cong.c:514:1: warning: 'retain' attribute ignored [-Wattributes]
> 514 | {
> | ^
> net/ipv4/tcp_cong.c:522:1: warning: 'retain' attribute ignored [-Wattributes]
> 522 | {
> | ^
> --
> >> net/ipv4/fou_bpf.c:46:1: warning: 'retain' attribute ignored [-Wattributes]
> 46 | {
> | ^
> net/ipv4/fou_bpf.c:88:1: warning: 'retain' attribute ignored [-Wattributes]
> 88 | {
> | ^
> --
> >> net/ipv4/tcp_bbr.c:300:1: warning: 'retain' attribute ignored [-Wattributes]
> 300 | {
> | ^
> net/ipv4/tcp_bbr.c:333:1: warning: 'retain' attribute ignored [-Wattributes]
> 333 | {
> | ^
> net/ipv4/tcp_bbr.c:1028:1: warning: 'retain' attribute ignored [-Wattributes]
> 1028 | {
> | ^
> net/ipv4/tcp_bbr.c:1040:1: warning: 'retain' attribute ignored [-Wattributes]
> 1040 | {
> | ^
> net/ipv4/tcp_bbr.c:1082:1: warning: 'retain' attribute ignored [-Wattributes]
> 1082 | {
> | ^
> net/ipv4/tcp_bbr.c:1091:1: warning: 'retain' attribute ignored [-Wattributes]
> 1091 | {
> | ^
> net/ipv4/tcp_bbr.c:1102:1: warning: 'retain' attribute ignored [-Wattributes]
> 1102 | {
> | ^
> net/ipv4/tcp_bbr.c:1130:1: warning: 'retain' attribute ignored [-Wattributes]
> 1130 | {
> | ^
> --
> >> net/ipv4/tcp_cubic.c:130:1: warning: 'retain' attribute ignored [-Wattributes]
> 130 | {
> | ^
> net/ipv4/tcp_cubic.c:143:1: warning: 'retain' attribute ignored [-Wattributes]
> 143 | {
> | ^
> net/ipv4/tcp_cubic.c:325:1: warning: 'retain' attribute ignored [-Wattributes]
> 325 | {
> | ^
> net/ipv4/tcp_cubic.c:342:1: warning: 'retain' attribute ignored [-Wattributes]
> 342 | {
> | ^
> net/ipv4/tcp_cubic.c:359:1: warning: 'retain' attribute ignored [-Wattributes]
> 359 | {
> | ^
> net/ipv4/tcp_cubic.c:449:1: warning: 'retain' attribute ignored [-Wattributes]
> 449 | {
> | ^
> --
> >> net/ipv4/tcp_dctcp.c:90:1: warning: 'retain' attribute ignored [-Wattributes]
> 90 | {
> | ^
> net/ipv4/tcp_dctcp.c:119:1: warning: 'retain' attribute ignored [-Wattributes]
> 119 | {
> | ^
> net/ipv4/tcp_dctcp.c:128:1: warning: 'retain' attribute ignored [-Wattributes]
> 128 | {
> | ^
> net/ipv4/tcp_dctcp.c:184:1: warning: 'retain' attribute ignored [-Wattributes]
> 184 | {
> | ^
> net/ipv4/tcp_dctcp.c:194:1: warning: 'retain' attribute ignored [-Wattributes]
> 194 | {
> | ^
> net/ipv4/tcp_dctcp.c:244:1: warning: 'retain' attribute ignored [-Wattributes]
> 244 | {
> | ^
> --
> >> fs/verity/measure.c:121:1: warning: 'retain' attribute ignored [-Wattributes]
> 121 | {
> | ^
>
>
> vim +/retain +511 net/bpf/test_run.c
>
> 391145ba2accc4 Dave Marchevsky 2023-10-31 509
> 400031e05adfce David Vernet 2023-02-01 510 __bpf_kfunc int bpf_fentry_test1(int a)
> faeb2dce084aff Alexei Starovoitov 2019-11-14 @511 {
> faeb2dce084aff Alexei Starovoitov 2019-11-14 512 return a + 1;
> faeb2dce084aff Alexei Starovoitov 2019-11-14 513 }
> 46565696434095 Kumar Kartikeya Dwivedi 2022-01-14 514 EXPORT_SYMBOL_GPL(bpf_fentry_test1);
> faeb2dce084aff Alexei Starovoitov 2019-11-14 515
>
> :::::: The code at line 511 was first introduced by commit
> :::::: faeb2dce084aff92d466c6ce68481989b815435b bpf: Add kernel test functions for fentry testing
>
> :::::: TO: Alexei Starovoitov <ast@xxxxxxxxxx>
> :::::: CC: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki