All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Florent Revest <revest@chromium.org>, bpf@vger.kernel.org
Cc: kbuild-all@lists.01.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, yhs@fb.com, kpsingh@kernel.org,
	jackmanb@chromium.org, linux-kernel@vger.kernel.org,
	Florent Revest <revest@chromium.org>
Subject: Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper
Date: Tue, 13 Apr 2021 03:11:11 +0800	[thread overview]
Message-ID: <202104130355.MHWouEGB-lkp@intel.com> (raw)
In-Reply-To: <20210412153754.235500-4-revest@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 3573 bytes --]

Hi Florent,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Florent-Revest/Add-a-snprintf-eBPF-helper/20210412-233921
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: i386-randconfig-s002-20210412 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-280-g2cd6d34e-dirty
        # https://github.com/0day-ci/linux/commit/168301dda58989eca274d5f5c926675540010e13
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florent-Revest/Add-a-snprintf-eBPF-helper/20210412-233921
        git checkout 168301dda58989eca274d5f5c926675540010e13
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   kernel/bpf/verifier.c:1674:41: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12051:76: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12489:81: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12493:81: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12497:81: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12501:79: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12505:78: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12509:79: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12513:78: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12557:38: sparse: sparse: subtraction of functions? Share your drugs
>> kernel/bpf/verifier.c:5944:23: sparse: sparse: non size-preserving integer to pointer cast

vim +5944 kernel/bpf/verifier.c

  5920	
  5921	static int check_bpf_snprintf_call(struct bpf_verifier_env *env,
  5922					   struct bpf_reg_state *regs)
  5923	{
  5924		struct bpf_reg_state *fmt_reg = &regs[BPF_REG_3];
  5925		struct bpf_reg_state *data_len_reg = &regs[BPF_REG_5];
  5926		struct bpf_map *fmt_map = fmt_reg->map_ptr;
  5927		int err, fmt_map_off, num_args;
  5928		u64 fmt_addr;
  5929		char *fmt;
  5930	
  5931		/* data must be an array of u64 */
  5932		if (data_len_reg->var_off.value % 8)
  5933			return -EINVAL;
  5934		num_args = data_len_reg->var_off.value / 8;
  5935	
  5936		/* fmt being ARG_PTR_TO_CONST_STR guarantees that var_off is const
  5937		 * and map_direct_value_addr is set.
  5938		 */
  5939		fmt_map_off = fmt_reg->off + fmt_reg->var_off.value;
  5940		err = fmt_map->ops->map_direct_value_addr(fmt_map, &fmt_addr,
  5941							  fmt_map_off);
  5942		if (err)
  5943			return err;
> 5944		fmt = (char *)fmt_addr + fmt_map_off;
  5945	
  5946		/* We are also guaranteed that fmt+fmt_map_off is NULL terminated, we
  5947		 * can focus on validating the format specifiers.
  5948		 */
  5949		err = bpf_printf_prepare(fmt, UINT_MAX, NULL, NULL, NULL, num_args);
  5950		if (err < 0)
  5951			verbose(env, "Invalid format string\n");
  5952	
  5953		return err;
  5954	}
  5955	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34661 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper
Date: Tue, 13 Apr 2021 03:11:11 +0800	[thread overview]
Message-ID: <202104130355.MHWouEGB-lkp@intel.com> (raw)
In-Reply-To: <20210412153754.235500-4-revest@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 3652 bytes --]

Hi Florent,

I love your patch! Perhaps something to improve:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Florent-Revest/Add-a-snprintf-eBPF-helper/20210412-233921
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: i386-randconfig-s002-20210412 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-280-g2cd6d34e-dirty
        # https://github.com/0day-ci/linux/commit/168301dda58989eca274d5f5c926675540010e13
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Florent-Revest/Add-a-snprintf-eBPF-helper/20210412-233921
        git checkout 168301dda58989eca274d5f5c926675540010e13
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   kernel/bpf/verifier.c:1674:41: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12051:76: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12489:81: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12493:81: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12497:81: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12501:79: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12505:78: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12509:79: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12513:78: sparse: sparse: subtraction of functions? Share your drugs
   kernel/bpf/verifier.c:12557:38: sparse: sparse: subtraction of functions? Share your drugs
>> kernel/bpf/verifier.c:5944:23: sparse: sparse: non size-preserving integer to pointer cast

vim +5944 kernel/bpf/verifier.c

  5920	
  5921	static int check_bpf_snprintf_call(struct bpf_verifier_env *env,
  5922					   struct bpf_reg_state *regs)
  5923	{
  5924		struct bpf_reg_state *fmt_reg = &regs[BPF_REG_3];
  5925		struct bpf_reg_state *data_len_reg = &regs[BPF_REG_5];
  5926		struct bpf_map *fmt_map = fmt_reg->map_ptr;
  5927		int err, fmt_map_off, num_args;
  5928		u64 fmt_addr;
  5929		char *fmt;
  5930	
  5931		/* data must be an array of u64 */
  5932		if (data_len_reg->var_off.value % 8)
  5933			return -EINVAL;
  5934		num_args = data_len_reg->var_off.value / 8;
  5935	
  5936		/* fmt being ARG_PTR_TO_CONST_STR guarantees that var_off is const
  5937		 * and map_direct_value_addr is set.
  5938		 */
  5939		fmt_map_off = fmt_reg->off + fmt_reg->var_off.value;
  5940		err = fmt_map->ops->map_direct_value_addr(fmt_map, &fmt_addr,
  5941							  fmt_map_off);
  5942		if (err)
  5943			return err;
> 5944		fmt = (char *)fmt_addr + fmt_map_off;
  5945	
  5946		/* We are also guaranteed that fmt+fmt_map_off is NULL terminated, we
  5947		 * can focus on validating the format specifiers.
  5948		 */
  5949		err = bpf_printf_prepare(fmt, UINT_MAX, NULL, NULL, NULL, num_args);
  5950		if (err < 0)
  5951			verbose(env, "Invalid format string\n");
  5952	
  5953		return err;
  5954	}
  5955	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34661 bytes --]

  reply	other threads:[~2021-04-12 19:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 15:37 [PATCH bpf-next v3 0/6] Add a snprintf eBPF helper Florent Revest
2021-04-12 15:37 ` [PATCH bpf-next v3 1/6] bpf: Factorize bpf_trace_printk and bpf_seq_printf Florent Revest
2021-04-13 23:01   ` Andrii Nakryiko
2021-04-14  9:56     ` Florent Revest
2021-04-14 10:56       ` Florent Revest
2021-04-12 15:37 ` [PATCH bpf-next v3 2/6] bpf: Add a ARG_PTR_TO_CONST_STR argument type Florent Revest
2021-04-13 23:03   ` Andrii Nakryiko
2021-04-12 15:37 ` [PATCH bpf-next v3 3/6] bpf: Add a bpf_snprintf helper Florent Revest
2021-04-12 19:11   ` kernel test robot [this message]
2021-04-12 19:11     ` kernel test robot
2021-04-12 20:32   ` kernel test robot
2021-04-12 20:32     ` kernel test robot
2021-04-14 13:32     ` Florent Revest
2021-04-14 13:32       ` Florent Revest
2021-04-12 20:40   ` kernel test robot
2021-04-12 20:40     ` kernel test robot
2021-04-13 23:16   ` Andrii Nakryiko
2021-04-14  9:46     ` Florent Revest
2021-04-14 22:57       ` Andrii Nakryiko
2021-04-15  9:34         ` Florent Revest
2021-04-14 18:02     ` Geert Uytterhoeven
2021-04-14 18:30       ` Florent Revest
2021-04-14 22:58         ` Andrii Nakryiko
2021-04-15  7:18           ` Geert Uytterhoeven
2021-04-12 15:37 ` [PATCH bpf-next v3 4/6] libbpf: Initialize the bpf_seq_printf parameters array field by field Florent Revest
2021-04-13 23:18   ` Andrii Nakryiko
2021-04-12 15:37 ` [PATCH bpf-next v3 5/6] libbpf: Introduce a BPF_SNPRINTF helper macro Florent Revest
2021-04-13 23:18   ` Andrii Nakryiko
2021-04-12 15:37 ` [PATCH bpf-next v3 6/6] selftests/bpf: Add a series of tests for bpf_snprintf Florent Revest
2021-04-13 23:21   ` Andrii Nakryiko
2021-04-14  9:21     ` Florent Revest
2021-04-14 22:16       ` Andrii Nakryiko
2021-04-15  9:38         ` Florent Revest

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=202104130355.MHWouEGB-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jackmanb@chromium.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=revest@chromium.org \
    --cc=yhs@fb.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.