Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp252773lqt; Thu, 6 Jun 2024 02:32:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHVTV1h0sQict6KZD1GlvCmqBaWLuY4Z8Ljmc8afCsH/z73SPRBc1/tW/K7Y0otOUKtUBLH4rmyHjPngktOVluLI5PV8FH0ncHsFCpwQ== X-Google-Smtp-Source: AGHT+IF6Qy6asRgOzQjkNyGffFoqkvx9on25CGMkggy7w7lLlPy3SFlmp6uhNFjSFsIP9iNyCLav X-Received: by 2002:a05:620a:2151:b0:792:f438:abff with SMTP id af79cd13be357-79523fd6a2bmr437146485a.76.1717666358994; Thu, 06 Jun 2024 02:32:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717666358; cv=pass; d=google.com; s=arc-20160816; b=VtRgdrPA8vAk64GBJRb4Z9R3MbPKZWKcXSjJrNAb9qdfl0xy3D3G3KHjB2D5zGfp0u dBGlcJAh0BBH3Es9s54PLcdC9QHNomrpIXVgv83QAR1S48pwE1FBd4Wa53kl4iBGZYjY hmku+nIx4S5vMWUEX3SF0jD6PkFf1zcd8x4J2fqZCjVzluryu8EqIiFHDHi/5v1VVuDs CTCo4YDxm2SYW2ABZejDYXgAJiPWipZ3qEgVjo7c9XVk0lusLPVVPtvwip5SiG+ae66N 5IdQ2pFvHF66AtQ7nFuFJxJdaOi9Pdfd39fS14iiDc50LHai15tU2MKvPglABZwoZrSg UEag== 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=U1pBbZAFqzrZDgDdfYVwGoMmcdxP7e2j16JwbU5hjzo=; fh=JTExmKz2op9Jurte8Lco6M1eP+x1rDIy0MQhgh9XKPk=; b=ZHmerMNY6ZZNHaOKiRzgUr4EH/0RpelaLUAs7GCYmmw+mcqTL9O+oXjfZFvnBUV+Y9 t8b4hOwu7qbOQcnmQmM0i1SNZ+eRGNPVpmHM5e+Ucxo9ImgtlvXkVPrCLvqK5M/mg0Pv YL66+Q2OX0dXcJwGGsF7UR9/mI8GTsesCJT9Br4E5uLBS0b+G+qLBDapw+QGq82yP7x8 1XrSOwXm4kGdvCq9e+UxzCc5r+dlIvpnTrrY2ybCksojnbV1MwK7T18cMaIeSllkDpbX b6sRqw1h8Ug/oqkmJDLjjjPapclzUpyeCD6RLtpyenGKQbZE3b5nv3AuHm4heRyg1aYC z7Gg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R2BLQDX7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-204009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204009-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-7953333b77bsi104997985a.566.2024.06.06.02.32.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:32:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=R2BLQDX7; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-204009-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204009-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A6C451C20DAA for ; Thu, 6 Jun 2024 09:32:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFDAD17E463; Thu, 6 Jun 2024 09:30:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R2BLQDX7" Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 41B2817C9FB for ; Thu, 6 Jun 2024 09:30:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666245; cv=none; b=MtJ417g5H3ND2PLjMQ0bZOolvUnov2fuOj55Y6MpYlyMYNJKEk615978g9y9lucnFSo2/Zc0HJJ81kpv3kcUVNIsHSk33MrW++CwjK80/qxRFz8wxdkw/JsEQt8uo5aXSy/VXFBwD/wEamBG9D5j/N5DZ7HH10UDoEZ3EBw32lE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717666245; c=relaxed/simple; bh=VLhNWmvRrSClxF+rekg2eSTJv5rjV4byVi/cT/a0RQA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SIO0KuB2H3T+0c7PN+d24YbCVjlNmiOLXk8dB7A9sRIDnYrkjWOGSiqjUZOwF3i98lVjDpdmTKZdowhyUD/bGvffVVkYYgCv/vQMDrJo2XzdB38uiSdJqdjiFz3HkHpAawTHrj4ggxHnPJ2Ap/zL32vJRxFDe+FRV+CiBR5H0ak= 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=R2BLQDX7; arc=none smtp.client-ip=209.85.128.48 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-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4213b94b8b5so8638465e9.0 for ; Thu, 06 Jun 2024 02:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717666241; x=1718271041; 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=U1pBbZAFqzrZDgDdfYVwGoMmcdxP7e2j16JwbU5hjzo=; b=R2BLQDX7M7NF0tWttMte3BqiedcSEiMkkKyPocx7Ghc9oSl2ABgUw20dd274sB2HrF RmiI9hGm4wySEdruKcyb9N4/nZbIVfWcVSMiCtRKIUUAFETKZseXH6Pc+eBVpOCTkD8t BKd0qzJoC+V+cKmFpUsmg2TCQinoazoJNZRY/08mgqIVMlQ0CMzEAWgX+Ymoj/PqSxge vYyO4z0SENadg/MC4erT2Y+JK8hh4qLPuu+C2sMK8BXebmaaKGN86+SZqVT94GW19lJp tpLwsvYdUfMRnB48eWDaGtnb764zVJ802lmdOEAg5gkt8FCe+p+oO24Oco4xx8GjUEsY oDDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717666241; x=1718271041; 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=U1pBbZAFqzrZDgDdfYVwGoMmcdxP7e2j16JwbU5hjzo=; b=CCaDJMGvJxVbFXg420D2NM3If9i0cGiNn9NfaAT7stG9UF+VbNiQDUUWEilQSeAdsq sI/jP5kjiB5wOwyxrEdPtOgiit8kXVdGahqcuCD5d7hQt30GRvKd8s6FP1oyWpb8gjoe jY1Fz/QTPTpUfQdLYC9rniE+JSLRp46vf/2cLVNx9i0JR9YkRRqdzwX/pbGKYmiULjhT tn6jjlPd1jobr7y/MjjVqeFMj+5bP6F3H6Z/PNifyvSHrPdirZToYtSSshtfw+z07aOg dIjLPaTJ4oWQS0w6QXOIFhx1HhKh5eNi9pdoquwx+3+nx3US10rb5+HPMdjheUva2JLz FV3Q== X-Gm-Message-State: AOJu0Yzb19QcLibmPp1A3p9SXgDG52BeCZikEybzghqO7GXZa+0izder RJWQ6ZiebuVHAW6dzQPRUi9R1p4zBYpM2vLhosZY6Wv7d0wHGAnm X-Received: by 2002:a5d:47c4:0:b0:354:db35:63ab with SMTP id ffacd0b85a97d-35e8ef09a48mr4213626f8f.39.1717666241372; Thu, 06 Jun 2024 02:30:41 -0700 (PDT) Received: from gmail.com (1F2EF20A.nat.pool.telekom.hu. [31.46.242.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35ef5d29653sm1056553f8f.21.2024.06.06.02.30.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 02:30:40 -0700 (PDT) Sender: Ingo Molnar Date: Thu, 6 Jun 2024 11:30:38 +0200 From: Ingo Molnar To: "Chang S. Bae" Cc: linux-kernel@vger.kernel.org, Andy Lutomirski , Andrew Morton , Dave Hansen , Peter Zijlstra , Borislav Petkov , "H . Peter Anvin" , Linus Torvalds , Oleg Nesterov , Thomas Gleixner , Uros Bizjak Subject: [PATCH] x86/fpu: Fix stale comment in ex_handler_fprestore() Message-ID: References: <20240605083557.2051480-1-mingo@kernel.org> <20240605083557.2051480-2-mingo@kernel.org> <204e541d-ff48-487c-8f70-619f90f65635@intel.com> 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: <204e541d-ff48-487c-8f70-619f90f65635@intel.com> * Chang S. Bae wrote: > On 6/5/2024 1:35 AM, Ingo Molnar wrote: > > /* > > * Handler for when we fail to restore a task's FPU state. We should never get > > - * here because the FPU state of a task using the FPU (task->thread.fpu.state) > > + * here because the FPU state of a task using the FPU (task->thread.fpu->state) > > Just a nitpick: > fpu::fpstate now points to the active FPU in-memory storage. Yeah, that is a stale comment, but this was just a 'sed' job in essence, and I'd like to keep that particular patch semi-automated. Note that later on that comment gets further mangled into: /* * Handler for when we fail to restore a task's FPU state. We should never get * here because the FPU state of a task using the FPU (x86_task_fpu(task)->state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ * should always be valid. However, past bugs have allowed userspace to set * reserved bits in the XSAVE area using PTRACE_SETREGSET or sys_rt_sigreturn(). * These caused XRSTOR to fail when switching to the task, leaking the FPU * registers of the task previously executing on the CPU. Mitigate this class * of vulnerability by restoring from the initial state (essentially, zeroing * out all the FPU registers) if we can't restore from the task's FPU state. */ ... which didn't improve clarity either. :-) How about the patch below? Thanks, Ingo =========================> From: Ingo Molnar Date: Thu, 6 Jun 2024 11:27:57 +0200 Subject: [PATCH] x86/fpu: Fix stale comment in ex_handler_fprestore() The state -> fpstate rename of the fpu::fpstate field didn't get propagated to the comment describing ex_handler_fprestore(), fix it. Reported-by: Chang S. Bae Signed-off-by: Ingo Molnar --- arch/x86/mm/extable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 1359ad75da3a..bf8dab18be97 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -111,7 +111,7 @@ static bool ex_handler_sgx(const struct exception_table_entry *fixup, /* * Handler for when we fail to restore a task's FPU state. We should never get - * here because the FPU state of a task using the FPU (x86_task_fpu(task)->state) + * here because the FPU state of a task using the FPU (struct fpu::fpstate) * should always be valid. However, past bugs have allowed userspace to set * reserved bits in the XSAVE area using PTRACE_SETREGSET or sys_rt_sigreturn(). * These caused XRSTOR to fail when switching to the task, leaking the FPU