Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4551833rdb; Tue, 12 Dec 2023 02:55:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBVviwrLG6JQu2rnBrQpnWhFxgEUsZR1kZiiQvLY8usMrjNXdJBC0jL+OkH3UB8L/Fd1yY X-Received: by 2002:a05:620a:3712:b0:77f:3b80:2a73 with SMTP id de18-20020a05620a371200b0077f3b802a73mr11144496qkb.4.1702378524310; Tue, 12 Dec 2023 02:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702378524; cv=none; d=google.com; s=arc-20160816; b=wE48ZrZY1H9Klfjrz7LA+QOmoHWLj4O7JS8t7j4rSRNDIHYqXUcf6HxCYBtQdy5SN7 s9iYn9A3thZj8KVbqBSxgPmmbDObB6BVCTKd+QGg/ABxJNsb7VnLGAtcoXhK/OBPOeE1 TgQgu/QVG5ZSj9vYck46PIYr52TqzYf1XZFs7vkbThb3fkHa2fuxxN8HfPacavC59umM YkQETPMMBvsV1e05E1q5jSw5KH6SrSsjYXwvZsOBhcWugXk7j0wLq/oHBXAu1CI74g6G wnNFGcDDRldJPo5FQqrMn2CE4RFmwSzMICEh8KKbJ6LXZoELWMhGEZXa+M5qyTPvN4Af FlGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=0RsFDYivujybNMKwWJtS1eSv1aRiqFG24uauHElDLzA=; fh=Okth665wlNjsaSgxJEUJxRBVAcPHDHuGMLPgW3wQKJc=; b=CTIUaafu928I1JXhJH67ahFgqszBknp1slo42HZcegkNJg6Ed5JI9mueXcMoHZoEmm AvzRNls39UKye+mSsw7sfxACbJR5+5wh3e5ymiJ9E5ZU0DJT/IouFf83n/CEYmSCGMO4 poFVDRY2DCt7vAO9LOx/K/mAu5gs1M8VoMgpXnoxAFDua4pRyvhunnHDhMHPTk2amt7V TFBA2Qx//BeR7+CSexB8Ir7kh6ldJHxpsZTW7r1tVxLcn5ETH8/ScRhF4UCF9fRtHYfu N0wxCe3CLnFAWhhgiV+PJaTI00uMsvGQxo02ozkLMK1TU9B2NrNhgM5WVkQ1TCT4nXHq L3Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U8p/TsfR"; spf=pass (google.com: domain of linux-crypto+bounces-746-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-746-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 u18-20020a05620a455200b0077f6d8c2bb2si5592577qkp.725.2023.12.12.02.55.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:55:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-746-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=@kernel.org header.s=k20201202 header.b="U8p/TsfR"; spf=pass (google.com: domain of linux-crypto+bounces-746-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-746-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 002B51C20ACF for ; Tue, 12 Dec 2023 10:55:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A20A5C91D; Tue, 12 Dec 2023 10:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U8p/TsfR" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 068FB53815 for ; Tue, 12 Dec 2023 10:55:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FF15C433C8; Tue, 12 Dec 2023 10:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702378519; bh=s2JNh92769JXDjX+tRer5QC+0r1XR8VxRjUPp8VSJ8U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U8p/TsfRprRxToug9Ovpb7T/deNKuOKurqqDMt0NItyspaQyCNHZ31rCnU2/SXOre +E8AK5v/qGWws8ra/mlXrVIByKSrUrNIY9n8jbWB4QXaN6giXmwXYgX2Z0uH4/FAfn hKPGUzVJ4NB8FlzE3DwdT1oHsbzuoq7zD6udN9QGfX4MnM0XIE4tiiKycWiTWNhjq9 uKTOI06vIL2YuqPj4ifBxCNdUC4ir7ENeBuzGz+UkKfxYmeNbVj9cFIJoMvsCw7OGU Xpm71dWXkAVCzuoIsW6DjIqYzfCdrvqw7RVgp+x6/3amnu7YBk9z67NMVxfh6SH5UG dPblU6q9AOpQw== Date: Tue, 12 Dec 2023 10:55:13 +0000 From: Will Deacon To: Ard Biesheuvel Cc: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, kernel-team@android.com, Mark Rutland , Sebastian Andrzej Siewior , Eric Biggers , Kees Cook , Marc Zyngier , Mark Brown , linux-crypto@vger.kernel.org Subject: Re: [PATCH v4 0/4] arm64: Run kernel mode NEON with preemption enabled Message-ID: <20231212105513.GA28416@willie-the-truck> References: <20231208113218.3001940-6-ardb@google.com> <170231871028.1857077.10318072500676133330.b4-ty@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@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: User-Agent: Mutt/1.10.1 (2018-07-13) On Tue, Dec 12, 2023 at 09:16:13AM +0100, Ard Biesheuvel wrote: > On Mon, 11 Dec 2023 at 21:27, Will Deacon wrote: > > [1/4] arm64: fpsimd: Drop unneeded 'busy' flag > > https://git.kernel.org/arm64/c/e109130b0e5e > > [2/4] arm64: fpsimd: Preserve/restore kernel mode NEON at context switch > > https://git.kernel.org/arm64/c/1e3a3de1ff6c > > I spotted a typo in the commit log of this patch: > > TIF_USING_KMODE_FPSIMD -> TIF_KERNEL_FPSTATE Cheers, I'll go in and fix that (so the SHAs will change). > > [3/4] arm64: fpsimd: Implement lazy restore for kernel mode FPSIMD > > https://git.kernel.org/arm64/c/035262623959 > > > > It would be nice to have an Ack from Herbert on the last one so that > > he's aware of the possible conflicts. > > > > The other thing I tangentially wondered about is what happens now if code > > calls uaccess routines (e.g. get_user()) within a kernel_neon_{begin,end} > > section? I think previously the fact that preemption had to be disabled > > would've caused the might_fault() to explode, but now I suppose the BUG_ON() > > in kernel_neon_begin() will save us. Is that right? > > > > Not sure what you mean by 'save us'. Is there anything fundamentally > wrong with doing user access from a kernel mode NEON region if > preemption remains enabled? > > The BUG_ON() will only catch uses from hardirq/NMI context, or cases > where FP/SIMD is not implemented/enabled in the first place so it will > not trigger on a user access. As discussed off-list, the vague concern was if kernel_neon_begin() is nested off the back of a user fault. The BUG_ON() should fire in that case, so we're all good. Thanks! Will