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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 946FBC433F5 for ; Tue, 28 Sep 2021 10:37:45 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5BF93610FC for ; Tue, 28 Sep 2021 10:37:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5BF93610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=Dm3sCKzxBj7nPqsFYMN9Z6FcTLzNZgRcWOaMtU8vqdk=; b=EvkkRcl7zt2j09 oq5YRdQOPe6QTaj1uaMedYropFjPia9F/XHkKx2mtJypWZeD5RUAom1opjkVA2/U1LP+57rM18LJs yVipXfmNFMQgwniFM8nq9u6m1S8kHt26p8dNqFGv417HQiglwgQkvNIZ23LluYoM1UoSrCHkiI1xf iyFafyZ4Upg8RXEOaO+hpwohlP3+KMiwwz41LUvRewjoKm5lk8p/TAR2ZKQPLbnLTZa7EsL4A3pkq 337qaYMDTmXL+CHRcSiMrLQKITWDM17OpHVo4UjcOs0ysYHuMb6YGn0E3TdxAF+7IqV6my9JC0nn1 +zDP2CXLDienWN+t2zsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVASr-006nqs-1I; Tue, 28 Sep 2021 10:35:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVASm-006npE-VU for linux-arm-kernel@lists.infradead.org; Tue, 28 Sep 2021 10:35:54 +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 0306B6D; Tue, 28 Sep 2021 03:35:50 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.23.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5377D3F7B4; Tue, 28 Sep 2021 03:35:47 -0700 (PDT) Date: Tue, 28 Sep 2021 11:35:43 +0100 From: Mark Rutland To: Dmitry Vyukov Cc: syzbot , Linux ARM , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk, will@kernel.org Subject: Re: [syzbot] upstream test error: KASAN: invalid-access Read in __entry_tramp_text_end Message-ID: <20210928103543.GF1924@C02TD0UTHF1T.local> References: <000000000000a3cf8605cb2a1ec0@google.com> <20210921165134.GE35846@C02TD0UTHF1T.local> <20210927170122.GA9201@C02TD0UTHF1T.local> <20210927171812.GB9201@C02TD0UTHF1T.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210928_033553_177649_0597A917 X-CRM114-Status: GOOD ( 29.65 ) 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 Tue, Sep 28, 2021 at 12:19:23PM +0200, Dmitry Vyukov wrote: > On Mon, 27 Sept 2021 at 19:18, Mark Rutland wrote: > > What's happened here is that __d_lookup() (via a few layers of inlining) called > > load_unaligned_zeropad(). The `LDR` at the start of the asm faulted (I suspect > > due to a tag check fault), and so the exception handler replaced the PC with > > the (anonymous) fixup function. This is akin to a tail or sibling call, and so > > the fixup function entirely replaces __d_lookup() in the trace. > > > > The fixup function itself has an `LDR` which faulted (because it's > > designed to fixup page alignment problems, not tag check faults), and > > that is what's reported here. > > > > As the fixup function is anonymous, and the nearest prior symbol in .text is > > __entry_tramp_text_end, it gets symbolized as an offset from that. > > > > We can make the unwinds a bit nicer by adding some markers (e.g. patch > > below), but actually fixing this case will require some more thought. > > > > Thanks, > > Mark. > > > > ---->8---- > > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S > > index 709d2c433c5e..127096a0faea 100644 > > --- a/arch/arm64/kernel/vmlinux.lds.S > > +++ b/arch/arm64/kernel/vmlinux.lds.S > > @@ -111,6 +111,11 @@ jiffies = jiffies_64; > > #define TRAMP_TEXT > > #endif > > > > +#define FIXUP_TEXT \ > > + __fixup_text_start = .; \ > > + *(.fixup); \ > > + __fixup_text_end = .; > > + > > /* > > * The size of the PE/COFF section that covers the kernel image, which > > * runs from _stext to _edata, must be a round multiple of the PE/COFF > > @@ -161,7 +166,7 @@ SECTIONS > > IDMAP_TEXT > > HIBERNATE_TEXT > > TRAMP_TEXT > > - *(.fixup) > > + FIXUP_TEXT > > *(.gnu.warning) > > . = ALIGN(16); > > *(.got) /* Global offset table */ > > > Oh, good it's very local to the .fixup thing rather than a common > issue that affects all unwinds. Yes, though the other issue I mentioned *does* exist, and can occur separately, even if we're getting lucky and not hitting it often enough to notice. > In the other x86 thread Josh Poimboeuf suggested to use asm goto to a > cold part of the function instead of .fixup: > https://lore.kernel.org/lkml/20210927234543.6waods7rraxseind@treble/ > This sounds like a more reliable solution that will cause less > maintenance burden. Would it work for arm64 as well? Maybe we can use that when CC_HAS_ASM_GOTO_OUTPUT is avaiable, but in general we can't rely on asm goto supporting output arguments (and IIRC GCC doesn't support that at all), so we'd still have to support the current fixup scheme. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel