public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Amery Hung <ameryhung@gmail.com>
Cc: bpf@vger.kernel.org, oe-kbuild-all@lists.linux.dev,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@meta.com, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH bpf-next 1/3] bpf: Check unsupported ops from the bpf_struct_ops's cfi_stubs
Date: Mon, 22 Jul 2024 10:34:08 -0700	[thread overview]
Message-ID: <15f7db68-e1b1-4ce5-8855-735fc5aae718@linux.dev> (raw)
In-Reply-To: <CAMB2axM565hLp1uuYggcEEPDA8y0NCpTn8gESmn6cPuyWfELJQ@mail.gmail.com>

On 7/21/24 3:45 PM, Amery Hung wrote:
> On Sat, Jul 20, 2024 at 7:45 AM kernel test robot <lkp@intel.com> wrote:
>>
>> Hi Martin,
>>
>> kernel test robot noticed the following build warnings:
>>
>> [auto build test WARNING on bpf-next/master]
>>
>> url:    https://github.com/intel-lab-lkp/linux/commits/Martin-KaFai-Lau/bpf-Check-unsupported-ops-from-the-bpf_struct_ops-s-cfi_stubs/20240720-144313
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
>> patch link:    https://lore.kernel.org/r/20240720062233.2319723-2-martin.lau%40linux.dev
>> patch subject: [PATCH bpf-next 1/3] bpf: Check unsupported ops from the bpf_struct_ops's cfi_stubs
>> config: i386-randconfig-001-20240720 (https://download.01.org/0day-ci/archive/20240720/202407202244.HvnUVyjM-lkp@intel.com/config)
>> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240720/202407202244.HvnUVyjM-lkp@intel.com/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@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202407202244.HvnUVyjM-lkp@intel.com/
>>
>> All warnings (new ones prefixed by >>):
>>
>>     kernel/bpf/bpf_struct_ops.c: In function 'bpf_struct_ops_supported':
>>>> kernel/bpf/bpf_struct_ops.c:1045:48: warning: dereferencing 'void *' pointer
>>       void *func_ptr = *(void **)(&st_ops->cfi_stubs[moff]);
>>                                                     ^
>>
>>
>> vim +1045 kernel/bpf/bpf_struct_ops.c
>>
>>    1042
>>    1043  int bpf_struct_ops_supported(const struct bpf_struct_ops *st_ops, u32 moff)
>>    1044  {
>>> 1045          void *func_ptr = *(void **)(&st_ops->cfi_stubs[moff]);
> 
> The compiler warning can be fixed with:
> void *func_ptr = *(void **)(st_ops->cfi_stubs + moff);
> 
> The patch looks good to me. I tested it with bpf qdisc, and it does
> what it is supposed to do by prohibiting users to attach to an
> operator whose cfi stub is not defined.

Thanks for testing. I just tried gcc and can repro it. I will respin.


  reply	other threads:[~2024-07-22 17:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-20  6:22 [PATCH bpf-next 0/3] bpf: Retire the unsupported_ops usage in struct_ops Martin KaFai Lau
2024-07-20  6:22 ` [PATCH bpf-next 1/3] bpf: Check unsupported ops from the bpf_struct_ops's cfi_stubs Martin KaFai Lau
2024-07-20 14:45   ` kernel test robot
2024-07-21 22:45     ` Amery Hung
2024-07-22 17:34       ` Martin KaFai Lau [this message]
2024-07-20  6:22 ` [PATCH bpf-next 2/3] selftests/bpf: Fix the missing tramp_1 to tramp_40 ops in cfi_stubs Martin KaFai Lau
2024-07-20  6:22 ` [PATCH bpf-next 3/3] selftests/bpf: Ensure the unsupported struct_ops prog cannot be loaded Martin KaFai Lau
2024-07-20  6:43 ` [PATCH bpf-next 0/3] bpf: Retire the unsupported_ops usage in struct_ops bot+bpf-ci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15f7db68-e1b1-4ce5-8855-735fc5aae718@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox