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] [thread-next>] [day] [month] [year] [list]
Message-ID: <202409062123.F3r9hB9z-lkp@intel.com>
Date: Fri, 6 Sep 2024 22:21:24 +0800
From: kernel test robot <lkp@...el.com>
To: Uros Bizjak <ubizjak@...il.com>, linux-kernel@...r.kernel.org
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	Uros Bizjak <ubizjak@...il.com>, Theodore Ts'o <tytso@....edu>,
	"Jason A. Donenfeld" <Jason@...c4.com>
Subject: Re: [PATCH 17/18] random: Do not include <linux/prandom.h>

Hi Uros,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on mtd/mtd/next mtd/mtd/fixes linus/master v6.11-rc6 next-20240906]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Uros-Bizjak/x86-kaslr-Include-linux-prandom-h-instead-of-linux-random-h/20240905-202710
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/20240905122020.872466-18-ubizjak%40gmail.com
patch subject: [PATCH 17/18] random: Do not include <linux/prandom.h>
config: um-randconfig-002-20240906 (https://download.01.org/0day-ci/archive/20240906/202409062123.F3r9hB9z-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 05f5a91d00b02f4369f46d076411c700755ae041)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240906/202409062123.F3r9hB9z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409062123.F3r9hB9z-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from crypto/testmgr.c:27:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2228:
   include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     517 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   In file included from crypto/testmgr.c:27:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     548 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     561 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from crypto/testmgr.c:27:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     574 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from crypto/testmgr.c:27:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     585 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     595 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     605 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     693 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     701 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     709 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     718 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     727 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     736 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
>> crypto/testmgr.c:881:42: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     881 | static inline void init_rnd_state(struct rnd_state *rng)
         |                                          ^
>> crypto/testmgr.c:883:2: error: call to undeclared function 'prandom_seed_state'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     883 |         prandom_seed_state(rng, get_random_u64());
         |         ^
   crypto/testmgr.c:886:36: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     886 | static inline u8 prandom_u8(struct rnd_state *rng)
         |                                    ^
>> crypto/testmgr.c:888:9: error: call to undeclared function 'prandom_u32_state'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     888 |         return prandom_u32_state(rng);
         |                ^
   crypto/testmgr.c:891:44: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                            ^
   crypto/testmgr.c:897:9: error: call to undeclared function 'prandom_u32_state'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     897 |         return prandom_u32_state(rng) % ceil;
         |                ^
   crypto/testmgr.c:900:40: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     900 | static inline bool prandom_bool(struct rnd_state *rng)
         |                                        ^
>> crypto/testmgr.c:902:27: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     902 |         return prandom_u32_below(rng, 2);
         |                                  ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:905:48: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     905 | static inline u32 prandom_u32_inclusive(struct rnd_state *rng,
         |                                                ^
   crypto/testmgr.c:908:35: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     908 |         return floor + prandom_u32_below(rng, ceil - floor + 1);
         |                                          ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:912:51: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     912 | static unsigned int generate_random_length(struct rnd_state *rng,
         |                                                   ^
   crypto/testmgr.c:915:39: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     915 |         unsigned int len = prandom_u32_below(rng, max_len + 1);
         |                                              ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:917:28: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     917 |         switch (prandom_u32_below(rng, 4)) {
         |                                   ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:930:31: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     930 |         if (len && prandom_u32_below(rng, 4) == 0)
         |                                      ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:936:36: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     936 | static void flip_random_bit(struct rnd_state *rng, u8 *buf, size_t size)
         |                                    ^
   crypto/testmgr.c:940:29: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     940 |         bitpos = prandom_u32_below(rng, size * 8);
         |                                    ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:945:37: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     945 | static void flip_random_byte(struct rnd_state *rng, u8 *buf, size_t size)
         |                                     ^
   crypto/testmgr.c:947:24: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     947 |         buf[prandom_u32_below(rng, size)] ^= 0xff;
         |                               ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:951:34: warning: declaration of 'struct rnd_state' will not be visible outside of this function [-Wvisibility]
     951 | static void mutate_buffer(struct rnd_state *rng, u8 *buf, size_t size)
         |                                  ^
   crypto/testmgr.c:957:24: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     957 |         if (prandom_u32_below(rng, 4) == 0) {
         |                               ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:958:52: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     958 |                 num_flips = min_t(size_t, 1 << prandom_u32_below(rng, 8),
         |                                                                  ^~~
   include/linux/minmax.h:213:49: note: expanded from macro 'min_t'
     213 | #define min_t(type, x, y) __cmp_once(min, type, x, y)
         |                                                 ^
   include/linux/minmax.h:96:30: note: expanded from macro '__cmp_once'
      96 |         __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
         |                                     ^
   include/linux/minmax.h:93:16: note: expanded from macro '__cmp_once_unique'
      93 |         ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })
         |                       ^
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:961:20: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     961 |                         flip_random_bit(rng, buf, size);
         |                                         ^~~
   crypto/testmgr.c:936:47: note: passing argument to parameter 'rng' here
     936 | static void flip_random_bit(struct rnd_state *rng, u8 *buf, size_t size)
         |                                               ^
   crypto/testmgr.c:965:24: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     965 |         if (prandom_u32_below(rng, 4) == 0) {
         |                               ^~~
   crypto/testmgr.c:891:55: note: passing argument to parameter 'rng' here
     891 | static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
         |                                                       ^
   crypto/testmgr.c:966:52: error: incompatible pointer types passing 'struct rnd_state *' to parameter of type 'struct rnd_state *' [-Werror,-Wincompatible-pointer-types]
     966 |                 num_flips = min_t(size_t, 1 << prandom_u32_below(rng, 8), size);
         |                                                                  ^~~
   include/linux/minmax.h:213:49: note: expanded from macro 'min_t'
     213 | #define min_t(type, x, y) __cmp_once(min, type, x, y)
         |                                                 ^
   include/linux/minmax.h:96:30: note: expanded from macro '__cmp_once'
      96 |         __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
         |                                     ^
   include/linux/minmax.h:93:16: note: expanded from macro '__cmp_once_unique'
      93 |         ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })


vim +/prandom_seed_state +883 crypto/testmgr.c

f2bb770ae89641 Eric Biggers 2019-04-11  873  
f900fde2888360 Eric Biggers 2023-02-27  874  /*
f900fde2888360 Eric Biggers 2023-02-27  875   * The fuzz tests use prandom instead of the normal Linux RNG since they don't
f900fde2888360 Eric Biggers 2023-02-27  876   * need cryptographically secure random numbers.  This greatly improves the
f900fde2888360 Eric Biggers 2023-02-27  877   * performance of these tests, especially if they are run before the Linux RNG
f900fde2888360 Eric Biggers 2023-02-27  878   * has been initialized or if they are run on a lockdep-enabled kernel.
f900fde2888360 Eric Biggers 2023-02-27  879   */
f900fde2888360 Eric Biggers 2023-02-27  880  
f900fde2888360 Eric Biggers 2023-02-27 @881  static inline void init_rnd_state(struct rnd_state *rng)
f900fde2888360 Eric Biggers 2023-02-27  882  {
f900fde2888360 Eric Biggers 2023-02-27 @883  	prandom_seed_state(rng, get_random_u64());
f900fde2888360 Eric Biggers 2023-02-27  884  }
f900fde2888360 Eric Biggers 2023-02-27  885  
f900fde2888360 Eric Biggers 2023-02-27  886  static inline u8 prandom_u8(struct rnd_state *rng)
f900fde2888360 Eric Biggers 2023-02-27  887  {
f900fde2888360 Eric Biggers 2023-02-27 @888  	return prandom_u32_state(rng);
f900fde2888360 Eric Biggers 2023-02-27  889  }
f900fde2888360 Eric Biggers 2023-02-27  890  
f900fde2888360 Eric Biggers 2023-02-27 @891  static inline u32 prandom_u32_below(struct rnd_state *rng, u32 ceil)
f900fde2888360 Eric Biggers 2023-02-27  892  {
f900fde2888360 Eric Biggers 2023-02-27  893  	/*
f900fde2888360 Eric Biggers 2023-02-27  894  	 * This is slightly biased for non-power-of-2 values of 'ceil', but this
f900fde2888360 Eric Biggers 2023-02-27  895  	 * isn't important here.
f900fde2888360 Eric Biggers 2023-02-27  896  	 */
f900fde2888360 Eric Biggers 2023-02-27  897  	return prandom_u32_state(rng) % ceil;
f900fde2888360 Eric Biggers 2023-02-27  898  }
f900fde2888360 Eric Biggers 2023-02-27  899  
f900fde2888360 Eric Biggers 2023-02-27  900  static inline bool prandom_bool(struct rnd_state *rng)
f900fde2888360 Eric Biggers 2023-02-27  901  {
f900fde2888360 Eric Biggers 2023-02-27 @902  	return prandom_u32_below(rng, 2);
f900fde2888360 Eric Biggers 2023-02-27  903  }
f900fde2888360 Eric Biggers 2023-02-27  904  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ