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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 73619C433F5 for ; Fri, 17 Dec 2021 14:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=tsfg7zvTtQkOOq4gH2yzrVuNuw8vf3xNA6WgK5yztAs=; b=oMf0g70fNsKQqz RtZV5o8EZO/eyJ3b8E/8bQ7EtwE8UTp6sDu+dfUv0X7bbwd51w09SOUYLzZE7cG4UR6b9f7/6le16 vJfOBrQkKITRMqYmM1fxDFEQp4wjctUIhB6VI9nPdrC0RTP/qYqyUzWbb12+0wvy4UKhW15U5H89m dsdwSYP6Y4SjrEVmUzhmQymgoRiZZIu+fBNhh0xGRgWnH/lnXSqTx7q3xtadnH82gG+TyvqO5v/1Y sOTEb3JjpA4/ES/W1B2E8Zv5t2XzACFyhdIgrjGqsNYHkj9+VeK0no8LoWhCdAzwpXSanWdWqDj3B yj505quV20dEnxz25dDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myESn-00AhPX-Jl; Fri, 17 Dec 2021 14:44:01 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myEQf-00AgXZ-T0 for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 14:41:51 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 74A956225E; Fri, 17 Dec 2021 14:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E9C4C36AE7; Fri, 17 Dec 2021 14:41:46 +0000 (UTC) Date: Fri, 17 Dec 2021 14:41:44 +0000 From: Catalin Marinas To: D Scott Phillips Cc: linux-arm-kernel@lists.infradead.org, Marc Zyngier , Will Deacon , Darren Hart , patches@amperecomputing.com Subject: Re: [PATCH v2] arm64: errata: Fix exec handling in erratum 1418040 workaround Message-ID: References: <20211216191618.972956-1-scott@os.amperecomputing.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211216191618.972956-1-scott@os.amperecomputing.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_064150_018534_AC3CD8BC X-CRM114-Status: GOOD ( 12.69 ) 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, Dec 16, 2021 at 11:16:18AM -0800, D Scott Phillips wrote: > diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h > index 97932fbf973d..24036b914226 100644 > --- a/arch/arm64/include/asm/elf.h > +++ b/arch/arm64/include/asm/elf.h > @@ -160,8 +160,16 @@ typedef struct user_fpsimd_state elf_fpregset_t; > > #define SET_PERSONALITY(ex) \ > ({ \ > + if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) \ > + preempt_disable(); \ > clear_thread_flag(TIF_32BIT); \ > current->personality &= ~READ_IMPLIES_EXEC; \ > + if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) { \ > + if (this_cpu_has_cap(ARM64_WORKAROUND_1418040)) \ > + sysreg_clear_set(cntkctl_el1, 0, \ > + ARCH_TIMER_USR_VCT_ACCESS_EN); \ > + preempt_enable(); \ > + } \ > }) > > /* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */ > @@ -223,7 +231,16 @@ int compat_elf_check_arch(const struct elf32_hdr *); > */ > #define COMPAT_SET_PERSONALITY(ex) \ > ({ \ > + if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) \ > + preempt_disable(); \ > set_thread_flag(TIF_32BIT); \ > + if (IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040)) { \ > + if (this_cpu_has_cap(ARM64_WORKAROUND_1418040)) \ > + sysreg_clear_set(cntkctl_el1, \ > + ARCH_TIMER_USR_VCT_ACCESS_EN, \ > + 0); \ > + preempt_enable(); \ > + } \ I don't particularly like adding more to these macros. There's arch_setup_new_exec() that gets called after SET_PERSONALITY, so you can check whether the task is compat or not. Thanks. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel