Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbbHEKHf (ORCPT ); Wed, 5 Aug 2015 06:07:35 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:34844 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbbHEKHd (ORCPT ); Wed, 5 Aug 2015 06:07:33 -0400 Date: Wed, 5 Aug 2015 12:07:28 +0200 From: Ingo Molnar To: Len Brown Cc: x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Len Brown , Peter Zijlstra Subject: Re: [PATCH 1/1] x86: replace RDRAND forced-reseed with simple sanity check Message-ID: <20150805100728.GA572@gmail.com> References: <001e354e9435443b1720838a111620c4eec12a61.1438356386.git.len.brown@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001e354e9435443b1720838a111620c4eec12a61.1438356386.git.len.brown@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 892 Lines: 34 * Len Brown wrote: > void x86_init_rdrand(struct cpuinfo_x86 *c) > { > #ifdef CONFIG_ARCH_RANDOM > unsigned long tmp; > - int i, count, ok; > + int i; > > if (!cpu_has(c, X86_FEATURE_RDRAND)) > - return; /* Nothing to do */ > + return; > > - for (count = i = 0; i < RESEED_LOOP; i++) { > - ok = rdrand_long(&tmp); > - if (ok) > - count++; > + for (i = 0; i < SANITY_CHECK_LOOPS; i++) { > + if (!rdrand_long(&tmp)) { > + clear_cpu_cap(c, X86_FEATURE_RDRAND); > + return; So here we should emit a printk_once() warning that something's fishy, instead of silently disabling a CPU feature. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/