Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp362783rdb; Tue, 31 Oct 2023 09:28:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECgY4KcuhRxGVbmKxIqmEa8hFc3Nh36JyKr/a8HjDqP2jIeOhBli2Qsny/oMWVFRTJswv6 X-Received: by 2002:a05:6a21:6d88:b0:17e:2afd:408a with SMTP id wl8-20020a056a216d8800b0017e2afd408amr13441863pzb.5.1698769683175; Tue, 31 Oct 2023 09:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698769683; cv=none; d=google.com; s=arc-20160816; b=fbUOGBg5ON3MfqEwn4qDcptDKFis6moklkEiSUoWqRSYPJ9sKuEXfyOxF/a8t2pDPw miq/zt2421LsTPzNheWtp/whc4mXbaEqArdWJsHtkBuo4ahvovF3jNNrFp40ExJ4AmCa pIPOcjuaZV/czqdDwfNz5oIwZWebf74ARDdUz9x1KIDSJoth6J97zyMPyKsD/AI3hVLy R2Qn04ZJqeYJDkBll7MGUbRGoDt9zzjAPLnysOBB8mhMsHd8QlLgQHP0l7yqNjdASuoZ /gITf0G+8nludf/0aJBhiNrPoebOwljQdmoDCbwotBimQ8GdU+XBLd+MSnWix4lx7tzD TynQ== 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=3zstg9HLxYV0gLx5q2494va4kf5NSA2ZNFevKF2Yx/M=; fh=HqPA2cmnW2s8DdURuQaeP6ywpmCI6/gxQZrVZ8oPS7U=; b=WCSengcanCinanVCshJ9BmNqQ9+plB1EnQ79vPTSrI0s5cHf8RRYi9b3904K1ldx1h uyOKH1vzepkJ9GdUpSYzl95gMNv500AkGm1uxXSUiYe8jOC+QwPJ03psa/a6WpWi/h/n bmIX7tVZMq3kknji+FBynGgUnYXvxJaIH8arYLqRqSWHQyNUpMvhGb0ptDcYkkuGotDO fIT3aImvvd5sj6MG2XDN1w25lVEINH2alSGrsgTbrS992xuPprbHJtr1J6pED82tQ+Zy E1Q+uppLIwFKcnZYE2A4q+TxJ71VoOFZXNVJ7FQVIRGIoeIanyFywJmL1lsNInVon1Qt oICQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id k11-20020a636f0b000000b005b958401e4fsi1261504pgc.418.2023.10.31.09.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:28:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 7486F802A928; Tue, 31 Oct 2023 09:27:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345110AbjJaQ1s (ORCPT + 99 others); Tue, 31 Oct 2023 12:27:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233385AbjJaQ1r (ORCPT ); Tue, 31 Oct 2023 12:27:47 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B33AFDF; Tue, 31 Oct 2023 09:27:43 -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 371A92F4; Tue, 31 Oct 2023 09:28:25 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.36.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 155193F67D; Tue, 31 Oct 2023 09:27:40 -0700 (PDT) Date: Tue, 31 Oct 2023 16:27:35 +0000 From: Mark Rutland To: Ard Biesheuvel Cc: Naresh Kamboju , Catalin Marinas , Will Deacon , Oliver Upton , Linux-Next Mailing List , open list , Linux ARM , lkft-triage@lists.linaro.org, Arnd Bergmann , Thomas Gleixner , Ingo Molnar , Anders Roxell , Dan Carpenter , LTP List , Petr Vorel Subject: Re: qemu-arm64: handle_futex_death - kernel/futex/core.c:661 - Unable to handle kernel unknown 43 at virtual address Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:27:57 -0700 (PDT) On Mon, Oct 30, 2023 at 09:14:56AM +0100, Ard Biesheuvel wrote: > From 97dea432bceadfcece84484609374c277afc2c81 Mon Sep 17 00:00:00 2001 > From: Ard Biesheuvel > Date: Sat, 28 Oct 2023 09:40:29 +0200 > Subject: [PATCH v2] Add missing ESR decoding for level -1 translation faults > > Signed-off-by: Ard Biesheuvel As a heads-up, looking at this some more we'll also need to rework the usage of of ESR_ELx_FSC_TYPE and ESR_ELx_FSC_LEVEL, since those no longer work correctly Level -1 xFSC value. ESR_ELx_FSC_TYPE is 0x3c and ESR_ELx_FSC_LEVEL is 0x3, and work on the basis that the xFSC fault types are encoded as xxxxyy, where the xxxx is the type and the yy is the level (0 to 3). That didn't expand naturally to level -1. For example, Level {0,1,2,3} translation faults get reported as 0b0001xx, where the xx encodes the level, while Level -1 translation faults get reported as 0b101011. That ends up affecting: * All the is_${FOO}_fault() predicat functions, e.g. is_translation_fault(), is_el1_permission_fault() and is_spurious_el1_translation_fault(). * Places where we synthesize an xFSC value, e.g. set_thread_esr() * A bunch of KVM due to the use of kvm_vcpu_trap_get_fault_type() ... and we probably need to remove ESR_ELx_FSC_TYPE and ESR_ELx_FSC_LEVEL entirely to avoid the possiblity of misuse. Mark. > --- > arch/arm64/mm/fault.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index 2e5d1e238af9..13f192691060 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -780,18 +780,18 @@ static const struct fault_info fault_info[] = { > { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 1 translation fault" }, > { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" }, > { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 8" }, > + { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 0 access flag fault" }, > { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" }, > { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" }, > { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 12" }, > + { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 0 permission fault" }, > { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" }, > { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" }, > { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" }, > { do_sea, SIGBUS, BUS_OBJERR, "synchronous external abort" }, > { do_tag_check_fault, SIGSEGV, SEGV_MTESERR, "synchronous tag check fault" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 18" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 19" }, > + { do_sea, SIGKILL, SI_KERNEL, "level -1 (translation table walk)" }, > { do_sea, SIGKILL, SI_KERNEL, "level 0 (translation table walk)" }, > { do_sea, SIGKILL, SI_KERNEL, "level 1 (translation table walk)" }, > { do_sea, SIGKILL, SI_KERNEL, "level 2 (translation table walk)" }, > @@ -799,7 +799,7 @@ static const struct fault_info fault_info[] = { > { do_sea, SIGBUS, BUS_OBJERR, "synchronous parity or ECC error" }, // Reserved when RAS is implemented > { do_bad, SIGKILL, SI_KERNEL, "unknown 25" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 26" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 27" }, > + { do_sea, SIGKILL, SI_KERNEL, "level -1 synchronous parity error (translation table walk)" }, // Reserved when RAS is implemented > { do_sea, SIGKILL, SI_KERNEL, "level 0 synchronous parity error (translation table walk)" }, // Reserved when RAS is implemented > { do_sea, SIGKILL, SI_KERNEL, "level 1 synchronous parity error (translation table walk)" }, // Reserved when RAS is implemented > { do_sea, SIGKILL, SI_KERNEL, "level 2 synchronous parity error (translation table walk)" }, // Reserved when RAS is implemented > @@ -813,9 +813,9 @@ static const struct fault_info fault_info[] = { > { do_bad, SIGKILL, SI_KERNEL, "unknown 38" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 39" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 40" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 41" }, > + { do_bad, SIGKILL, SI_KERNEL, "level -1 address size fault" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 42" }, > - { do_bad, SIGKILL, SI_KERNEL, "unknown 43" }, > + { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level -1 translation fault" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 44" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 45" }, > { do_bad, SIGKILL, SI_KERNEL, "unknown 46" }, > -- > 2.42.0.820.g83a721a137-goog >