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>] [day] [month] [year] [list]
Date:   Sun, 25 Sep 2022 05:30:28 +0800
From:   kernel test robot <lkp@...el.com>
To:     John Johansen <john.johansen@...onical.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [jj-apparmor:apparmor-next 30/41]
 security/apparmor/policy_unpack.c:489:12: warning: result of comparison of
 constant 16777216 with expression of type 'u16' (aka 'unsigned short') is
 always false

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next
head:   97b7371922d82e5841281d3f8575243a55f8f0bd
commit: 995a5b64620e24e689a2014af46fa98d62fb2045 [30/41] apparmor: make unpack_array return a trianary value
config: s390-randconfig-c005-20220923
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git/commit/?id=995a5b64620e24e689a2014af46fa98d62fb2045
        git remote add jj-apparmor https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git
        git fetch --no-tags jj-apparmor apparmor-next
        git checkout 995a5b64620e24e689a2014af46fa98d62fb2045
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash security/apparmor/

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

All warnings (new ones prefixed by >>):

   In file included from security/apparmor/policy_unpack.c:22:
   In file included from security/apparmor/include/audit.h:16:
   In file included from include/linux/lsm_audit.h:24:
   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:547: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:560: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:37: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 security/apparmor/policy_unpack.c:22:
   In file included from security/apparmor/include/audit.h:16:
   In file included from include/linux/lsm_audit.h:24:
   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:573: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:35: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 security/apparmor/policy_unpack.c:22:
   In file included from security/apparmor/include/audit.h:16:
   In file included from include/linux/lsm_audit.h:24:
   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:584: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:594: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:604: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:692: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:700: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:708: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:717: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:726: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:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> security/apparmor/policy_unpack.c:489:12: warning: result of comparison of constant 16777216 with expression of type 'u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
                       size > (1 << 24))
                       ~~~~ ^ ~~~~~~~~~
   13 warnings generated.


vim +489 security/apparmor/policy_unpack.c

   470	
   471	/**
   472	 * unpack_trans_table - unpack a profile transition table
   473	 * @e: serialized data extent information  (NOT NULL)
   474	 * @table: str table to unpack to (NOT NULL)
   475	 *
   476	 * Returns: true if table successfully unpacked or not present
   477	 */
   478	static bool unpack_trans_table(struct aa_ext *e, struct aa_str_table *strs)
   479	{
   480		void *saved_pos = e->pos;
   481		char **table;
   482	
   483		/* exec table is optional */
   484		if (unpack_nameX(e, AA_STRUCT, "xtable")) {
   485			u16 size;
   486			int i;
   487	
   488			if (unpack_array(e, NULL, &size) != TRI_TRUE ||
 > 489			    size > (1 << 24))
   490			  /* currently 2^24 bits entries 0-3 */
   491				goto fail;
   492			table = kcalloc(size, sizeof(char *), GFP_KERNEL);
   493			if (!table)
   494				goto fail;
   495	
   496			for (i = 0; i < size; i++) {
   497				char *str;
   498				int c, j, pos, size2 = unpack_strdup(e, &str, NULL);
   499				/* unpack_strdup verifies that the last character is
   500				 * null termination byte.
   501				 */
   502				if (!size2)
   503					goto fail;
   504				table[i] = str;
   505				/* verify that name doesn't start with space */
   506				if (isspace(*str))
   507					goto fail;
   508	
   509				/* count internal #  of internal \0 */
   510				for (c = j = 0; j < size2 - 1; j++) {
   511					if (!str[j]) {
   512						pos = j;
   513						c++;
   514					}
   515				}
   516				if (*str == ':') {
   517					/* first character after : must be valid */
   518					if (!str[1])
   519						goto fail;
   520					/* beginning with : requires an embedded \0,
   521					 * verify that exactly 1 internal \0 exists
   522					 * trailing \0 already verified by unpack_strdup
   523					 *
   524					 * convert \0 back to : for label_parse
   525					 */
   526					if (c == 1)
   527						str[pos] = ':';
   528					else if (c > 1)
   529						goto fail;
   530				} else if (c)
   531					/* fail - all other cases with embedded \0 */
   532					goto fail;
   533			}
   534			if (!unpack_nameX(e, AA_ARRAYEND, NULL))
   535				goto fail;
   536			if (!unpack_nameX(e, AA_STRUCTEND, NULL))
   537				goto fail;
   538	
   539			strs->table = table;
   540			strs->size = size;
   541		}
   542		return true;
   543	
   544	fail:
   545		kfree_sensitive(table);
   546		e->pos = saved_pos;
   547		return false;
   548	}
   549	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (150022 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ