Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1695172imj; Thu, 14 Feb 2019 10:26:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IbUl5PZwOzGoECUSEnUvfOCeJ6yKPYoykEh0QhbSi3XR6BqihB+NgQavHVdE0jErOp3M3EN X-Received: by 2002:a65:5301:: with SMTP id m1mr1147933pgq.90.1550168811724; Thu, 14 Feb 2019 10:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550168811; cv=none; d=google.com; s=arc-20160816; b=dGtLUgCa7BF3BE4vQxo+Oa4mnR9yh1tk1/fYzDQgw88Y8F83EoyOQTKc2WF84JvQq6 /7FykZ37oKZK6hm2ex3Liz9Mo8bsSWdA2+TNyLHQILuCL2T87uw+wzUpif1TJnCVWF7x vewp0oQ3XTIjZVXvLvSdq4LveoHqWlWeE+qXkg5EPF/uB2wnMmluXb46MR0EoRvQXbqI rLC5pXeCq/G8V3VCfszeNcpTLa21bmwVG2ENwWCJnKLpEJM2IDdhdtMicrfVJ+7vnz7Q JPofaIW/bgNG22d2rTJK1SOSQF03riWf+EitxvHmAx8OQYQtsSWZt56A0yRf/i+3sWT6 6YdA== 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:from:references:cc:to:subject; bh=HQUGTVFhhMAygoka3YfsscIaCVoSGhIKyJDNc4fGKnQ=; b=ti948tiQonvS96S5dOnlr3hX6JUCZtxnpagQ4n9W9ORKKdmtb8zXrjl9aqlIQUnpBz NYktj8gJLqJWKRRL//xyNfz93zo1rA3R5x0MvRzojJW0kbQBXZq6IpllOjkobFGh1Z0g nkB6V2fOsTXL7aqJtuieevfQPz4ClrOKLDi01tIh2wn1kjOwy/2d6pE6h7WRUDkk20C/ aaWc66xLrQIFwcWfLhV+iU9hI+Mdsfq2kYla8mCZj39Kzhq8bFKZGc8ODA3hifk95PKz YkNzqO7DTdn35l5PUSVcVM3ilhm7s1GOMoUq72MqED4U2iUyfrNMadWLXgj9qf6cmKGa XyXA== 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 y7si3026733plt.387.2019.02.14.10.26.35; Thu, 14 Feb 2019 10:26:51 -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 S2406749AbfBNKx7 (ORCPT + 99 others); Thu, 14 Feb 2019 05:53:59 -0500 Received: from foss.arm.com ([217.140.101.70]:41284 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbfBNKx6 (ORCPT ); Thu, 14 Feb 2019 05:53:58 -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 82601EBD; Thu, 14 Feb 2019 02:53:58 -0800 (PST) Received: from [10.162.0.144] (a075553-lin.blr.arm.com [10.162.0.144]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AE3423F575; Thu, 14 Feb 2019 02:53:55 -0800 (PST) Subject: Re: [PATCH v5 1/5] arm64: Add utilities to save restore pointer authentication keys To: Kristina Martsenko , James Morse 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> From: Amit Daniel Kachhap Message-ID: <41ab78a2-b2c0-61e9-e582-f2174d4203b5@arm.com> Date: Thu, 14 Feb 2019 16:23:53 +0530 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: Content-Type: text/plain; charset=utf-8; format=flowed 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 Hi, On 2/13/19 11:02 PM, Kristina Martsenko wrote: > 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. I added it to stress on some functions which should be pointer authentication safe. Yes this can be dropped and a small comment may also do. //Amit D > >> >> ('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 >> >