Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1437403rdb; Fri, 19 Jan 2024 22:00:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyuUNhBtKslZi0CRxOoU8occe+mW7gbAwxtyoOkURmDj2frxflNUdBlWXLvirTGge06S0V X-Received: by 2002:a05:6a20:1a24:b0:199:9c7e:a58b with SMTP id cj36-20020a056a201a2400b001999c7ea58bmr985498pzb.118.1705730429414; Fri, 19 Jan 2024 22:00:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705730429; cv=pass; d=google.com; s=arc-20160816; b=JN8WNstoQbHWqds0sDrJfAGiJuVCkJAPYCPR3SMDB/7jvgCz3UYnHgluLc/cWF1UZy g2eKGGpQBspFtzvzcqW+uJ72Czj/m1LNpNhG3LEtjg64sJbmtYAV57sNSXBCoaqdXbcf 5SLyTYsRHICovmWVfSxlUFOyFuozmq1BrZk1b+MUgoLIO9j1nwMirYTwnhDoazSbuzGR iXlTj7dqyAzvCaN3LsXnYJR2tiNZnAVssb4lyh7bHouk+IFl2Q5lEpEKYZEwqhU1C0Kc ZHGCkeRRey07YTw31W1kIPmfprwt/QndrAcqSSeovjVuYfZujuPkgtP0gkeX33mTWPi/ pe+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:autocrypt :from:content-language:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=vZ4zHSmH9zvpcLiz/34jW9sffxJCVxWmE3505f3SxYU=; fh=i4E7q8kxh5Crgu9LMXZtjf8pgd65hyrLr5vEyOdiUtw=; b=DZ4ShvPGUgr8MonzRlYA+5Rek/Y7Pz9QiZH45GYrh7Vd0U4PwkXDAJH0S7KkMwxs4f X/eI7LnAcUM/QlqM02lk8uftzFu9oaJ20DPiVDzkpG0Vk6nnmNX5vNdiTkcWPzFA1MZh dAFMJ3APtaoiNcd38U9ypeElsNbzpcuJOWtEnAjMtt/MdpvYt9J4Bw0l4Tx+HDoOrLGj 9iiO8IrX6OCVJTROLzCyrzLC16wnPrvMLPasbCiOaikX8AhUYuotkbGxCaT6sSxHRxqr Z8kvoXr4kH+V9diQOfc6UTXr5ndsCkNGwTes6RHTVALxA+Kqk0YLUxZy2glsxTCEzaIO 5DsA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.com header.s=s31663417 header.b=jlcofXBN; arc=pass (i=1 spf=pass spfdomain=gmx.com dkim=pass dkdomain=gmx.com dmarc=pass fromdomain=gmx.com); spf=pass (google.com: domain of linux-kernel+bounces-31711-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bg11-20020a17090b0d8b00b002902388cac0si4176049pjb.133.2024.01.19.22.00.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 22:00:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31711-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.com header.s=s31663417 header.b=jlcofXBN; arc=pass (i=1 spf=pass spfdomain=gmx.com dkim=pass dkdomain=gmx.com dmarc=pass fromdomain=gmx.com); spf=pass (google.com: domain of linux-kernel+bounces-31711-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31711-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E715B282A65 for ; Sat, 20 Jan 2024 06:00:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57F6320F5; Sat, 20 Jan 2024 06:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.com header.i=quwenruo.btrfs@gmx.com header.b="jlcofXBN" Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D24F510E1; Sat, 20 Jan 2024 06:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705730416; cv=none; b=Eqj1snHMfd0AJbPCo4icfWf5rX4tEet/uI5LiCKGxBmpAz/xkdxd00uzbKukFxJ8vv7AakG9lWFX4t5MNid199Z9zMfSsi1Rf6GMcn6Hplu/ceSa5gpXxQVy9PGTmiYdtzbzN2dUHpqIpOs5YScOJB0yyw26VLUvNg1xYOmLtu8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705730416; c=relaxed/simple; bh=cIkFBfLpMKWlQkZCQmZqdlejJJB9NpMVtpEI3jG1RZQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dm0j5NZYkEeUQZnW4Me7/33Ij7AIwzmtb7vMGweu812NFGIEAfSqIbr9EbGGpvyy5KpvkcYSW3xqrM/Mdb0ZSW8m0M/GV6in5GNdNPaiUw/JjRlWZdy916wv/LdOx+Snp2n7w4J/wu7Mplfzx9fevL7tSei1dRYADgvxDCnP6Yg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.com; spf=pass smtp.mailfrom=gmx.com; dkim=pass (2048-bit key) header.d=gmx.com header.i=quwenruo.btrfs@gmx.com header.b=jlcofXBN; arc=none smtp.client-ip=212.227.17.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.com; s=s31663417; t=1705730390; x=1706335190; i=quwenruo.btrfs@gmx.com; bh=cIkFBfLpMKWlQkZCQmZqdlejJJB9NpMVtpEI3jG1RZQ=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=jlcofXBNNJEm2bZ2SzdQjp25/DEjZq6r0fTEfF0oRSuYQutg7kRCpBeQF+QA8SCU 3364EEuv4bX4xx0RjfwlevR2V9K8VQjJ1bi1bFvD/EHiKzziNzkwY2UwhKyZ8ZY3b +zSZVShMjn3ec1eiBz+pAra2pUPcWRAuMPjLsOC/veUAXiyWaP8xS9+NV4f/XyvUs od4b8c2OI1wxYV+6U6IhZ59JG6wnzKbEAVT005Zq2Eds913OON/+rNlvJq1rfviPJ iXjned0twTs94ZuyU2OEiD+dGSvQy+lV2+5ZZFx5p4zbCFhrT9xn3d2TXTYcxKbSG QMIo5KZHgm1ge+I56A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [172.16.0.153] ([61.245.157.120]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MQe5u-1rnZaN2sdS-00Ni1C; Sat, 20 Jan 2024 06:59:50 +0100 Message-ID: Date: Sat, 20 Jan 2024 16:29:44 +1030 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [Linux Kernel Bug] kernel BUG in btrfs_get_root_ref (assertion failed: !anon_dev) and general protection fault in btrfs_update_reloc_root To: Chenyuan Yang , linux-btrfs@vger.kernel.org, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com, Zijie Zhao References: Content-Language: en-US From: Qu Wenruo Autocrypt: addr=quwenruo.btrfs@gmx.com; keydata= xsBNBFnVga8BCACyhFP3ExcTIuB73jDIBA/vSoYcTyysFQzPvez64TUSCv1SgXEByR7fju3o 8RfaWuHCnkkea5luuTZMqfgTXrun2dqNVYDNOV6RIVrc4YuG20yhC1epnV55fJCThqij0MRL 1NxPKXIlEdHvN0Kov3CtWA+R1iNN0RCeVun7rmOrrjBK573aWC5sgP7YsBOLK79H3tmUtz6b 9Imuj0ZyEsa76Xg9PX9Hn2myKj1hfWGS+5og9Va4hrwQC8ipjXik6NKR5GDV+hOZkktU81G5 gkQtGB9jOAYRs86QG/b7PtIlbd3+pppT0gaS+wvwMs8cuNG+Pu6KO1oC4jgdseFLu7NpABEB AAHNIlF1IFdlbnJ1byA8cXV3ZW5ydW8uYnRyZnNAZ214LmNvbT7CwJQEEwEIAD4CGwMFCwkI BwIGFQgJCgsCBBYCAwECHgECF4AWIQQt33LlpaVbqJ2qQuHCPZHzoSX+qAUCY00iVQUJDToH pgAKCRDCPZHzoSX+qNKACACkjDLzCvcFuDlgqCiS4ajHAo6twGra3uGgY2klo3S4JespWifr BLPPak74oOShqNZ8yWzB1Bkz1u93Ifx3c3H0r2vLWrImoP5eQdymVqMWmDAq+sV1Koyt8gXQ XPD2jQCrfR9nUuV1F3Z4Lgo+6I5LjuXBVEayFdz/VYK63+YLEAlSowCF72Lkz06TmaI0XMyj jgRNGM2MRgfxbprCcsgUypaDfmhY2nrhIzPUICURfp9t/65+/PLlV4nYs+DtSwPyNjkPX72+ LdyIdY+BqS8cZbPG5spCyJIlZonADojLDYQq4QnufARU51zyVjzTXMg5gAttDZwTH+8LbNI4 mm2YzsBNBFnVga8BCACqU+th4Esy/c8BnvliFAjAfpzhI1wH76FD1MJPmAhA3DnX5JDORcga CbPEwhLj1xlwTgpeT+QfDmGJ5B5BlrrQFZVE1fChEjiJvyiSAO4yQPkrPVYTI7Xj34FnscPj /IrRUUka68MlHxPtFnAHr25VIuOS41lmYKYNwPNLRz9Ik6DmeTG3WJO2BQRNvXA0pXrJH1fN GSsRb+pKEKHKtL1803x71zQxCwLh+zLP1iXHVM5j8gX9zqupigQR/Cel2XPS44zWcDW8r7B0 q1eW4Jrv0x19p4P923voqn+joIAostyNTUjCeSrUdKth9jcdlam9X2DziA/DHDFfS5eq4fEv ABEBAAHCwHwEGAEIACYCGwwWIQQt33LlpaVbqJ2qQuHCPZHzoSX+qAUCY00ibgUJDToHvwAK CRDCPZHzoSX+qK6vB/9yyZlsS+ijtsvwYDjGA2WhVhN07Xa5SBBvGCAycyGGzSMkOJcOtUUf tD+ADyrLbLuVSfRN1ke738UojphwkSFj4t9scG5A+U8GgOZtrlYOsY2+cG3R5vjoXUgXMP37 INfWh0KbJodf0G48xouesn08cbfUdlphSMXujCA8y5TcNyRuNv2q5Nizl8sKhUZzh4BascoK DChBuznBsucCTAGrwPgG4/ul6HnWE8DipMKvkV9ob1xJS2W4WJRPp6QdVrBWJ9cCdtpR6GbL iQi22uZXoSPv/0oUrGU+U5X4IvdnvT+8viPzszL5wXswJZfqfy8tmHM85yjObVdIG6AlnrrD In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:rqMFq29DGLQxE41/8lph09W7U1P8Q+yXnIzBV7ODg2O+ymxMNjx fyXp4i5xpKTSiRSV5i9z6G/XxBpPqQZEMhh2oIn56LSqaGZXRJS0ozYbnZvjvvkaaHhr+QF 9/X3QNm6WSXpAYnwnywG2ANoKckY5lStH0x/GN4BnYFRbIix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r jxRAU1PELC4euXGkYT+kIVQidQg= On 2024/1/20 14:45, Chenyuan Yang wrote: > Dear Linux Kernel Developers for BTRFS, > > We encountered "kernel BUG in btrfs_get_root_ref" and "general > protection fault in btrfs_update_reloc_root" when testing BTRFS with > Syzkaller and our generated specifications. > > For "kernel BUG in btrfs_get_root_ref", it is an internal assertion > failure `ASSERT(!anon_dev)` in `btrfs_get_root_ref` > (https://elixir.bootlin.com/linux/latest/source/fs/btrfs/disk-io.c#L1319= ), > which asserts the `anno_dev` should be NULL but it is preallocated > here. I've attached the reproducible C program and report. Thanks for this report, unfortunately the C reproducer did nothing related to btrfs, it doesn't even try to mount any btrfs (no dmesg on mounting/unmounting a btrfs at all). I guess I'm missing something? And through the dmesg, it looks like there is something weird here. Firstly the ASSERT() got triggered means we didn't get any anon_dev number assigned, but create_subvol() would return an error if its get_anon_bdev() call failed. So the only explanation I can come up with is, in a special system that there is no anon_dev allocated at all, get_anon_bdev() can get @anon_dev assigned to 0. In that case, it just means the ASSERT() is not correct as it doesn't take this case into consideration at all. I can definitely submit a patch to remove the ASSERT(). Do you have any dedicated URL for this btrfs_get_root_ref() failure that you want to put as "Reported-by" tag? Or I should just use your gmail address as "Reported-by"? Thanks, Qu > > For "general protection fault in btrfs_update_reloc_root", it attempts > to deference the null pointer in `refcount_inc_not_zero(&root->refs)` > (https://elixir.bootlin.com/linux/latest/source/fs/btrfs/disk-io.h#L101)= , > which is invoked by `btrfs_update_reloc_root` > (https://elixir.bootlin.com/linux/v6.7/source/fs/btrfs/relocation.c#L926= ). > Here is the call trace: > ``` > general protection fault, probably for non-canonical address > 0xdffffc00000000cd: 0000 [#1] PREEMPT SMP KASAN > KASAN: null-ptr-deref in range [0x0000000000000668-0x000000000000066f] > [ 1904.856783][T69219] Call Trace: > [ 1904.857057][T69219] > [1904.857312][T69219] ? show_regs (arch/x86/kernel/dumpstack.c:479) > [1904.857693][T69219] ? die_addr (arch/x86/kernel/dumpstack.c:421 > arch/x86/kernel/dumpstack.c:460) > [1904.858074][T69219] ? exc_general_protection > (arch/x86/kernel/traps.c:700 arch/x86/kernel/traps.c:642) > [1904.858515][T69219] ? asm_exc_general_protection > (./arch/x86/include/asm/idtentry.h:564) > [1904.858941][T69219] ? btrfs_update_reloc_root > (./include/linux/refcount.h:162 ./include/linux/refcount.h:227 > ./include/linux/refcount.h:245 fs/btrfs/disk-io.h:101 > fs/btrfs/relocation.c:926) > [1904.859402][T69219] ? btrfs_update_reloc_root (fs/btrfs/relocation.c:9= 29) > ``` > Unfortunately, we failed to find the reproducible program for > "general protection fault in btrfs_update_reloc_root". I have attached > the report and log for it. > > If you have any questions or require more information, please feel > free to contact us. > > Best, > Chenyuan