Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4996628rwb; Mon, 31 Jul 2023 16:21:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlF57bLhdtD06j6XGMEgqnCeXpVFYnwj/Hj7+PtoTPeUUUoiA2oYcJKtV8OVWiRsMEpvSHEz X-Received: by 2002:a05:6808:11c9:b0:3a4:2941:b0d4 with SMTP id p9-20020a05680811c900b003a42941b0d4mr11809376oiv.24.1690845689149; Mon, 31 Jul 2023 16:21:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690845689; cv=pass; d=google.com; s=arc-20160816; b=p08FkZ0Qmzu7Kjn8LrPx3ZUsF32V+l9hC3rJ6udeXIH2Njo4tBWusqbLyzrvXQPtDc fFj19c2dFae3wTBHVYpOtF3qsbWCnLNp/vb3Jbz1fUhPnq8ysYE0sroMO92819mco4ur 2itV8WmLdGGe1Z7wsad+JKj5EnP1kJ+oQKb9znHQmKOoGH7DtgHH6jcuycPOV2ZRZ32h D8J/bAQXM/7nYjwKU38fc18+C3Jd+8mASyc07A3cIj0qujTPHK5TxBmueOHnlsFme3BX yHkL3xToe1b38oJqpGwt6UB1hI7yvnrHy799fl64x5nxaeMSNPTG/5s+/66qj/NKYQj0 SOmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=bgzvx0yfOrEF8cRgYaZxnmXTuYIRw1CwP8WyPahWOOY=; fh=3jol88ga/rmLNO3zE5aUJyJPe8OdI4ZQBc8ufxzvsug=; b=bAvZV/z6a/hc4KC4YlvBY2z3/vMMrdte8hTIHw6UD10LHhn0Pn10PS33M4tyLMbiVj lDwFsGebOEmqLALUCue3Qrlgnw0sveAFAMWJE1PuNuizrJGb3aKqi+wCW3G+JKxwvloe pPP7DA/hPVRTeUn7z+46PuECWiPKOCCVon1GwaKuJtiFcOWSmGaKkv1sSBggd7UHY9R9 a5Mu84aJ/Z/aLtAElCkK5GreQhgl9XpSx6HQzpwJ0wd9LXE0q3tZSTa7FkKp0V2aTyKp zueR5r8hPttvqwNO4b7SGAN+6UYQFsaqXT0cdu51lxITxPOQ2VbotTAbYBUyOi8gz3Xo PNgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yzIPqrCN; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a63e113000000b0056427788d96si4791048pgh.70.2023.07.31.16.21.17; Mon, 31 Jul 2023 16:21:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yzIPqrCN; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbjGaV52 (ORCPT + 99 others); Mon, 31 Jul 2023 17:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbjGaV51 (ORCPT ); Mon, 31 Jul 2023 17:57:27 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 518D3E7; Mon, 31 Jul 2023 14:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hkm1TGGKBKdWJ7GoRKQZq+kafZafaSoo4fOcCDmz9mV57VUhDSGBydLF6SElpiY1G7HIJ5K/f0eFL4hZjdUEfc743A5JFwS2RLqIn38Wg+hiPOG45mXzO/FbKga204oLJTQQMAwYf2mun7OkBjz2I0ZJ4oxsVLcpzTuPeGYLbeKWsBmGZagBwTZ+lonc/hsQiKcHI7LGnm5A5QBQ4vuSKumyQalZZdsn8VjyJ620oBfHVTTmj596T0tMlSfz2xCzF+7GZRQGlILcz5Zkq74yIIIiKcsy89mMHmH6MTHhd5SlsrhW8g2wrWcAmPiTSizFsN+DLfwmYLQLVokDvQ5w8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bgzvx0yfOrEF8cRgYaZxnmXTuYIRw1CwP8WyPahWOOY=; b=Y7vOzIvZop4wCOYBPm2UDPDkOH0NABQ+TA2vkaSRboDFBNd+KDUBWpnwCkcfDKv4viYnvKkKlq9+7IhJChzLU/QSQni2Cy9BRSccVvzufZ7+MbZvm/4bzHrah1tGOS/IvXo4aD7zfi0+umPZFc9gdJMDPDB7RMJoB6KBfWv6RcwXuNIXzcOYLQAHQgC2O1mqrIzNnX5nV0D9axhrFoKSmvX2EcNAtKYRl9n9mCQPKRTw3PeSPS/g0d5O8tOxtpJ6SzST58HzoA1Vj+GEfUcZE5cBymM/9TJdv6bCsBI6YbKIYoPJchfxKn4nGEih7lWP+DqfzO2jVXJBJqY7xsvsrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bgzvx0yfOrEF8cRgYaZxnmXTuYIRw1CwP8WyPahWOOY=; b=yzIPqrCNbelSq94UveTRcs74KPREG6ausZdtdj/kC2MPUVFg99B+M9e+9MNx1GP+KF325O5rrI8XqMuiAQ+WD2RFNGsXYUQQDWq54ynO19UYJlcCHmdc8exmFVcSa9JKMopd0F9jJvQIs6aKsHKBV2RZUg6sWCLq3HZbvQRU5fQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) by SA1PR12MB8721.namprd12.prod.outlook.com (2603:10b6:806:38d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.43; Mon, 31 Jul 2023 21:57:24 +0000 Received: from MN0PR12MB6101.namprd12.prod.outlook.com ([fe80::36f9:ffa7:c770:d146]) by MN0PR12MB6101.namprd12.prod.outlook.com ([fe80::36f9:ffa7:c770:d146%7]) with mapi id 15.20.6631.043; Mon, 31 Jul 2023 21:57:23 +0000 Message-ID: Date: Mon, 31 Jul 2023 16:57:20 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/1] tpm: disable hwrng for fTPM on some AMD designs Content-Language: en-US To: Linus Torvalds , linux@dominikbrodowski.net Cc: Jarkko Sakkinen , Daniil Stas , James.Bottomley@hansenpartnership.com, Jason@zx2c4.com, linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, regressions@leemhuis.info, stable@vger.kernel.org References: <20230727183805.69c36d6e@g14> <20230727193949.55c18805@g14> <65a1c307-826d-4ca3-0336-07a185684e5d@amd.com> <20230727195019.41abb48d@g14> <67eefe98-e6df-e152-3169-44329e22478d@amd.com> <20230727200527.4080c595@g14> <105b9d13-cedd-7d3c-1f29-2c65199f1de7@amd.com> From: "Limonciello, Mario" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DS7PR05CA0103.namprd05.prod.outlook.com (2603:10b6:8:56::18) To MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR12MB6101:EE_|SA1PR12MB8721:EE_ X-MS-Office365-Filtering-Correlation-Id: 15ddb5c9-7d58-4f89-05b4-08db92111f21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WA6SyQRRqtnYs0NE2yfGEYlEgkJ0QK6Du5d5XYInr3ED1+ZTnKqx6Zr4QVYVHzE2GVukkOK4i1EsCW97uvnHpM4D8SXqpUMLlorPsI3z5z9aErkz75pZpRaSmOm3GLutXKLeKDljL1oBIgOyKPPi0MNemGutiIkTI/w0jYVrsUNjjjvkw4EEBwwbywirlr5mJiEf3MpqHXB8x5c8JxKjcE6PdYnIFJ3ZYfkfWzNyCOYHbZ/4FNOcn5WmYBl253QxoIaDki5+8gS2LCdtvNU7BY0wjsq4+SYvV7YL3i2I0SdB3dCuLFk5xA4z39sw2uoN4DjPh3ORoNvKgwCm9LtLKWwvWpv4ERRHpTHireoGbRj8i+CvPjg5Q/RNYcyF538Gq1K2aLewjCfFnHqw6zUUSug0scl/YWRGytfZClUaUsGjHDQ0rxYNsEXhXJer/ihMtQbo9wAb8PYce2VrEUWfisKAZLGhY9iUcpskVTgnHWWzJ2RTCvI84Y2ipADBikvchYCRQWvzPWwBXrOwZOqCPit0Ps9D0monenNLdIOb0EOFI52FZYYNZ6UZdZKqHVq0I4PdMvtPPh1UiXG8ows/9XjbeuS3fwfueDSubgSRdH6byAojJajF2cUfDWARA54+pODVNzyp7dyIp83oTg9tLA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR12MB6101.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(39860400002)(396003)(346002)(376002)(136003)(451199021)(6512007)(6486002)(36756003)(2616005)(53546011)(6506007)(26005)(186003)(66946007)(66556008)(7416002)(54906003)(41300700001)(38100700002)(31696002)(66476007)(86362001)(316002)(5660300002)(4326008)(8676002)(8936002)(31686004)(2906002)(478600001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cW83elVPcVpIRm5kcGM0ZUw2bnVWVW4yTWpHZVZ3Vk1YeG5LeEdORWZJSCsw?= =?utf-8?B?bXVXSHduNHdjQ1dkUktkdTc1MnNhaUpoQndFaWJYL0dRZEhqZFZTK1ovUk5Q?= =?utf-8?B?L1FNdmhVY1dBVzBVckJMM1dHMk9SUGoyUG1HU2p3aXpuM1A4VXUwSVAzbTY0?= =?utf-8?B?OVFBQTdKbTdoMEFkZ2lPNGd1b3NwR3RsOFBCMlpvWkhJUjhITkpURlFvMDZv?= =?utf-8?B?V0JPcTZMUmJYa1hCaFhoaTF3R3JkSFEwYkhWbndUM3VQYkhIYXdBYTA2ZmpT?= =?utf-8?B?RGoza05BMEhXMVVMbWhtMHNXSDM2ZjNkVUoxd2dLZmx0RmVGa25MZUpDbUQv?= =?utf-8?B?eXMvbW0ySVRsc21LSHNLcFdXVmxjbWkvZnk4QkdNdzQwWlV2WERtSnRiakJI?= =?utf-8?B?Q0twRlhWTDVLbWxxRkFKd0dMeW9pK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zN3pzVUU3ZXVPakZNbDVpUTF4NlJRRnJtVVhjZVlhSmwy?= =?utf-8?B?QzJZekpQdG4rQWxrWURpZHpIOS9WYXY5UjVPa211UTQ0RU44bTY5Q1hqdnFT?= =?utf-8?B?RkZkaldDUy9CN1pVTUg1bGZQdlZtRnlRbHdhamV5OUFYd0xaeWZ4eE45cUtX?= =?utf-8?B?NWtraU1iM0k4Mk1FL3VxeUYvTjJxYVJFZ3VNRjkrejVRTmViOUFRS2UrS0li?= =?utf-8?B?dFBGNkNINk9OSUZyeG1icDg4dDZIeTM0OGlWcGphWjF4eHVJRGppNFdGb1A4?= =?utf-8?B?eGNOcjVjUHVDN25nUTgvSGtVM1lJTExQMzc0NHZIK0NFeWcxL2EvditvbndY?= =?utf-8?B?MnZEK0ozd2N5ckNEalF2ZWtYcFZSd1FkL1dLaFM0VjFaUzNtQ2ZhdUJPZHd4?= =?utf-8?B?a2RWaXhCVlczRlBrc0NtckQ3YlkyNzBucmZYT3RpWXFtclNRdVQ2QUtlbEZn?= =?utf-8?B?Ykg2YTlYTHRvMTYwVXhKNFMwaVJRVnJvQ0VYeDVLNVREZVMxUWNBcUdhQUt0?= =?utf-8?B?QlB2RVgzbUtjWTNqcUpqNWNPeTVIWE50clplVlpZUHlBSkFERXVtNDd4bnpu?= =?utf-8?B?WVhwM1RpMisrZ1BYeGtSNHRJd1NkenZHeko2VWNvV0RoRHpIc2NCalJ1bElO?= =?utf-8?B?cEFsWm1ESXFqbGZCQ0U0bXcxc29yaTFjdmpEWDFyN2tRUHgyTjYzV2Q3ZVIy?= =?utf-8?B?OGlkSEw0ZjRuVzlTQmlPVjRaV0V4MVA3RzhzaE9HeGRWTjZBc0REYmpUeEQ2?= =?utf-8?Q?wLNsRvLtERZHl/ws70uY+F+nK?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15ddb5c9-7d58-4f89-05b4-08db92111f21 X-MS-Exchange-CrossTenant-AuthSource: MN0PR12MB6101.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2023 21:57:23.9236 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PCwRE1rj0je37wB2xopeA/Ok5uvpJh+LqkHQDxtUHqL3nSn3B+cPG+2p4QP4R2/9VOdxlGWKLL21EoZE3cBrzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8721 X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/31/2023 2:30 PM, Linus Torvalds wrote: > On Mon, 31 Jul 2023 at 12:18, Limonciello, Mario > wrote: >> >>> Is there some way to just see "this is a fTPM"? >> >> How many fTPM implementations are there? We're talking like less than 5 >> right? Maybe just check against a static list when >> calling tpm_add_hwrng(). > > Sounds sane. But I was hoping for some direct way to just query "are > you a firmware SMI hook, or real hardware". > > It would be lovely to avoid the list, because maybe AMD does - or in > the past have done - discrete TPM hardware? So it might not be as > easy as just checking against the manufacturer.. > > That said, maybe it really doesn't matter. I'm perfectly fine with > just the "check for AMD as a manufacturer" too. Jarko's patch seems conceptually fine for now for the fire of the day if that's the consensus on the direction for this. > > In fact, I'd be perfectly happy with not using the TPM for run-time > randomness at all, and purely doing it for the bootup entropy, which > is where I feel it matters a lot m ore. > >> I've had some discussions today with a variety of people on this problem >> and there is no advantage to get RNG through the fTPM over RDRAND. > > Ack. > > And that's true even if you _trust_ the fTPM. > > That said, I see no real downside to using the TPM (whether firmware > or discrete) to just add to the boot-time "we'll gather entropy for > our random number generator from any source". > > So it's purely the runtime randomness where I feel that the upside > just isn't there, and the downsides are real. > > Linus Are you thinking then to unregister the tpm hwrng "sometime" after boot? What would be the right timing/event for this? Maybe rootfs_initcall?