Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3434608rdb; Wed, 27 Dec 2023 07:20:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAyvc+rsMmsWeJch4ZUQX5k2+LL5kMLypw8gqbrwfhHHZg6Tfjh9aBzH/cRaK5cNc8ehR2 X-Received: by 2002:a05:6a20:7345:b0:195:b681:852d with SMTP id v5-20020a056a20734500b00195b681852dmr4670819pzc.91.1703690402337; Wed, 27 Dec 2023 07:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703690402; cv=none; d=google.com; s=arc-20160816; b=hQrPxJRvZujcyqoMq1/I/KSgQYzXUGFEEOUulz91hgkd8M5BLj0FlT6UkoPMl5EpLm UB/LIit8GCgxg15iUXLupYFmBYV1a04mj4Tp7ZL1H4Px1YegkK/LDYIuuRZjXYn8CzdQ CYwlbS+f/OYTRFu9wC8qv7jj71g108QyrD9iAdr0pfsgL42Ctx4yNcX8KSYhjtMKpkz+ 0r+anrtzZ8vmkZPPmIVu7Cih+FDD6yBpAWge965zUyuSfnjo568REInIQEvrWHNX6Ewv +AwF/GPb+hrDVRMC4QsOz6GZHLuENux0bRkLCFvmukXdCObsgnOuSXZ0W4+q7mkBpIhh pIMQ== ARC-Message-Signature: i=1; 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:message-id :date:subject:cc:to:from; bh=HIKGOBaBWkqeEgBcBzwSxi/snXFv7xa6xa8yVQ9XAyQ=; fh=FSMGbC55xQL5hnCmurY7u0s+iimG2a8fhtdQ0AJgrrM=; b=unhCEGZ31OvWOHOJEsfVQYAPNF08uIxkWwbmgcjQQVOXJwH24GIWLyShE9ZjxLfxz+ V72cVwuMo3jhARU7KmzxwqtYAF9mN55C5aghoSR5jIDQMpu/YxDbbMXx8c/XwEqP4z+J xY7H2vStfee3UVA7KkXydN/dD9crKKvElYb8h0OvbA88wBwtChgNCSZ/081ucaRwSKp2 srcCKeOVWaijlk2qpAwEDiDJNAT8Xt5KvVPBEGS40h4/hswlccJngxB1meVWTiI8cMqO BVZJJB2YXMdsH/UQvfR8J4Jm7hmNQiOIs8LcyiKyfJZ3EQQcwoUtRUD5RHPXsJKRBW6T tlVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-12081-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c1-20020aa78c01000000b006d9d49847aasi3380615pfd.33.2023.12.27.07.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 07:20:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12081-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; spf=pass (google.com: domain of linux-kernel+bounces-12081-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4DF27B2125B for ; Wed, 27 Dec 2023 15:19:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6360F45962; Wed, 27 Dec 2023 15:19:23 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (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 14D6145956 for ; Wed, 27 Dec 2023 15:19:19 +0000 (UTC) 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 X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R291e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VzLTIgm_1703690346; Received: from e69b19392.et15sqa.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VzLTIgm_1703690346) by smtp.aliyun-inc.com; Wed, 27 Dec 2023 23:19:11 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , Gao Xiang , syzbot+6c746eea496f34b3161d@syzkaller.appspotmail.com Subject: [PATCH] erofs: avoid debugging output for (de)compressed data Date: Wed, 27 Dec 2023 23:19:03 +0800 Message-Id: <20231227151903.2900413-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <000000000000321c24060d7cfa1c@google.com> References: <000000000000321c24060d7cfa1c@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Syzbot reported a KMSAN warning, erofs: (device loop0): z_erofs_lz4_decompress_mem: failed to decompress -12 in[46, 4050] out[917] ===================================================== BUG: KMSAN: uninit-value in hex_dump_to_buffer+0xae9/0x10f0 lib/hexdump.c:194 .. print_hex_dump+0x13d/0x3e0 lib/hexdump.c:276 z_erofs_lz4_decompress_mem fs/erofs/decompressor.c:252 [inline] z_erofs_lz4_decompress+0x257e/0x2a70 fs/erofs/decompressor.c:311 z_erofs_decompress_pcluster fs/erofs/zdata.c:1290 [inline] z_erofs_decompress_queue+0x338c/0x6460 fs/erofs/zdata.c:1372 z_erofs_runqueue+0x36cd/0x3830 z_erofs_read_folio+0x435/0x810 fs/erofs/zdata.c:1843 The root cause is that the printed decompressed buffer may be filled incompletely due to decompression failure. Since they were once only used for debugging, get rid of them now. Reported-by: syzbot+6c746eea496f34b3161d@syzkaller.appspotmail.com Closes: https://lore.kernel.org/r/000000000000321c24060d7cfa1c@google.com Signed-off-by: Gao Xiang --- fs/erofs/decompressor.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index af98e88908ee..923afef7997a 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -246,15 +246,9 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx, if (ret != rq->outputsize) { erofs_err(rq->sb, "failed to decompress %d in[%u, %u] out[%u]", ret, rq->inputsize, inputmargin, rq->outputsize); - - print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET, - 16, 1, src + inputmargin, rq->inputsize, true); - print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET, - 16, 1, out, rq->outputsize, true); - if (ret >= 0) memset(out + ret, 0, rq->outputsize - ret); - ret = -EIO; + ret = -EFSCORRUPTED; } else { ret = 0; } -- 2.39.3