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 CD525C433FE for ; Fri, 18 Nov 2022 15:11:31 +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-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-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BydyffHjpVMKqacosEr9oSw6jhb95LpP9fYop5hTdbs=; b=yem0PiKuoiJOKfAUZt8m0f0K3c oC3Fon/p336kVDMWrqht2l+62fTwA4uzJXQeaDXdna0pSizsWfyNC3fVCAWD0kbFOIF3novnl2P7d mnJge56D9AcRns3I9WGiP6PT8rRFuEoPX/FyzyI1rH1ktPqfQsc0poS5URN6uGo2LBC2yQIFCSotD ztYGtIrDCqbUNXSjQyf7xl8BiKtPDqdS/H6hQOtsybe/cGytc/WO3B0R7Ddspw69PQH/5Mwa5V4aM MyBmkh3Rt2FEppWSJeZZEKGL6szfInHFiKKQlpP0oK7jLZHUhneAvW+DU9juuATcWcQppFukzj0g3 9qF5qxGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow30b-004nBV-PI; Fri, 18 Nov 2022 15:10:26 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow30S-004n7t-3i for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 15:10:17 +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 D54BE625BE; Fri, 18 Nov 2022 15:10:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3703C433D6; Fri, 18 Nov 2022 15:10:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668784214; bh=Vpa+udLkhlVjDQhRInWIbU1vcvX3FXmKbnZNnbo05Ic=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TjZEgpAS5BLAcyEab/qXPJd1r0KaQektpqy9gfdlcPrRW0SwyiXVn7g5/2sBCPgmP AbpqZq0i/NCTae5Bwmaq6gqOnj3juVnAOuTRLrVtWVhszIeMZy3UDdinSYDMBi21tO 6+eeQrRMXAYYan9A2c60v+Nmr8rK/PQ5/h2knW4JfVEeMTlXj3KDEQufIKYrHht/KA /nUEAfMb4hV1QgjOiacE1E9BknIPn+mS89NPxiMCmW0TzrPfVxFUPeIS659YzYca+Y oMIpf11yzGWjDZRf4qTEVTop7m5ouHA7EHBtiqYWCK3/mDRSzzJFXMcTOVNyF2rpvM 7iXkWMfImb1zQ== Date: Fri, 18 Nov 2022 15:10:10 +0000 From: Mark Brown To: Will Deacon 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: References: <20221031201736.894374-1-broonie@kernel.org> <20221031201736.894374-3-broonie@kernel.org> <20221114161005.GB31141@willie-the-truck> <20221115122225.GG32523@willie-the-truck> <20221118135552.GD4046@willie-the-truck> MIME-Version: 1.0 In-Reply-To: <20221118135552.GD4046@willie-the-truck> X-Cookie: Ego sum ens omnipotens. X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_071016_291419_9B438708 X-CRM114-Status: GOOD ( 26.09 ) 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: multipart/mixed; boundary="===============0204056327978468559==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============0204056327978468559== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="l3zbzPUoujjjjNKz" Content-Disposition: inline --l3zbzPUoujjjjNKz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Nov 18, 2022 at 01:55:53PM +0000, Will Deacon wrote: > On Tue, Nov 15, 2022 at 04:42:14PM +0000, Mark Brown wrote: > > > 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 > 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 think it might be best to go the other way and remove the size checks from parse_user_sigframe() entirely and put them into the frame type specific functions so that parse_user_sigframe() looks the same for all frame types. We should make sure that the individual frame type functions don't re-read the magic and size though, only reading the additional frame type specific data and doing whatever validation makes sense. > I'm actually warming more towards an exact check now that we've spoken > about it a bit... What do you think? I'm more inclined towards exact checks, it seems safer. It's hard to see how we'd use any extensibility in a way that doesn't go bad in some situation or other if the frame isn't designed to be variably sized from the start, it's a lot easier to add a new frame safely than to extend an existing one. I'll send a new version fixing all the other issues you pointed out and with size the check code as is (apart from anything else I already prepared it) and then look at fixing up the behaviour for FPSIMD and generally around parse_user_sigframe() incrementally. Hopefully that's OK. --l3zbzPUoujjjjNKz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmN3oFIACgkQJNaLcl1U h9DMAAf/df3tSqya+ohM7zlmT5ag/bqmv7zb6eaagOnB/Mn8sJvDe99YjhL1m2uM fJF9N5W1VQwfi0xiwGzxAiSEA9W9JGvr/K14VY8r3H8oZVxiZYXC7V+kQhRIl0yR zbPaxnO0QBniVC2APIWXF5F9IYdhizhhwctL8XF4y4KM1/hQu03FaMRao+ohSeIb GTfwiSQWARtL96gSDVsRpVnn14ghy7boxgV1zYG8GrdgdOMtz0ykk0VErReqYp0m UR3je3r8CvBCbeFJLrahr358BUHEuiSoWK1crr+aEhgeH3Cq/YrxU+GR/BaXtKEp 4P/cp0kqqEHHtL/wMtLTPUp9Gbuhzw== =5QMP -----END PGP SIGNATURE----- --l3zbzPUoujjjjNKz-- --===============0204056327978468559== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============0204056327978468559==--