Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp636562rdb; Thu, 18 Jan 2024 14:12:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/kJzrBHmi5Ym46xDK+ZkKpC3qykkzlpKNNUxhQmpLlfwWu7EYP8/L+kS0ecEygGU7JU91 X-Received: by 2002:a17:903:1207:b0:1d4:e04b:3eea with SMTP id l7-20020a170903120700b001d4e04b3eeamr1903644plh.31.1705615941999; Thu, 18 Jan 2024 14:12:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705615941; cv=pass; d=google.com; s=arc-20160816; b=lYxcxSzXcpPZep4e+NFJY9CH/F8LDmqXyijKgoLqqJT8qjtmALaOyLrPY6SLLv0nnn o2/4muPQpnib7ONJDpvypNDFHOMpz9IlP5jxl06F3ZAb/EYNBQyhMoiQh5ypOl+HV7aq I2UlDWGbFMdgYxelfBUweLpNvznNyMqSgxaBNkL6skk0TVITaDUMEzp0nSXmi5Aku5ae riPbCOxmV0uzDD0uhrbz9c2if7o7uGTNRQZrjYguB2BLhQtFz8lGgvvsCJPSvFs0G95k 4zpoe5uPU8d2yeKpfSrN+6wVKJVVnF7abVuWIBwgpXxqxCMJipNCm9V2TJgHMGH5UcQO 0xqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=tDtVWcMaj7jj4XT6eyA4k8Tf0NHxgvS28FM4DOAYURw=; fh=xHGPeKhl28l7EqnfSF00XkmqMsyrZBVHhcbUdcmquAY=; b=0ejh5TRivrrTp+1GxRDXD7FO1mS41ObVuG+0oRYoOtuSJb4QfDSJtYSBxOwAdC/Ky4 j0CHZudL3PsStKQjK3bmiuItYl/7tRGShWQvviiZNH8zzHLi2k/v8vXGPHLd6VYN24ck jeLp9oUaUYUeajeQYWJVht1V+pj/xQOa4l3p/wzSGhfyBhiTmLd59oUBxKKl5mbm2jdV Fy3WC7+6RneYEUEY0pVybyp4JSlGB8mArsvqvuQvfMf/fOfTEKO2J6TitEdN5Zp0GPBV d0JayTWiuFs1zvdsFpWb5ToLp6lkAIFXeeyOHpdClnymiF6qG8mfnomvG8Q60nAeD+l0 43/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JgEPiifx; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-30594-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30594-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k10-20020a170902c40a00b001d70e83e01bsi1206122plk.500.2024.01.18.14.12.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 14:12:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30594-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=JgEPiifx; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-30594-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30594-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 1C620B236B3 for ; Thu, 18 Jan 2024 22:11:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BEB331A71; Thu, 18 Jan 2024 22:11:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JgEPiifx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ciaocaMb" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C15D02E640 for ; Thu, 18 Jan 2024 22:11:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705615905; cv=none; b=BUKP+k2ZiPM0GJFGicdE/HGSWUruCV081gPcVXqbILQ/e+Q0YE6L8rZcZ0hEZAofQtS2sCy0wIuAN46cIavgO7fwwuwkGMHH0viARBH2u0T7bDHjnkrcSn275dxSzbCS/U/NXXuXY7CHUJZ4KdQyKgxUZ32U8PCb1+Y/vK89vTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705615905; c=relaxed/simple; bh=OpJNRpQ+SSmWdmSOznoYKZnRIsdRAvixasMs7TNCrmc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=KdB+mVcNBWZH707ziRpgVp6vaNj6srcFqgGnCymBKcgOeQcPK3s7AoWR4l6Zfv4Wyywjr39NjsQ58EDwxixnJwZd8Aa6dolY+3hiYSt+29nYDOwoI6QSuse2YBIGI/1JZvxurTg4ie44NeByFqYrpMoHVKVmXu8USSSpimMNcc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JgEPiifx; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ciaocaMb; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1705615901; 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: in-reply-to:in-reply-to:references:references; bh=tDtVWcMaj7jj4XT6eyA4k8Tf0NHxgvS28FM4DOAYURw=; b=JgEPiifxwKN/IvmmGejYJOw51/jz0lWbxnaUBttFn4grsxUqtWqKel0IjulNRkgA6Vqv2o hyODFPnv2cScLvnQ/PLQNEVMderFzYyvwVVSgaqUz9YYnibEoXGIScetcgcGeOn/11o2sp LD1tr27eSvQ4qdVosL7J0puJTOdqa3UQB1Gd+61vM3Po3taK+61cv74Qg0QGnoiuym4HMu BSJLZb7A8v1g3HYEsle9yTuqoBDMKgD0BF1KRIsUzw+A3oJ7soaOFpxiJf0skHLMzmn/us jACrLJDpTVgU7wW7BkSdktJIkTU4J5tSyetrpqew6r18zmlDGTXVTAY6sx9WAg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705615901; 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: in-reply-to:in-reply-to:references:references; bh=tDtVWcMaj7jj4XT6eyA4k8Tf0NHxgvS28FM4DOAYURw=; b=ciaocaMb0qk1X+Yx3OTnxO4UxrfnVV0eHuMjORdqZ1QaCU9xZgXPQDR0jCpwVFs3aIAwT3 0tThV3b9mBMzzRCQ== To: Dave Hansen , Andrei Vagin Cc: Andrei Vagin , Ingo Molnar , Borislav Petkov , Dave Hansen , LKML , x86@kernel.org, "H. Peter Anvin" Subject: Re: [PATCH] x86/fpu: verify xstate buffer size according with requested features In-Reply-To: <5bddbb34-4081-494b-8c12-c2e70898a608@intel.com> References: <20240116234901.3238852-1-avagin@google.com> <30cd0be4-705f-4d63-bdad-fc57301e7eda@intel.com> <54bcb902-0fab-4a53-8b8e-85b6e4484b03@intel.com> <87cytyfmd8.ffs@tglx> <5bddbb34-4081-494b-8c12-c2e70898a608@intel.com> Date: Thu, 18 Jan 2024 23:11:40 +0100 Message-ID: <877ck6fg0z.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Jan 18 2024 at 14:02, Dave Hansen wrote: > On 1/18/24 11:54, Thomas Gleixner wrote: >> On Thu, Jan 18 2024 at 10:27, Dave Hansen wrote: >>> If we have nice, reliable fault handling and then decide that we've got >>> XRSTOR's running amok reading random memory all over the place that need >>> a nicer error message, then we can add that code to predict the future. >>> If our "predict the future" code goes wrong, then we lose an error >>> message -- not a big deal. >> After staring more at it, it's arguable to pass fpstate->user_size to >> fault_in_readable() and ignore fx_sw->xstate_size completely. >> >> That's a guaranteed to be reliable size which prevents endless loops >> because arguably that's the maximum size which can be touched by XRSTOR, >> no? > > I like it. It takes fx_sw completely out of the picture, which was the > root of the problem in the first place. Correct. I really don't care about the esoteric case where this might theoretically result in a unjustified application abort. You really need to twist your brain around 6 corners and then squint twice to construct that case. Of course syzcaller might trigger it, but fuzzing the sigreturn frame is a #GP, #PF and whatever lottery anyway.