All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v33 01/12] Linux Random Number Generator
Date: Sun, 23 Aug 2020 09:24:35 +0800	[thread overview]
Message-ID: <202008230905.2ifTYxkZ%lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <7836152.NyiUUSuA9g@positron.chronox.de>
References: <7836152.NyiUUSuA9g@positron.chronox.de>
TO: "Stephan Müller" <smueller@chronox.de>
TO: Arnd Bergmann <arnd@arndb.de>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
CC: linux-crypto(a)vger.kernel.org
CC: LKML <linux-kernel@vger.kernel.org>
CC: linux-api(a)vger.kernel.org
CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: "Alexander E. Patrakov" <patrakov@gmail.com>
CC: "Ahmed S. Darwish" <darwish.07@gmail.com>
CC: "Theodore Y. Ts'o" <tytso@mit.edu>
CC: Willy Tarreau <w@1wt.eu>

Hi "Stephan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on cryptodev/master crypto/master v5.9-rc1 next-20200821]
[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/Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B-compliance/20200821-140523
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d162219c655c8cf8003128a13840d6c1e183fb80
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm64-randconfig-s031-20200821 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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


sparse warnings: (new ones prefixed by >>)

   drivers/char/lrng/lrng_drng.c:381:6: sparse: sparse: symbol 'lrng_reset' was not declared. Should it be static?
>> drivers/char/lrng/lrng_drng.c:81:13: sparse: sparse: context imbalance in 'lrng_drngs_init_cc20' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:113:13: sparse: sparse: context imbalance in 'lrng_drng_inject' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:161:25: sparse: sparse: context imbalance in 'lrng_drng_seed' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:318:33: sparse: sparse: context imbalance in 'lrng_drng_get' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:373:9: sparse: sparse: context imbalance in '_lrng_reset' - different lock contexts for basic block
>> drivers/char/lrng/lrng_drng.c:388:13: sparse: sparse: context imbalance in 'lrng_drng_init_early' - different lock contexts for basic block
--
>> drivers/char/lrng/lrng_chacha20.c:54:47: sparse: sparse: cast to restricted __le32
   drivers/char/lrng/lrng_chacha20.c:58:47: sparse: sparse: cast to restricted __le32
--
>> drivers/char/lrng/lrng_interfaces.c:482:16: sparse: sparse: incorrect type in return expression (different base types) @@     expected unsigned int @@     got restricted __poll_t [assigned] [usertype] mask @@
>> drivers/char/lrng/lrng_interfaces.c:482:16: sparse:     expected unsigned int
>> drivers/char/lrng/lrng_interfaces.c:482:16: sparse:     got restricted __poll_t [assigned] [usertype] mask
>> drivers/char/lrng/lrng_interfaces.c:612:18: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __poll_t ( *poll )( ... ) @@     got unsigned int ( * )( ... ) @@
>> drivers/char/lrng/lrng_interfaces.c:612:18: sparse:     expected restricted __poll_t ( *poll )( ... )
>> drivers/char/lrng/lrng_interfaces.c:612:18: sparse:     got unsigned int ( * )( ... )

# https://github.com/0day-ci/linux/commit/95481f9aadd4408e56c65cd95e47b929224fbc28
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B-compliance/20200821-140523
git checkout 95481f9aadd4408e56c65cd95e47b929224fbc28
vim +/lrng_drngs_init_cc20 +81 drivers/char/lrng/lrng_drng.c

95481f9aadd440 Stephan Müller 2020-08-21   79  
95481f9aadd440 Stephan Müller 2020-08-21   80  /* Initialize the default DRNG during boot */
95481f9aadd440 Stephan Müller 2020-08-21  @81  static void lrng_drngs_init_cc20(void)
95481f9aadd440 Stephan Müller 2020-08-21   82  {
95481f9aadd440 Stephan Müller 2020-08-21   83  	unsigned long flags = 0;
95481f9aadd440 Stephan Müller 2020-08-21   84  
95481f9aadd440 Stephan Müller 2020-08-21   85  	if (lrng_get_available())
95481f9aadd440 Stephan Müller 2020-08-21   86  		return;
95481f9aadd440 Stephan Müller 2020-08-21   87  
95481f9aadd440 Stephan Müller 2020-08-21   88  	lrng_drng_lock(&lrng_drng_init, &flags);
95481f9aadd440 Stephan Müller 2020-08-21   89  	if (lrng_get_available()) {
95481f9aadd440 Stephan Müller 2020-08-21   90  		lrng_drng_unlock(&lrng_drng_init, &flags);
95481f9aadd440 Stephan Müller 2020-08-21   91  		return;
95481f9aadd440 Stephan Müller 2020-08-21   92  	}
95481f9aadd440 Stephan Müller 2020-08-21   93  
95481f9aadd440 Stephan Müller 2020-08-21   94  	lrng_drng_reset(&lrng_drng_init);
95481f9aadd440 Stephan Müller 2020-08-21   95  	lrng_cc20_init_state(&chacha20);
95481f9aadd440 Stephan Müller 2020-08-21   96  	lrng_state_init_seed_work();
95481f9aadd440 Stephan Müller 2020-08-21   97  	lrng_drng_unlock(&lrng_drng_init, &flags);
95481f9aadd440 Stephan Müller 2020-08-21   98  
95481f9aadd440 Stephan Müller 2020-08-21   99  	lrng_drng_lock(&lrng_drng_atomic, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  100  	lrng_drng_reset(&lrng_drng_atomic);
95481f9aadd440 Stephan Müller 2020-08-21  101  	/*
95481f9aadd440 Stephan Müller 2020-08-21  102  	 * We do not initialize the state of the atomic DRNG as it is identical
95481f9aadd440 Stephan Müller 2020-08-21  103  	 * to the DRNG at this point.
95481f9aadd440 Stephan Müller 2020-08-21  104  	 */
95481f9aadd440 Stephan Müller 2020-08-21  105  	lrng_drng_unlock(&lrng_drng_atomic, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  106  
95481f9aadd440 Stephan Müller 2020-08-21  107  	lrng_set_available();
95481f9aadd440 Stephan Müller 2020-08-21  108  }
95481f9aadd440 Stephan Müller 2020-08-21  109  
95481f9aadd440 Stephan Müller 2020-08-21  110  /************************* Random Number Generation ***************************/
95481f9aadd440 Stephan Müller 2020-08-21  111  
95481f9aadd440 Stephan Müller 2020-08-21  112  /* Inject a data buffer into the DRNG */
95481f9aadd440 Stephan Müller 2020-08-21 @113  static void lrng_drng_inject(struct lrng_drng *drng,
95481f9aadd440 Stephan Müller 2020-08-21  114  			     const u8 *inbuf, u32 inbuflen)
95481f9aadd440 Stephan Müller 2020-08-21  115  {
95481f9aadd440 Stephan Müller 2020-08-21  116  	const char *drng_type = unlikely(drng == &lrng_drng_atomic) ?
95481f9aadd440 Stephan Müller 2020-08-21  117  				"atomic" : "regular";
95481f9aadd440 Stephan Müller 2020-08-21  118  	unsigned long flags = 0;
95481f9aadd440 Stephan Müller 2020-08-21  119  
95481f9aadd440 Stephan Müller 2020-08-21  120  	BUILD_BUG_ON(LRNG_DRNG_RESEED_THRESH > INT_MAX);
95481f9aadd440 Stephan Müller 2020-08-21  121  	pr_debug("seeding %s DRNG with %u bytes\n", drng_type, inbuflen);
95481f9aadd440 Stephan Müller 2020-08-21  122  	lrng_drng_lock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  123  	if (drng->crypto_cb->lrng_drng_seed_helper(drng->drng,
95481f9aadd440 Stephan Müller 2020-08-21  124  						    inbuf, inbuflen) < 0) {
95481f9aadd440 Stephan Müller 2020-08-21  125  		pr_warn("seeding of %s DRNG failed\n", drng_type);
95481f9aadd440 Stephan Müller 2020-08-21  126  		atomic_set(&drng->requests, 1);
95481f9aadd440 Stephan Müller 2020-08-21  127  	} else {
95481f9aadd440 Stephan Müller 2020-08-21  128  		pr_debug("%s DRNG stats since last seeding: %lu secs; generate calls: %d\n",
95481f9aadd440 Stephan Müller 2020-08-21  129  			 drng_type,
95481f9aadd440 Stephan Müller 2020-08-21  130  			 (time_after(jiffies, drng->last_seeded) ?
95481f9aadd440 Stephan Müller 2020-08-21  131  			  (jiffies - drng->last_seeded) : 0) / HZ,
95481f9aadd440 Stephan Müller 2020-08-21  132  			 (LRNG_DRNG_RESEED_THRESH -
95481f9aadd440 Stephan Müller 2020-08-21  133  			  atomic_read(&drng->requests)));
95481f9aadd440 Stephan Müller 2020-08-21  134  		drng->last_seeded = jiffies;
95481f9aadd440 Stephan Müller 2020-08-21  135  		atomic_set(&drng->requests, LRNG_DRNG_RESEED_THRESH);
95481f9aadd440 Stephan Müller 2020-08-21  136  		drng->force_reseed = false;
95481f9aadd440 Stephan Müller 2020-08-21  137  
95481f9aadd440 Stephan Müller 2020-08-21  138  		if (drng->drng == lrng_drng_atomic.drng) {
95481f9aadd440 Stephan Müller 2020-08-21  139  			lrng_drng_atomic.last_seeded = jiffies;
95481f9aadd440 Stephan Müller 2020-08-21  140  			atomic_set(&lrng_drng_atomic.requests,
95481f9aadd440 Stephan Müller 2020-08-21  141  				   LRNG_DRNG_RESEED_THRESH);
95481f9aadd440 Stephan Müller 2020-08-21  142  			lrng_drng_atomic.force_reseed = false;
95481f9aadd440 Stephan Müller 2020-08-21  143  		}
95481f9aadd440 Stephan Müller 2020-08-21  144  	}
95481f9aadd440 Stephan Müller 2020-08-21  145  	lrng_drng_unlock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  146  }
95481f9aadd440 Stephan Müller 2020-08-21  147  
95481f9aadd440 Stephan Müller 2020-08-21  148  /*
95481f9aadd440 Stephan Müller 2020-08-21  149   * Perform the seeding of the DRNG with data from noise source
95481f9aadd440 Stephan Müller 2020-08-21  150   */
95481f9aadd440 Stephan Müller 2020-08-21  151  static inline int _lrng_drng_seed(struct lrng_drng *drng)
95481f9aadd440 Stephan Müller 2020-08-21  152  {
95481f9aadd440 Stephan Müller 2020-08-21  153  	struct entropy_buf seedbuf __aligned(LRNG_KCAPI_ALIGN);
95481f9aadd440 Stephan Müller 2020-08-21  154  	unsigned long flags = 0;
95481f9aadd440 Stephan Müller 2020-08-21  155  	u32 total_entropy_bits;
95481f9aadd440 Stephan Müller 2020-08-21  156  	int ret;
95481f9aadd440 Stephan Müller 2020-08-21  157  
95481f9aadd440 Stephan Müller 2020-08-21  158  	lrng_drng_lock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  159  	total_entropy_bits = lrng_fill_seed_buffer(drng->crypto_cb, drng->hash,
95481f9aadd440 Stephan Müller 2020-08-21  160  						   &seedbuf, 0);
95481f9aadd440 Stephan Müller 2020-08-21 @161  	lrng_drng_unlock(drng, &flags);
95481f9aadd440 Stephan Müller 2020-08-21  162  
95481f9aadd440 Stephan Müller 2020-08-21  163  	/* Allow the seeding operation to be called again */
95481f9aadd440 Stephan Müller 2020-08-21  164  	lrng_pool_unlock();
95481f9aadd440 Stephan Müller 2020-08-21  165  	lrng_init_ops(total_entropy_bits);
95481f9aadd440 Stephan Müller 2020-08-21  166  	ret = total_entropy_bits >> 3;
95481f9aadd440 Stephan Müller 2020-08-21  167  
95481f9aadd440 Stephan Müller 2020-08-21  168  	lrng_drng_inject(drng, (u8 *)&seedbuf, sizeof(seedbuf));
95481f9aadd440 Stephan Müller 2020-08-21  169  	memzero_explicit(&seedbuf, sizeof(seedbuf));
95481f9aadd440 Stephan Müller 2020-08-21  170  
95481f9aadd440 Stephan Müller 2020-08-21  171  	return ret;
95481f9aadd440 Stephan Müller 2020-08-21  172  }
95481f9aadd440 Stephan Müller 2020-08-21  173  

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

             reply	other threads:[~2020-08-23  1:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23  1:24 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-08-20  8:25 [PATCH v32 00/12] /dev/random - a new approach with full SP800-90B compliance Stephan Müller
2020-08-21  5:37 ` [PATCH v33 " Stephan Müller
2020-08-21  5:38   ` [PATCH v33 01/12] Linux Random Number Generator Stephan Müller
2020-08-21 19:42     ` kernel test robot
2020-08-21 19:42       ` kernel test robot
2020-08-22  4:49       ` Stephan Müller
2020-08-22  4:49         ` Stephan Müller
2020-08-22  3:34     ` kernel test robot
2020-08-22  3:34       ` kernel test robot
2020-08-26 14:27     ` kernel test robot
2020-08-26 14:27       ` kernel test robot
2020-08-26 14:22       ` Stephan Mueller
2020-08-26 14:22         ` Stephan Mueller

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=202008230905.2ifTYxkZ%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@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.