From: kernel test robot <lkp@intel.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, davem@davemloft.net
Cc: kbuild-all@lists.01.org, daniel@iogearbox.net,
john.fastabend@gmail.com, jolsa@kernel.org,
netdev@vger.kernel.org, bpf@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH bpf-next 1/3] bpf: Support for pointers beyond pkt_end.
Date: Thu, 22 Oct 2020 06:07:46 +0800 [thread overview]
Message-ID: <202010220537.8Z5ADZAN-lkp@intel.com> (raw)
In-Reply-To: <20201021182015.39000-2-alexei.starovoitov@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7257 bytes --]
Hi Alexei,
I love your patch! Perhaps something to improve:
[auto build test WARNING on bpf-next/master]
url: https://github.com/0day-ci/linux/commits/Alexei-Starovoitov/bpf-Pointers-beyond-packet-end/20201022-022139
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: i386-randconfig-r026-20201021 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1aa4c81ae1dbbc3b6de7416f0384cde6cc8739b1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexei-Starovoitov/bpf-Pointers-beyond-packet-end/20201022-022139
git checkout 1aa4c81ae1dbbc3b6de7416f0384cde6cc8739b1
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
kernel/bpf/verifier.c: In function 'is_pkt_ptr_branch_taken':
>> kernel/bpf/verifier.c:7029:24: warning: variable 'pkt_end' set but not used [-Wunused-but-set-variable]
7029 | struct bpf_reg_state *pkt_end, *pkt;
| ^~~~~~~
In file included from include/linux/bpf_verifier.h:8,
from kernel/bpf/verifier.c:12:
kernel/bpf/verifier.c: In function 'jit_subprogs':
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'unsigned int (*)(const void *, const struct bpf_insn *)' to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:10793:16: note: in expansion of macro 'BPF_CAST_CALL'
10793 | insn->imm = BPF_CAST_CALL(func[subprog]->bpf_func) -
| ^~~~~~~~~~~~~
kernel/bpf/verifier.c: In function 'fixup_bpf_calls':
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'void * (* const)(struct bpf_map *, void *)' to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:11186:17: note: in expansion of macro 'BPF_CAST_CALL'
11186 | insn->imm = BPF_CAST_CALL(ops->map_lookup_elem) -
| ^~~~~~~~~~~~~
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *, void *, u64)' {aka 'int (* const)(struct bpf_map *, void *, void *, long long unsigned int)'} to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:11190:17: note: in expansion of macro 'BPF_CAST_CALL'
11190 | insn->imm = BPF_CAST_CALL(ops->map_update_elem) -
| ^~~~~~~~~~~~~
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *)' to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:11194:17: note: in expansion of macro 'BPF_CAST_CALL'
11194 | insn->imm = BPF_CAST_CALL(ops->map_delete_elem) -
| ^~~~~~~~~~~~~
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *, u64)' {aka 'int (* const)(struct bpf_map *, void *, long long unsigned int)'} to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:11198:17: note: in expansion of macro 'BPF_CAST_CALL'
11198 | insn->imm = BPF_CAST_CALL(ops->map_push_elem) -
| ^~~~~~~~~~~~~
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *)' to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:11202:17: note: in expansion of macro 'BPF_CAST_CALL'
11202 | insn->imm = BPF_CAST_CALL(ops->map_pop_elem) -
| ^~~~~~~~~~~~~
include/linux/filter.h:345:4: warning: cast between incompatible function types from 'int (* const)(struct bpf_map *, void *)' to 'u64 (*)(u64, u64, u64, u64, u64)' {aka 'long long unsigned int (*)(long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int, long long unsigned int)'} [-Wcast-function-type]
345 | ((u64 (*)(u64, u64, u64, u64, u64))(x))
| ^
kernel/bpf/verifier.c:11206:17: note: in expansion of macro 'BPF_CAST_CALL'
11206 | insn->imm = BPF_CAST_CALL(ops->map_peek_elem) -
| ^~~~~~~~~~~~~
vim +/pkt_end +7029 kernel/bpf/verifier.c
7024
7025 static int is_pkt_ptr_branch_taken(struct bpf_reg_state *dst_reg,
7026 struct bpf_reg_state *src_reg,
7027 u8 opcode)
7028 {
> 7029 struct bpf_reg_state *pkt_end, *pkt;
7030
7031 if (src_reg->type == PTR_TO_PACKET_END) {
7032 pkt_end = src_reg;
7033 pkt = dst_reg;
7034 } else if (dst_reg->type == PTR_TO_PACKET_END) {
7035 pkt_end = dst_reg;
7036 pkt = src_reg;
7037 opcode = flip_opcode(opcode);
7038 } else {
7039 return -1;
7040 }
7041
7042 if (pkt->range >= 0)
7043 return -1;
7044
7045 switch (opcode) {
7046 case BPF_JLE:
7047 /* pkt <= pkt_end */
7048 fallthrough;
7049 case BPF_JGT:
7050 /* pkt > pkt_end */
7051 if (pkt->range == BEYOND_PKT_END)
7052 /* pkt has at last one extra byte beyond pkt_end */
7053 return opcode == BPF_JGT;
7054 break;
7055 case BPF_JLT:
7056 /* pkt < pkt_end */
7057 fallthrough;
7058 case BPF_JGE:
7059 /* pkt >= pkt_end */
7060 if (pkt->range == BEYOND_PKT_END || pkt->range == AT_PKT_END)
7061 return opcode == BPF_JGE;
7062 break;
7063 }
7064 return -1;
7065 }
7066
---
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: 36550 bytes --]
next prev parent reply other threads:[~2020-10-21 22:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-21 18:20 [PATCH bpf-next 0/3] bpf: Pointers beyond packet end Alexei Starovoitov
2020-10-21 18:20 ` [PATCH bpf-next 1/3] bpf: Support for pointers beyond pkt_end Alexei Starovoitov
2020-10-21 22:07 ` kernel test robot [this message]
2020-10-21 18:20 ` [PATCH bpf-next 2/3] selftests/bpf: Add skb_pkt_end test Alexei Starovoitov
2020-10-21 18:20 ` [PATCH bpf-next 3/3] selftests/bpf: Add asm tests for pkt vs pkt_end comparison Alexei Starovoitov
2020-10-22 9:47 ` [PATCH bpf-next 0/3] bpf: Pointers beyond packet end Jiri Olsa
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=202010220537.8Z5ADZAN-lkp@intel.com \
--to=lkp@intel.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).