All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 7/9] riscv: bpf: Avoid breaking W^X
Date: Wed, 31 Mar 2021 00:39:29 +0800	[thread overview]
Message-ID: <202103310033.KbPQacrN-lkp@intel.com> (raw)
In-Reply-To: <20210330022521.2a904a8c@xhacker>

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

Hi Jisheng,

I love your patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master linus/master v5.12-rc5]
[cannot apply to next-20210330]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jisheng-Zhang/riscv-improve-self-protection/20210330-023324
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: riscv-randconfig-r026-20210330 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 482283042f795ecc27838a3b2f76b5494991401c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/8291e9d78fc2eb2438c93001ab65dfe1743a97f2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jisheng-Zhang/riscv-improve-self-protection/20210330-023324
        git checkout 8291e9d78fc2eb2438c93001ab65dfe1743a97f2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

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

All errors (new ones prefixed by >>):

>> arch/riscv/net/bpf_jit_core.c:155:26: error: use of undeclared identifier 'header'
                   bpf_jit_binary_lock_ro(header);
                                          ^
   1 error generated.


vim +/header +155 arch/riscv/net/bpf_jit_core.c

    41	
    42	struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
    43	{
    44		bool tmp_blinded = false, extra_pass = false;
    45		struct bpf_prog *tmp, *orig_prog = prog;
    46		int pass = 0, prev_ninsns = 0, i;
    47		struct rv_jit_data *jit_data;
    48		struct rv_jit_context *ctx;
    49		unsigned int image_size = 0;
    50	
    51		if (!prog->jit_requested)
    52			return orig_prog;
    53	
    54		tmp = bpf_jit_blind_constants(prog);
    55		if (IS_ERR(tmp))
    56			return orig_prog;
    57		if (tmp != prog) {
    58			tmp_blinded = true;
    59			prog = tmp;
    60		}
    61	
    62		jit_data = prog->aux->jit_data;
    63		if (!jit_data) {
    64			jit_data = kzalloc(sizeof(*jit_data), GFP_KERNEL);
    65			if (!jit_data) {
    66				prog = orig_prog;
    67				goto out;
    68			}
    69			prog->aux->jit_data = jit_data;
    70		}
    71	
    72		ctx = &jit_data->ctx;
    73	
    74		if (ctx->offset) {
    75			extra_pass = true;
    76			image_size = sizeof(*ctx->insns) * ctx->ninsns;
    77			goto skip_init_ctx;
    78		}
    79	
    80		ctx->prog = prog;
    81		ctx->offset = kcalloc(prog->len, sizeof(int), GFP_KERNEL);
    82		if (!ctx->offset) {
    83			prog = orig_prog;
    84			goto out_offset;
    85		}
    86		for (i = 0; i < prog->len; i++) {
    87			prev_ninsns += 32;
    88			ctx->offset[i] = prev_ninsns;
    89		}
    90	
    91		for (i = 0; i < NR_JIT_ITERATIONS; i++) {
    92			pass++;
    93			ctx->ninsns = 0;
    94			if (build_body(ctx, extra_pass, ctx->offset)) {
    95				prog = orig_prog;
    96				goto out_offset;
    97			}
    98			bpf_jit_build_prologue(ctx);
    99			ctx->epilogue_offset = ctx->ninsns;
   100			bpf_jit_build_epilogue(ctx);
   101	
   102			if (ctx->ninsns == prev_ninsns) {
   103				if (jit_data->header)
   104					break;
   105	
   106				image_size = sizeof(*ctx->insns) * ctx->ninsns;
   107				jit_data->header =
   108					bpf_jit_binary_alloc(image_size,
   109							     &jit_data->image,
   110							     sizeof(u32),
   111							     bpf_fill_ill_insns);
   112				if (!jit_data->header) {
   113					prog = orig_prog;
   114					goto out_offset;
   115				}
   116	
   117				ctx->insns = (u16 *)jit_data->image;
   118				/*
   119				 * Now, when the image is allocated, the image can
   120				 * potentially shrink more (auipc/jalr -> jal).
   121				 */
   122			}
   123			prev_ninsns = ctx->ninsns;
   124		}
   125	
   126		if (i == NR_JIT_ITERATIONS) {
   127			pr_err("bpf-jit: image did not converge in <%d passes!\n", i);
   128			bpf_jit_binary_free(jit_data->header);
   129			prog = orig_prog;
   130			goto out_offset;
   131		}
   132	
   133	skip_init_ctx:
   134		pass++;
   135		ctx->ninsns = 0;
   136	
   137		bpf_jit_build_prologue(ctx);
   138		if (build_body(ctx, extra_pass, NULL)) {
   139			bpf_jit_binary_free(jit_data->header);
   140			prog = orig_prog;
   141			goto out_offset;
   142		}
   143		bpf_jit_build_epilogue(ctx);
   144	
   145		if (bpf_jit_enable > 1)
   146			bpf_jit_dump(prog->len, image_size, pass, ctx->insns);
   147	
   148		prog->bpf_func = (void *)ctx->insns;
   149		prog->jited = 1;
   150		prog->jited_len = image_size;
   151	
   152		bpf_flush_icache(jit_data->header, ctx->insns + ctx->ninsns);
   153	
   154		if (!prog->is_func || extra_pass) {
 > 155			bpf_jit_binary_lock_ro(header);
   156	out_offset:
   157			kfree(ctx->offset);
   158			kfree(jit_data);
   159			prog->aux->jit_data = NULL;
   160		}
   161	out:
   162	
   163		if (tmp_blinded)
   164			bpf_jit_prog_release_other(prog, prog == orig_prog ?
   165						   tmp : orig_prog);
   166		return prog;
   167	}
   168	

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

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

  reply	other threads:[~2021-03-30 16:39 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-29 18:21 [PATCH 0/9] riscv: improve self-protection Jisheng Zhang
2021-03-29 18:21 ` Jisheng Zhang
2021-03-29 18:22 ` [PATCH 1/9] riscv: add __init section marker to some functions Jisheng Zhang
2021-03-29 18:22   ` Jisheng Zhang
2021-03-29 18:22 ` [PATCH 2/9] riscv: Mark some global variables __ro_after_init Jisheng Zhang
2021-03-29 18:22   ` Jisheng Zhang
2021-03-29 18:23 ` [PATCH 3/9] riscv: Constify sys_call_table Jisheng Zhang
2021-03-29 18:23   ` Jisheng Zhang
2021-03-29 18:23 ` [PATCH 4/9] riscv: Constify sbi_ipi_ops Jisheng Zhang
2021-03-29 18:23   ` Jisheng Zhang
2021-03-29 18:24 ` [PATCH 5/9] riscv: kprobes: Implement alloc_insn_page() Jisheng Zhang
2021-03-29 18:24   ` Jisheng Zhang
2021-03-29 18:24 ` [PATCH 6/9] riscv: bpf: Move bpf_jit_alloc_exec() and bpf_jit_free_exec() to core Jisheng Zhang
2021-03-29 18:24   ` Jisheng Zhang
2021-03-29 20:41   ` Luke Nelson
2021-03-29 20:41     ` Luke Nelson
2021-03-29 18:25 ` [PATCH 7/9] riscv: bpf: Avoid breaking W^X Jisheng Zhang
2021-03-29 18:25   ` Jisheng Zhang
2021-03-30 16:39   ` kernel test robot [this message]
2021-06-11 14:10   ` Andreas Schwab
2021-06-11 14:10     ` Andreas Schwab
2021-06-11 16:23     ` Jisheng Zhang
2021-06-11 16:23       ` Jisheng Zhang
2021-06-11 16:41       ` Andreas Schwab
2021-06-11 16:41         ` Andreas Schwab
2021-06-13 17:05         ` Jisheng Zhang
2021-06-13 17:05           ` Jisheng Zhang
2021-06-13 19:50           ` Andreas Schwab
2021-06-13 19:50             ` Andreas Schwab
2021-06-14 16:49             ` [PATCH] riscv: Ensure BPF_JIT_REGION_START aligned with PMD size Jisheng Zhang
2021-06-14 16:49               ` Jisheng Zhang
2021-06-15 12:29               ` Daniel Borkmann
2021-06-15 12:29                 ` Daniel Borkmann
2021-06-15 18:54               ` Alex Ghiti
2021-06-15 18:54                 ` Alex Ghiti
2021-06-16  0:03                 ` Jisheng Zhang
2021-06-16  0:03                   ` Jisheng Zhang
2021-06-17  7:23                   ` Alex Ghiti
2021-06-17  7:23                     ` Alex Ghiti
2021-06-17 17:17                     ` Jisheng Zhang
2021-06-17 17:17                       ` Jisheng Zhang
2021-06-17  7:30                   ` Palmer Dabbelt
2021-06-17  7:30                     ` Palmer Dabbelt
2021-06-17  8:09                     ` Alex Ghiti
2021-06-17  8:09                       ` Alex Ghiti
2021-06-17 14:18                       ` Alex Ghiti
2021-06-17 14:18                         ` Alex Ghiti
2021-06-17 17:27                         ` Jisheng Zhang
2021-06-17 17:27                           ` Jisheng Zhang
2021-06-17 17:46                           ` Jisheng Zhang
2021-06-17 17:46                             ` Jisheng Zhang
2021-06-17 18:10                             ` Jisheng Zhang
2021-06-17 18:10                               ` Jisheng Zhang
2021-06-17 18:15                               ` [PATCH v2] " Jisheng Zhang
2021-06-17 18:15                                 ` Jisheng Zhang
2021-06-18  6:48                                 ` Alex Ghiti
2021-06-18  6:48                                   ` Alex Ghiti
2021-03-29 18:25 ` [PATCH 8/9] riscv: module: Create module allocations without exec permissions Jisheng Zhang
2021-03-29 18:25   ` Jisheng Zhang
2021-03-29 18:26 ` [PATCH 9/9] riscv: Set ARCH_HAS_STRICT_MODULE_RWX if MMU Jisheng Zhang
2021-03-29 18:26   ` Jisheng Zhang
2021-04-23  1:48 ` [PATCH 0/9] riscv: improve self-protection Palmer Dabbelt
2021-04-23  1:48   ` Palmer Dabbelt

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=202103310033.KbPQacrN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.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 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.