Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1955002imm; Tue, 22 May 2018 12:06:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo9x+D7XiNSJY+Iw//YZ4zDgMh6zvULCCX0LUgw0Wi8pcKVzrOgbefS5LGFjk7y79St2il9 X-Received: by 2002:a17:902:680c:: with SMTP id h12-v6mr26500375plk.113.1527016016490; Tue, 22 May 2018 12:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527016016; cv=none; d=google.com; s=arc-20160816; b=jPFG1T4G49wsseqqhnP3kZe3mX9H5jWxwPn8p7cCHGqs/X9rOtAdZ6dmLFQwJEqpDA wObJUH3x6wsARWKgNTYBoo+q7KcgaRcfprBkcbt2USImHNnB2SGJqtXi20vIXLXpUMWt 7XUKRYIBK9CIgulLyEjv7eVycA0hD3Bj/zTA2mq9vjKILKzVtcRyb4nbVgRLOOJNcTKR HJ39Q978dCxyPUXivGOAL8dXIQO6agRPw8rmFEh4rN7LNodWyCXwuiy0OTivnhhPGCrX UrqPAnIfypJCGI8Ga07KipAkJ8tj/Xyf+TKPY25sHWBiy9HXNsAdLa7KMsId7fE4+DDX W7hw== 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:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=0ETQ2Npxd0mBLsTlom9U5B0gnyqRw8SA1qoKCbwo/xU=; b=weGY138dxBZzjFNmpLvUlOJyoJt/19siPwpkWozxum97wsu1nDneCP2qkQKnRXT0MG qwuRORTeTmx4jjh7jQ+DVsOfryqI7IeXIqV3IHcoRGr7+lcYKGfcl1C9wSO7zu3smzE7 CfLwuZMZnQYKIirxL22tTUaaMgTAniSd0QIN1y07XeddT6ab96GQEBK3zuzgdiLIfDch NOyWPbRgouKUV2qebOQM5ekVVO6RuupEmnq5ffLcRqv52gQzHIjvxeWeSWch6Bb6PdCu Ca4lOfAs6wpJkKg4WcI3BVys63CbyzDwUsdeWWmY3MZcGeC6FCtO/rjnYLdDgQc0rD8n wuyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=P7dAHb+M; dkim=pass header.i=@codeaurora.org header.s=default header.b=YSkef0qE; 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 u6-v6si10943281pgo.144.2018.05.22.12.06.41; Tue, 22 May 2018 12:06:56 -0700 (PDT) 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=@codeaurora.org header.s=default header.b=P7dAHb+M; dkim=pass header.i=@codeaurora.org header.s=default header.b=YSkef0qE; 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 S1751813AbeEVTG2 (ORCPT + 99 others); Tue, 22 May 2018 15:06:28 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:35130 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751687AbeEVTGZ (ORCPT ); Tue, 22 May 2018 15:06:25 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 35429601D7; Tue, 22 May 2018 19:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527015985; bh=v+JdfN40vPFidVtl1SXDX988xzXTOx9k6IT6YL35clM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=P7dAHb+Mi2XyKz9pLCZAW935seito92FX8HVH/fOrkKd5aERKPjuhy+TxGNWMC4Po fC8oB/un9hhz8lD54TAukvHak6oTaz8V3V9vU6IBxtQCl75yjF8aWwhuLV2pQp/4bd ADbavX52qDULL+mbv6WPopoglxQ8nXh8T2v0QK3k= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.86.184] (unknown [98.29.208.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: awallis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BCCB4601D7; Tue, 22 May 2018 19:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527015984; bh=v+JdfN40vPFidVtl1SXDX988xzXTOx9k6IT6YL35clM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=YSkef0qEauYO7JClJ02x54KxcUU2KArjJiFlka19z1iYeCDQ9wxHXSJIT423e/1iL 38eIOI9k/vi8LeOQ80E2fPVhwZDwfcYDeBmwk8ZU6YccttlW3qJrq5JXfHcDH728fw uh5Cp0wR/RonIdx2s85kcnMBhpli7kafJ++xYWlY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BCCB4601D7 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=awallis@codeaurora.org Subject: Re: [PATCHv2 06/12] arm64: add basic pointer authentication support To: Mark Rutland , linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, catalin.marinas@arm.com, cdall@linaro.org, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, marc.zyngier@arm.com, suzuki.poulose@arm.com, will.deacon@arm.com, yao.qi@arm.com, kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org References: <20171127163806.31435-1-mark.rutland@arm.com> <20171127163806.31435-7-mark.rutland@arm.com> From: Adam Wallis Message-ID: Date: Tue, 22 May 2018 15:06:21 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20171127163806.31435-7-mark.rutland@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 11/27/2017 11:38 AM, Mark Rutland wrote: > This patch adds basic support for pointer authentication, allowing > userspace to make use of APIAKey. The kernel maintains an APIAKey value > for each process (shared by all threads within), which is initialised to > a random value at exec() time. > > To describe that address authentication instructions are available, the > ID_AA64ISAR0.{APA,API} fields are exposed to userspace. A new hwcap, > APIA, is added to describe that the kernel manages APIAKey. > > Instructions using other keys (APIBKey, APDAKey, APDBKey) are disabled, > and will behave as NOPs. These may be made use of in future patches. > > No support is added for the generic key (APGAKey), though this cannot be > trapped or made to behave as a NOP. Its presence is not advertised with > a hwcap. > > Signed-off-by: Mark Rutland > Cc: Catalin Marinas > Cc: Suzuki K Poulose > Cc: Will Deacon > --- > arch/arm64/include/asm/mmu.h | 5 ++ > arch/arm64/include/asm/mmu_context.h | 25 +++++++++- > arch/arm64/include/asm/pointer_auth.h | 89 +++++++++++++++++++++++++++++++++++ > arch/arm64/include/uapi/asm/hwcap.h | 1 + > arch/arm64/kernel/cpufeature.c | 17 ++++++- > arch/arm64/kernel/cpuinfo.c | 1 + > 6 files changed, 134 insertions(+), 4 deletions(-) > create mode 100644 arch/arm64/include/asm/pointer_auth.h Mark, I was able to verify that a buffer overflow exploit results in a segfault with these PAC patches. When I compile the same binary without "-msign-return-address=none", I am able to successfully overflow the stack and execute malicious code. Thanks Adam Tested-by: Adam Wallis -- Adam Wallis Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.