linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: "Stephan Müller" <smueller@chronox.de>, "Arnd Bergmann" <arnd@arndb.de>
Cc: kbuild-all@lists.01.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-crypto@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	linux-api@vger.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Alexander E. Patrakov" <patrakov@gmail.com>,
	"Ahmed S. Darwish" <darwish.07@gmail.com>,
	"Theodore Y. Ts'o" <tytso@mit.edu>, Willy Tarreau <w@1wt.eu>
Subject: Re: [PATCH v34 04/12] LRNG - add switchable DRNG support
Date: Mon, 31 Aug 2020 18:03:10 +0800	[thread overview]
Message-ID: <202008311810.JC5i2WCC%lkp@intel.com> (raw)
In-Reply-To: <2098366.irdbgypaU6@positron.chronox.de>

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

Hi "Stephan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on cryptodev/master crypto/master v5.9-rc3 next-20200828]
[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/20200825-153914
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d162219c655c8cf8003128a13840d6c1e183fb80
config: riscv-allmodconfig (attached as .config)
compiler: riscv64-linux-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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv 

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

All errors (new ones prefixed by >>):

   drivers/char/lrng/lrng_switch.c: In function 'lrng_drng_switch':
>> drivers/char/lrng/lrng_switch.c:20:2: error: variable 'seed' with 'latent_entropy' attribute must not be local
      20 |  u8 seed[LRNG_DRNG_SECURITY_STRENGTH_BYTES] __latent_entropy;
         |  ^~

# https://github.com/0day-ci/linux/commit/b4a65336bab63ba2d7b4be76a1acad8eb6b63daf
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/20200825-153914
git checkout b4a65336bab63ba2d7b4be76a1acad8eb6b63daf
vim +20 drivers/char/lrng/lrng_switch.c

    13	
    14	static int lrng_drng_switch(struct lrng_drng *drng_store,
    15				    const struct lrng_crypto_cb *cb, int node)
    16	{
    17		const struct lrng_crypto_cb *old_cb;
    18		unsigned long flags = 0;
    19		int ret;
  > 20		u8 seed[LRNG_DRNG_SECURITY_STRENGTH_BYTES] __latent_entropy;
    21		void *new_drng = cb->lrng_drng_alloc(LRNG_DRNG_SECURITY_STRENGTH_BYTES);
    22		void *old_drng, *new_hash, *old_hash;
    23		bool sl = false, reset_drng = !lrng_get_available();
    24	
    25		if (IS_ERR(new_drng)) {
    26			pr_warn("could not allocate new DRNG for NUMA node %d (%ld)\n",
    27				node, PTR_ERR(new_drng));
    28			return PTR_ERR(new_drng);
    29		}
    30	
    31		/*
    32		 * The seed potentially used as MAC key is undefined to add some
    33		 * variation. Yet, the security of the MAC does not rely on the key
    34		 * being secret. The key is only there to turn a MAC into a hash.
    35		 * The intention is to allow the specification of CMAC(AES) as "hash"
    36		 * to limit the dependency to AES when using the CTR DRBG.
    37		 */
    38		new_hash = cb->lrng_hash_alloc(seed, sizeof(seed));
    39		if (IS_ERR(new_hash)) {
    40			pr_warn("could not allocate new LRNG pool hash (%ld)\n",
    41				PTR_ERR(new_hash));
    42			cb->lrng_drng_dealloc(new_drng);
    43			return PTR_ERR(new_hash);
    44		}
    45	
    46		lrng_drng_lock(drng_store, &flags);
    47	
    48		/*
    49		 * Pull from existing DRNG to seed new DRNG regardless of seed status
    50		 * of old DRNG -- the entropy state for the DRNG is left unchanged which
    51		 * implies that als the new DRNG is reseeded when deemed necessary. This
    52		 * seeding of the new DRNG shall only ensure that the new DRNG has the
    53		 * same entropy as the old DRNG.
    54		 */
    55		ret = drng_store->crypto_cb->lrng_drng_generate_helper(
    56					drng_store->drng, seed, sizeof(seed));
    57		lrng_drng_unlock(drng_store, &flags);
    58	
    59		if (ret < 0) {
    60			reset_drng = true;
    61			pr_warn("getting random data from DRNG failed for NUMA node %d (%d)\n",
    62				node, ret);
    63		} else {
    64			/* seed new DRNG with data */
    65			ret = cb->lrng_drng_seed_helper(new_drng, seed, ret);
    66			if (ret < 0) {
    67				reset_drng = true;
    68				pr_warn("seeding of new DRNG failed for NUMA node %d (%d)\n",
    69					node, ret);
    70			} else {
    71				pr_debug("seeded new DRNG of NUMA node %d instance from old DRNG instance\n",
    72					 node);
    73			}
    74		}
    75	
    76		mutex_lock(&drng_store->lock);
    77		/*
    78		 * If we switch the DRNG from the initial ChaCha20 DRNG to something
    79		 * else, there is a lock transition from spin lock to mutex (see
    80		 * lrng_drng_is_atomic and how the lock is taken in lrng_drng_lock).
    81		 * Thus, we need to take both locks during the transition phase.
    82		 */
    83		if (lrng_drng_is_atomic(drng_store)) {
    84			spin_lock_irqsave(&drng_store->spin_lock, flags);
    85			sl = true;
    86		} else {
    87			__acquire(&drng_store->spin_lock);
    88		}
    89	
    90		if (reset_drng)
    91			lrng_drng_reset(drng_store);
    92	
    93		old_drng = drng_store->drng;
    94		old_cb = drng_store->crypto_cb;
    95		drng_store->drng = new_drng;
    96		drng_store->crypto_cb = cb;
    97	
    98		old_hash = drng_store->hash;
    99		drng_store->hash = new_hash;
   100		pr_info("Entropy pool read-hash allocated for DRNG for NUMA node %d\n",
   101			node);
   102	
   103		if (sl)
   104			spin_unlock_irqrestore(&drng_store->spin_lock, flags);
   105		else
   106			__release(&drng_store->spin_lock);
   107		mutex_unlock(&drng_store->lock);
   108	
   109		/* ChaCha20 serves as atomic instance left untouched. */
   110		if (old_drng != &chacha20) {
   111			old_cb->lrng_drng_dealloc(old_drng);
   112			old_cb->lrng_hash_dealloc(old_hash);
   113		}
   114	
   115		pr_info("DRNG of NUMA node %d switched\n", node);
   116	
   117		return 0;
   118	}
   119	

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

  reply	other threads:[~2020-08-31 10:49 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20  8:25 [PATCH v32 00/12] /dev/random - a new approach with full SP800-90B compliance Stephan Müller
2020-08-20  8:39 ` [PATCH v32 01/12] Linux Random Number Generator Stephan Müller
2020-08-20 11:46   ` kernel test robot
2020-08-20 12:31     ` Stephan Müller
2020-08-20  8:40 ` [PATCH v32 02/12] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-08-20  8:40 ` [PATCH v32 03/12] LRNG - sysctls and /proc interface Stephan Müller
2020-08-20  8:41 ` [PATCH v32 04/12] LRNG - add switchable DRNG support Stephan Müller
2020-08-20  8:42 ` [PATCH v32 05/12] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-08-20  8:42 ` [PATCH v32 06/12] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-08-20 12:07   ` kernel test robot
2020-08-20 12:27     ` Stephan Müller
2020-08-20  8:43 ` [PATCH v32 07/12] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-08-20 12:32   ` kernel test robot
2020-08-20  8:43 ` [PATCH v32 08/12] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-08-20  8:44 ` [PATCH v32 09/12] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-08-20  8:44 ` [PATCH v32 10/12] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-08-20  8:45 ` [PATCH v32 11/12] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-08-20 12:47   ` kernel test robot
2020-08-20  8:45 ` [PATCH v32 12/12] LRNG - add power-on and runtime self-tests Stephan Müller
2020-08-21  5:37 ` [PATCH v33 00/12] /dev/random - a new approach with full SP800-90B compliance 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-22  4:49       ` Stephan Müller
2020-08-22  3:34     ` kernel test robot
2020-08-26 14:27     ` kernel test robot
2020-08-26 14:22       ` Stephan Mueller
2020-08-21  5:39   ` [PATCH v33 02/12] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-08-21  5:39   ` [PATCH v33 03/12] LRNG - sysctls and /proc interface Stephan Müller
2020-08-23  7:10     ` kernel test robot
2020-08-21  5:40   ` [PATCH v33 04/12] LRNG - add switchable DRNG support Stephan Müller
2020-08-21  5:40   ` [PATCH v33 05/12] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-08-21  5:41   ` [PATCH v33 06/12] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-08-21  5:42   ` [PATCH v33 07/12] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-08-21  5:42   ` [PATCH v33 08/12] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-08-21  5:42   ` [PATCH v33 09/12] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-08-21  5:43   ` [PATCH v33 10/12] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-08-21  5:43   ` [PATCH v33 11/12] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-08-21  5:44   ` [PATCH v33 12/12] LRNG - add power-on and runtime self-tests Stephan Müller
2020-08-23 14:50     ` kernel test robot
2020-08-25  7:21   ` [PATCH v34 00/12] /dev/random - a new approach with full SP800-90B compliance Stephan Müller
2020-08-25  7:22     ` [PATCH v34 01/12] Linux Random Number Generator Stephan Müller
2020-08-25 11:28       ` kernel test robot
2020-08-25 11:51         ` Stephan Mueller
2020-08-31  9:24       ` kernel test robot
2020-08-25  7:23     ` [PATCH v34 02/12] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-08-25  7:23     ` [PATCH v34 03/12] LRNG - sysctls and /proc interface Stephan Müller
2020-08-25  7:24     ` [PATCH v34 04/12] LRNG - add switchable DRNG support Stephan Müller
2020-08-31 10:03       ` kernel test robot [this message]
2020-08-25  7:24     ` [PATCH v34 05/12] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-08-25  7:25     ` [PATCH v34 06/12] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-08-25  7:25     ` [PATCH v34 07/12] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-08-25  7:26     ` [PATCH v34 08/12] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-08-25  7:26     ` [PATCH v34 09/12] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-08-25  7:27     ` [PATCH v34 10/12] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-08-25  7:27     ` [PATCH v34 11/12] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-08-25  7:27     ` [PATCH v34 12/12] LRNG - add power-on and runtime self-tests Stephan Müller
2020-09-18  9:47   ` [PATCH v35 00/13] /dev/random - a new approach Stephan Müller
2020-09-18  9:48     ` [PATCH v35 01/13] Linux Random Number Generator Stephan Müller
2020-09-18 13:02       ` kernel test robot
2020-09-20 16:49         ` Stephan Mueller
2020-09-18  9:48     ` [PATCH v35 02/13] LRNG - allocate one DRNG instance per NUMA node Stephan Müller
2020-09-18  9:49     ` [PATCH v35 03/13] LRNG - sysctls and /proc interface Stephan Müller
2020-09-18  9:49     ` [PATCH v35 04/13] LRNG - add switchable DRNG support Stephan Müller
2020-09-18  9:49     ` [PATCH v35 05/13] LRNG - add common generic hash support Stephan Müller
2020-09-18  9:50     ` [PATCH v35 06/13] crypto: DRBG - externalize DRBG functions for LRNG Stephan Müller
2020-09-18  9:50     ` [PATCH v35 07/13] LRNG - add SP800-90A DRBG extension Stephan Müller
2020-09-18  9:51     ` [PATCH v35 08/13] LRNG - add kernel crypto API PRNG extension Stephan Müller
2020-09-18  9:51     ` [PATCH v35 09/13] crypto: provide access to a static Jitter RNG state Stephan Müller
2020-09-18  9:51     ` [PATCH v35 10/13] LRNG - add Jitter RNG fast noise source Stephan Müller
2020-09-18  9:52     ` [PATCH v35 11/13] LRNG - add SP800-90B compliant health tests Stephan Müller
2020-09-18  9:53     ` [PATCH v35 12/13] LRNG - add interface for gathering of raw entropy Stephan Müller
2020-09-18  9:53     ` [PATCH v35 13/13] LRNG - add power-on and runtime self-tests Stephan Müller

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=202008311810.JC5i2WCC%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arnd@arndb.de \
    --cc=darwish.07@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patrakov@gmail.com \
    --cc=smueller@chronox.de \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    /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).