Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp657588imj; Wed, 13 Feb 2019 15:07:54 -0800 (PST) X-Google-Smtp-Source: AHgI3Iakee6gl95aezlvVMkjTAu4NxHFT6r0YGTw3/+dCpY9hnATQxQQIxiEafJj6Ce2EIP4RoWx X-Received: by 2002:a62:e086:: with SMTP id d6mr619014pfm.247.1550099274655; Wed, 13 Feb 2019 15:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550099274; cv=none; d=google.com; s=arc-20160816; b=xyOGcKoj5YuBIWOyGIytK7kmagRBH1k/GeBxrvl2gvZJ5h5sTzyd5FGklf7csgGUoi dAc8qPRJYDBWmPFxmrzJ72VMIs/eFygEN3SYUKKW3WJX3b3CknSTspIggyz5YrWnOYc2 kEL9ksjQY/V9PxLKLL7sVXuvLsYRWgJ0osdnvZf2KC/CEkBuipQIN9cnnoDLIIx8wukD BKVPbS1pmIOWqid4mqU3AEf5ULd0nJORXkoX5COt9W2YuJR85XcJ5/ysXUddGvVOTTME l3zZRhoASM//0tRZvMVvgV56ZDc6Zl1hp2XxNo1q/SQIIv2UXcMaF/5YhDznsZ/dckyh 7TGA== 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:references:cc:to:subject:from; bh=DT1hMB8Yhjx9g7UEr+5CBn2aiwHq9V7/XVz+pOEwwfA=; b=YUOiAsKd1MV5Ivv7pTQYqD0ER2A7vq39DCfdiIusIJYBKMFrw2CNjV4zfPn4/KwSiD qdNLKPnE+tDhtnsbZNZkJdeb4BTJ/Z7X5Ms9vpn1mZESY8s+STlakv6i6L3JCFr3TAgJ XoBuxde4E1ovtXm7t7FtMhDaabG2YsL4cXagPdUnkmzpTmHiTzLUauX0w+UbiZA1orbH J1sYEoDRS/OFivDJsQcfgFqHkgtNHtc4KSF3lx668XDzuUrsUOU6tfwh/DsuLZP26CeT DL8HuJvTIyPsHmUdWHd5ZE/6mUhzO5gJO5y03INkTAMrjynwO9kmJlcCdH8m1R4zoaj/ rNfA== 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 a11si667544pla.20.2019.02.13.15.07.38; Wed, 13 Feb 2019 15:07:54 -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 S2393069AbfBMRcl (ORCPT + 99 others); Wed, 13 Feb 2019 12:32:41 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57814 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390079AbfBMRcl (ORCPT ); Wed, 13 Feb 2019 12:32:41 -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 9E10DA78; Wed, 13 Feb 2019 09:32:40 -0800 (PST) Received: from [10.1.197.21] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D81F63F675; Wed, 13 Feb 2019 09:32:38 -0800 (PST) From: Kristina Martsenko Subject: Re: [PATCH v5 1/5] arm64: Add utilities to save restore pointer authentication keys To: James Morse , Amit Daniel Kachhap Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu, Ramana Radhakrishnan , Dave Martin , linux-kernel@vger.kernel.org References: <1548658727-14271-1-git-send-email-amit.kachhap@arm.com> <1548658727-14271-2-git-send-email-amit.kachhap@arm.com> <88ccd568-f027-6cdf-b4f1-6709d76102c1@arm.com> Message-ID: Date: Wed, 13 Feb 2019 17:32:37 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <88ccd568-f027-6cdf-b4f1-6709d76102c1@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 31/01/2019 16:20, James Morse wrote: > Hi Amit, > > On 28/01/2019 06:58, Amit Daniel Kachhap wrote: >> The keys can be switched either inside an assembly or such >> functions which do not have pointer authentication checks, so a GCC >> attribute is added to enable it. >> >> A function ptrauth_keys_store is added which is similar to existing >> function ptrauth_keys_switch but saves the key values in memory. >> This may be useful for save/restore scenarios when CPU changes >> privilege levels, suspend/resume etc. > > >> diff --git a/arch/arm64/include/asm/pointer_auth.h b/arch/arm64/include/asm/pointer_auth.h >> index 15d4951..98441ce 100644 >> --- a/arch/arm64/include/asm/pointer_auth.h >> +++ b/arch/arm64/include/asm/pointer_auth.h >> @@ -11,6 +11,13 @@ >> >> #ifdef CONFIG_ARM64_PTR_AUTH >> /* >> + * Compile the function without pointer authentication instructions. This >> + * allows pointer authentication to be enabled/disabled within the function >> + * (but leaves the function unprotected by pointer authentication). >> + */ >> +#define __no_ptrauth __attribute__((target("sign-return-address=none"))) > > The documentation[0] for this says 'none' is the default. Will this only > take-effect once the kernel supports pointer-auth for the host? (Is this just > documentation until then?) Yes, I don't think this should be in this series, since we're not building the kernel with pointer auth yet. > > ('noptrauth' would fit with 'notrace' slightly better) (But worse with e.g. __noreturn, __notrace_funcgraph, __init, __always_inline, __exception. Not sure what the pattern is. Would __noptrauth be better?) Thanks, Kristina > > [0] > https://gcc.gnu.org/onlinedocs/gcc/AArch64-Function-Attributes.html#AArch64-Function-Attributes >