Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp558753pxp; Wed, 9 Mar 2022 08:09:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyW16xff/Rck6TRd1CRQPeygPtk/nfT2UnoohfJZ5HQTJuqbaYfWlzGFBwuyOkA/efz3IsF X-Received: by 2002:a25:9845:0:b0:628:99a6:55ed with SMTP id k5-20020a259845000000b0062899a655edmr319309ybo.221.1646842195495; Wed, 09 Mar 2022 08:09:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646842195; cv=none; d=google.com; s=arc-20160816; b=FuQigPr6gr4bTSRnrqQjc8T5W4p/DsJezv3MdZfiTs54Fy+wVhe8tFiia2y/WbdIjp MEatS6GC6TsDunEKupfOlJ7wXlm/INanwul0Uzgb5O4z41rje98pY3Jne2FAdnhKzv/a lkmfq3ST4Xz1vBU748uES7OkJ5GLRCnslKwdHO6GcZuhyb6eYDAbManktgAidrRjfOP/ kA/p9Vf2/T5fTm6MEhdzfIzT031B4fQ8RC58R6TH6FmtMu87JNAF09KhvYVS3uAbEVj9 hqwz7a/WfcNlJmr/ptt7UUyNc57h6m1z+wjCq6q316URI+hRqOIPaA1cEy/mGG7sAKwC o7xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5ENNUetdAdV23lOsdfpgFf5wyMnmt2QbJLAqBbZEt2E=; b=aP5qT9OvtcMqLQGfdsVjysJUWGzdR7mccJOzpgikkcPzhSFzuOFB272H3b3kaPvMqt +CdGd+8LYfEsPjK1vJfJNvQOaj/9KXsynhC3PUgYFCMV0eUqjZLG+kM+u2wQ+fnlafqp +bprxzWzwdpnddecK0TOrK0JMqYoCVMNNv/IpgGRfP9zNAmXjeKNM8Amn0srrJOVthn4 e7SAYMHh70rBtuD8Tsav64zQUKbFGbpRMIvpg2gXrRcIFaOFc0eUx/ZJjVpTu2GPvOA7 +W1NenTKP593VwjkHV3iW/Ff6sk9+FcBqZu2c5PymnqrJleTdd1RSwXtGI7E/ymenpUd u4PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LGhLLa6W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v184-20020a25c5c1000000b00629264ad85dsi1549738ybe.146.2022.03.09.08.09.16; Wed, 09 Mar 2022 08:09:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LGhLLa6W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233739AbiCIPLg (ORCPT + 99 others); Wed, 9 Mar 2022 10:11:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233603AbiCIPLe (ORCPT ); Wed, 9 Mar 2022 10:11:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49FB8A647B; Wed, 9 Mar 2022 07:10:35 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id E19B4B82200; Wed, 9 Mar 2022 15:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF819C340F4; Wed, 9 Mar 2022 15:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646838632; bh=HW6Lkz1+wwMQvCFCzrUzcgIzsEbj2Xvy0+6Wzf4FlwY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LGhLLa6WQZwwbOvrvE8SdNp/PVxstQcAKsfzBHxZoCY2eRahiO4DqB45w3O02pmga LLAc2B7q31qxwDpCXzDZHymzbuaKd14QF/KvaajyHI5vpzeMeZsnyumQfEU0Jh9G/2 velrEIq7E/uFEIVK6aZm+xNJbR0ZEl3Ik9yIsjiGPDscMfIhJKaedP3Bwh1npXTI0b hXdIiiVujtBXv0oq224S+MhJbcbWHVw1KtUMq68/CACe5wCB9GuCzd8oz6BFirqa+p ka+Dtz/j5MajKEN/zho5f1nKjOt33yJQwgMCSlomOguD3seQx5Om3v/7y/wr/yyajP 9ptheUk809JDQ== Received: by mail-yb1-f178.google.com with SMTP id h126so5031873ybc.1; Wed, 09 Mar 2022 07:10:32 -0800 (PST) X-Gm-Message-State: AOAM533NHuZ49tziH3jrAJxmWg9g2bGjiVugzZ3DM8OpddjG0IAfBd9Z UpYT4HgGkS9DwrsFXjNm503elzrSw4TWKyUkq+c= X-Received: by 2002:a25:df4e:0:b0:629:547b:d83a with SMTP id w75-20020a25df4e000000b00629547bd83amr98521ybg.432.1646838631682; Wed, 09 Mar 2022 07:10:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ard Biesheuvel Date: Wed, 9 Mar 2022 16:10:20 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [next] arm: Internal error: Oops: 5 PC is at __read_once_word_nocheck To: "Russell King (Oracle)" Cc: Naresh Kamboju , open list , Linux-Next Mailing List , Linux ARM , Linus Walleij , Arnd Bergmann , Corentin Labbe , Stephen Rothwell Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 9 Mar 2022 at 16:07, Russell King (Oracle) wrote: > > On Wed, Mar 09, 2022 at 03:57:32PM +0100, Ard Biesheuvel wrote: > > On Wed, 9 Mar 2022 at 15:44, Naresh Kamboju wrote: > > > > > > On Wed, 9 Mar 2022 at 19:37, Naresh Kamboju wrote: > > > > > > > > On Wed, 9 Mar 2022 at 16:16, Ard Biesheuvel wrote: > > > > > > > > > > On Wed, 9 Mar 2022 at 11:37, Russell King (Oracle) > > > > > wrote: > > > > > > > > > > > > On Wed, Mar 09, 2022 at 03:18:12PM +0530, Naresh Kamboju wrote: > > > > > > > While boting linux next-20220308 on BeagleBoard-X15 and qemu arm the following > > > > > > > kernel crash reported which is CONFIG_KASAN enabled build [1] & [2]. > > > > > > > > > > > > The unwinder is currently broken in linux-next. Please try reverting > > > > > > 532319b9c418 ("ARM: unwind: disregard unwind info before stack frame is > > > > > > set up") > > > > > > I have reverted the suggested commit and built and boot failed due to reported > > > kernel crash [1]. > > > > > > - Naresh > > > > > > > Thanks Naresh, > > > > This looks like it might be related to the issue Russell just sent a fix for: > > https://lore.kernel.org/linux-arm-kernel/CAMj1kXEqp2UmsyUe1eWErtpMk3dGEFZyyno3nqydC_ML0bwTLw@mail.gmail.com/T/#t > > > > Could you please try that? > > Well, we unwound until: > > __irq_svc from migrate_disable+0x0/0x70 > > and then crashed - and the key thing there is that we're at the start > of migrate_disable() when we took an interrupt. > > For some reason, this triggers an access to address 0x10, which faults. > We then try unwinding again, and successfully unwind all the way back > to the same point (the line above) which then causes the unwinder to > again access address 0x10, and the cycle repeats with the stack > growing bigger and bigger. > > I'd suggest also testing without the revert but with my patch. > Indeed. And as I suggested the other day, maybe it wouldn't be so bad to harden the vsp dereference, like below: --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -236,10 +237,11 @@ static int unwind_pop_register(struct unwind_ctrl_block *ctrl, if (*vsp >= (unsigned long *)ctrl->sp_high) return -URC_FAILURE; - /* Use READ_ONCE_NOCHECK here to avoid this memory access - * from being tracked by KASAN. + /* Use get_kernel_nofault() here to avoid this memory access + * from causing a fatal fault, and from being tracked by KASAN. */ - ctrl->vrs[reg] = READ_ONCE_NOCHECK(*(*vsp)); + if (get_kernel_nofault(ctrl->vrs[reg], *vsp)) + return -URC_FAILURE; if (reg == 14) ctrl->lr_addr = *vsp; (*vsp)++;