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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E97C0C433ED for ; Thu, 20 May 2021 16:00:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7E646124C for ; Thu, 20 May 2021 16:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233399AbhETQCK (ORCPT ); Thu, 20 May 2021 12:02:10 -0400 Received: from foss.arm.com ([217.140.110.172]:54638 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233386AbhETQCB (ORCPT ); Thu, 20 May 2021 12:02:01 -0400 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 46DCF31B; Thu, 20 May 2021 09:00:40 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.7.235]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 91C573F73B; Thu, 20 May 2021 09:00:38 -0700 (PDT) Date: Thu, 20 May 2021 17:00:35 +0100 From: Mark Rutland To: Derrick McKee Cc: Nathan.Burow@ll.mit.edu, Yianni Giannaris , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Ensure kernel AI key is not changed on fork Message-ID: <20210520160035.GP17233@C02TD0UTHF1T.local> References: <20210430150438.GA57205@C02TD0UTHF1T.local> <20210520151854.3632129-1-derrick.mckee@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210520151854.3632129-1-derrick.mckee@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 20, 2021 at 11:18:54AM -0400, Derrick McKee wrote: > The kernel uses the IA key for PAC signing, > and this key should remain unchanged from the kernel point of view. > This patch ensures that the IA key remains constant on fork, > if it has been previously set. > The software is provided on an as-is basis. > > Signed-off-by: Derrick McKee > Signed-off-by: Yianni Giannaris On the kernel side, we use a unique IA key per kernel thread, and while this must remain the same *for that kernel thread*, the kernel IA key should differ across kernel threads when a fork() occurs. I think you're trying to use the keys in a different way than upstream intends to, and we do not need this change as-is. So NAK to this patch as it stands. Thanks, Mark. > --- > arch/arm64/include/asm/pointer_auth.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/include/asm/pointer_auth.h b/arch/arm64/include/asm/pointer_auth.h > index d50416be99be..9748413e72fd 100644 > --- a/arch/arm64/include/asm/pointer_auth.h > +++ b/arch/arm64/include/asm/pointer_auth.h > @@ -69,10 +69,13 @@ static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys) > ptrauth_keys_install_user(keys); > } > > -static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel *keys) > +static __always_inline void > +ptrauth_keys_init_kernel(struct ptrauth_keys_kernel *keys) > { > - if (system_supports_address_auth()) > - get_random_bytes(&keys->apia, sizeof(keys->apia)); > + if (keys->apia.lo == 0 && keys->apia.hi == 0) { > + if (system_supports_address_auth()) > + get_random_bytes(&keys->apia, sizeof(keys->apia)); > + } > } > > static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kernel *keys) > -- > 2.31.1 > 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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D1AA9C433B4 for ; Thu, 20 May 2021 16:04:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 9A9FC610CC for ; Thu, 20 May 2021 16:04:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A9FC610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hMuQIr5aKaOSaHw1ZKZ2c0SLVdtlbBvm2Kk/KaEZ8LQ=; b=qTxWP7WudLH8aWysdvZT/Oszbo 2RwFI/IGggkjOId6zEvwfyEdEXPcdHS89W4B6BYfpL/2iAtY10CdRzWuRyg0Ps2FYMVHrR9lybMlx 4q3Zdml/h5GNrlOw5HIXMK7Mce24KGeMTjLr8TVU4chX2qqqcjbizIPb53AugHkq6kf8/okNv0SKg pgp5hZPGKTESl+yzCkuyMp6CDAkiZwM0knRuncWi+xcqdzkmPQD5d0ae56YsUsGqEe95f1wvS0wnQ etQu8/xy7lMWHdw+sadEwKT1sK7aD0zFqdvdl2D/MdLNlL+J9Pz029OjRLqj+3ejevBOZuFoK0QIA SkWTpNzw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljl8W-001qHM-He; Thu, 20 May 2021 16:03:00 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ljl6L-001pWd-Qe for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 16:00:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bb7oF73nxciOZ0M5fvxlh/sG9ASLqtipkfsZGoLJPcw=; b=zNfIKxPnVQW8aYIq4MRamoF1vw /DWuZCAHecgEywd8w/GiWmT/hcc8n2aG8mlsSKzDhay0WSjvWVpN709Hw2M62vUwSGc0rhaurmsSC VgvbsMR0KNq6c0LCHeHazxjg93v3qeuaio2h2NDWcrU6W+wpkX9xFCUmrT6h2d2Cl3tLWE0OkQGXp UyxeXNEjQEOIuqx+iazhbz/sEgnd5+scr6l9EBoCLRq6oQbtDGQbTW5ffdjt7dRLP+svFtcNTSQsG qdeA84KWdfMQWffZjcaPqYppXUhG+JEOwPwoxVUpknF4hmVFbd69o6PSFNI6prekvkB0Ee2N4JnWP aEJOdS7A==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljl6I-00GUVE-W0 for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 16:00:44 +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 46DCF31B; Thu, 20 May 2021 09:00:40 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.7.235]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 91C573F73B; Thu, 20 May 2021 09:00:38 -0700 (PDT) Date: Thu, 20 May 2021 17:00:35 +0100 From: Mark Rutland To: Derrick McKee Cc: Nathan.Burow@ll.mit.edu, Yianni Giannaris , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Ensure kernel AI key is not changed on fork Message-ID: <20210520160035.GP17233@C02TD0UTHF1T.local> References: <20210430150438.GA57205@C02TD0UTHF1T.local> <20210520151854.3632129-1-derrick.mckee@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210520151854.3632129-1-derrick.mckee@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_090043_097107_1D76A45D X-CRM114-Status: GOOD ( 23.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 20, 2021 at 11:18:54AM -0400, Derrick McKee wrote: > The kernel uses the IA key for PAC signing, > and this key should remain unchanged from the kernel point of view. > This patch ensures that the IA key remains constant on fork, > if it has been previously set. > The software is provided on an as-is basis. > > Signed-off-by: Derrick McKee > Signed-off-by: Yianni Giannaris On the kernel side, we use a unique IA key per kernel thread, and while this must remain the same *for that kernel thread*, the kernel IA key should differ across kernel threads when a fork() occurs. I think you're trying to use the keys in a different way than upstream intends to, and we do not need this change as-is. So NAK to this patch as it stands. Thanks, Mark. > --- > arch/arm64/include/asm/pointer_auth.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/include/asm/pointer_auth.h b/arch/arm64/include/asm/pointer_auth.h > index d50416be99be..9748413e72fd 100644 > --- a/arch/arm64/include/asm/pointer_auth.h > +++ b/arch/arm64/include/asm/pointer_auth.h > @@ -69,10 +69,13 @@ static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys) > ptrauth_keys_install_user(keys); > } > > -static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel *keys) > +static __always_inline void > +ptrauth_keys_init_kernel(struct ptrauth_keys_kernel *keys) > { > - if (system_supports_address_auth()) > - get_random_bytes(&keys->apia, sizeof(keys->apia)); > + if (keys->apia.lo == 0 && keys->apia.hi == 0) { > + if (system_supports_address_auth()) > + get_random_bytes(&keys->apia, sizeof(keys->apia)); > + } > } > > static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kernel *keys) > -- > 2.31.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel