Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp3205533rdd; Sat, 13 Jan 2024 23:18:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQp5eNUsuOD/LV88BZ2fn5RMK4Mlx/+YfqsoNG66dWaKtHkwzNi0VM5Jb02WqCKwVGDYxo X-Received: by 2002:a05:620a:22e2:b0:783:e81:d616 with SMTP id p2-20020a05620a22e200b007830e81d616mr4204186qki.132.1705216725075; Sat, 13 Jan 2024 23:18:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705216725; cv=none; d=google.com; s=arc-20160816; b=eLXm4xW4NbEWXvuGpONytvilF//CHLcZVwbGZ3teuGej0z47JkNljmcIMCqiQisfNc aNw4oSXqgjQuS7eI3C908iwQUlDiDD/UnO+11S+P3naNM1XHgTmhJj/ZJjp2Ccg5n2PD Fs9MjsMFPV2UUHXCkm9cGVkjqLLSHq+5Qk0YYSQYQWg7EF0Oy3zOjx1H4tFtSOsQVGQD MLV0a6so1B3DPMwTfL2ZQb26n0VI1Y06mEyAN1ifARZzo0TUK0DxLShb/J+cuQDtsgRL nMQpl1SUkVKZBeMTkS8khN/gDG18eQRDLmwNs/Z7EzMYGDStlfVWDFB46oTJEo8gmpsM jMBA== 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 :subject:cc:to:from:date:dkim-signature; bh=EfOY4hqiuCt9vvQdw+q0DGwlOUMbwjspM6TDeMSz84Q=; fh=Bz3RizA2diWNTzaLSv4aT9xBmDGuUoAYmiwfDfvX78I=; b=oGtzhJGyYXsP5VgfIo2DzZgSdIU1J/9uKfjZN79vlexUytgUwuKxAx6rtwBG7N/zKr J8r4EUWNPXBILvHallQCEy5swBcuUCQ+vBzDn9qwpPCbkAx9ZPaCgYRTao2j4N4JKY3E kEMriCwXy8iqoqCLL0ekEnR7gxqzEQ2guzfpCtEfVWDyyrIJup+1VqPvHVlY8gFj42r9 fIdaBIsQdE6ImyaJGu9nZdnubbm2AV9lnSyf3vpNeYQyflO5fWvGscjr9Hs8yhZPeuiH gtOplr77yCFwOGzYaDtCqZiz3Q79+iTGTyxTLGR8yW780r6lIfRQxeRjFUVwjh6uOzKB 59HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="luOi+0/5"; spf=pass (google.com: domain of linux-kernel+bounces-25412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ou2-20020a05620a620200b007834d5f9833si3198099qkn.78.2024.01.13.23.18.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jan 2024 23:18:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="luOi+0/5"; spf=pass (google.com: domain of linux-kernel+bounces-25412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25412-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D0F651C20DD8 for ; Sun, 14 Jan 2024 07:18:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD2B51877; Sun, 14 Jan 2024 07:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="luOi+0/5" Received: from mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 967561854 for ; Sun, 14 Jan 2024 07:18:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-36066190a99so38911965ab.3 for ; Sat, 13 Jan 2024 23:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705216713; x=1705821513; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=EfOY4hqiuCt9vvQdw+q0DGwlOUMbwjspM6TDeMSz84Q=; b=luOi+0/5yzDZoWNNO4wpriLI6P2dmRLOuU8yP4DmutoVdzhBsSRxakbDp9hAvdkN02 9SQfV1C2Mruw0N+SNUiksFY/+7Xy0T2w80s0I86pPwsgYVT+N2UyoQOmIQoFACj4iUE5 F28kyEVwNT2BerxyFxLdOUqnfPTxGvH27aAoZcRrKms9RpVj8+iMIsqIoc6dro3GDq0T CDNqj2EkMNGVl0quEgPEykQg4XuuNrAHg3IyDjnZdy2vWX8g2tsc3jzBvKh3YAwOUwV2 rbdz+YPkmOosDtP943XzTsxesL3BlDXLTg2aY1TBccpshvl80kFEubV1DWWVmHWMQjBa CHgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705216713; x=1705821513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EfOY4hqiuCt9vvQdw+q0DGwlOUMbwjspM6TDeMSz84Q=; b=AmQFJAFodyNANobfGvfFr4wm4R9kLuErHIuqt2XtLCC946PAL9KJ+u9y+wKVPS6fnt 7CdYO3AmMYMXsA6Rmwl6u+L57AMS8Lx+6Ew1xDZVR0+SHMt8E03KOAMBfyCyBavDVLPF PXNqHPg8a3fycUCanmGlXWI9eR+p6aMpgn1ZrVkDR1PwWXC6s8E45ca2yUp4lXUCxJUp ng+2DIzyMER+OvSscWafBkVDSaBDbw7aCQA6+PT0HY8OOSywKKZpd0hUviJMzk6D3fCI ddKklb0a6CMva1p4F5Y0JAnczsJzZCOyiWqlz/P6BV0cV3LaIgFYRAIi6890TN7h6zRQ 5CdQ== X-Gm-Message-State: AOJu0Yy85dMlZGlejQjV5/bJSLnp16oNdh2oJMrDsUgZ20OszxhfpCe9 K+QeiBEYftmS7rHObgnkQ+tMRAJhQqMok9On X-Received: by 2002:a6b:f90a:0:b0:7be:dc94:766a with SMTP id j10-20020a6bf90a000000b007bedc94766amr5059898iog.0.1705216713583; Sat, 13 Jan 2024 23:18:33 -0800 (PST) Received: from localhost ([156.236.96.164]) by smtp.gmail.com with ESMTPSA id mf3-20020a170902fc8300b001d075e847d5sm5690600plb.44.2024.01.13.23.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jan 2024 23:18:33 -0800 (PST) Date: Sun, 14 Jan 2024 15:18:27 +0800 From: Yue Hu To: Gao Xiang Cc: linux-erofs@lists.ozlabs.org, Yue Hu , bugreport@ubisectech.com, LKML Subject: Re: [PATCH v3] erofs: fix inconsistent per-file compression format Message-ID: <20240114151827.000069d6.zbestahu@gmail.com> In-Reply-To: <20240113150602.1471050-1-hsiangkao@linux.alibaba.com> References: <20231227050633.1507448-1-hsiangkao@linux.alibaba.com> <20240113150602.1471050-1-hsiangkao@linux.alibaba.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) 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-Transfer-Encoding: 7bit On Sat, 13 Jan 2024 23:06:02 +0800 Gao Xiang wrote: > EROFS can select compression algorithms on a per-file basis, and each > per-file compression algorithm needs to be marked in the on-disk > superblock for initialization. > > However, syzkaller can generate inconsistent crafted images that use > an unsupported algorithmtype for specific inodes, e.g. use MicroLZMA > algorithmtype even it's not set in `sbi->available_compr_algs`. This > can lead to an unexpected "BUG: kernel NULL pointer dereference" if > the corresponding decompressor isn't built-in. > > Fix this by checking against `sbi->available_compr_algs` for each > m_algorithmformat request. Incorrect !erofs_sb_has_compr_cfgs preset > bitmap is now fixed together since it was harmless previously. > > Reported-by: > Fixes: 8f89926290c4 ("erofs: get compression algorithms directly on mapping") > Fixes: 622ceaddb764 ("erofs: lzma compression support") > Reviewed-by: Yue Hu > Signed-off-by: Gao Xiang LGTM. Reviewed-by: Yue Hu