netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: kbuild-all@01.org, Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	Marek Majkowski <marek@cloudflare.com>,
	Lorenz Bauer <lmb@cloudflare.com>,
	Alan Maguire <alan.maguire@oracle.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/5] bpf: Support injecting chain calls into BPF programs on load
Date: Sat, 5 Oct 2019 05:12:32 +0800	[thread overview]
Message-ID: <201910050511.zt2z9hQE%lkp@intel.com> (raw)
In-Reply-To: <157020976144.1824887.10249946730258092768.stgit@alrua-x1>

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

Hi "Toke,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Toke-H-iland-J-rgensen/bpf-Support-injecting-chain-calls-into-BPF-programs-on-load/20191005-035650
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=xtensa 

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

All warnings (new ones prefixed by >>):

   kernel/bpf/verifier.c: In function 'bpf_inject_chain_calls':
>> kernel/bpf/verifier.c:9195:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     call_next[0].imm = (u32)((u64) prog_array);
                              ^
   kernel/bpf/verifier.c:9196:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     call_next[1].imm = ((u64) prog_array) >> 32;
                         ^

vim +9195 kernel/bpf/verifier.c

  9156	
  9157	static int bpf_inject_chain_calls(struct bpf_verifier_env *env)
  9158	{
  9159		struct bpf_prog *prog = env->prog;
  9160		struct bpf_insn *insn = prog->insnsi;
  9161		int i, cnt, delta = 0, ret = -ENOMEM;
  9162		const int insn_cnt = prog->len;
  9163		struct bpf_array *prog_array;
  9164		struct bpf_prog *new_prog;
  9165		size_t array_size;
  9166	
  9167		struct bpf_insn call_next[] = {
  9168			BPF_LD_IMM64(BPF_REG_2, 0),
  9169			/* Save real return value for later */
  9170			BPF_MOV64_REG(BPF_REG_6, BPF_REG_0),
  9171			/* First try tail call with index ret+1 */
  9172			BPF_MOV64_REG(BPF_REG_3, BPF_REG_0),
  9173			BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, 1),
  9174			BPF_RAW_INSN(BPF_JMP | BPF_TAIL_CALL, 0, 0, 0, 0),
  9175			/* If that doesn't work, try with index 0 (wildcard) */
  9176			BPF_MOV64_IMM(BPF_REG_3, 0),
  9177			BPF_RAW_INSN(BPF_JMP | BPF_TAIL_CALL, 0, 0, 0, 0),
  9178			/* Restore saved return value and exit */
  9179			BPF_MOV64_REG(BPF_REG_0, BPF_REG_6),
  9180			BPF_EXIT_INSN()
  9181		};
  9182	
  9183		if (prog->aux->chain_progs)
  9184			return 0;
  9185	
  9186		array_size = sizeof(*prog_array) + BPF_NUM_CHAIN_SLOTS * sizeof(void*);
  9187		prog_array = bpf_map_area_alloc(array_size, NUMA_NO_NODE);
  9188	
  9189		if (!prog_array)
  9190			goto out_err;
  9191	
  9192		prog_array->elem_size = sizeof(void*);
  9193		prog_array->map.max_entries = BPF_NUM_CHAIN_SLOTS;
  9194	
> 9195		call_next[0].imm = (u32)((u64) prog_array);
  9196		call_next[1].imm = ((u64) prog_array) >> 32;
  9197	
  9198		for (i = 0; i < insn_cnt; i++, insn++) {
  9199			if (insn->code != (BPF_JMP | BPF_EXIT))
  9200				continue;
  9201	
  9202			cnt = ARRAY_SIZE(call_next);
  9203	
  9204			new_prog = bpf_patch_insn_data(env, i+delta, call_next, cnt);
  9205			if (!new_prog) {
  9206				goto out_err;
  9207			}
  9208	
  9209			delta    += cnt - 1;
  9210			env->prog = prog = new_prog;
  9211			insn      = new_prog->insnsi + i + delta;
  9212		}
  9213	
  9214		/* If we chain call into other programs, we cannot make any assumptions
  9215		 * since they can be replaced dynamically during runtime.
  9216		 */
  9217		prog->cb_access = 1;
  9218		env->prog->aux->stack_depth = MAX_BPF_STACK;
  9219		env->prog->aux->max_pkt_offset = MAX_PACKET_OFF;
  9220	
  9221		prog->aux->chain_progs = prog_array;
  9222		return 0;
  9223	
  9224	out_err:
  9225		bpf_map_area_free(prog_array);
  9226		return ret;
  9227	}
  9228	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

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

  parent reply	other threads:[~2019-10-04 21:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 17:22 [PATCH bpf-next v2 0/5] xdp: Support multiple programs on a single interface through chain calls Toke Høiland-Jørgensen
2019-10-04 17:22 ` [PATCH bpf-next v2 1/5] bpf: Support injecting chain calls into BPF programs on load Toke Høiland-Jørgensen
2019-10-04 20:51   ` kbuild test robot
2019-10-04 21:12   ` kbuild test robot [this message]
2019-10-04 23:17   ` Jakub Kicinski
2019-10-05 10:29     ` Toke Høiland-Jørgensen
2019-10-06  3:39       ` Jakub Kicinski
2019-10-06 15:52         ` Toke Høiland-Jørgensen
2019-10-05 10:32     ` Toke Høiland-Jørgensen
2019-10-07  0:27   ` Alexei Starovoitov
2019-10-07 10:11     ` Toke Høiland-Jørgensen
2019-10-07 20:22       ` Daniel Borkmann
2019-10-08  9:00         ` Toke Høiland-Jørgensen
2019-10-07 20:45       ` Alexei Starovoitov
2019-10-08  9:02         ` Toke Høiland-Jørgensen
2019-10-04 17:22 ` [PATCH bpf-next v2 2/5] bpf: Add support for setting chain call sequence for programs Toke Høiland-Jørgensen
2019-10-04 23:18   ` Jakub Kicinski
2019-10-05 10:30     ` Toke Høiland-Jørgensen
2019-10-04 17:22 ` [PATCH bpf-next v2 3/5] tools: Update bpf.h header for program chain calls Toke Høiland-Jørgensen
2019-10-04 17:22 ` [PATCH bpf-next v2 4/5] libbpf: Add syscall wrappers for BPF_PROG_CHAIN_* commands Toke Høiland-Jørgensen
2019-10-04 17:22 ` [PATCH bpf-next v2 5/5] selftests: Add tests for XDP chain calls Toke Høiland-Jørgensen

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=201910050511.zt2z9hQE%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alan.maguire@oracle.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=kbuild-all@01.org \
    --cc=lmb@cloudflare.com \
    --cc=marek@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=toke@redhat.com \
    --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 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).