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.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,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 31784C432C0 for ; Thu, 21 Nov 2019 12:15: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 CDBEB2089D for ; Thu, 21 Nov 2019 12:15: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="BqXNGd3o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDBEB2089D 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=ws9Vu3W5upUmhoGZZ8dY2dcCU01lBsbgfwuwcTY5ink=; b=BqXNGd3ood4qVwjjJ7/0sWvVW 8GXRKfbA6Cvaqcm9gg7sImEmIRTnM5XBZRT1ZfoRccynLhNodPalQT8/lM4IJsv2LKS5k70Pl4Gn0 t7UsyGbD0nWJo1KJ33FfB6Xydq2g9wbmr3bn8XhWvTAAmWcYRd0mDEpatuXrrDGOgM5Ocmh5yfge+ wpIOPJ1UW7YiNKhHgaqOI+i+zX0lCzTKMXcjrQ4e2cIVyVjAwMBrvXjtPBh7z5sb2TtpcxsTzn3Hn dfr9Dxkl0YAPKQlvniUkjCgMZFCZ9sUDCM+1BPPjlLyM9++Vks3TJXfRWxFblku1LiDBFbGbFa160 cSEvsJ/UQ==; 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 1iXlNM-0006QX-8e; Thu, 21 Nov 2019 12:15: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 1iXlNJ-0006Q6-89 for linux-arm-kernel@lists.infradead.org; Thu, 21 Nov 2019 12:15: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 14CC8328; Thu, 21 Nov 2019 04:15:50 -0800 (PST) Received: from [10.162.42.107] (a075563-lin.blr.arm.com [10.162.42.107]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C6993F703; Thu, 21 Nov 2019 04:15:45 -0800 (PST) Subject: Re: [PATCH v2 00/14] arm64: return address signing To: Ard Biesheuvel References: <1574166746-27197-1-git-send-email-amit.kachhap@arm.com> From: Amit Kachhap Message-ID: <225e4746-bc53-ff63-b360-264066f338e4@arm.com> Date: Thu, 21 Nov 2019 17:45:43 +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-20191121_041553_331059_B8D81FFB X-CRM114-Status: GOOD ( 19.83 ) 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 , Will Deacon , Kristina Martsenko , James Morse , 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 Hi Ard, On 11/20/19 9:35 PM, Ard Biesheuvel wrote: > On Tue, 19 Nov 2019 at 13:33, Amit Daniel Kachhap wrote: >> >> Hi, >> >> This series improves function return address protection for the arm64 kernel, by >> compiling the kernel with ARMv8.3 Pointer Authentication instructions (referred >> ptrauth hereafter). This should help protect the kernel against attacks using >> return-oriented programming. >> >> This series is based on v5.4-rc8. >> >> High-level changes since v1 [1] (detailed changes are listed in patches): >> - Dropped patch "arm64: cpufeature: handle conflicts based on capability" >> as pointed by Suzuki. >> - Patch 4, 10, 12 and 14 are added newly added. >> - Patch 12 adds support to block probe of authenticate ptrauth instructions. >> - Patch 14 adds support for lkdtm to test ptrauth. >> - In the last version if secondary cpus do have ptrauth and primary cpu do not >> then the secondary will silently disable ptrauth and keep running. This version >> creates panic in this case as suggested by Suzuki. >> - Many suggestion from James implemented. >> >> This series do not implement few things or have known limitations: >> - kdump tool may need some rework to work with ptrauth. >> - Generate/Get some randomness for ptrauth keys during kernel early booting. >> > > Hello Amit, > > As we discussed off line, we still need some place to initialize the > PAC keys for the boot CPU. > > We should follow the same approach as boot_init_stack_canary() is > currently taking: it is called from start_kernel(), never returns, and > it is marked as __always_inline, which means it does not set up a > stack frame and so its return address will not get signed with the > wrong key. > > Something like the below should be acceptable for a generic header > file, and we can wire up kernel PAC in the arm64 version of the > stackprotector.h header whichever way we like. > This seems to be a practical approach. I tested in my local system and it works fine. For few functions before boot_init_stack_canary, it can afford to run without keys as randomization driver is not initialised. Thanks for the pointer. Regards, Amit Daniel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel