Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1066136ybl; Fri, 16 Aug 2019 08:21:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFN7KssOoZ5K5CI6oOAU0ol0nIucmhyY3v834AdYPm49Ju+5QeuihKW6mTkSjW5Rvoz9tL X-Received: by 2002:a17:90a:fa95:: with SMTP id cu21mr5974390pjb.43.1565968871805; Fri, 16 Aug 2019 08:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565968871; cv=none; d=google.com; s=arc-20160816; b=VhqGi04yUV2oQSZ/fU3WwzIGuZ3KnPPcFE9N0CMzL1TegjVkm2LfOX26U6XlwzF1WY PRZe3ba3dxt+tbTApz+GpYs0qR0FNvpis856od08acm5r23gPTjf/cpbbEWSKzVdLLc5 dyHRuTz2WP7iKbdCX4eFGOuqLHoRB0egX3CU6XCaGYusgg5ACooSweO/RP+AxLAcyGeI 67vtWqISAkfnMridNSTbqQ5A0uOJ2lWeqPCZKIUnOQ6Or+0irF6BvMeMztaQpSkY/I8x qxI+vvzenohQpk3IIdh7kxKXL6WfP3WuGNao+jZPBfGYbq47G4r8yFjQv+wERZe3HhZT qFbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Uq/BinxihOIL92bxz7COo1OH8fndOXzflXkJ66CJ19A=; b=mizp/s1hQ65PkEj2Foc476NvIHg+EmvFBWzWUjQ2I9JeXXQZULjkB1r9h0rqmrHF0f 90mL+eSVJEIXnKWqwQGq8kVRsPGZn0TGiGawEmdyAkAujKd7q4nzdazSFFSIVfEPVyvm GjgBeu/m8Kpg+hsf6BP8RJGKHo6vtawdhoIUgdFtoYUYutv/tvHpwkFgaKUi4KARKyjY 6h1kGQ374/xu6S/N7l+gfp+f3QAejw219SlYbjJB++WeT4FDKqlvUavYWK6goJmn5t9+ 4DHdHdPEa0/8W1j/4f2QXyJHWN4j7WHAl94C5swGtnEcGhRB/AXprjA2it0y/RtWkMIJ ZHng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a18si3967301pgg.28.2019.08.16.08.20.54; Fri, 16 Aug 2019 08:21:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727493AbfHPPUN (ORCPT + 99 others); Fri, 16 Aug 2019 11:20:13 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34398 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727359AbfHPPUN (ORCPT ); Fri, 16 Aug 2019 11:20:13 -0400 Received: by mail-pl1-f193.google.com with SMTP id d3so720158plr.1 for ; Fri, 16 Aug 2019 08:20:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Uq/BinxihOIL92bxz7COo1OH8fndOXzflXkJ66CJ19A=; b=CtO92iiXc5Y6GCMFyP81KJqGtx3cMSHQcnbT4wPnCaWGkHOsjhN1O9X8nQWN/jBsE4 nqFHNrGt94dG5lBLPnsNI572yKNVPgT89rkK/8rhSAipEeZ5CvH/MJO6A3Q9YVqS0mk/ i8DC+ysqgNnB/DRACIdi7wJ9yGNASuop3y53MFE/C14nrOeTzMoAr5oByXeO/u332OAJ GjKAqcCWJhReVLCuCNJbdyGCU/QugUxaadZYCLvLBE069kqCBZyELlAJWcd6uac2owo4 DylXP6CNruV5jAzBdjOPxPZv1f7Yt7584rIenB9imnxQ1N4iQJEz31pp9I+n7T+D45iq ONqQ== X-Gm-Message-State: APjAAAU/+x/X8pk0MPMfvADj1/s2T793JW2eowus2iOqDAkIoShh+Yib JR0PZdcTyZ0TBMZ/Lh3zgQI/3w== X-Received: by 2002:a17:902:7d84:: with SMTP id a4mr9646776plm.90.1565968812494; Fri, 16 Aug 2019 08:20:12 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:3602:86ff:fef6:e86b? ([2601:646:c200:1ef2:3602:86ff:fef6:e86b]) by smtp.googlemail.com with ESMTPSA id h9sm4839072pgk.10.2019.08.16.08.20.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Aug 2019 08:20:11 -0700 (PDT) Subject: Re: [PATCH] x86/CPU/AMD: Clear RDRAND CPUID bit on AMD family 15h/16h To: "Lendacky, Thomas" , "linux-kernel@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-pm@vger.kernel.org" , "x86@kernel.org" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "Rafael J . Wysocki" , Pavel Machek , Chen Yu , Jonathan Corbet , Andrew Cooper References: <776cb5c2d33e7fd0d2893904724c0e52b394f24a.1565817448.git.thomas.lendacky@amd.com> From: Andy Lutomirski Message-ID: <87dacbb4-1733-fd70-1356-7f8d5c69c029@kernel.org> Date: Fri, 16 Aug 2019 08:19:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <776cb5c2d33e7fd0d2893904724c0e52b394f24a.1565817448.git.thomas.lendacky@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/14/19 2:17 PM, Lendacky, Thomas wrote: > From: Tom Lendacky > > There have been reports of RDRAND issues after resuming from suspend on > some AMD family 15h and family 16h systems. This issue stems from BIOS > not performing the proper steps during resume to ensure RDRAND continues > to function properly. Can you or someone from AMD document *precisely* what goes wrong here? The APM is crystal clear: Hardware modifies the CF flag to indicate whether the value returned in the destination register is valid. If CF = 1, the value is valid. If CF = 0, the value is invalid. If BIOS screws up and somehow RDRAND starts failing and returning CF = 0, then I think it's legitimate to call it a BIOS bug. Some degree of documentation would be nice, as would a way for BIOS to indicate to the OS that it does not have this bug. But, from the reports, it sounds like RDRAND starts failing, setting CF = 1, and returning 0xFFFF.... in the destination register. If true, then this is, in my book, a severe CPU bug. Software is supposed to be able to trust that, if RDRAND sets CF = 1, the result is a cryptographically secure random number, even if everything else in the system is actively malicious. On a SEV-ES system, this should be considered a security hole -- even if the hypervisor and BIOS collude, RDRAND in the guest should work as defined by the manual. So, can you clarify what is actually going on? And, if there is an issue where the CPU does not behave as documented in the APM, and AMD issue an erratum? And ideally also fix it in microcode or in a stepping and give an indication that the issue is fixed?