Message ID | tencent_7F29369E974036964A3E742F778567CC3C09@qq.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-46397-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1856447dyb; Wed, 31 Jan 2024 04:37:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnWm/1viuwG9CoSQlsMt7xG58cPP8Jyys+oE3Rmz/lwp+mLzGQHk+01s+9rx2NrlshV/00 X-Received: by 2002:aa7:86d2:0:b0:6de:3319:ac22 with SMTP id h18-20020aa786d2000000b006de3319ac22mr1622801pfo.2.1706704654231; Wed, 31 Jan 2024 04:37:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706704654; cv=pass; d=google.com; s=arc-20160816; b=aaKV9n43/4sC3eMPZ0RdgIciQ9TbOyvQUGgzseqIQAawgqLWiofnp9iooMdGjeIhYz 83niwibHohVaJrlMXez1fAiBu/XLO0V6615T7XuY1qStG7K8d9lsqW12daejJWXOui9o d7Iw45i4cZhMD2DyGzZbtpBWwnuYqAF68mvw+aJ5VVoVcMNowvyLYI9UHDUEyDS0YaXz j/Q0NPQ/i9vHAsH2fvRtw1jRAz/gvWyfCDJuu0c6BS3TqDazgGbIDa2lSJmKNOxTVV8+ qLsVsoVmZ9/YJ/G9uOTBDnttK2Qtpgq8vtNZ3+kg+Hf+w8kD62IeX8lls6SQTbay2trg 7nGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=OcZp1rMol08Z2WnpIQmEJuPhzfQf6La7Ry56I2aCSsM=; fh=F/S412EquzH50RqQ6l0ZKuRGvnFzcTuYeBtLxFe8M2Q=; b=0WtQmbQPRfA1uOAVbaPdn3EGWKCqX1nCY7To3jCgdkv/VY11dEpBU1L1AZ/qmzUAGc EUuwNZWhMo89wEDJO2A9UKqPkDu3RnbcDKtxxJPJJAUnt4PvFH0oKjBaLkRFlC/jPWgX zv0XSCGh/aot9hGFimksRqJP39YZ6k1YLJ3uiHhjyvr3e8WUU4zOFKpJnSTOtmXHBLYr OMI2CSFvw3BtGEJNdQb78wqJZ8Y4RlJJpC08q044SZDS4bfRXqYhMNG9uEqagdEln8OA 5TGUOIBJwDpHY7PsZcVe95NtW4Jn80PGe34oFIIrD5lQGElq/E/EGOLlYmkoDPObP/5u NHvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=gpwVmNbX; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-46397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46397-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com X-Forwarded-Encrypted: i=1; AJvYcCVEhY5cFqy6uAlCwzjG1DtOHlFz9TMBrwYD+GqGJuQQIr/ds2JNoSaA0qC9zwdm7d0krQB6BYj+sVxvjIlLTukXdOou3g== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p31-20020a056a000a1f00b006db0fd78246si9608637pfh.366.2024.01.31.04.37.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 04:37:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=gpwVmNbX; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-46397-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46397-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2EE23B27453 for <ouuuleilei@gmail.com>; Wed, 31 Jan 2024 12:04:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E311978B73; Wed, 31 Jan 2024 12:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="gpwVmNbX" Received: from out203-205-221-205.mail.qq.com (out203-205-221-205.mail.qq.com [203.205.221.205]) (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 4A2F67866C; Wed, 31 Jan 2024 12:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.205.221.205 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706702675; cv=none; b=JIzOX3o3nCHpjoLz3iKxi+JjQMiBT+nqBOUgFOk0HyP1GrDYtm8SsITkjClxIqp6uCQ1/6Lht2U0Kf7lBT42jIy+ubp9u/Sbw9w4lVMpLbD81dzGfN7djhsiztZ3znQw1si1bBQXEhiQtlAPfy48Ve8N0zdL1Kr24FpnlS5awEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706702675; c=relaxed/simple; bh=F+KoyRFtfnsgTzITPD6Uvzz6cJDqE0m6fF2NfXjS3LQ=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=u39f1ODfm94IvorN4Uq4vQ9PUgW2fCDwIcHp9XrOkyVDqGTkBRsUTlaOqNsRc3SW/m3wZamR0yTz2wfOL3mlvTUIFRvCRifpAwnz4UZDF1wMIo9t++cb6J1zrwojoy+j/paBrQ5pmwHQ5NqpDRf8G5Ze4mqVL3iRbsKeqm/HjtU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=gpwVmNbX; arc=none smtp.client-ip=203.205.221.205 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1706702669; bh=OcZp1rMol08Z2WnpIQmEJuPhzfQf6La7Ry56I2aCSsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gpwVmNbXAfM4HjLrVX8m0DwgrXVHwxM1nuqcFibTpkSFKbMMwGlHoYCrKkE/+jvSn ln7ROO//5hE+V/MnBzbemmx3MnkH4qqvNsXL5QAUeXtOCENFHRnJ11mrtQpGcaPf9T Cgacs6g7BLoSDldyPbpUeVICnlTULcYCDq+5hflQ= Received: from pek-lxu-l1.wrs.com ([111.198.225.215]) by newxmesmtplogicsvrsza7-0.qq.com (NewEsmtp) with SMTP id 11AB34D7; Wed, 31 Jan 2024 20:04:26 +0800 X-QQ-mid: xmsmtpt1706702666trpq83rx5 Message-ID: <tencent_7F29369E974036964A3E742F778567CC3C09@qq.com> X-QQ-XMAILINFO: OLnGMPzD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bcdf0096ef605@syzkaller.appspotmail.com Cc: 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: [PATCH] jbd2: user-memory-access in jbd2__journal_start Date: Wed, 31 Jan 2024 20:04:27 +0800 X-OQ-MSGID: <20240131120426.1278044-2-eadavis@qq.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <000000000000d6e06d06102ae80b@google.com> References: <000000000000d6e06d06102ae80b@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789609539254304640 X-GMAIL-MSGID: 1789609539254304640 |
Series |
jbd2: user-memory-access in jbd2__journal_start
|
|
Commit Message
Edward Adam Davis
Jan. 31, 2024, 12:04 p.m. UTC
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 <eadavis@qq.com>
---
fs/jbd2/transaction.c | 3 +++
1 file changed, 3 insertions(+)
Comments
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 <eadavis@qq.com> 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 >
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;