lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202010011859.bXKkBh70-lkp@intel.com>
Date:   Thu, 1 Oct 2020 18:09:15 +0800
From:   kernel test robot <lkp@...el.com>
To:     Łukasz Stelmach <l.stelmach@...sung.com>,
        Russell King <linux@...linux.org.uk>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Enrico Weigelt <info@...ux.net>,
        Kees Cook <keescook@...omium.org>,
        Ingo Molnar <mingo@...nel.org>,
        Ben Dooks <ben-linux@...ff.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     kbuild-all@...ts.01.org
Subject: Re: [PATCH v3 4/4] arm: kexec_file: load zImage or uImage, initrd
 and dtb

Hi "Łukasz,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20200930]
[cannot apply to arm/for-next v5.9-rc7 v5.9-rc6 v5.9-rc5 v5.9-rc7]
[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/ukasz-Stelmach/kexec_file_load-for-arm/20201001-024045
base:    de69ee6df1cfbf3c67787d8504fd21b59da39572
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
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
        # https://github.com/0day-ci/linux/commit/9a7741b76697140672aba84338463032c1fc9fb8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review ukasz-Stelmach/kexec_file_load-for-arm/20201001-024045
        git checkout 9a7741b76697140672aba84338463032c1fc9fb8
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

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

All warnings (new ones prefixed by >>):

   arch/arm/kernel/kexec_zimage.c: In function 'zimage_load':
>> arch/arm/kernel/kexec_zimage.c:89:28: warning: variable 'h' set but not used [-Wunused-but-set-variable]
      89 |  struct arm_zimage_header *h;
         |                            ^

vim +/h +89 arch/arm/kernel/kexec_zimage.c

    83	
    84	static void *zimage_load(struct kimage *image,
    85					char *zimage, unsigned long zimage_len,
    86					char *initrd, unsigned long initrd_len,
    87					char *cmdline, unsigned long cmdline_len)
    88	{
  > 89		struct arm_zimage_header *h;
    90		struct kexec_buf kbuf;
    91		struct kexec_segment *zimage_segment;
    92		const struct arm_zimage_tag *tag;
    93		int ret = -EINVAL;
    94	
    95		unsigned long zimage_mem = 0x20000; /* malloc 64kB + stack 4 kB + some bss */
    96		unsigned long kernel_len = zimage_len * 5; /* 5:1 compression */
    97		unsigned long kernel_offset = memblock_start_of_DRAM();
    98		unsigned long zimage_offset = kernel_offset +
    99			ALIGN(kernel_len, PAGE_SIZE);
   100		unsigned long initrd_offset = zimage_offset +
   101			ALIGN(zimage_len + zimage_mem, PAGE_SIZE);
   102	
   103		if (image->type == KEXEC_TYPE_CRASH) {
   104			kernel_offset += crashk_res.start;
   105			zimage_offset += crashk_res.start;
   106			initrd_offset += crashk_res.start;
   107		}
   108		debug_offsets();
   109	
   110		h = (struct arm_zimage_header *)zimage;
   111	
   112		tag = find_extension_tag(zimage, zimage_len, ZIMAGE_TAG_KRNL_SIZE);
   113		if (tag) {
   114			uint32_t *p = (void *)zimage +
   115				le32_to_cpu(tag->u.krnl_size.size_ptr);
   116			uint32_t edata_size = le32_to_cpu(get_unaligned(p));
   117			uint32_t bss_size = le32_to_cpu(tag->u.krnl_size.bss_size);
   118			uint32_t text_offset = le32_to_cpu(tag->u.krnl_size.text_offset);
   119	
   120			kernel_offset += ALIGN(text_offset, PAGE_SIZE);
   121			kernel_len = edata_size + bss_size;
   122	
   123			pr_debug("Decompressed kernel sizes:\n");
   124			pr_debug(" text+data 0x%08lx bss 0x%08lx total 0x%08lx\n",
   125				 (unsigned long)edata_size,
   126				 (unsigned long)bss_size,
   127				 (unsigned long)kernel_len);
   128	
   129			zimage_offset = kernel_offset + ALIGN(edata_size, PAGE_SIZE);
   130			initrd_offset = zimage_offset +
   131				max(ALIGN(zimage_len + 0x20000, PAGE_SIZE),
   132				    ALIGN((unsigned long)bss_size, PAGE_SIZE));
   133			debug_offsets();
   134		}
   135	
   136		tag = find_extension_tag(zimage, zimage_len,
   137					 ZIMAGE_TAG_ZIMAGE_MEM);
   138		if (tag) {
   139			uint32_t zimage_mem = le32_to_cpu(tag->u.zimage_mem);
   140	
   141			pr_debug("Decompressor requires %d bytes of memory\n", zimage_mem);
   142	
   143			initrd_offset = max(ALIGN(zimage_offset + zimage_len + zimage_mem, PAGE_SIZE),
   144					    ALIGN(kernel_offset + kernel_len, PAGE_SIZE));
   145			debug_offsets();
   146		}
   147	
   148		/*
   149		 * zImage MUST be loaded into the first 128 MiB of physical
   150		 * memory for proper memory detection. Should the uncompressed
   151		 * kernel be larger than 128 MiB, zImage relocation becomes
   152		 * unavoidable and it is best to rely on the relocation code.
   153		 */
   154		if (((zimage_offset - kernel_offset) + PAGE_SIZE + 0x8000) >= SZ_128M) {
   155			pr_debug("The kernel is too big (%ld MiB) to avoid "
   156				 "zImage relocation. Loading zimage at 0x%08lx\n",
   157				 ((zimage_offset - kernel_offset) >> 20),
   158				 kernel_offset);
   159			zimage_offset = kernel_offset;
   160		}
   161	
   162		kbuf.image = image;
   163		kbuf.top_down = false;
   164	
   165		kbuf.buf_min = zimage_offset;
   166		kbuf.buf_max = ULONG_MAX;
   167		kbuf.buffer = zimage;
   168		kbuf.bufsz = zimage_len;
   169		kbuf.buf_align = PAGE_SIZE;
   170	
   171		kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
   172		kbuf.memsz = zimage_len;
   173	
   174		ret = kexec_add_buffer(&kbuf);
   175		if (ret)
   176			return ERR_PTR(ret);
   177	
   178		pr_debug("Loaded zImage at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
   179			 kbuf.mem, kbuf.bufsz, kbuf.memsz);
   180	
   181		initrd_offset += kbuf.mem - zimage_offset;
   182		debug_offsets();
   183	
   184		zimage_segment = &image->segment[image->nr_segments - 1];
   185		image->start = zimage_segment->mem;
   186	
   187		ret = load_other_segments(image,
   188					  zimage_segment->mem, zimage_segment->memsz,
   189					  initrd, initrd_len, initrd_offset,
   190					  cmdline);
   191		return ERR_PTR(ret);
   192	}
   193	

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

Download attachment ".config.gz" of type "application/gzip" (76676 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ