Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2681234imu; Sun, 9 Dec 2018 07:04:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+NOPbCBh23aOCphGmFgaoVLsFTEcm2TkY1EdX3fVs5qgUCvgIDUd2vl8spTM4M9CTBUFk X-Received: by 2002:a63:fe48:: with SMTP id x8mr8111602pgj.261.1544367895967; Sun, 09 Dec 2018 07:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544367895; cv=none; d=google.com; s=arc-20160816; b=wPVjq3tYLLgSQMI1VQ8JGPuNRzFGei1mdKkrFNfJU4vNzbjPE9RZmwYD7imjbw3BHf NyAhsyWAA9ufw90N31S6Cd2bt0MD100x/T6+hRljnbBIn/2y6vO0B6JdZCBIXGevuxjt dECP5samO7sDQ5EjN9+tF2VSIvye/Ly1dPKX+z12qfmUvTKWm2errrPadj4F4TrhdiPs AUpuC5ivCsMPA8w15Ce1K2m2Haye3H1pi/87bhN8gXUyoOw/2ALuiNYXsdqMIFQRuqee gIiL8BCg4TSooAeeV0Z98nzzpTURRbPGetQT09xX8cfh0f0XDjXfF6/eC1BmlSV0cxp2 NZrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject:dkim-signature; bh=6wAro+aQhZQfz7d2P5D1XHhlS8lnf90w3dPGgeqlEDM=; b=LVFDEBTCUcjvpzt/p97QHlUrsQ9ex2IV7DOlhJ6xQ6rLPRjo3aNVV+xEOvMb4VM6zz zagdZp9NS1gzM9qHkogCcxJMB+4+5SrJnOJ4iXEf03LE3AntkHBHMARRqbNVo6M07c4+ K0Ygo9tksGcQAmNuV/rtYark3gLcLvD+gI7AHWtoBikKWWC0yK4QeenmrM4gi0CuLGKn NffmnZ2lPfPq6S60Et1trhM8KGz04L0NjCgkQqkvKyBKir+dF0lASXT5WEChY43kfSOq 4KeetNpEiefBJfj2fnPnVHwbMJ817Dw1c6zTn+XO1zVxA/rxSz+LP1EO2xQS3KBnbDVC pr4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kMkXSqWg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d69si7660672pga.184.2018.12.09.07.04.39; Sun, 09 Dec 2018 07:04:55 -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; dkim=pass header.i=@linaro.org header.s=google header.b=kMkXSqWg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726261AbeLIPEB (ORCPT + 99 others); Sun, 9 Dec 2018 10:04:01 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:40039 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbeLIPEB (ORCPT ); Sun, 9 Dec 2018 10:04:01 -0500 Received: by mail-oi1-f193.google.com with SMTP id t204so7045796oie.7 for ; Sun, 09 Dec 2018 07:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6wAro+aQhZQfz7d2P5D1XHhlS8lnf90w3dPGgeqlEDM=; b=kMkXSqWgHQuo0bBX8k6M+WmACOk4S/y836UcpbETC1siw5Gvz4lYQC1WoH1Q6WqPt3 gMeS2C2ABBNR0lwuIrQpErrPhXKtUDW8q4hWY1DSUj+Sc3lIs0fGlxpTfSw5DwoT2Tb+ yRz3I6oahNSSReMM8oxQKpFLlt224lNPCRvPU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6wAro+aQhZQfz7d2P5D1XHhlS8lnf90w3dPGgeqlEDM=; b=VfoHVH7bgGg+Rg1FqOHnCG6t6RerKCwxteDgDdEMhW5oygbZrHGhDU9is9I+s1KvuK qDhGFpWYi2QDwwSSf+Lx5V0N6TIJMTIEYc930uUkw3FFvwNpiXrkQqnv4uphCDBfeSI8 zHyaNeJ5I4asbKAjHKT1bhslXkPwsLj6LMtl4Mi0Wllu1WKneqMhEZHfckIuRkDM7JmO wZdHS7FioMXFqR8Zfjode0DG83yIi7Ci4WL7UkvsFp+BrUpDV6WM2/dgqmuOrvNTDeSj 2+IESj/OQisFaY6lmZq0VBfbXj68eIZy6QtoRjUnTwd5ZYqWBsPY95vO1st5RTODTbYm 5ZcQ== X-Gm-Message-State: AA+aEWZ3twsuyT3bWzaCYiQB3Pq3/Q7+kzFNuZnZX1XuIfKBdemoKZKZ lLL5wTjaJP8/G5VDiF1V7/cRniDtc7gvhQ== X-Received: by 2002:aca:a90f:: with SMTP id s15mr5698057oie.137.1544367839569; Sun, 09 Dec 2018 07:03:59 -0800 (PST) Received: from cloudburst.twiddle.net ([187.217.227.243]) by smtp.gmail.com with ESMTPSA id z191sm5945690oig.3.2018.12.09.07.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Dec 2018 07:03:58 -0800 (PST) Subject: Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace To: Kristina Martsenko , linux-arm-kernel@lists.infradead.org Cc: Adam Wallis , Amit Kachhap , Andrew Jones , Ard Biesheuvel , Catalin Marinas , Christoffer Dall , Cyrill Gorcunov , Dave P Martin , Jacob Bramley , Kees Cook , Marc Zyngier , Mark Rutland , Ramana Radhakrishnan , Suzuki K Poulose , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org References: <20181207183931.4285-1-kristina.martsenko@arm.com> <20181207183931.4285-9-kristina.martsenko@arm.com> From: Richard Henderson Openpgp: preference=signencrypt Message-ID: <2957cf52-498d-ba62-3be7-33c2e9a2f518@linaro.org> Date: Sun, 9 Dec 2018 09:03:55 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181207183931.4285-9-kristina.martsenko@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/7/18 12:39 PM, Kristina Martsenko wrote: > From: Mark Rutland > > 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. > > For userspace debuggers to unwind the stack and/or to follow pointer > chains, they need to be able to remove the PAC bits before attempting to > use a pointer. > > This patch adds a new structure with masks describing the location of > the PAC bits in userspace instruction and data pointers (i.e. those > addressable via TTBR0), which userspace can query via PTRACE_GETREGSET. > By clearing these bits from pointers (and replacing them with the value > of bit 55), userspace can acquire the PAC-less versions. > > This new regset is exposed when the kernel is built with (user) pointer > authentication support, and the address authentication feature is > enabled. Otherwise, the regset is hidden. > > Signed-off-by: Mark Rutland > Signed-off-by: Kristina Martsenko > Cc: Catalin Marinas > Cc: Ramana Radhakrishnan > Cc: Will Deacon > --- > arch/arm64/include/asm/pointer_auth.h | 8 ++++++++ > arch/arm64/include/uapi/asm/ptrace.h | 7 +++++++ > arch/arm64/kernel/ptrace.c | 38 +++++++++++++++++++++++++++++++++++ > include/uapi/linux/elf.h | 1 + > 4 files changed, 54 insertions(+) Reviewed-by: Richard Henderson r~