linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Nick Alcock <nick.alcock@oracle.com>,
	jeyu@kernel.org, masahiroy@kernel.org
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	arnd@arndb.de
Subject: Re: [PATCH 6/7] kallsyms: add /proc/kallmodsyms
Date: Sat, 10 Jul 2021 11:39:39 +0800	[thread overview]
Message-ID: <202107101140.egiOSCAE-lkp@intel.com> (raw)
In-Reply-To: <20210709222523.17639-7-nick.alcock@oracle.com>

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

Hi Nick,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kbuild/for-next]
[also build test WARNING on linus/master v5.13]
[cannot apply to kbuild/kconfig next-20210709]
[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/Nick-Alcock/kbuild-bring-back-tristate-conf/20210710-072558
base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
config: s390-randconfig-r012-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
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 s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/0day-ci/linux/commit/af04f89ab6ea4f6ffbd83ee71afe1e8a0df26ee1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nick-Alcock/kbuild-bring-back-tristate-conf/20210710-072558
        git checkout af04f89ab6ea4f6ffbd83ee71afe1e8a0df26ee1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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 >>):

   In file included from kernel/kallsyms.c:25:
   In file included from include/linux/filter.h:13:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from kernel/kallsyms.c:25:
   In file included from include/linux/filter.h:13:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from kernel/kallsyms.c:25:
   In file included from include/linux/filter.h:13:
   In file included from include/linux/skbuff.h:31:
   In file included from include/linux/dma-mapping.h:10:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:75:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   kernel/kallsyms.c:581:12: warning: no previous prototype for function 'arch_get_kallsym' [-Wmissing-prototypes]
   int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value,
              ^
   kernel/kallsyms.c:581:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value,
   ^
   static 
>> kernel/kallsyms.c:688:7: warning: variable 'mod_idx' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (kallsyms_module_offsets)
                       ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/kallsyms.c:708:35: note: uninitialized use occurs here
                   iter->hint_builtin_module_idx = mod_idx;
                                                   ^~~~~~~
   kernel/kallsyms.c:688:3: note: remove the 'if' if its condition is always true
                   if (kallsyms_module_offsets)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/kallsyms.c:675:23: note: initialize the variable 'mod_idx' to silence this warning
           unsigned long mod_idx;
                                ^
                                 = 0
   14 warnings generated.


vim +688 kernel/kallsyms.c

   580	
 > 581	int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value,
   582				    char *type, char *name)
   583	{
   584		return -EINVAL;
   585	}
   586	
   587	static int get_ksymbol_arch(struct kallsym_iter *iter)
   588	{
   589		int ret = arch_get_kallsym(iter->pos - kallsyms_num_syms,
   590					   &iter->value, &iter->type,
   591					   iter->name);
   592	
   593		if (ret < 0) {
   594			iter->pos_arch_end = iter->pos;
   595			return 0;
   596		}
   597	
   598		return 1;
   599	}
   600	
   601	static int get_ksymbol_mod(struct kallsym_iter *iter)
   602	{
   603		int ret = module_get_kallsym(iter->pos - iter->pos_arch_end,
   604					     &iter->value, &iter->type,
   605					     iter->name, iter->module_name,
   606					     &iter->exported);
   607		iter->builtin_module_names = NULL;
   608	
   609		if (ret < 0) {
   610			iter->pos_mod_end = iter->pos;
   611			return 0;
   612		}
   613	
   614		return 1;
   615	}
   616	
   617	/*
   618	 * ftrace_mod_get_kallsym() may also get symbols for pages allocated for ftrace
   619	 * purposes. In that case "__builtin__ftrace" is used as a module name, even
   620	 * though "__builtin__ftrace" is not a module.
   621	 */
   622	static int get_ksymbol_ftrace_mod(struct kallsym_iter *iter)
   623	{
   624		int ret = ftrace_mod_get_kallsym(iter->pos - iter->pos_mod_end,
   625						 &iter->value, &iter->type,
   626						 iter->name, iter->module_name,
   627						 &iter->exported);
   628		iter->builtin_module_names = NULL;
   629	
   630		if (ret < 0) {
   631			iter->pos_ftrace_mod_end = iter->pos;
   632			return 0;
   633		}
   634	
   635		return 1;
   636	}
   637	
   638	static int get_ksymbol_bpf(struct kallsym_iter *iter)
   639	{
   640		int ret;
   641	
   642		strlcpy(iter->module_name, "bpf", MODULE_NAME_LEN);
   643		iter->exported = 0;
   644		iter->builtin_module_names = NULL;
   645		ret = bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end,
   646				      &iter->value, &iter->type,
   647				      iter->name);
   648		if (ret < 0) {
   649			iter->pos_bpf_end = iter->pos;
   650			return 0;
   651		}
   652	
   653		return 1;
   654	}
   655	
   656	/*
   657	 * This uses "__builtin__kprobes" as a module name for symbols for pages
   658	 * allocated for kprobes' purposes, even though "__builtin__kprobes" is not a
   659	 * module.
   660	 */
   661	static int get_ksymbol_kprobe(struct kallsym_iter *iter)
   662	{
   663		strlcpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN);
   664		iter->exported = 0;
   665		iter->builtin_module_names = NULL;
   666		return kprobe_get_kallsym(iter->pos - iter->pos_bpf_end,
   667					  &iter->value, &iter->type,
   668					  iter->name) < 0 ? 0 : 1;
   669	}
   670	
   671	/* Returns space to next name. */
   672	static unsigned long get_ksymbol_core(struct kallsym_iter *iter, int kallmodsyms)
   673	{
   674		unsigned off = iter->nameoff;
   675		unsigned long mod_idx;
   676	
   677		iter->exported = 0;
   678		iter->value = kallsyms_sym_address(iter->pos);
   679	
   680		iter->type = kallsyms_get_symbol_type(off);
   681	
   682		iter->module_name[0] = '\0';
   683		iter->builtin_module_names = NULL;
   684	
   685		off = kallsyms_expand_symbol(off, iter->name, ARRAY_SIZE(iter->name));
   686	#ifdef CONFIG_KALLMODSYMS
   687		if (kallmodsyms) {
 > 688			if (kallsyms_module_offsets)
   689				mod_idx =
   690				  get_builtin_module_idx(iter->value,
   691							 iter->hint_builtin_module_idx);
   692	
   693			/*
   694			 * This is a built-in module iff the tables of built-in modules
   695			 * (address->module name mappings) and module names are known,
   696			 * and if the address was found there, and if the corresponding
   697			 * module index is nonzero.  All other cases mean off the end of
   698			 * the binary or in a non-modular range in between one or more
   699			 * modules.  (Also guard against a corrupt kallsyms_objfiles
   700			 * array pointing off the end of kallsyms_modules.)
   701			 */
   702			if (kallsyms_modules != NULL && kallsyms_module_names != NULL &&
   703			    mod_idx != (unsigned long) -1 &&
   704			    kallsyms_modules[mod_idx] != 0 &&
   705			    kallsyms_modules[mod_idx] < kallsyms_module_names_len)
   706				iter->builtin_module_names =
   707				  &kallsyms_module_names[kallsyms_modules[mod_idx]];
   708			iter->hint_builtin_module_idx = mod_idx;
   709		}
   710	#endif
   711		return off - iter->nameoff;
   712	}
   713	

---
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: 11431 bytes --]

  reply	other threads:[~2021-07-10  4:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 22:25 [PATCH v3] kallsyms: new /proc/kallmodsyms with builtin modules Nick Alcock
2021-07-09 22:25 ` [PATCH 1/7] kbuild: bring back tristate.conf Nick Alcock
2021-07-09 22:25 ` [PATCH 2/7] kbuild: add modules_thick.builtin Nick Alcock
2021-07-09 22:25 ` [PATCH 3/7] kbuild: generate an address ranges map at vmlinux link time Nick Alcock
2021-07-09 22:25 ` [PATCH 4/7] kallsyms: introduce sections needed to map symbols to built-in modules Nick Alcock
2021-07-09 22:25 ` [PATCH 5/7] kallsyms: optimize .kallsyms_modules* Nick Alcock
2021-07-09 22:25 ` [PATCH 6/7] kallsyms: add /proc/kallmodsyms Nick Alcock
2021-07-10  3:39   ` kernel test robot [this message]
2021-07-09 22:25 ` [PATCH RFC 7/7] kallsyms: add reliable symbol size info Nick Alcock

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=202107101140.egiOSCAE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=jeyu@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nick.alcock@oracle.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).