Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1651045lqg; Sun, 3 Mar 2024 22:04:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOdylFrihoJ8M86f6fZIGlGxmOOIujOO3WEmjCY6rnGmwjdtdpAhPgjruanLkQHzkueHCivIzX40rJgRSZLMXNlQIF83tqEmJz7sADHg== X-Google-Smtp-Source: AGHT+IHYOoVFlmoIsZLuRcQOL1AxeqdYIUxGPlprdGxk39g9AXFiW2rumgpm4fs+5FdounQUZRF0 X-Received: by 2002:a17:906:b7cb:b0:a44:e90d:c091 with SMTP id fy11-20020a170906b7cb00b00a44e90dc091mr3174339ejb.59.1709532292319; Sun, 03 Mar 2024 22:04:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709532292; cv=pass; d=google.com; s=arc-20160816; b=OuOvvHWo9nf8almYLnOAPFIIN/tJb0VVfLYExg5yIRpsqTl4HgkqWxT9Cx6JUsmf9h 5k7QgRCNLW16OdQedo6RU52nlS9bP3sHZtPTI8jOOPb2VxPAYbrwZ9WzQ5L6crxHgSy5 axJ5Ah7wE6NYafZuzS23lJBFnDUvX3stCgMrdTJvhLxKH90WeP/8GQeVOxeNJNcGPixg NaeiuNfcfocGHWeyUkRS6ixqXrHV3qcQu99DgdQrUfRuLycTa1lNPFZW5O04oMHL8eL3 S0NovlpNPjjBQk5wuadRaQIv9EOzzSzfEWmO4c13Wr+0gRZ5GPajEBrTYAig03n3x2QG 3AXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=ADibi9+LqS/ZbdWl7A42/kCs0BgntDzko1HwYihHMqE=; fh=uEeDYTHbWkMkV3NhBH3gQVCsNPYCeEFvW9FRasoF1BI=; b=loF3L4/y+CvhKSwvPegCM89q/xOVknXepta/qsDqNAKiSJyHx+8MeQO6jLRnJNo3XJ EfbZtoAB5GNv1mfWd+TyDwEr8ay/sgDrdbTktmeOi3s9ntarORO0d5SDvMMyCOXee0sJ +KMFpfnhz/1iKirypxr5YRRxUox+ngRHGeQ9eVHFTkB84sgVsb7joNXlt0VFVwVtkXA4 VMoNJ+3KzefxGhBgLFEucPrZkg4ygTPKqWofBBK/L+nZMCYsRMeqH9PgJ3S97txz5H8V 9QGHT50vOpOgFj1RhBDdbuzuFgIAk7Hik+XCy+qGy1vP0SqPjOu/oIl+gt5Be32VjnAm /9pA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=h0PmJG41; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-90074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90074-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ne19-20020a1709077b9300b00a3f52dc6a1esi3784266ejc.1014.2024.03.03.22.04.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 22:04:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=h0PmJG41; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-90074-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90074-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0AF961F21272 for ; Mon, 4 Mar 2024 06:04:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A18DBE7F; Mon, 4 Mar 2024 06:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="h0PmJG41" Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) (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 1E324B666 for ; Mon, 4 Mar 2024 06:04:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709532284; cv=none; b=OFq1iYZReSQardUoEdsv/NG4YHPPf/BPD3BEvVt/QfkP/1uFLlOtOlYrwFzL3vPECzAQMcy0MsQSAR641/q6aMwvie0yH9iMQja4Ltoat527fpNBw8eOvTsrPo03ziFVhct5bm0u9jkIz3S143emh+KwN3dYyyxjwsbPUHNNJnM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709532284; c=relaxed/simple; bh=j1N9CytCpZ1A/5cEBov9dniiOXlJSyDrvcVElBK+Qsk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dsCoffC4SxHkbrJRKbG7mqhYNiY6DdDMPLfj2Ag3vufat8+8SeYixEFl1er/RAUYlXLuWKh1QQDjQiFkAqGqzeBvAjnGTSjV6cQiQevXtKgH+F5ZVAVqUc3XzkhfZB9/kGEg4MK2/A0aODKNucNYEbxNXv9R3CGp+FL12+TSP9Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=h0PmJG41; arc=none smtp.client-ip=115.124.30.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1709532272; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=ADibi9+LqS/ZbdWl7A42/kCs0BgntDzko1HwYihHMqE=; b=h0PmJG41RmFR1ERwxj1z1jfJT8PZw9L4jEqqTH9c4QF7QzVUKeUNRHBtVWUfFd3qaGmVso5Mes8/pcLIA9Wp0jyUB6i0qRDB6RdCwMULGPO6hJ6XRPGIq46aVDI8AMs3bXeTrbNzt0D6bbVom33i8WoaaXgwDEB3oaYJK1CVvJ4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R401e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0W1jQ1i1_1709532271; Received: from 30.97.48.196(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0W1jQ1i1_1709532271) by smtp.aliyun-inc.com; Mon, 04 Mar 2024 14:04:32 +0800 Message-ID: Date: Mon, 4 Mar 2024 14:04:30 +0800 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: [PATCH] erofs: fix uninitialized page cache reported by KMSAN To: linux-erofs@lists.ozlabs.org, syzkaller-bugs@googlegroups.com Cc: syzbot+7bc44a489f0ef0670bd5@syzkaller.appspotmail.com, Tetsuo Handa , LKML , Roberto Sassu References: <20240304035339.425857-1-hsiangkao@linux.alibaba.com> From: Gao Xiang In-Reply-To: <20240304035339.425857-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit #syz test git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git dev-test On 2024/3/4 11:53, Gao Xiang wrote: > syzbot reports a KMSAN reproducer [1] which generates a crafted > filesystem image and causes IMA to read uninitialized page cache. > > Later, (rq->outputsize > rq->inputsize) will be formally supported > after either large uncompressed pclusters (> block size) or big > lclusters are landed. However, currently there is no way to generate > such filesystems by using mkfs.erofs. > > Thus, let's mark this condition as unsupported for now. > > [1] https://lore.kernel.org/r/0000000000002be12a0611ca7ff8@google.com > > Reported-by: syzbot+7bc44a489f0ef0670bd5@syzkaller.appspotmail.com > Fixes: 1ca01520148a ("erofs: refine z_erofs_transform_plain() for sub-page block support") > Signed-off-by: Gao Xiang > --- > fs/erofs/decompressor.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c > index d4cee95af14c..2ec9b2bb628d 100644 > --- a/fs/erofs/decompressor.c > +++ b/fs/erofs/decompressor.c > @@ -323,7 +323,8 @@ static int z_erofs_transform_plain(struct z_erofs_decompress_req *rq, > unsigned int cur = 0, ni = 0, no, pi, po, insz, cnt; > u8 *kin; > > - DBG_BUGON(rq->outputsize > rq->inputsize); > + if (rq->outputsize > rq->inputsize) > + return -EOPNOTSUPP; > if (rq->alg == Z_EROFS_COMPRESSION_INTERLACED) { > cur = bs - (rq->pageofs_out & (bs - 1)); > pi = (rq->pageofs_in + rq->inputsize - cur) & ~PAGE_MASK;