Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp159401rdb; Sun, 21 Jan 2024 23:04:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIH82TinWxJwh5eY+HAJnKFhuZBROoMgW/VfunaPYskX3C11eIsWpjLx1h0TOKMa0aerV4 X-Received: by 2002:a05:6a00:22c5:b0:6db:e546:313 with SMTP id f5-20020a056a0022c500b006dbe5460313mr277017pfj.14.1705907042622; Sun, 21 Jan 2024 23:04:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705907042; cv=pass; d=google.com; s=arc-20160816; b=pz4lLyYCiuPPElWLfmHpBePO0rQkEnDBQv8P2lXrjamT2+ElE5cuvf8rUDVYaMv5vj +2Rx/up8HqI+JApjJ24lOtb50WEqPsY4z08ZEutlfHsRi0s2AErnWo9l4HwX23SLOugD 7XkHyXwq4MrXEimT0OyAfNCodUHPEWYEudVOJvbDmnhkc3hMVt70wpv38/kQITqOq08u plLwHeHnwKRg5GBS87k6qHlQFJ5xXNHkN/zANktcE97GX6rN8IpKZPOMor+luscq3r9u 9Q7/XcQoCpPBPUefr+tcgJJUtd4XWHi7QBHtkh/OvJFJZNGHEWVybZHOOqazSNsNzDWl GXYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=plBekECwCrnkNSE3tEir64JnXRMMrK6QpZzhIq/r/bU=; fh=vQROzqsqKbuBfUG1c6TTNscEWyGEIW0EJDI4Xjopjr8=; b=Cg7c4ohW13JkdzGvwJvT064btnxPM8TOVBUrghZlI8nlNDEgb+Qw3El+uRCKSkOLVE dixeloaWZ2f8dtYL1LghRauSrRRY9aGTLTnudNnV4mho/zL70Ha3Y96yG65ehtgWYXL1 WMbJKCSzrmDM/OTFeOn7MLAsodD32YwrtQ3WQMT+xfs1Ha29hhDtiME2KlWCwAsI9SdM 96qxn2coyGly1hsUiahuXe7XPFxb91+nw3Nph8DfOXwlenrEZ4j0J9lmSBYN4TtPovP/ ynU3TCyZMoPXDPmP9cGlT+xRfkAtStMVwoPBeuGAFtW4ObPrO1hnx/FAfuLhSeVhg4cr 71gg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mgeDQ4pI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-32395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32395-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ei55-20020a056a0080f700b006dbca95d27bsi4182704pfb.325.2024.01.21.23.04.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:04:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mgeDQ4pI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-32395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32395-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 215C0B274AD for ; Mon, 22 Jan 2024 06:44:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DD2AD297; Mon, 22 Jan 2024 06:44:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mgeDQ4pI" Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 33A07CA66 for ; Mon, 22 Jan 2024 06:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705905851; cv=none; b=Im2wWVucyckzryuMmu+vbJLa2OmQFWDyWUM/OjJrH537OoV0MTgmS43Lxw1aMA1yFfBktQHNHrsuIb+CWtOc6LsHR28wq7s+HqyTp4uqsmpInwg0QmUa1mN5ZbW8mAd424haOCmn+XQP9B8mNhCn1S7HwAzRQDSTYyYAo2KiTmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705905851; c=relaxed/simple; bh=PXG7D7pO3cEeSofvUiEpo7EfpxglZFW9kTHuY80VPqg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=pXFgdPLaXENpFVLZqpaXePXTTYdM1JcTvvXmoQKkP4+QutKsPe9WHjEu4zueYUQaMnYrF1EMUdW0q2qNWEI+RqfLV4qFuMoiETP4eYg9sha0j+8xbNwkzUhxOtIMHtm2fVHa/U33yWiC1Ls+6tlW6vaaZ+CzLzpykQPu2VUjSTE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mgeDQ4pI; arc=none smtp.client-ip=209.85.208.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2cdb50d8982so30215231fa.2 for ; Sun, 21 Jan 2024 22:44:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705905848; x=1706510648; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=plBekECwCrnkNSE3tEir64JnXRMMrK6QpZzhIq/r/bU=; b=mgeDQ4pIStB6bKJWPqXUJnwRc0Gg9k5U8woiIokdQuIFFxBMjbHA9w1zZ579LaLm4a s8kQ8YeOKEU24oH9OkpHFTqMEKg9PJIf+boOm9jNUwMysfiRRtsOi1/ZbnQtxSeEPYVf 847B52daVSLbsSNkpUwyA+5OqGuzCxDK+aH0qrYtwxGrAEwijA9rANYfy/MmdeBAjLa+ aH7hAKtcZTX0kqEc5uomIpn9rz4jlX5YGAqghRHtMr4jTN1dgMlTPd2x3qZ0whooxwS8 WWcwhdZPNGhte/NRnFYxxtYoVZpqjLLJdL77FokaOh69gMUtlXFOUPYx1mUVNj1kNBPQ E2iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705905848; x=1706510648; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=plBekECwCrnkNSE3tEir64JnXRMMrK6QpZzhIq/r/bU=; b=sViCygo9IVG+fsIEuE3CzlewbCWlqAj3CQUJp/Jk8XO419s1qUGdys9H9pCC+Pd7yo ZOyYQKR8eqV76ow3EKvSbucNPYJbu1rAXNK67fkM50MYl8ty24exkPnzJkXK09AUNhgp 3zy2FaA0VIKOgSvjVabR6rLXNyfC4iFL/W7ewWsZ3xRAa4jf88nn8ti9Y4vgxuMaNtVa KwknKi8HvOeCdr6iofu30RF5Z3Ceqh1J04TZx7Fi2DWTYTcXjc29myiu6wN4q9sXJkrl wunht8Xz/ungQjLzFbJfIJlkpnSjm3mLp0duHOAfNdWbd2v79pVshKkbW6A/w26iPY1Y fuKA== X-Gm-Message-State: AOJu0YzntA9qX7AaklrIwmqjsaV3SoN92ml4tpiv1UnblHkhbwNafIE5 4af/7Vg04zMDpdohngM29kdYmR2bdERvFMqjR/dXknHEGlMYfdIp9TtIEEiP9ph0PQR6gxMC1FL Ln17wPujkymuPXddllE6uafWXtx+up2njGlJdCA== X-Received: by 2002:a05:651c:2004:b0:2cc:f163:fb6a with SMTP id s4-20020a05651c200400b002ccf163fb6amr1207905ljo.53.1705905848024; Sun, 21 Jan 2024 22:44:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240116234901.3238852-1-avagin@google.com> <30cd0be4-705f-4d63-bdad-fc57301e7eda@intel.com> <87le8mfojz.ffs@tglx> In-Reply-To: <87le8mfojz.ffs@tglx> From: Andrei Vagin Date: Sun, 21 Jan 2024 22:43:56 -0800 Message-ID: Subject: Re: [PATCH] x86/fpu: verify xstate buffer size according with requested features To: Thomas Gleixner Cc: Dave Hansen , Andrei Vagin , Ingo Molnar , Borislav Petkov , Dave Hansen , LKML , x86@kernel.org, "H. Peter Anvin" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 18, 2024 at 11:07=E2=80=AFAM Thomas Gleixner wrote: > > On Wed, Jan 17 2024 at 23:59, Andrei Vagin wrote: > > On Wed, Jan 17, 2024 at 3:52=E2=80=AFPM Dave Hansen wrote: > >> I'm not really following the logic there. What's the downside of taki= ng > >> the fault? > > > > Let's consider a scenario where someone messed up with an fpu state on = a > > signal frame. > > Then he can rightfully keep the pieces... > > > With my approach, a mistake can be promptly detected. > > How so? Everything which ends up at the 'setfx:' label will just > silently fall back to FX only and init all other components. and it will trigger the x86_fpu_xstate_check_failed tracing event. Usually, when I want to check that our code generates sigframe fpu states properly, I enable this event type, run tests and check that no event has been triggered. Plus, we have tests that check fpu register values, so they will fail if registers are changed in unexpected values. Thanks, Andrei