Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3589432imu; Mon, 10 Dec 2018 04:51:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/VK441HPw2v1NhnrlNglQhgOaEHXqNwJK46IYcFVPL5d2plpd4La3VLNy+KVGuoPl2PdH+s X-Received: by 2002:a63:5c22:: with SMTP id q34mr10666915pgb.417.1544446316059; Mon, 10 Dec 2018 04:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544446316; cv=none; d=google.com; s=arc-20160816; b=ntViAg4Y+/t6H2AOiL8bxtlCF4+Qf3KYhgmRl0rUgUvsFQXS8vRapB4+Rlhg7nCVM8 Daik6RVROwxyepvS3KIOIVmZ3sAjmM/wUwCBeskFPq89YbUsawfgvgH+9gQtoB1cJVOj lG+oPXrc4emM9GAT9TvjXtzVNACCtX2zotKzUENudEfW81H82LqYifqPgJINASw9J4Wi 4FcF5j6FZRRZqsljbTOmO3wLERY+p20hztvdYVZTj6Yq7Blu3Pa/nHvCwvMUq/QVPSHd Hy9x68gA2NeGOSU/bcNgUfdRFfYID9NxJONe9k/QLD0GYhxbifuo31Xnjr8AwtB/NjDa 9SDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CNZx5TJbhov1AwcA8QOmWZ0wREzsYASWRF56J/Vv1os=; b=vTOA1p6HpL+waSBIoaOsTN6do4BPMgKXMublXOMkPZtQoeYiwFpyYnYC2rGEeWb0Ut riJa5YMwekmye5XI/N6FICnhQ5jVA1jMCPdKWPJ8WaPMFgDEPlHFQ/T3a0+a7wpQuou7 5fpnuWg5KbACPHvW7+ytADtirWTOvvPMWrcT/ahOzFEBV1FE7MVX3wa4OdrsiCuNwVQU ROOFwbq6Rx39u0QWVPDeFMLxeZVB1xNEqDESB4NwsRxLFH3654rt4TB8Jlp1EGF69AkY sb+fl63LgsBd1zA/4TwO73dzrHpXRbWJWO1CSbBAFAnHXub6V8aU/HcAzaOI+wI8zyii tyBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b131si9080217pga.51.2018.12.10.04.51.39; Mon, 10 Dec 2018 04:51:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727424AbeLJMDh (ORCPT + 99 others); Mon, 10 Dec 2018 07:03:37 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52498 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbeLJMDh (ORCPT ); Mon, 10 Dec 2018 07:03:37 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC19715AB; Mon, 10 Dec 2018 04:03:36 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 71F693F6A8; Mon, 10 Dec 2018 04:03:33 -0800 (PST) Date: Mon, 10 Dec 2018 12:03:30 +0000 From: Catalin Marinas To: Richard Henderson Cc: Kristina Martsenko , linux-arm-kernel@lists.infradead.org, Mark Rutland , Andrew Jones , Jacob Bramley , Ard Biesheuvel , Marc Zyngier , Adam Wallis , Suzuki K Poulose , Will Deacon , Christoffer Dall , kvmarm@lists.cs.columbia.edu, Cyrill Gorcunov , Ramana Radhakrishnan , Amit Kachhap , Dave P Martin , linux-kernel@vger.kernel.org, Kees Cook , Steve Capper Subject: Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace Message-ID: <20181210120330.GB4048@arrakis.emea.arm.com> References: <20181207183931.4285-1-kristina.martsenko@arm.com> <20181207183931.4285-9-kristina.martsenko@arm.com> 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 09, 2018 at 09:41:31AM -0600, Richard Henderson wrote: > On 12/7/18 12:39 PM, Kristina Martsenko wrote: > > When pointer authentication is in use, data/instruction pointers have a > > number of PAC bits inserted into them. The number and position of these > > bits depends on the configured TCR_ELx.TxSZ and whether tagging is > > enabled. ARMv8.3 allows tagging to differ for instruction and data > > pointers. > > At this point I think it's worth starting a discussion about pointer tagging, > and how we can make it controllable and not mandatory. > > With this patch set, we are enabling 7 authentication bits: [54:48]. > > However, it won't be too long before someone implements support for > ARMv8.2-LVA, at which point, without changes to mandatory pointer tagging, we > will only have 3 authentication bits: [54:52]. This seems useless and easily > brute-force-able. Such support is already here (about to be queued): https://lore.kernel.org/linux-arm-kernel/20181206225042.11548-1-steve.capper@arm.com/ > I assume that pointer tagging is primarily used by Android, since I'm not aware > of anything else that uses it at all. I would expect it to be enabled more widely (Linux distros), though only the support for instructions currently in the NOP space. > Unfortunately, there is no obvious path to making this optional that does not > break compatibility with Documentation/arm64/tagged-pointers.txt. There is also the ARMv8.5 MTE (memory tagging) which relies on tagged pointers. > I've been thinking that there ought to be some sort of global setting, akin to > /proc/sys/kernel/randomize_va_space, as well as a prctl which an application > could use to selectively enable TBI/TBID for an application that actually uses > tagging. An alternative would be to allow the opt-in to 52-bit VA, leaving it at 48-bit by default. However, it has the problem of changing the PAC size and not being able to return. > The global /proc setting allows the default to remain 1, which would let any > application using tagging to continue working. If there are none, the sysadmin > can set the default to 0. Going forward, applications could be updated to use > the prctl, allowing more systems to set the default to 0. > > FWIW, pointer authentication continues to work when enabling TBI, but not the > other way around. Thus the prctl could be used to enable TBI at any point, but > if libc is built with PAuth, there's no way to turn it back off again. This may work but, as you said, TBI is user ABI at this point, we can't take it away now (at the time we didn't forsee the pauth). Talking briefly with Will/Kristina/Mark, I think the best option is to make 52-bit VA default off in the kernel config. Whoever needs it enabled (enterprise systems) should be aware of the reduced PAC bits. I don't really think we have a better solution. -- Catalin