Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp41221lql; Fri, 12 Apr 2024 03:08:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4UfeP1wC9Ue4S6Xr+2jKWHsTDZedtKStRcvhW1X70tK+KsySwT++MfVY4YQvI2ZWfreAlHGPE4HKxr5HSqrgSCv8QjT+CDpAe0V0j0g== X-Google-Smtp-Source: AGHT+IFgNsB/l7oQVVgx8087g8I7wU1x7u0lWTdVGJ25eVLXqPdkoNqyODQG9U83LNkmRHiKCaT/ X-Received: by 2002:a50:c313:0:b0:568:c6a2:f427 with SMTP id a19-20020a50c313000000b00568c6a2f427mr1533497edb.27.1712916494316; Fri, 12 Apr 2024 03:08:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712916494; cv=pass; d=google.com; s=arc-20160816; b=FqszvZK9Oit8rUdf48EOSH4wmuUQzQXeXNkOM3+ofd3W8FwJ4W43TgKNVmg3gmdbPl p/1z7xYNNUKo9tcX6mDhyEiLmOZU5YGzckqOKf5bUQ8bhn2oDxNs4U59hcnArdzV2u4c jsuw0oxeltw+xw12lt8NZ7AA9BpIXNimXg+AGE8mOmIHNeBqcWl43I1mVnJrtLHM8erz +j4eyCo2TOBnOhp9dhRL6KYSVrhanH9nfB3uj/WjOtt6lzMFiu17I226FvOKDGuK9zqs bQRK/6JDABtL9agEGw5oLGbZeEILbF5PGBBQkodg7TJ6bHPq0olXc1DQdO2JiUNwpxIB 4PBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=5VzUzE7x+skOX5qaEeZqxkVm0YOlBS5qhNXsJv+OjBw=; fh=J49CPdsxg0dOO68OaRLQtiU8Y5tP2ze0E5TGQSEdcHY=; b=OEqhf6nImNj9PYxaUJ7DU5iFT55S3QtC2wSpfLRcHIiPG9dsnG9xiVQGr6ATV7mssJ rOnmRn+lbvdiDyZXy7y/pk/2TSnhcRMWXxlQ55mix5LYkEku2f6fW+mgJdC/h3VU097r PEdR92iICYc3hz0GnNbWSAUnl09lBiludd3yn0aJkt1RwWsVHbDNb2hVPGivlH6U0EZs +6E8IeF27se2Er7Y63FCecfUgyfqOgxrpgzW/rI+x/sJogImTLkarP3kZu20wrr/XAds e0AoZISznfAuCut2vHrl24RZuRRuEldLG3454g7aSMf70S42Pj/SujZg5eyl53T/k1iY 9diA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nsnN7CMH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-142469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f17-20020a056402355100b0056dc723873bsi1580785edd.163.2024.04.12.03.08.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:08:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nsnN7CMH; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-142469-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DD3351F223C3 for ; Fri, 12 Apr 2024 10:08:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D15EA53E15; Fri, 12 Apr 2024 10:07:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nsnN7CMH" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76073535C4 for ; Fri, 12 Apr 2024 10:07:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712916476; cv=none; b=L7N+VlVQVTAek5QlfjwFojyCbg/YiwoBV+YurzsLLkG39CVfUUd9Pp5PCRpHTaJA21fQmgm/rADroqpQcIWRuPwJ95G78yxBygFCuTLZ5RvduXH7xY42Gn2b3mIaTyiu++p+7JR8JpYgqyVjBtiXdke3aIYfHA5I16jzIupkBZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712916476; c=relaxed/simple; bh=TUv2nJagR2r4uAvL25YF8nJB2rsmp4p08hUHWGbC6R4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=h0oUw//7mWDACaRDEf3Qzwk19LhqRtscBJ3SEuZOSkDOAquLe42rUYcS8vsQ61rnOr9O+FhPV3S8NVq8Yn7NyeY0E/QHGiLnQ3juS1KzR40yVmyvaquVxxt8iUGbr/Lv1aQd3XGDY9UmFiEmZY55vu/lPYIOJoIW9Wf1rTtjIhQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nsnN7CMH; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a4702457ccbso85425566b.3 for ; Fri, 12 Apr 2024 03:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712916473; x=1713521273; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=5VzUzE7x+skOX5qaEeZqxkVm0YOlBS5qhNXsJv+OjBw=; b=nsnN7CMHXIowAa7bjYVFGqEzZA/H9hKhWlMB13uy8nDDh57Ba2/hwGJmsN5xii0hhj XR9eq01K1dotulBX4Akd4p4t/FBWINfsV4l67pgPsKRYl6LZIDw0oWX8TyQV5DM9EhXv KVRP2e+o4052jCBxQE9aCxKwoFqI+AX6JMGUfIEV2N+ET6cbtBmISWpk0ZKyVa2q8P3t tQLXWxuRTNiCBF8R2sR09yWED5cxXITr99Oywp5eC6k5WbFeBqQeke2stUmHPGMb8ls/ pWYcz3WDIQS+FDbBrBY9/TJCNasra7DIr/WWAZ9TM2ARuLTHu9zbw8a0Dco3EPMp9Ly9 R4yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712916473; x=1713521273; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5VzUzE7x+skOX5qaEeZqxkVm0YOlBS5qhNXsJv+OjBw=; b=shmNHyYHcn2ERb7XsoyQMDZwQtDPMYjfdQGmiyMoOdLRTzAe/3LHoDLxlOlUjI87hT nN6rA95TSY+OiFrVyNmkIPIyrLPICm9eS+TlAaCIrLaTNrEImq0lpTynznDQNg4bGor8 V6R+jQd9aV9ri+shC9shaKxv0KKpug4k5OZuyNnFte72YROLOtG4mPfOEjR5Iq4cjw27 2FggFLa5eT/kHAsWSNlnBDnCkOvSS/Hl25BExSOOtBC8VlRF1Gh27n9968d6ZTV+XRtH 61HOQgDPx8CpYWdgHr0ZtHzfXHl3SrfajR1/+T7T74FXcdNGH0PcUeY3gFbaG6OeZDbY xItg== X-Forwarded-Encrypted: i=1; AJvYcCVJ+YCZN9hausdXiq8yVWjkXyv1Ii+ffPrisOcn4CY0BpcySEy7ijDKmAV4KqqGstaNyqU93O8VvA5ZtlD2ANPPe3bSezMaJz3ommxU X-Gm-Message-State: AOJu0Yx/TX9Bewl6RoNgVlUMBfU+eA/3fdyuwX9AgQXg4KlCfVfriEnW bhbprAJbfQaUTJa+0OOFhDUtqh8szKXzekd7XABI3Jt/AW8UqQMa X-Received: by 2002:a17:907:6e8c:b0:a4e:3fad:b973 with SMTP id sh12-20020a1709076e8c00b00a4e3fadb973mr1609050ejc.65.1712916472172; Fri, 12 Apr 2024 03:07:52 -0700 (PDT) Received: from gmail.com (1F2EF1A5.nat.pool.telekom.hu. [31.46.241.165]) by smtp.gmail.com with ESMTPSA id bq16-20020a170906d0d000b00a51aa517076sm1664208ejb.74.2024.04.12.03.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:07:51 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 12 Apr 2024 12:07:49 +0200 From: Ingo Molnar To: Josh Poimboeuf Cc: Pawan Gupta , x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds , Daniel Sneddon , Thomas Gleixner , Alexandre Chartre , Konrad Rzeszutek Wilk , Peter Zijlstra , Greg Kroah-Hartman , Sean Christopherson , Andrew Cooper , Dave Hansen , Nikolay Borisov , KP Singh , Waiman Long , Borislav Petkov Subject: Re: [PATCH 5/7] x86/bugs: Only harden syscalls when needed Message-ID: References: <97befd7c1e008797734dee05181c49056ff6de57.1712813475.git.jpoimboe@kernel.org> <20240412001522.3zp2mzked4ksglkl@desk> <20240412035740.ojgvlqahqlm2umsx@treble> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240412035740.ojgvlqahqlm2umsx@treble> * Josh Poimboeuf wrote: > > [...] > > > @@ -1720,6 +1744,7 @@ static void __init spectre_v2_select_mitigation(void) > > > > > > case SPECTRE_V2_CMD_RETPOLINE_LFENCE: > > > pr_err(SPECTRE_V2_LFENCE_MSG); > > > + setup_clear_cpu_cap(X86_FEATURE_INDIRECT_SAFE); > > > > I don't know if it intentional, this seems to be the duplicate of > > X86_FEATURE_INDIRECT_SAFE clear later in SPECTRE_V2_LFENCE mode. Also it > > seems a bit odd to do this here in SPECTRE_V2_CMD handling. > > Yeah, I accidentally left that in from an earlier implementation. It's > harmless but I'll clean that up too with a new patch unless Ingo wants to > remove that line. Lemme remove it entirely from x86/urgent, so that you can submit an updated patch with all feedback included. In addition to the above line, Pawan's suggestion of doing it in C via cpu_feature_enabled() looks quite a bit simpler and easier to read & argue about, right? Thanks, Ingo