Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp307176pxu; Thu, 3 Dec 2020 00:09:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqUnrW9fHPtoWOGozakK821L2JhOPSH0Tjn5jztKSww3AvhSmiWGnf3ggEnZaVBTpSyMD2 X-Received: by 2002:a50:d886:: with SMTP id p6mr1813521edj.366.1606982952245; Thu, 03 Dec 2020 00:09:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606982952; cv=none; d=google.com; s=arc-20160816; b=c8j1JuH7JX4VsFOzRIscw4Nbkfbx5pnhKWhwUXmkB+UWKdnCmR0no02XgzfUkZBTcF nillodKB8kr5RssSQwt21FkssHG1v3ms3H1R1mbdIw7rgUmGhfDxpCmngh1foTHhjNuJ G8HTIMDC84qi63bIPwPogV0n5+xSszWg02a9hEEVCNcx8MsOjc0fMRYcmM1zbRJ+Hjzt wZ9mrNy6x0E4glSvGpWvPeNPoYBGkiZFlu8erLnqjIX21rSLhFYknEi5pf/SJN51+8c7 4kNLCiCx6i9xVgSKFt4Ttte+d97Ifu3yrIvuFG6cN0KIyWpLcpDcA1McWyDs9hY6p5q2 lItw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=O9n4/oTxIhX8kHwY/oqjrF0HD8L5ra/yVKDq4j9gWME=; b=b7KGwwufFYRvL78aPxpsdvgFz2MysjxxK51Lfx+qqiRu9e5/6wUwkC6kGgctx4FeAL sP6mSX+kWOjhVHX9pW5BRSFYpLZl+SYL1gUBuFjDEFGZWSpow1qcEeSIYwijjlK0Z0ce HIez1RQyvy1pXht4KswoZ38ACtanNMIOxakUiT0SEzs6ZTTgcbnUFoukWX/GOIovCShF YVdPjy++akM/7nk2ZGTcKVfqHg3MPUeTa1ZTgTxlCBeX/w6eCMwiqMs5RhsO5TRjMEHY 8d4mngUbzHumbS6d7/8YyswM1khy1LPEk08DrUIDDfifTiOEjr6ax81ogEYAI2nLnhou jAEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=K4CcJweM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr6si777723ejc.319.2020.12.03.00.08.49; Thu, 03 Dec 2020 00:09:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=K4CcJweM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729896AbgLCIGr (ORCPT + 99 others); Thu, 3 Dec 2020 03:06:47 -0500 Received: from ozlabs.org ([203.11.71.1]:34547 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387609AbgLCIGq (ORCPT ); Thu, 3 Dec 2020 03:06:46 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4CmpLg21srz9s0b; Thu, 3 Dec 2020 19:06:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1606982763; bh=xGYzUa8N9aV4gF00C4v79MReDpaoluhaxU2yKgsMMdc=; h=Date:From:To:Cc:Subject:From; b=K4CcJweMlGN9NvMrN8jajo6OuLZPcmlqkgdpj7//BMDN9sSUL49UFISsUVF2JcEHE LdOj3Tl1OprG/k8EqNZEoo9sY8RRZNnIzebZPYlcTBO1E/DxlTGj98LfZ30aunC8t5 /PVdeQFGTaTiq0kUWfiuQJc6ha4oMdwaSOM/JklwiHpN6bx44jBpoOQRPhA5i5cugp 8wtIAz2VfK+BsT/dR+zd1nQxpMoqXQPkmmRIU0J4lzURfVwqwxDkPv0Pixmea+/e1g XtluPI3q0eLdet8rZKZW4s/MS60jHfeif8AAiWdlMvj0EnFn2CESoNu4sBULSbwXSk 4lOdufy0XaAKg== Date: Thu, 3 Dec 2020 19:06:01 +1100 From: Stephen Rothwell To: Andrew Morton , Catalin Marinas , Will Deacon Cc: Andrey Konovalov , Linux Kernel Mailing List , Linux Next Mailing List , Mark Rutland , Vincenzo Frascino Subject: linux-next: manual merge of the akpm-current tree with the arm64 tree Message-ID: <20201203190426.5a2cc067@canb.auug.org.au> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/3rzT+mr9BPpMcHeNjiP8dJL"; protocol="application/pgp-signature"; micalg=pgp-sha256 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/3rzT+mr9BPpMcHeNjiP8dJL Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi all, Today's linux-next merge of the akpm-current tree got a conflict in: arch/arm64/include/asm/uaccess.h between commits: 923e1e7d8223 ("arm64: uaccess: rename privileged uaccess routines") 7cf283c7bd62 ("arm64: uaccess: remove redundant PAN toggling") from the arm64 tree and commit: 9bc0016cc21a ("arm64: mte: add in-kernel tag fault handler") from the akpm-current tree. I fixed it up (as specified by Catalin (thanks) see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. --=20 Cheers, Stephen Rothwell diff --cc arch/arm64/include/asm/uaccess.h index d841a560fae7,abb31aa1f8ca..000000000000 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@@ -186,64 -159,20 +159,43 @@@ static inline void __uaccess_enable_hw_ CONFIG_ARM64_PAN)); } =20 - #define __uaccess_disable(alt) \ - do { \ - if (!uaccess_ttbr0_disable()) \ - asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), alt, \ - CONFIG_ARM64_PAN)); \ - } while (0) -=20 - #define __uaccess_enable(alt) \ - do { \ - if (!uaccess_ttbr0_enable()) \ - asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), alt, \ - CONFIG_ARM64_PAN)); \ - } while (0) -=20 +/* + * The Tag Check Flag (TCF) mode for MTE is per EL, hence TCF0 + * affects EL0 and TCF affects EL1 irrespective of which TTBR is + * used. + * The kernel accesses TTBR0 usually with LDTR/STTR instructions + * when UAO is available, so these would act as EL0 accesses using + * TCF0. + * However futex.h code uses exclusives which would be executed as + * EL1, this can potentially cause a tag check fault even if the + * user disables TCF0. + * + * To address the problem we set the PSTATE.TCO bit in uaccess_enable() + * and reset it in uaccess_disable(). + * + * The Tag check override (TCO) bit disables temporarily the tag checking + * preventing the issue. + */ - static inline void uaccess_disable(void) + static inline void uaccess_disable_privileged(void) { + asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(0), + ARM64_MTE, CONFIG_KASAN_HW_TAGS)); + - __uaccess_disable(ARM64_HAS_PAN); + if (uaccess_ttbr0_disable()) + return; +=20 + __uaccess_enable_hw_pan(); } =20 - static inline void uaccess_enable(void) + static inline void uaccess_enable_privileged(void) { + asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1), + ARM64_MTE, CONFIG_KASAN_HW_TAGS)); + - __uaccess_enable(ARM64_HAS_PAN); - } -=20 - /* - * These functions are no-ops when UAO is present. - */ - static inline void uaccess_disable_not_uao(void) - { - __uaccess_disable(ARM64_ALT_PAN_NOT_UAO); - } + if (uaccess_ttbr0_enable()) + return; =20 - static inline void uaccess_enable_not_uao(void) - { - __uaccess_enable(ARM64_ALT_PAN_NOT_UAO); + __uaccess_disable_hw_pan(); } =20 /* --Sig_/3rzT+mr9BPpMcHeNjiP8dJL Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAl/InGkACgkQAVBC80lX 0Gxzdwf9GANeltJT1osZOEfCQJKiPr1joH9pI5wkbid6kHvhgQEh5+WBwcnOEDkr ds+Zm2632L7Vs8hpkbRmfCpmicJLFhUc+PwzA1QT/lfz6lCQ3QyqZbtbgXZyBP+Z QsfnKEkhdPknJrzqKlp3HSbEMnVbEJLTopBN5VT+hIOT985MsxQB5V99UJDzPdeF yLh4g/zbzqo4/EjJ/Ky3YoQavJGHSdB2h+SzmvchJ0KwRYAEYDkSbduJGMyvRXJZ EqEe63fGUk7HgdHYDJYJbhm2g9cdPZkq8O8Q/bHRmF8OjIiZSKR8ePs6mURr6YW5 8Tluxg2mkO1YJEhAU1qeVwgHy6gVwA== =VwDD -----END PGP SIGNATURE----- --Sig_/3rzT+mr9BPpMcHeNjiP8dJL--