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 7EB8DCD37A7 for ; Tue, 3 Sep 2024 16:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Subject:Cc:To:From: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yihzTrlKqUmEH9UVfnUiCUnd1hgJ1/s0nLlswnTd0Ds=; b=ju+H6E/ck7RzWHyzxqVxn4hfJU MtP093mAlzB7THz1iIZAmH5P6u9nbcNneVkufoWZXJFWuT3nAOtJ6zswcDTYs/N50R6Gp1USUMRPy 0IzvOH2oVbDp4BEmJJS6p49/DJIjComAvQwZqcT2b6m+f6CUVzvBuz0ytH7dcSUkzoqJvNq0cCG0V dsyxfSRQNptcWHOi4Ol5TfV3SLBj2p5kCmp0Y7rO9g1rJY8is1co5iDigQpgmGGUJLZND/Tu2dFi9 RaLe2XiWBAX18r/MCnguIe/ZB43EGSUTUEUROeK+5HwFGzbkFK1MksFieIKaVbIe8oHYXqduIRe5n 2UEIidrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slWHj-000000014fp-3i0L; Tue, 03 Sep 2024 16:21:39 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slW2J-000000010qr-17wM for linux-arm-kernel@lists.infradead.org; Tue, 03 Sep 2024 16:05:44 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D7FEE5C5A13; Tue, 3 Sep 2024 16:05:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8605C4CEC4; Tue, 3 Sep 2024 16:05:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725379542; bh=2wQB06Ioy56Jp4yrDEUkgoleTrLVnxBL9fMf8S5OGvI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=avChr2MsAIGfNuJzgWRsfivkfHVS8fPzjeV0R5R5OcUB44Dwz+v0Eyg7EVtT1bMza K/scvAyygsVoSlXuVMLVDmTfLcrFwKoV6jovrvvsb8/KgA7iHIg2xgYa6KGOxxbczn 2O4IAS6kuZqvMujtxLx/JMQ08mWc15bRpPvZxbx7H3DlpGx5eT4KBNUjyEEpBnmA3l mtOZxVishLdwxwj2VXpT8mIq4hYP7eb1K3eS/Y++n3V3pROQFDrnh5D884OOgfhsqR IfbBVzadiQkjKPLqKW6hAeaGVrB7Rjha/yHqCVY3eLxKXvJuRGHJr7+qdhk3yZYpHP mOWiON/GAQNdg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1slW2F-009IVG-T3; Tue, 03 Sep 2024 17:05:39 +0100 Date: Tue, 03 Sep 2024 17:05:38 +0100 Message-ID: <86seugvi25.wl-maz@kernel.org> From: Marc Zyngier To: Alexander Potapenko Cc: samuel.holland@sifive.com, Andrey Konovalov , Aleksandr Nogikh , kasan-dev , Will Deacon , syzbot , catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [arm?] upstream test error: KASAN: invalid-access Write in setup_arch In-Reply-To: References: <000000000000f362e80620e27859@google.com> <20240830095254.GA7769@willie-the-truck> <86wmjwvatn.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: glider@google.com, samuel.holland@sifive.com, andreyknvl@gmail.com, nogikh@google.com, kasan-dev@googlegroups.com, will@kernel.org, syzbot+908886656a02769af987@syzkaller.appspotmail.com, catalin.marinas@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_090543_523306_183C5939 X-CRM114-Status: GOOD ( 40.98 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 03 Sep 2024 16:39:28 +0100, Alexander Potapenko wrote: >=20 > On Mon, Sep 2, 2024 at 12:03=E2=80=AFPM 'Aleksandr Nogikh' via kasan-dev > wrote: > > > > +kasan-dev > > > > On Sat, Aug 31, 2024 at 7:53=E2=80=AFPM 'Marc Zyngier' via syzkaller-bu= gs > > wrote: > > > > > > On Fri, 30 Aug 2024 10:52:54 +0100, > > > Will Deacon wrote: > > > > > > > > On Fri, Aug 30, 2024 at 01:35:24AM -0700, syzbot wrote: > > > > > Hello, > > > > > > > > > > syzbot found the following issue on: > > > > > > > > > > HEAD commit: 33faa93bc856 Merge branch kvmarm-master/next into= kvmarm-m.. > > > > > git tree: git://git.kernel.org/pub/scm/linux/kernel/git/kvm= arm/kvmarm.git fuzzme > > > > > > > > +Marc, as this is his branch. > > > > > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=3D13984= 20b980000 > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=3D2b7b3= 1c9aa1397ca > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=3D9088866= 56a02769af987 > > > > > compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binuti= ls for Debian) 2.40 > > > > > userspace arch: arm64 > > > > > > As it turns out, this isn't specific to this branch. I can reproduce > > > it with this config on a vanilla 6.10 as a KVM guest. Even worse, > > > compiling with clang results in an unbootable kernel (without any > > > output at all). > > > > > > Mind you, the binary is absolutely massive (130MB with gcc, 156MB with > > > clang), and I wouldn't be surprised if we were hitting some kind of > > > odd limit. > > > > > > > > > > > > > Downloadable assets: > > > > > disk image (non-bootable): https://storage.googleapis.com/syzbot-= assets/384ffdcca292/non_bootable_disk-33faa93b.raw.xz > > > > > vmlinux: https://storage.googleapis.com/syzbot-assets/9093742fcee= 9/vmlinux-33faa93b.xz > > > > > kernel image: https://storage.googleapis.com/syzbot-assets/b1f599= 907931/Image-33faa93b.gz.xz > > > > > > > > > > IMPORTANT: if you fix the issue, please add the following tag to = the commit: > > > > > Reported-by: syzbot+908886656a02769af987@syzkaller.appspotmail.com > > > > > > > > > > Booting Linux on physical CPU 0x0000000000 [0x000f0510] > > > > > Linux version 6.11.0-rc5-syzkaller-g33faa93bc856 (syzkaller@syzka= ller) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40= ) #0 SMP PREEMPT now > > > > > random: crng init done > > > > > Machine model: linux,dummy-virt > > > > > efi: UEFI not found. > > > > > NUMA: No NUMA configuration found > > > > > NUMA: Faking a node at [mem 0x0000000040000000-0x00000000bfffffff] > > > > > NUMA: NODE_DATA [mem 0xbfc1d340-0xbfc20fff] > > > > > Zone ranges: > > > > > DMA [mem 0x0000000040000000-0x00000000bfffffff] > > > > > DMA32 empty > > > > > Normal empty > > > > > Device empty > > > > > Movable zone start for each node > > > > > Early memory node ranges > > > > > node 0: [mem 0x0000000040000000-0x00000000bfffffff] > > > > > Initmem setup node 0 [mem 0x0000000040000000-0x00000000bfffffff] > > > > > cma: Reserved 32 MiB at 0x00000000bba00000 on node -1 > > > > > psci: probing for conduit method from DT. > > > > > psci: PSCIv1.1 detected in firmware. > > > > > psci: Using standard PSCI v0.2 function IDs > > > > > psci: Trusted OS migration not required > > > > > psci: SMC Calling Convention v1.0 > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > > BUG: KASAN: invalid-access in smp_build_mpidr_hash arch/arm64/ker= nel/setup.c:133 [inline] > > > > > BUG: KASAN: invalid-access in setup_arch+0x984/0xd60 arch/arm64/k= ernel/setup.c:356 > > > > > Write of size 4 at addr 03ff800086867e00 by task swapper/0 > > > > > Pointer tag: [03], memory tag: [fe] > > > > > > > > > > CPU: 0 UID: 0 PID: 0 Comm: swapper Not tainted 6.11.0-rc5-syzkall= er-g33faa93bc856 #0 > > > > > Hardware name: linux,dummy-virt (DT) > > > > > Call trace: > > > > > dump_backtrace+0x204/0x3b8 arch/arm64/kernel/stacktrace.c:317 > > > > > show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324 > > > > > __dump_stack lib/dump_stack.c:93 [inline] > > > > > dump_stack_lvl+0x260/0x3b4 lib/dump_stack.c:119 > > > > > print_address_description mm/kasan/report.c:377 [inline] > > > > > print_report+0x118/0x5ac mm/kasan/report.c:488 > > > > > kasan_report+0xc8/0x108 mm/kasan/report.c:601 > > > > > kasan_check_range+0x94/0xb8 mm/kasan/sw_tags.c:84 > > > > > __hwasan_store4_noabort+0x20/0x2c mm/kasan/sw_tags.c:149 > > > > > smp_build_mpidr_hash arch/arm64/kernel/setup.c:133 [inline] > > > > > setup_arch+0x984/0xd60 arch/arm64/kernel/setup.c:356 > > > > > start_kernel+0xe0/0xff0 init/main.c:926 > > > > > __primary_switched+0x84/0x8c arch/arm64/kernel/head.S:243 > > > > > > > > > > The buggy address belongs to stack of task swapper/0 > > > > > > > > > > Memory state around the buggy address: > > > > > ffff800086867c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > > > > > ffff800086867d00: 00 fe fe 00 00 00 fe fe fe fe fe fe fe fe fe fe > > > > > >ffff800086867e00: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe > > > > > ^ > > > > > ffff800086867f00: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe > > > > > ffff800086868000: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > > > > > I can't spot the issue here. We have a couple of fixed-length > > > > (4 element) arrays on the stack and they're indexed by a simple loop > > > > counter that runs from 0-3. > > > > > > Having trimmed the config to the extreme, I can only trigger the > > > warning with CONFIG_KASAN_SW_TAGS (CONFIG_KASAN_GENERIC does not > > > scream). Same thing if I use gcc 14.2.0. > > > > > > However, compiling with clang 14 (Debian clang version 14.0.6) does > > > *not* result in a screaming kernel, even with KASAN_SW_TAGS. > > > > > > So I can see two possibilities here: > > > > > > - either gcc is incompatible with KASAN_SW_TAGS and the generic > > > version is the only one that works > > > > > > - or we have a compiler bug on our hands. > > > > > > Frankly, I can't believe the later, as the code is so daft that I > > > can't imagine gcc getting it *that* wrong. > > > > > > Who knows enough about KASAN to dig into this? >=20 > This looks related to Samuel's "arm64: Fix KASAN random tag seed > initialization" patch that landed in August. f75c235565f9 arm64: Fix KASAN random tag seed initialization $ git describe --contains f75c235565f9 --match=3Dv\* v6.11-rc4~15^2 So while this is in -rc4, -rc6 still has the same issue (with GCC -- clang is OK). > I am a bit surprised the bug is reported before the > "KernelAddressSanitizer initialized" banner is printed - I thought we > shouldn't be reporting anything until the tool is fully initialized. Specially if this can report false positives... Thanks, M. --=20 Without deviation from the norm, progress is not possible.