Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1752078rdb; Wed, 31 Jan 2024 08:04:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IERtPOvirAocIYn8FmiG8WhT/rPpbVdXzIBGPRfPTpK7rQE6J6qzA+g6jiGquWE/qbAwv8G X-Received: by 2002:a17:903:1107:b0:1d9:3fda:91bf with SMTP id n7-20020a170903110700b001d93fda91bfmr931649plh.48.1706717075589; Wed, 31 Jan 2024 08:04:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706717075; cv=pass; d=google.com; s=arc-20160816; b=EFNHFRw51LTwXFl8JKRJ+1Pubog3PJTl4JUEYanRZkB3WNCqumzy14yJ2KpyRlakzq kz4KRkWrBCiigdMmjYtzkQjtRZBX7/Ijyn9iMJke9L2n3LJoAZj3QBaQUTt1oyHpOoSX wS3npIGqJmh6559uxFnWCqrVfTrYFv07zz4snivi0KUWK9XihFerIWs8bjAzSfoFq+wm a//79X5eRWR123ig8kup4B1DV28sf/gukk96K++bzGwspjE0fZu4NnN5+hOA7UKKpKww wT+mfrKCR+blfhaInw5aYWMj6TwlbUZJ+MuJW0DjX2Xs/H+mF88AzoLLfEymWLqT/uo0 dkeg== 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=DfCZX+hFUBlbWs8+8jojtXLtoVcojjb6ykWSphE2z1g=; fh=agjtHH6Ynka1wejGdk3PHH4WGSmBcBenFWJVD4g9SaY=; b=Vv1NmstYUQr9+Bc5gmFKqdLEdVeit+rErdCgYcSaUOeEsJJF7ehvHPZsHHHaAj9jZc hZY+nlNOyYqD6kTWM2d3B7umhMlPr3ykP1yGS/A/GG6JwWwnleC8wb+/ZRX68eWJhkmX DOJmgKxbnE2NVXtfvvuu8Q3MD2x1fdzhGFjUAWUhc4DJ5VwwG7M5qgHzWDgSmpks37Ma VdiqxYe0OdT7KOk2NdjLyN0EGLUvAglPXMmn834OL1QbeXs3gT5jZgm/qjkXTL0MBCtc zKq1s4NVMyBzytDTa5SmOvxhGwoBiXLppfiGm/wb7pYZTNd6JIEcomDSA8swDcAQ+rdD kCXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=eAYRS6JE; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=eAYRS6JE; 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-ext4+bounces-1046-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1046-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUNVMRz1i6oGdoxJptm0kw9ncviqSgsg+G4KFosvY9fzfBjRTFmw5VMuirB6ow1Me2S35dQx6gX/flcpVNSgE/PHxIyWal3cPxowDSJKw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f7-20020a170902860700b001d5486c27a6si9635477plo.422.2024.01.31.08.04.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:04:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-1046-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=eAYRS6JE; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=eAYRS6JE; 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-ext4+bounces-1046-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-ext4+bounces-1046-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 BAE38B2B351 for ; Wed, 31 Jan 2024 15:42:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BA4612AAE3; Wed, 31 Jan 2024 15:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="eAYRS6JE"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="JEcCUXZl"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="eAYRS6JE"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="JEcCUXZl" X-Original-To: linux-ext4@vger.kernel.org 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 8013D1292FA; Wed, 31 Jan 2024 15:41:56 +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=1706715718; cv=none; b=pZju3J0nx0puZSIkBCggZbQJUm+109hAI0j9Jw6Yid3RiwshLOIhsmXrFxxNoZHHN8tKcFbXwnygkaQejmOpbnSH7wx5+lEiDn+zXYsxflruIoqMr1tUiR96K2eMVYVGno1Rl+YR0GwtJXmZVTrqBcse1UIF7D0FY1B/YFMwPWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706715718; c=relaxed/simple; bh=k975rr5SOQJ0akKpIS6Xf8RVc6oORwcCOak8L3VOgN4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qEVhLmtMhFruNXNH2kXnf3NWNJQPKTLGMINfAbfdYQt1TWP5cZ7J6aBgdeFNftKB/pzlHzMzIsu5gAGgNlkhQHd3eYKFDRevlyWRanlrKP3MigFiaIF5kQ8EiHXuwbgNKp4w9ZRvXkDP8/dc9NJvYsqqtelR1y3Wkz6+6lQIDDY= 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=eAYRS6JE; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=JEcCUXZl; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=eAYRS6JE; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=JEcCUXZl; 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 imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (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 99A931F747; Wed, 31 Jan 2024 15:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1706715714; 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=DfCZX+hFUBlbWs8+8jojtXLtoVcojjb6ykWSphE2z1g=; b=eAYRS6JERcuIGWvi6Ek08YG+lfpfdU+UAgjzoDk7TwEInNVsdBf4o7EZXbfN0Y0JfD3dBs aobWKJqCIB0rO7brfn9fUSiZT/mn2cZ04fww5vWpgTp2gVtXvpjhASo+fdLTjVTrAEp7aI 8zP5d9B3ea8I12U+4GCjKO9R6SMA6zc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1706715714; 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=DfCZX+hFUBlbWs8+8jojtXLtoVcojjb6ykWSphE2z1g=; b=JEcCUXZltSMg4I4IO5xpTfXnvD8ZUTPWFRkM79oWnUGyAKuqqAs88AeT8qyKn9A19NT6zo zDhz8aK3F+mAXmCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1706715714; 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=DfCZX+hFUBlbWs8+8jojtXLtoVcojjb6ykWSphE2z1g=; b=eAYRS6JERcuIGWvi6Ek08YG+lfpfdU+UAgjzoDk7TwEInNVsdBf4o7EZXbfN0Y0JfD3dBs aobWKJqCIB0rO7brfn9fUSiZT/mn2cZ04fww5vWpgTp2gVtXvpjhASo+fdLTjVTrAEp7aI 8zP5d9B3ea8I12U+4GCjKO9R6SMA6zc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1706715714; 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=DfCZX+hFUBlbWs8+8jojtXLtoVcojjb6ykWSphE2z1g=; b=JEcCUXZltSMg4I4IO5xpTfXnvD8ZUTPWFRkM79oWnUGyAKuqqAs88AeT8qyKn9A19NT6zo zDhz8aK3F+mAXmCA== Received: from imap2.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 imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 7DCC2132FA; Wed, 31 Jan 2024 15:41:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id cPeuHkJqumWyfwAAn2gu4w (envelope-from ); Wed, 31 Jan 2024 15:41:54 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 0ADF9A0809; Wed, 31 Jan 2024 16:41:54 +0100 (CET) Date: Wed, 31 Jan 2024 16:41:53 +0100 From: Jan Kara To: Edward Adam Davis Cc: syzbot+cdee56dbcdf0096ef605@syzkaller.appspotmail.com, adilger.kernel@dilger.ca, chandan.babu@oracle.com, jack@suse.com, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, syzkaller-bugs@googlegroups.com, tytso@mit.edu Subject: Re: [PATCH] jbd2: user-memory-access in jbd2__journal_start Message-ID: <20240131154153.domdzkkbqgpkplp2@quack3> References: <000000000000d6e06d06102ae80b@google.com> Precedence: bulk X-Mailing-List: linux-ext4@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; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=eAYRS6JE; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=JEcCUXZl X-Spamd-Result: default: False [1.69 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.cz:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[11]; FREEMAIL_TO(0.00)[qq.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[qq.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TAGGED_RCPT(0.00)[cdee56dbcdf0096ef605]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.cz:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; SUSPICIOUS_RECIPS(1.50)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 1.69 X-Rspamd-Queue-Id: 99A931F747 X-Spam-Level: * X-Spam-Flag: NO X-Spamd-Bar: + On Wed 31-01-24 20:04:27, Edward Adam Davis wrote: > Before reusing the handle, it is necessary to confirm that the transaction is > ready. > > Reported-and-tested-by: syzbot+cdee56dbcdf0096ef605@syzkaller.appspotmail.com > Signed-off-by: Edward Adam Davis Sorry but no. Dave found a way to fix this particular problem in XFS and your patch would not really improve anything because we'd just crash when dereferencing handle->saved_alloc_context. Honza > diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c > index cb0b8d6fc0c6..702312cd5392 100644 > --- a/fs/jbd2/transaction.c > +++ b/fs/jbd2/transaction.c > @@ -493,6 +493,9 @@ handle_t *jbd2__journal_start(journal_t *journal, int nblocks, int rsv_blocks, > return ERR_PTR(-EROFS); > > if (handle) { > + if (handle->saved_alloc_context & ~PF_MEMALLOC_NOFS) > + return ERR_PTR(-EBUSY); > + > J_ASSERT(handle->h_transaction->t_journal == journal); > handle->h_ref++; > return handle; > -- > 2.43.0 > -- Jan Kara SUSE Labs, CR