linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v26 12/12] LRNG - add interface for gathering of raw entropy (fwd)
@ 2019-11-26 18:04 Julia Lawall
  2019-11-26 19:27 ` Stephan Mueller
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2019-11-26 18:04 UTC (permalink / raw)
  To: Stephan Müller
  Cc: Greg Kroah-Hartman, linux-crypto, LKML, linux-api,
	Eric W. Biederman, Alexander E. Patrakov, Ahmed S. Darwish,
	Theodore Y. Ts'o, Willy Tarreau, Matthew Garrett,
	Vito Caputo, Andreas Dilger, Jan Kara, Ray Strode,
	William Jon McCann, zhangjs, Andy Lutomirski, Florian Weimer,
	Lennart Poettering, Nicolai Stange, Peter, Matthias,
	Marcelo Henrique Cerri, Roman Drahtmueller, Neil Horman,
	Randy Dunlap, Arnd Bergmann, kbuild-all

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

Hello,

Should something be done about the lock on line 162?

julia

---------- Forwarded message ----------
Date: Tue, 26 Nov 2019 01:12:49 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@lists.01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: Re: [PATCH v26 12/12] LRNG - add interface for gathering of raw entropy

In-Reply-To: <3742813.K7GG538zxB@positron.chronox.de>
References: <3742813.K7GG538zxB@positron.chronox.de>

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 v5.4 next-20191125]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B/20191125-042152
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git b78cda795ac83333293f1bfa3165572a47e550c2
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>

>> drivers/char/lrng/lrng_testing.c:176:1-7: preceding lock on line 134

# https://github.com/0day-ci/linux/commit/d69edb724ef2677392bfcbaf4fb6750306f8a1f1
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d69edb724ef2677392bfcbaf4fb6750306f8a1f1
vim +176 drivers/char/lrng/lrng_testing.c

d69edb724ef267 Stephan Müller 2019-11-23  125
d69edb724ef267 Stephan Müller 2019-11-23  126  static int lrng_raw_entropy_reader(u8 *outbuf, u32 outbuflen)
d69edb724ef267 Stephan Müller 2019-11-23  127  {
d69edb724ef267 Stephan Müller 2019-11-23  128  	unsigned long flags;
d69edb724ef267 Stephan Müller 2019-11-23  129  	int collected_data = 0;
d69edb724ef267 Stephan Müller 2019-11-23  130
d69edb724ef267 Stephan Müller 2019-11-23  131  	lrng_raw_entropy_init();
d69edb724ef267 Stephan Müller 2019-11-23  132
d69edb724ef267 Stephan Müller 2019-11-23  133  	while (outbuflen) {
d69edb724ef267 Stephan Müller 2019-11-23 @134  		spin_lock_irqsave(&lrng_raw_lock, flags);
d69edb724ef267 Stephan Müller 2019-11-23  135
d69edb724ef267 Stephan Müller 2019-11-23  136  		/* We have no data or reached the writer. */
d69edb724ef267 Stephan Müller 2019-11-23  137  		if (!lrng_rb_writer || (lrng_rb_writer == lrng_rb_reader)) {
d69edb724ef267 Stephan Müller 2019-11-23  138
d69edb724ef267 Stephan Müller 2019-11-23  139  			spin_unlock_irqrestore(&lrng_raw_lock, flags);
d69edb724ef267 Stephan Müller 2019-11-23  140
d69edb724ef267 Stephan Müller 2019-11-23  141  			/*
d69edb724ef267 Stephan Müller 2019-11-23  142  			 * Now we gathered all boot data, enable regular data
d69edb724ef267 Stephan Müller 2019-11-23  143  			 * collection.
d69edb724ef267 Stephan Müller 2019-11-23  144  			 */
d69edb724ef267 Stephan Müller 2019-11-23  145  			if (boot_test) {
d69edb724ef267 Stephan Müller 2019-11-23  146  				boot_test = 0;
d69edb724ef267 Stephan Müller 2019-11-23  147  				goto out;
d69edb724ef267 Stephan Müller 2019-11-23  148  			}
d69edb724ef267 Stephan Müller 2019-11-23  149
d69edb724ef267 Stephan Müller 2019-11-23  150  			wait_event_interruptible(lrng_raw_read_wait,
d69edb724ef267 Stephan Müller 2019-11-23  151  						 lrng_raw_have_data());
d69edb724ef267 Stephan Müller 2019-11-23  152  			if (signal_pending(current)) {
d69edb724ef267 Stephan Müller 2019-11-23  153  				collected_data = -ERESTARTSYS;
d69edb724ef267 Stephan Müller 2019-11-23  154  				goto out;
d69edb724ef267 Stephan Müller 2019-11-23  155  			}
d69edb724ef267 Stephan Müller 2019-11-23  156
d69edb724ef267 Stephan Müller 2019-11-23  157  			continue;
d69edb724ef267 Stephan Müller 2019-11-23  158  		}
d69edb724ef267 Stephan Müller 2019-11-23  159
d69edb724ef267 Stephan Müller 2019-11-23  160  		/* We copy out word-wise */
d69edb724ef267 Stephan Müller 2019-11-23  161  		if (outbuflen < sizeof(u32))
d69edb724ef267 Stephan Müller 2019-11-23  162  			goto out;
d69edb724ef267 Stephan Müller 2019-11-23  163
d69edb724ef267 Stephan Müller 2019-11-23  164  		memcpy(outbuf, &lrng_testing_rb[lrng_rb_reader], sizeof(u32));
d69edb724ef267 Stephan Müller 2019-11-23  165  		lrng_rb_reader++;
d69edb724ef267 Stephan Müller 2019-11-23  166
d69edb724ef267 Stephan Müller 2019-11-23  167  		spin_unlock_irqrestore(&lrng_raw_lock, flags);
d69edb724ef267 Stephan Müller 2019-11-23  168
d69edb724ef267 Stephan Müller 2019-11-23  169  		outbuf += sizeof(u32);
d69edb724ef267 Stephan Müller 2019-11-23  170  		outbuflen -= sizeof(u32);
d69edb724ef267 Stephan Müller 2019-11-23  171  		collected_data += sizeof(u32);
d69edb724ef267 Stephan Müller 2019-11-23  172  	}
d69edb724ef267 Stephan Müller 2019-11-23  173
d69edb724ef267 Stephan Müller 2019-11-23  174  out:
d69edb724ef267 Stephan Müller 2019-11-23  175  	lrng_raw_entropy_fini();
d69edb724ef267 Stephan Müller 2019-11-23 @176  	return collected_data;
d69edb724ef267 Stephan Müller 2019-11-23  177  }
d69edb724ef267 Stephan Müller 2019-11-23  178

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v26 12/12] LRNG - add interface for gathering of raw entropy (fwd)
  2019-11-26 18:04 [PATCH v26 12/12] LRNG - add interface for gathering of raw entropy (fwd) Julia Lawall
@ 2019-11-26 19:27 ` Stephan Mueller
  0 siblings, 0 replies; 2+ messages in thread
From: Stephan Mueller @ 2019-11-26 19:27 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Greg Kroah-Hartman, linux-crypto, LKML, linux-api,
	Eric W. Biederman, Alexander E. Patrakov, Ahmed S. Darwish,
	Theodore Y. Ts'o, Willy Tarreau, Matthew Garrett,
	Vito Caputo, Andreas Dilger, Jan Kara, Ray Strode,
	William Jon McCann, zhangjs, Andy Lutomirski, Florian Weimer,
	Lennart Poettering, Nicolai Stange, Peter, Matthias,
	Marcelo Henrique Cerri, Roman Drahtmueller, Neil Horman,
	Randy Dunlap, Arnd Bergmann, kbuild-all

Am Dienstag, 26. November 2019, 19:04:10 CET schrieb Julia Lawall:

Hi Julia,

> Hello,
> 
> Should something be done about the lock on line 162?

Yes, thank you for the report. There should be an unlock, naturally.

Ciao
Stephan



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-26 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 18:04 [PATCH v26 12/12] LRNG - add interface for gathering of raw entropy (fwd) Julia Lawall
2019-11-26 19:27 ` Stephan Mueller

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