Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3323BC432C0 for ; Mon, 25 Nov 2019 11:01:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F3DB72068E for ; Mon, 25 Nov 2019 11:01:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JT+Y0/wX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F3DB72068E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ibwpV31J82q2dGAqqBYoi2ePm27Mqd/X/0K/RzXni6c=; b=JT+Y0/wXOUzqHBvpWcjU6AOe3 xDFjWzGtRLN5HSC9jO+NGnCpIHmDE3F51IwjqaKJ3W24rjvgSo/J5qV6yVGPooXN1xvGC5GVVgwOz FVwjhjb3kfXfP9mUA9ATjsV/v7F5qj7MnFsOybUrDouJeoOkL96iK4rN8blrbf9XCxvjPhfIpKSVB C97gKkUWSLCsmaQJ+jMTMdTfukh9HL7wLEr+UHH/+kWsZ3Bh1NZ+EZBHCVKhXt1XQQxuvMI/rrewl 82SK96TJtp5Zjw05XD+7aOXcrZNjtVc06v9UThS0W4JO4yF9SUMsIly3xaKT0aolyQJbjpxWShUM2 17Vrpmq8g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZC7w-0004Ti-DF; Mon, 25 Nov 2019 11:01:56 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iZC7t-0004TN-HN for linux-arm-kernel@lists.infradead.org; Mon, 25 Nov 2019 11:01:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9CE6731B; Mon, 25 Nov 2019 03:01:52 -0800 (PST) Received: from [10.163.1.198] (unknown [10.163.1.198]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0BB4E3F52E; Mon, 25 Nov 2019 03:01:42 -0800 (PST) Subject: Re: [PATCH v2 07/14] arm64: initialize and switch ptrauth kernel keys To: Ard Biesheuvel References: <1574166746-27197-1-git-send-email-amit.kachhap@arm.com> <1574166746-27197-8-git-send-email-amit.kachhap@arm.com> <432f8082-c34f-8036-8c5e-fd1fcec9aa17@linaro.org> From: Amit Kachhap Message-ID: Date: Mon, 25 Nov 2019 16:31:37 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191125_030153_621370_0EDEB9B9 X-CRM114-Status: GOOD ( 15.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Suzuki K Poulose , Catalin Marinas , Richard Henderson , Will Deacon , James Morse , Kristina Martsenko , Ramana Radhakrishnan , Vincenzo Frascino , Dave Martin , linux-arm-kernel Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 11/25/19 3:09 PM, Ard Biesheuvel wrote: > On Mon, 25 Nov 2019 at 10:34, Amit Kachhap wrote: >> >> >> >> On 11/23/19 12:49 AM, Richard Henderson wrote: >>> On 11/19/19 12:32 PM, Amit Daniel Kachhap wrote: >>>> --- a/arch/arm64/include/asm/asm_pointer_auth.h >>>> +++ b/arch/arm64/include/asm/asm_pointer_auth.h >>>> @@ -35,11 +35,25 @@ alternative_if ARM64_HAS_GENERIC_AUTH >>>> alternative_else_nop_endif >>>> .endm >>>> >>>> + .macro ptrauth_keys_install_kernel tsk, tmp1, tmp2, tmp3 >>>> + mov \tmp1, #THREAD_KEYS_KERNEL >>>> + add \tmp1, \tsk, \tmp1 >>>> +alternative_if ARM64_HAS_ADDRESS_AUTH >>>> + ldp \tmp2, \tmp3, [\tmp1, #PTRAUTH_KERNEL_KEY_APIA] >>>> + msr_s SYS_APIAKEYLO_EL1, \tmp2 >>>> + msr_s SYS_APIAKEYHI_EL1, \tmp3 >>>> + isb >>>> +alternative_else_nop_endif >>>> + .endm >>> >>> Any reason you didn't put the first two insns in the alternative? >> >> Yes these 2 instructions can be moved below. Thanks for the catch. >> > > Do you even need them? Isn't it possible to do > > ldp \tmp1, \tmp2, [\tsk, #(THREAD_KEYS_KERNEL + PTRAUTH_KERNEL_KEY_APIA)] > > ? Or is the range for the offset insufficient? Yes the offset exceeds the maximum range so done this way. > > >>> >>> You could have re-used tmp1 instead of requiring tmp3, but at no point are we >>> lacking tmp registers so it doesn't matter. >>> > > I think we should fix it nonetheless. yes. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel