Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6908DC433FE for ; Fri, 18 Nov 2022 13:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j6gwkzerpebN9OKiFufaAeR54VlUhSyP18CP1KJsoSM=; b=anKuNfpyyzofXD Nv9DnXapICOkBQxJ3M0LgUPoc0L04ZrMWFO9O0mKeyxUZJlUChi9+PK5rCPNSHZI4zjNjUSpifRMt oWtIbMAv+cecRvUNXY9nfK+FT8iOU9o1ZDHmBuduikgoZ1e7u4Evy9h3XZjqprl/iu35k780TAiMy swJ/pdKX6peuFdYUYBQNVTGh0v8Tg2Dkk34YizG9ocxDt5q4zhSM11CNfTDpkov5DmX2YZylWZPi1 KPx6n3W1k73lkD2jICaHhu6ry4uBx7lyLsZH2DKVoIJnb8a2do44+OWlqsMuInti5TeniQWmoX43t s4Hpgxh4TP/0ZzrI+wfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow1qd-004FFT-Pv; Fri, 18 Nov 2022 13:56:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow1qZ-004FE2-Me for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 13:56:01 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16FEE6233A; Fri, 18 Nov 2022 13:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 412ABC433D6; Fri, 18 Nov 2022 13:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668779758; bh=nCS4A0zpY+e0pmXeMn/Imf7hY/zvnrlQffxazx0DJXQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pTWli/Th7q+HDIR4a8r35I47ZKAT3ImY/LuyQgv0CD1wvXxjArfhNnk2VywztI7v7 IifjFjUN0syDERWO/vXSNvXGflsSrW/o/EbpWP06InASG1TFCeGuVOtnTu5aea7H/r dRqfodhNKX7SpEdgdjfEEKhGimc0PJpx0H+CJt1PhubyFtk7MMi2qoU1ywN2zuHNfd lmGc2NcVcEAYpHRqPIq0Na8dL9294/yxOVQ0pw5hV/OgEZEKUFiqGUbkb9AEfxi8CQ nYAfpbuwfVBHNlsqQGegAMmhtkOifGwWKGkRGus7whj2JaqV1p5Itls4c+lqHph7tj m1D8tMGU1A1Mg== Date: Fri, 18 Nov 2022 13:55:53 +0000 From: Will Deacon To: Mark Brown Cc: Catalin Marinas , Shuah Khan , Shuah Khan , Szabolcs Nagy , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/4] arm64/signal: Include TPIDR2 in the signal context Message-ID: <20221118135552.GD4046@willie-the-truck> References: <20221031201736.894374-1-broonie@kernel.org> <20221031201736.894374-3-broonie@kernel.org> <20221114161005.GB31141@willie-the-truck> <20221115122225.GG32523@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_055559_911886_061F8BC1 X-CRM114-Status: GOOD ( 30.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 15, 2022 at 04:42:14PM +0000, Mark Brown wrote: > On Tue, Nov 15, 2022 at 12:22:26PM +0000, Will Deacon wrote: > > On Tue, Nov 15, 2022 at 12:08:44PM +0000, Mark Brown wrote: > > > On Mon, Nov 14, 2022 at 04:10:06PM +0000, Will Deacon wrote: > > > > On Mon, Oct 31, 2022 at 08:17:34PM +0000, Mark Brown wrote: > > > > > > + if (user->tpidr2) > > > > > + goto invalid; > > > > > > + if (size != sizeof(*user->tpidr2)) > > > > > Why are you requiring an exact match here? Won't that hinder any future > > > > extension of the structure? > > > > It will but since the structure is explicitly for a single sysreg > > > that's intentional - the thinking was to just continue to model > > > any more sysregs we want to report in the signal context in the > > > same format with their own contexts. It felt like it fit better > > > into how everything else in the signal context is extended. > > > I see, but having the usual '<' check wouldn't preclude us from doing > > what you suggest above, whilst also giving us some flexibility in case > > things turn out differently from how we expected. > > This actually also how we validate the base fpsimd_context - > while there is a < check in the switch statement in > parse_user_sigframe() but we also have an exact size check > near the top of restore_fpsimd_context() which gets called from > there, meaning that the check in parse_user_sigframe() is a bit > redundant. We do however allow the varibly sized frames to have > an oversized allocation, though those have internal sizing > information whereas fpsimd_context doesn't. My take was that we > were erroring out here because if userspace thinks it's supplying > some state that we're ignoring and not restoring then things > might go badly. I'm not super wedded to this approach but it is > consistent with the fpsimd_context handling and I can see some > justificaton for it being done the way it is. Hmm, good point about fpsimd, it looks at magic/size twice which is definitely wrong (userspace could even change those values in between!). So I'd vote for removing the checks from restore_fpsimd_context() which raises the same question we were discussing initially: should the check in parse_user_sigframe() require an exact size match or instead truncate the structure on the stack by only copying a prefix into the kernel? I'm actually warming more towards an exact check now that we've spoken about it a bit... What do you think? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel