Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1978621rwb; Fri, 5 Aug 2022 10:57:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR6eKIoCVLQuOOY5pxJ2hC5luWDGFrK7rVrha+sFamegZ83LcPoRxTZjH3nOY3vWWkBla8c3 X-Received: by 2002:a05:6402:1771:b0:43d:3fab:dd73 with SMTP id da17-20020a056402177100b0043d3fabdd73mr7647014edb.136.1659722225012; Fri, 05 Aug 2022 10:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659722225; cv=none; d=google.com; s=arc-20160816; b=dBXXQkQYNAQGv8Ms0S5BuwQT72sITA81K6vFOG14ffk88nO9Y1let//i3wCI2czYFx F918Xv4/Dv7sKyB14F0pFYQXj/p0SSgMHEiQ94ErgE4MQJ0bKDVuK1mzlGuMWHNoNW0j FmPtcfsWy9r4igjtvfFCpkX16aiNUy/wJIsJKS/g5ukKOtKBZDSiRQuZakpnrREe+Qjf WOZ72hqJBKSUWWvFPai3C5XnCZKiv7YmRUsI7i8qsg3KgN3LAUAeAg02RunPHpOJXezh 6gbjvlAjKhJEoC0Wj3m7qTGFM9Hr6RT5AzRFqQIwijS/ekDs8EL61QwKurXEwWe4pysh HwNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lgHt3P8hxmYNsCsO6oz+2j46ElNujepttLSppVvmEgo=; b=KK85q9+JD08VuxHXTxtsn5BfQ8TqbLpovjO/RCah8BevAbKgsxROTT8FeGrRHfShjR eYBHS4ec5C2PlgZ+QsY3oIj/tx4OCNTv9fTI5XC8uXVhJdSIBvWvpixrZqoOvxzc3NH/ St4ec7LPHl3aLkOqcoZ9PxjVjNZwKJcqY1wUPf+7MVmx7yiHdxXJzpCwiL+pVpoFU5a5 PQr1aj4H22k7AeVKRhlgPh3E7vX2Lc7DkYehELpawDLpGc4FPZB9xsfDjHOGe96UQ+Yp dQaG0BaV7NnltL5zBtKu3FXa0LwXLrlya4hYTb5GOvmw4/egBC9lAsGlnvvDvvs/wkla XtEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=LhH4G9E2; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be27-20020a0564021a3b00b0043bdd032e2esi229185edb.473.2022.08.05.10.56.40; Fri, 05 Aug 2022 10:57:05 -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=@alien8.de header.s=dkim header.b=LhH4G9E2; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241486AbiHERzo (ORCPT + 99 others); Fri, 5 Aug 2022 13:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241483AbiHERzi (ORCPT ); Fri, 5 Aug 2022 13:55:38 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3190065FB; Fri, 5 Aug 2022 10:55:37 -0700 (PDT) Received: from zn.tnic (p200300ea971b986e329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:971b:986e:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 718381EC04C2; Fri, 5 Aug 2022 19:55:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1659722131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=lgHt3P8hxmYNsCsO6oz+2j46ElNujepttLSppVvmEgo=; b=LhH4G9E2jS2NJtKOOrZhc5cvM3+7Wrv9VzdHWSsSgwvfMzg2i4SHyA0giKHc4WZ+vu6DWw yNR87bw4s/ZIL3vRfcdv9jPSqoamVpaCFtwHf2gWSNe/wr0bUiBy793oG1PF9N/MSAVJGN Nu3L3/WqLhVSJ8i5Be/Ek30EdBieORA= Date: Fri, 5 Aug 2022 19:55:27 +0200 From: Borislav Petkov To: Kim Phillips Cc: x86@kernel.org, peterz@infradead.org, bpf@vger.kernel.org, jpoimboe@redhat.com, andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, thomas.lendacky@amd.com Subject: Re: [PATCH] x86/bugs: Enable STIBP for IBPB mitigated RetBleed Message-ID: References: <20220804192201.439596-1-kim.phillips@amd.com> <86921fe7-6a6b-2731-b09e-a6e03f38a6b9@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <86921fe7-6a6b-2731-b09e-a6e03f38a6b9@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, Aug 05, 2022 at 12:04:34PM -0500, Kim Phillips wrote: > On 8/5/22 9:42 AM, Borislav Petkov wrote: > > On Thu, Aug 04, 2022 at 02:22:01PM -0500, Kim Phillips wrote: > > > For retbleed=ibpb, force STIBP on machines that have it, > > > > Because? > > See "6.1.2 IBPB On Privileged Mode Entry / SMT Safety": > > https://www.amd.com/system/files/documents/technical-guidance-for-mitigating-branch-type-confusion_v7_20220712.pdf > > Did you want me to re-quote the whitepaper, or reference it, > or paraphrase it, or...? I would like for our commit messages to be fully standalone and explain in detail why a change is being done. So that when doing git archeology months, years from now it is perfectly clear why a change was needed. This holds especially true for the CPU vuln nightmares. So please explain the "why" of your change. In your own words. > "{unret,ibpb} alone does not stop sibling threads influencing the predictions of > other sibling threads. For that reason, we use STIBP on processors that support > it, and mitigate SMT on processors that don't." Pretty much. I'd even explain each case explicitly: ibpb - mitigate short speculation windows on basic block boundaries too. Safe, highest perf impact. On AMD, it also enables STIBP if present. ibpb,nosmt - like ibpb, but will disable SMT when STIBP is not available. This is the alternative for systems which do not have STIBP. > Those messages only get printed on non-AMD hardware? See, I got confused by our spaghetti code from hell. ;-\ -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette