From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 520EDC2D0DB for ; Mon, 20 Jan 2020 14:20:34 +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 206C320678 for ; Mon, 20 Jan 2020 14:20:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Qyc6grhF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 206C320678 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=AHExfEIdeVOtkyIMhnI1WOmTzRI90PITAmNokdT1p2A=; b=Qyc6grhFdMx9FFkqPeijJoWSU YwNWbu9fw8v8VTLVXe/5LD4QRXU1NXqL8Rp3cPOTDDWGxJOu3/gRBFony8KbzjH4q/h4sa+8IU8ew uU3JOaTlVkINaA2B9nlGCtHmf2TxhZ99we0HuAk+jT/dsVD9mYNv3rDi2i/trR/3cAOn7PVOHt02A Xqq+V8R86U+55FLigp5bdXyTdLIfLkzn32xTWR2CmrWArPdRvoKWEra2arIKwsxIqmFfKgNd8AmiD Zul5t+4gKdObcWG8LcVL5OiOKUUHXuIFPB3b4YXxFqpk2UT5Wj1mcNbabUBFzDOjLZ5/M/5Wt3oqu F4ok7vAIA==; 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 1itXup-0002EL-4D; Mon, 20 Jan 2020 14:20:31 +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 1itXuf-0002D4-Lv for linux-arm-kernel@lists.infradead.org; Mon, 20 Jan 2020 14:20:27 +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 B49E730E; Mon, 20 Jan 2020 06:20:20 -0800 (PST) Received: from [10.1.37.58] (a075563-lin.cambridge.arm.com [10.1.37.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A36593F52E; Mon, 20 Jan 2020 06:20:18 -0800 (PST) Subject: Re: [PATCH v3 09/16] arm64: mask PAC bits of __builtin_return_address To: Catalin Marinas References: <1576486038-9899-1-git-send-email-amit.kachhap@arm.com> <1576486038-9899-10-git-send-email-amit.kachhap@arm.com> <20200117101432.GA26090@arrakis.emea.arm.com> From: Amit Kachhap Message-ID: <1735949f-a8c2-4cb5-d7e7-63efcfd4e96c@arm.com> Date: Mon, 20 Jan 2020 14:20:17 +0000 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: <20200117101432.GA26090@arrakis.emea.arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200120_062021_760427_FDCF0183 X-CRM114-Status: GOOD ( 18.43 ) 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 , Ard Biesheuvel , Richard Henderson , Kristina Martsenko , James Morse , Ramana Radhakrishnan , Mark Brown , Vincenzo Frascino , Will Deacon , Dave Martin , linux-arm-kernel@lists.infradead.org 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 1/17/20 10:14 AM, Catalin Marinas wrote: > On Mon, Dec 16, 2019 at 02:17:11PM +0530, Amit Daniel Kachhap wrote: >> diff --git a/arch/arm64/include/asm/compiler.h b/arch/arm64/include/asm/compiler.h >> new file mode 100644 >> index 0000000..3cb06f9 >> --- /dev/null >> +++ b/arch/arm64/include/asm/compiler.h >> @@ -0,0 +1,20 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +#ifndef __ASM_COMPILER_H >> +#define __ASM_COMPILER_H >> + >> +#if defined(CONFIG_ARM64_PTR_AUTH) >> + >> +/* >> + * The EL0/EL1 pointer bits used by a pointer authentication code. >> + * This is dependent on TBI0/TBI1 being enabled, or bits 63:56 would also apply. >> + */ >> +#define ptrauth_user_pac_mask() GENMASK_ULL(54, vabits_actual) > > That's the current behaviour but I guess we could extend the mask to 63 > here without breaking anything since we don't expect instruction > addresses to be tagged. I also think we should turn TCR_EL1.TBID0 on > when we have PAC present (in a separate patch for both the mask change > and the TCR_EL1 bit as this may be slightly more controversial, a > theoretical ABI change). ok. For this there has to be 2 mask then as ptrace passes both the masks to user. #define ptrauth_user_ins_pac_mask() GENMASK_ULL(63, vabits_actual) #define ptrauth_user_data_pac_mask() GENMASK_ULL(54, vabits_actual) > >> +#define ptrauth_kernel_pac_mask() (GENMASK_ULL(63, 56) | GENMASK_ULL(54, VA_BITS)) > > I think the kernel mask should be GENMASK_ULL(63, vabits_actual), no > need to skip bit 55 since it's 1 already. > > With regards to VA_BITS (a constant), I'm not sure that's correct. > ARMv8.2-LVA (52-bit VA) is an optional feature and I don't think PAC in > 8.3 mandates it. yes. Thanks for the correction. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel