Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3773665rdg; Wed, 18 Oct 2023 05:57:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeTKJpKMGGJWaDlEgjeTIMt2nEQ0jha4Tr2e3xEXhgR13L14DCPqqopqG9aQIW50rOF34h X-Received: by 2002:a17:902:db11:b0:1c3:8464:cabd with SMTP id m17-20020a170902db1100b001c38464cabdmr6465292plx.12.1697633830214; Wed, 18 Oct 2023 05:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697633830; cv=none; d=google.com; s=arc-20160816; b=ZtnrzbZca2AWJ9RXfmmibpAQQhT9tTHSKKMlXC8sCzjr9HqrDkmQZjFAIU8wa+dZR/ hmUHtwxKBlU2h7JM2l/SKUuulXzJQXEDzu55A3cCTn/kAh9dw8MQ/qSjRM/3vgN5OViD UjGuIPRR3+xnILKFIggWgW7VrkZZ288aO+6U2Y8jF8S9E3sj1MSJWIv0O5zSC0Er4NyU oN3wSD4pRTz7v8KwkmKZJSOp+GTLPqc843VORkqnyexbApxuMTF8wdMfvpsrACAM8Hkk mkzgxul2KUXKIsBJ9FPiqiGz0MOF50IqlLSdphKi25fbD2p/AqDKnmBrrnhgCyNr+3Uh Nw6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=eAR0B1zZoyHJDYaMg14Yj5GvQ4AA/vogOWBo3M8mf5E=; fh=hCPobr24DmA9maJD9j0iJQVs2bF3FJ0EU8dYUrAN60Y=; b=yNbp35kGSMBhmxxegdfqGN96kM4ZFuU59vVCtRP3m1rIYtNhajhzgEAqv9TrQXWy1s Wx7nqA4Udda8CjyBaNAWsaQs4wttx3RMNAk3wN17r2LgtM+CsKa3dv1pMN3H1JHpUZr8 nT3fg/KEYB/PnggUgES5rP15LnQ6l+HnoNIx7knwKMSEAWPcugBr6IWlD1eeKAc/P3rc OV+Qwk54BJTPSHSdu69HjZjIk0+MEBKnDDaEBVDuT7uTy6r1B+zW/xYeJWtpuRyWHyZ9 CQAQungRZ10s+ZqLYYgS2BuysvuSmjzQTWeBb3Obbtrsou4oo/EXQ7JPohgUp/IXppmO 6ktQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id g13-20020a170902c38d00b001c9c599f77bsi3916576plg.312.2023.10.18.05.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 05:57:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 755368045BC5; Wed, 18 Oct 2023 05:57:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231131AbjJRM5H (ORCPT + 99 others); Wed, 18 Oct 2023 08:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjJRM5G (ORCPT ); Wed, 18 Oct 2023 08:57:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AEC40106 for ; Wed, 18 Oct 2023 05:57:04 -0700 (PDT) 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 82DAE2F4; Wed, 18 Oct 2023 05:57:45 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.31.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 809553F762; Wed, 18 Oct 2023 05:57:03 -0700 (PDT) Date: Wed, 18 Oct 2023 13:57:00 +0100 From: Mark Rutland To: Andrea della Porta Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nik.borisov@suse.com Subject: Re: [PATCH 3/4] arm64/entry-common: Make Aarch32 syscalls' availability depend on aarch32_enabled() Message-ID: References: <88bdea628a13747bff32c0c3055d6d6ef7264d96.1697614386.git.andrea.porta@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <88bdea628a13747bff32c0c3055d6d6ef7264d96.1697614386.git.andrea.porta@suse.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 05:57:09 -0700 (PDT) On Wed, Oct 18, 2023 at 01:13:21PM +0200, Andrea della Porta wrote: > Another major aspect of supporting running of 32bit processes is the > ability to access 32bit syscalls. Such syscalls can be invoked by > using the svc instruction. > > If Aarch32 emulation is disabled ensure that calling svc results > in the same behavior as if CONFIG_COMPAT has not been enabled (i.e. > a kernel panic). It's not "emulation" it's directly supported by the hardware. > > Signed-off-by: Andrea della Porta > --- > arch/arm64/kernel/entry-common.c | 25 ++++++++++++++++++++++--- > 1 file changed, 22 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c > index 69ff9b8c0bde..32761760d9dd 100644 > --- a/arch/arm64/kernel/entry-common.c > +++ b/arch/arm64/kernel/entry-common.c > @@ -802,6 +802,11 @@ asmlinkage void noinstr el0t_64_error_handler(struct pt_regs *regs) > } > > #ifdef CONFIG_COMPAT > +UNHANDLED(el0t, 32, sync_ni) > +UNHANDLED(el0t, 32, irq_ni) > +UNHANDLED(el0t, 32, fiq_ni) > +UNHANDLED(el0t, 32, error_ni) IRQ, FIQ, and SError are not syscalls, so the commit title is bad. > + > static void noinstr el0_cp15(struct pt_regs *regs, unsigned long esr) > { > enter_from_user_mode(regs); > @@ -821,6 +826,11 @@ static void noinstr el0_svc_compat(struct pt_regs *regs) > > asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) > { > + if (!aarch32_enabled()) { > + el0t_32_sync_ni_handler(regs); > + return; > + } Why do we have to do this at all? If we don't have AArch32 tasks, these paths are unreachable. Why do we need to check that they aren't called? Mark. > + > unsigned long esr = read_sysreg(esr_el1); > > switch (ESR_ELx_EC(esr)) { > @@ -865,17 +875,26 @@ asmlinkage void noinstr el0t_32_sync_handler(struct pt_regs *regs) > > asmlinkage void noinstr el0t_32_irq_handler(struct pt_regs *regs) > { > - __el0_irq_handler_common(regs); > + if (!aarch32_enabled()) > + el0t_32_irq_ni_handler(regs); > + else > + __el0_irq_handler_common(regs); > } > > asmlinkage void noinstr el0t_32_fiq_handler(struct pt_regs *regs) > { > - __el0_fiq_handler_common(regs); > + if (!aarch32_enabled()) > + el0t_32_fiq_ni_handler(regs); > + else > + __el0_fiq_handler_common(regs); > } > > asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs) > { > - __el0_error_handler_common(regs); > + if (!aarch32_enabled()) > + el0t_32_error_ni_handler(regs); > + else > + __el0_error_handler_common(regs); > } > > bool __aarch32_enabled __ro_after_init = true; > -- > 2.35.3 >