public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	martin.lau@kernel.org
Cc: oe-kbuild-all@lists.linux.dev, andrii@kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 3/6] bpf: switch BPF verifier log to be a rotating log by default
Date: Fri, 17 Mar 2023 13:07:21 +0800	[thread overview]
Message-ID: <202303171242.biyrTbVN-lkp@intel.com> (raw)
In-Reply-To: <20230316183013.2882810-4-andrii@kernel.org>

Hi Andrii,

I love your patch! Yet something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Andrii-Nakryiko/bpf-split-off-basic-BPF-verifier-log-into-separate-file/20230317-023431
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20230316183013.2882810-4-andrii%40kernel.org
patch subject: [PATCH bpf-next 3/6] bpf: switch BPF verifier log to be a rotating log by default
config: i386-randconfig-a002-20230313 (https://download.01.org/0day-ci/archive/20230317/202303171242.biyrTbVN-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/f2876fe2427e5bdfbbb27980025b969c93f46c4b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andrii-Nakryiko/bpf-split-off-basic-BPF-verifier-log-into-separate-file/20230317-023431
        git checkout f2876fe2427e5bdfbbb27980025b969c93f46c4b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303171242.biyrTbVN-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: kernel/bpf/log.o: in function `bpf_verifier_vlog':
>> kernel/bpf/log.c:59: undefined reference to `__umoddi3'
>> ld: kernel/bpf/log.c:60: undefined reference to `__umoddi3'
   ld: kernel/bpf/log.o: in function `bpf_vlog_finalize':
   kernel/bpf/log.c:212: undefined reference to `__umoddi3'


vim +59 kernel/bpf/log.c

    17	
    18	void bpf_verifier_vlog(struct bpf_verifier_log *log, const char *fmt,
    19			       va_list args)
    20	{
    21		unsigned int n;
    22	
    23		n = vscnprintf(log->kbuf, BPF_VERIFIER_TMP_LOG_SIZE, fmt, args);
    24	
    25		WARN_ONCE(n >= BPF_VERIFIER_TMP_LOG_SIZE - 1,
    26			  "verifier log line truncated - local buffer too short\n");
    27	
    28		if (log->level == BPF_LOG_KERNEL) {
    29			bool newline = n > 0 && log->kbuf[n - 1] == '\n';
    30	
    31			pr_err("BPF: %s%s", log->kbuf, newline ? "" : "\n");
    32			return;
    33		}
    34	
    35		if (log->level & BPF_LOG_FIXED) {
    36			n = min(log->len_total - bpf_log_used(log) - 1, n);
    37			log->kbuf[n] = '\0';
    38			n += 1;
    39	
    40			if (copy_to_user(log->ubuf + log->end_pos, log->kbuf, n))
    41				goto fail;
    42	
    43			log->end_pos += n - 1; /* don't count terminating '\0' */
    44		} else {
    45			u64 new_end, new_start, cur_pos;
    46			u32 buf_start, buf_end, new_n;
    47	
    48			log->kbuf[n] = '\0';
    49			n += 1;
    50	
    51			new_end = log->end_pos + n;
    52			if (new_end - log->start_pos >= log->len_total)
    53				new_start = new_end - log->len_total;
    54			else
    55				new_start = log->start_pos;
    56			new_n = min(n, log->len_total);
    57			cur_pos = new_end - new_n;
    58	
  > 59			buf_start = cur_pos % log->len_total;
  > 60			buf_end = new_end % log->len_total;
    61			/* new_end and buf_end are exclusive indices, so if buf_end is
    62			 * exactly zero, then it actually points right to the end of
    63			 * ubuf and there is no wrap around
    64			 */
    65			if (buf_end == 0)
    66				buf_end = log->len_total;
    67	
    68			/* if buf_start > buf_end, we wrapped around;
    69			 * if buf_start == buf_end, then we fill ubuf completely; we
    70			 * can't have buf_start == buf_end to mean that there is
    71			 * nothing to write, because we always write at least
    72			 * something, even if terminal '\0'
    73			 */
    74			if (buf_start < buf_end) {
    75				/* message fits within contiguous chunk of ubuf */
    76				if (copy_to_user(log->ubuf + buf_start,
    77						 log->kbuf + n - new_n,
    78						 buf_end - buf_start))
    79					goto fail;
    80			} else {
    81				/* message wraps around the end of ubuf, copy in two chunks */
    82				if (copy_to_user(log->ubuf + buf_start,
    83						 log->kbuf + n - new_n,
    84						 log->len_total - buf_start))
    85					goto fail;
    86				if (copy_to_user(log->ubuf,
    87						 log->kbuf + n - buf_end,
    88						 buf_end))
    89					goto fail;
    90			}
    91	
    92			log->start_pos = new_start;
    93			log->end_pos = new_end - 1; /* don't count terminating '\0' */
    94		}
    95	
    96		return;
    97	fail:
    98		log->ubuf = NULL;
    99	}
   100	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

  parent reply	other threads:[~2023-03-17  5:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 18:30 [PATCH bpf-next 0/6] BPF verifier rotating log Andrii Nakryiko
2023-03-16 18:30 ` [PATCH bpf-next 1/6] bpf: split off basic BPF verifier log into separate file Andrii Nakryiko
2023-03-16 18:30 ` [PATCH bpf-next 2/6] bpf: remove minimum size restrictions on verifier log buffer Andrii Nakryiko
2023-03-16 18:30 ` [PATCH bpf-next 3/6] bpf: switch BPF verifier log to be a rotating log by default Andrii Nakryiko
2023-03-17  3:54   ` Alexei Starovoitov
2023-03-17 16:44     ` Andrii Nakryiko
2023-03-17  5:07   ` kernel test robot [this message]
2023-03-17  6:39   ` kernel test robot
2023-03-17  6:59   ` kernel test robot
2023-03-17 15:05   ` Eduard Zingerman
2023-03-17 16:47     ` Andrii Nakryiko
2023-03-16 18:30 ` [PATCH bpf-next 4/6] libbpf: don't enfore verifier log levels on libbpf side Andrii Nakryiko
2023-03-16 18:30 ` [PATCH bpf-next 5/6] selftests/bpf: add more veristat control over verifier log options Andrii Nakryiko
2023-03-16 18:30 ` [PATCH bpf-next 6/6] selftests/bpf: add fixed vs rotating verifier log tests Andrii Nakryiko
  -- strict thread matches above, loose matches on Subject: below --
2023-03-17 22:03 [PATCH bpf-next 0/6] BPF verifier rotating log Andrii Nakryiko
2023-03-17 22:03 ` [PATCH bpf-next 3/6] bpf: switch BPF verifier log to be a rotating log by default Andrii Nakryiko
2023-03-17 22:05   ` Andrii Nakryiko
2023-03-17 23:02   ` Daniel Borkmann
2023-03-17 23:12     ` Andrii Nakryiko
2023-03-20 16:10       ` Lorenz Bauer
2023-03-20 18:55         ` Andrii Nakryiko
2023-03-21 16:18           ` Lorenz Bauer
2023-03-22 21:27             ` Andrii Nakryiko

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=202303171242.biyrTbVN-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=kernel-team@meta.com \
    --cc=martin.lau@kernel.org \
    --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