Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp199734lqb; Thu, 14 Mar 2024 08:57:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVU4d7gt9jAvJ3N5rNsTe4VOnPmBU6eOTq+H5Jtb8JCizUuGDMcn1AevQECvjQ/DKk+MY0sOH2nWFQzmjA8kPgJxw8mNuflRn5mUu1hHw== X-Google-Smtp-Source: AGHT+IGbCp5lm482KgXmUtCbhWy6Y0MSfgfzwZTQOsVxy2byCN58Y1N6SYsnnY4ikdG292QVzL2x X-Received: by 2002:a05:6a20:1720:b0:1a3:2d92:de05 with SMTP id bn32-20020a056a20172000b001a32d92de05mr420859pzb.62.1710431858902; Thu, 14 Mar 2024 08:57:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710431858; cv=pass; d=google.com; s=arc-20160816; b=oT6J+rTtvCVTo1QprL48VMFmbmiTM0mNlOq4CAUzZ9oNWq2L2BM8d7qb6H7bNYEzS1 ElWJxGWPK+3y50M0CbFO+zBJy31eym5B0IH8QYhD/IU9QeoyR3OQu2FyY4MFDpNdSbW1 7Zey47LyGOM36GfuFI2ORQT6hNt7Lq9k8UFq5xD1oAahKUPoA59Gk4iIVVv2MFPSxgv3 31HriVvMrlHIhbXeHm2R30eBMFzncu4k36y8xeMpwSyVp8ZLWkFhLAa/Gg/QrzzpIRUa Bw4Nw22AQz8v501cHn1qq3Z28WGFGhyfw3Q89/nejz/xjTKiFo7BN02zSqo62rTZvp34 fr+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=BT7NUMGMj375LcHUS5Xp8EH29Otg/hkMc0woQNGiIn8=; fh=t4mT/NN5idW8yB1/0Db/VddV5CvojMaSxdvwmvls/9A=; b=Vv3pHw9u8Fat1hzcmP8yaZowlI+2M/bTaAE2t+xeLy9dxquw7ZU6N1mVPbIL0ZU9wU hBl8wMaGcOjd74vKZDESWaZqMgqUUEjjl4gA51KEydtKgdcA9uLDI0O0u8cydGukb/2z CPSO0iInJoXKSW5DHj6SkwHc8LuVSob51/GdfDoKiJDDj0nv+MOfIzAenA3m2RO+ADMh 69IFJuxH+0lRtGV5I1mxj1sgc/I9vz66Os2iJNlCC8UWyDAD2OGfN0gwRcWNBL5iuYHs k8hV2cD1a9VG/cXLsClvowNCrcTbcoj7PRxj+apQGUdFDcOTA/PpbkPCG6Fi8SM0/WWe gj1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=tjLgQCjs; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AWTTVirU; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-103531-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103531-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h8-20020a632108000000b005dc4eb22ed9si849140pgh.166.2024.03.14.08.57.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 08:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103531-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=tjLgQCjs; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=AWTTVirU; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-103531-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103531-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BEA75B226AB for ; Thu, 14 Mar 2024 15:55:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 090F37441E; Thu, 14 Mar 2024 15:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="tjLgQCjs"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="deiIgmej"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="AWTTVirU"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="aYLQHl+L" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BC6B7353F; Thu, 14 Mar 2024 15:54:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710431664; cv=none; b=oT8c6Knds8w0Y7UTcOBGeUq2Hbc/7MZr7l4NjrWE5AdWCe1KZFmgustnggJb3iBnN6CttvaO+c2YMT4MH+TI3qU5yd+d9kL39sP3r7WoTzIIgPgs/l3S5VKN73iUipKbhvT03GLTDRUTO8i9u4el6wD9a2SpxCWXbiR9BNrmGig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710431664; c=relaxed/simple; bh=km/3aGcwVNjprkRJ5a9yQcLEWlg19dOOzcQex1nbcDg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iMY7NUvTtS/agUwjhDvxZX1jeUGXPY9XhMEPV26bEsANTtT4LslycTb4OLnxexMnV68DafSlE30NjfXyoTjRMCzuykS8EeovUIAFNi425hz9wxmDq4ul5tOr1cQhIA7qZfbdnlnaKroQrGMmauTQHvLBr8pf/U0TwWCaw6CoZcQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=tjLgQCjs; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=deiIgmej; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=AWTTVirU; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=aYLQHl+L; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0A9211F86A; Thu, 14 Mar 2024 15:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1710431660; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BT7NUMGMj375LcHUS5Xp8EH29Otg/hkMc0woQNGiIn8=; b=tjLgQCjs4YoblTiknk6v6c925YSD176Y5HwHks5cFNCjarrSHZnNEBosRUXLkYpZuJQDgu +V5LUYgzSuPSn6h8z+ai0PgYyjYuQeJkuTUPS9S4rX5wpZjluyB08UhyDQS7styBkfHrCi sTt5gjYS0TpE5tM880uh41XJrpXOjp8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1710431660; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BT7NUMGMj375LcHUS5Xp8EH29Otg/hkMc0woQNGiIn8=; b=deiIgmejfrJ1f/+HDe80GhXDzXeVJZUZmpGB+FgnmxIn0XO8HuDS1CKuV240QgjtijBZCb 5jVWmsuSoaoKEzDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1710431658; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BT7NUMGMj375LcHUS5Xp8EH29Otg/hkMc0woQNGiIn8=; b=AWTTVirUlEzlgXbsQ5/f9Ni0hm7MBI1wX/6gYrGxFWSWj6ybNhOifVLrALpsP0LQts1qfJ j3YdTiJh+dEBUQc6RnC4g86+BZft7fVBVnoWCu4AhYRNl7VoMzxaOEucNliSC3wuCrP5MN 6a/lRkIjIIkgM/NcuUVenfQDVJGBHBY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1710431658; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BT7NUMGMj375LcHUS5Xp8EH29Otg/hkMc0woQNGiIn8=; b=aYLQHl+LTd9+OOpdnBqccfKM8gwkHbTbLRCQxsonPrvfIziysIshoKCi2gTAW/ZjG0pg4N V8P5o+s9G9SCgMAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F092B1368B; Thu, 14 Mar 2024 15:54:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Myy1Oqkd82V5MwAAD6G6ig (envelope-from ); Thu, 14 Mar 2024 15:54:17 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 916D4A07D9; Thu, 14 Mar 2024 16:54:17 +0100 (CET) Date: Thu, 14 Mar 2024 16:54:17 +0100 From: Jan Kara To: Aleksandr Nogikh Cc: Jan Kara , syzbot , axboe@kernel.dk, brauner@kernel.org, jmorris@namei.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, paul@paul-moore.com, serge@hallyn.com, syzkaller-bugs@googlegroups.com, Tetsuo Handa Subject: Re: [syzbot] [hfs] general protection fault in tomoyo_check_acl (3) Message-ID: <20240314155417.aysvaktvvqxc34zb@quack3> References: <000000000000fcfb4a05ffe48213@google.com> <0000000000009e1b00060ea5df51@google.com> <20240111092147.ywwuk4vopsml3plk@quack3> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -1.30 X-Spamd-Result: default: False [-1.30 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; URI_HIDDEN_PATH(1.00)[https://syzkaller.appspot.com/x/.config?x=7406f415f386e786]; TAGGED_RCPT(0.00)[28aaddd5a3221d7fd709]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCPT_COUNT_TWELVE(0.00)[13]; DBL_BLOCKED_OPENRESOLVER(0.00)[syzkaller.appspot.com:url,suse.com:email,suse.cz:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Spam-Flag: NO On Sun 10-03-24 09:52:01, Tetsuo Handa wrote: > On 2024/01/11 18:21, Jan Kara wrote: > > On Wed 10-01-24 22:44:04, syzbot wrote: > >> syzbot suspects this issue was fixed by commit: > >> > >> commit 6f861765464f43a71462d52026fbddfc858239a5 > >> Author: Jan Kara > >> Date: Wed Nov 1 17:43:10 2023 +0000 > >> > >> fs: Block writes to mounted block devices > >> > >> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15135c0be80000 > >> start commit: a901a3568fd2 Merge tag 'iomap-6.5-merge-1' of git://git.ke.. > >> git tree: upstream > >> kernel config: https://syzkaller.appspot.com/x/.config?x=7406f415f386e786 > >> dashboard link: https://syzkaller.appspot.com/bug?extid=28aaddd5a3221d7fd709 > >> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17b5bb80a80000 > >> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10193ee7280000 > >> > >> If the result looks correct, please mark the issue as fixed by replying with: > > > > Makes some sense since fs cannot be corrupted by anybody while it is > > mounted. I just don't see how the reproducer would be corrupting the > > image... Still probably: > > > > #syz fix: fs: Block writes to mounted block devices > > > > and we'll see if syzbot can find new ways to tickle some similar problem. > > > > Honza > > Since the reproducer is doing open(O_RDWR) before switching loop devices > using ioctl(LOOP_SET_FD/LOOP_CLR_FD), I think that that commit converted > a run many times, multi threaded program into a run once, single threaded > program. That will likely hide all race bugs. > > Does that commit also affect open(3) (i.e. open for ioctl only) case? > If that commit does not affect open(3) case, the reproducer could continue > behaving as run many times, multi threaded program that overwrites > filesystem images using ioctl(LOOP_SET_FD/LOOP_CLR_FD), by replacing > open(O_RDWR) with open(3) ? Hum, that's a good point. I had a look into details how syskaller sets up loop devices and indeed it gets broken by CONFIG_BLK_DEV_WRITE_MOUNTED=n. Strace confirms that: openat(AT_FDCWD, "/dev/loop0", O_RDWR) = 4 ioctl(4, LOOP_SET_FD, 3) = 0 close(3) = 0 mkdir("./file0", 0777) = -1 EEXIST (File exists) mount("/dev/loop0", "./file0", "reiserfs", 0, "") = -1 EBUSY (Device or resource busy) ioctl(4, LOOP_CLR_FD) = 0 close(4) = 0 which explains why syzbot was not able to reproduce some problems for which CONFIG_BLK_DEV_WRITE_MOUNTED=n should have made no difference (I wanted to have a look into that but other things kept getting higher priority). It should be easily fixable by opening /dev/loop0 with O_RDONLY instead of O_RDWR. Aleksandr? Honza -- Jan Kara SUSE Labs, CR