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-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1911261903060.2605@hadrien>
Date:   Tue, 26 Nov 2019 19:04:10 +0100 (CET)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Stephan Müller <smueller@...onox.de>
cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-crypto@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        linux-api@...r.kernel.org,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        "Alexander E. Patrakov" <patrakov@...il.com>,
        "Ahmed S. Darwish" <darwish.07@...il.com>,
        "Theodore Y. Ts'o" <tytso@....edu>, Willy Tarreau <w@....eu>,
        Matthew Garrett <mjg59@...f.ucam.org>,
        Vito Caputo <vcaputo@...garu.com>,
        Andreas Dilger <adilger.kernel@...ger.ca>,
        Jan Kara <jack@...e.cz>, Ray Strode <rstrode@...hat.com>,
        William Jon McCann <mccann@....edu>,
        zhangjs <zachary@...shancloud.com>,
        Andy Lutomirski <luto@...nel.org>,
        Florian Weimer <fweimer@...hat.com>,
        Lennart Poettering <mzxreary@...inter.de>,
        Nicolai Stange <nstange@...e.de>,
        "Peter, Matthias" <matthias.peter@....bund.de>,
        Marcelo Henrique Cerri <marcelo.cerri@...onical.com>,
        Roman Drahtmueller <draht@...altsekun.de>,
        Neil Horman <nhorman@...hat.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Arnd Bergmann <arnd@...db.de>, kbuild-all@...ts.01.org
Subject: Re: [PATCH v26 12/12] LRNG - add interface for gathering of raw
 entropy (fwd)

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@...el.com>
To: kbuild@...ts.01.org
Cc: Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH v26 12/12] LRNG - add interface for gathering of raw entropy

In-Reply-To: <3742813.K7GG538zxB@...itron.chronox.de>
References: <3742813.K7GG538zxB@...itron.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@...el.com>
Reported-by: Julia Lawall <julia.lawall@...6.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ