Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6351606rwi; Tue, 18 Oct 2022 11:13:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CKFPh9irjOJirLBWfR5L86et4vMBWmSODPyzV/kKxQZcGJ426a8qc3zynPGuU8KaVc19h X-Received: by 2002:a17:907:6e11:b0:78e:3057:f631 with SMTP id sd17-20020a1709076e1100b0078e3057f631mr3449946ejc.333.1666116782068; Tue, 18 Oct 2022 11:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666116782; cv=none; d=google.com; s=arc-20160816; b=BTk9xRoMi1c5lSdvpqcdYBmbXIBzrmFLbr9sYWYGYFy6CUrg/s0d7h8jATi4rpGgx7 VfUHwGy3ZYsAc3WAfijsgGuMEZ8J97m2gbLzMAyP+qFNmWaw+OYyemsHvu6Z1FUO/+dI aDRAyuO1fz5b5mBZnhpyNM4rZ1yhDMKHqEUK+PjJXXcOSdCjyt90uHFPLdrHD2E0h/Y+ +m3HveVxnsuxGfw7jKIaIDF5P7Eaa3cZGZuKElTC7a07FNQ1TArK5Yx/282xeAhpIkDi obbRYICWcjBOW1kYTklccnbwUkrMwYEN+vpaI2k05t9k5EznWft863uVet+pbKDP4UGc 29ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=c1UppvZkrKayx9W42qwAXbGEUyOYAnVI1Kemi8GuBOo=; b=n35Ad1p+7uyv6fG6ASpqbo9p+AGopCNesTE3I8ptuE/vBQYQay51fOwpmHrYNcG1Ed N4H3KPUjW64ya6ILrIrHPwaXAfs6RojIVVvVbyPhDVd9QOueueewuHsbs+LSNAFFAyG3 NYaJw/kGAHwVp1fnYIj0FyBgvQYoCBF5EGgLmnmtlkq2W8Sj66R+DOKDBTY+LgboDQJD WxMOojagGxII9GKVQcc1RTl3DZK4jfGZx2zIN2GKS3D6jueN8VcaO0LY9cRyjr3dJbIV RP4Ndl+4dl9qRM4tyDjpcMqgoK8o6UXwQHLLAJas7qGWNHZOD2s+pp+k6g2EJsPSHNCt MGjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go37-20020a1709070da500b0078356aaeb61si13028136ejc.286.2022.10.18.11.12.36; Tue, 18 Oct 2022 11:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230099AbiJRRmf (ORCPT + 99 others); Tue, 18 Oct 2022 13:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbiJRRmc (ORCPT ); Tue, 18 Oct 2022 13:42:32 -0400 Received: from p3plwbeout26-02.prod.phx3.secureserver.net (p3plsmtp26-02-2.prod.phx3.secureserver.net [216.69.139.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDFF2EE88E for ; Tue, 18 Oct 2022 10:42:29 -0700 (PDT) Received: from mailex.mailcore.me ([94.136.40.141]) by :WBEOUT: with ESMTP id kqbjoTEhSaD3jkqbkoAt11; Tue, 18 Oct 2022 10:42:28 -0700 X-CMAE-Analysis: v=2.4 cv=T4FJ89GQ c=1 sm=1 tr=0 ts=634ee584 a=bheWAUFm1xGnSTQFbH9Kqg==:117 a=84ok6UeoqCVsigPHarzEiQ==:17 a=ggZhUymU-5wA:10 a=Qawa6l4ZSaYA:10 a=8QSNtyZ53ZY05QiGhuwA:9 X-SECURESERVER-ACCT: phillip@squashfs.org.uk X-SID: kqbjoTEhSaD3j Received: from 82-69-79-175.dsl.in-addr.zen.co.uk ([82.69.79.175] helo=phoenix.fritz.box) by smtp11.mailcore.me with esmtpa (Exim 4.94.2) (envelope-from ) id 1okqbj-0000Im-1l; Tue, 18 Oct 2022 18:42:27 +0100 From: Phillip Lougher To: phillip@squashfs.org.uk Cc: bagasdotme@gmail.com, hsinyi@chromium.org, linux-kernel@vger.kernel.org, marcmiltenberger@gmail.com, mirsad.todorovac@alu.unizg.hr, nicememory@gmail.com, regressions@leemhuis.info, regressions@lists.linux.dev, srw@sladewatkins.net Subject: Re: BISECT result: 6.0.0-RC kernels trigger Firefox snap bug with 6.0.0-rc3 through 6.0.0-rc7 Date: Tue, 18 Oct 2022 18:41:57 +0100 Message-Id: <20221018174157.1897-1-phillip@squashfs.org.uk> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailcore-Auth: 439999529 X-Mailcore-Domain: 1394945 X-123-reg-Authenticated: phillip@squashfs.org.uk X-Originating-IP: 82.69.79.175 X-CMAE-Envelope: MS4xfAzOq15OjXOtpKqHv+wEeTuSh7GwJ+xWBUTbIgCl2ysxU/0uUhBqc046a+/sNRMrLA2GYxlPGtddNiNKgMhbjmNr8pqTwQVlMF9E7g+RjM2wiTMtUBtS E0Vxc2AE6011ZS7EBbFz88WpJpnbmKiOuEjxgB7cXV78si8ZSIRn7Ax9tZBvF39rbJo7I3CPQqRt50rVsmZyY7G9U/ivKX6wJ2I= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This diff has fixed the problem with my repoducer. Please test and report your results. Phillip diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c index e56510964b22..e526eb7a1658 100644 --- a/fs/squashfs/file.c +++ b/fs/squashfs/file.c @@ -557,6 +557,7 @@ static void squashfs_readahead(struct readahead_control *ractl) int res, bsize; u64 block = 0; unsigned int expected; + struct page *last_page; nr_pages = __readahead_batch(ractl, pages, max_pages); if (!nr_pages) @@ -593,15 +594,15 @@ static void squashfs_readahead(struct readahead_control *ractl) res = squashfs_read_data(inode->i_sb, block, bsize, NULL, actor); - squashfs_page_actor_free(actor); + last_page = squashfs_page_actor_free(actor); if (res == expected) { int bytes; /* Last page (if present) may have trailing bytes not filled */ bytes = res % PAGE_SIZE; - if (pages[nr_pages - 1]->index == file_end && bytes) - memzero_page(pages[nr_pages - 1], bytes, + if (index == file_end && bytes && last_page) + memzero_page(last_page, bytes, PAGE_SIZE - bytes); for (i = 0; i < nr_pages; i++) { diff --git a/fs/squashfs/page_actor.c b/fs/squashfs/page_actor.c index 54b93bf4a25c..6aa38f88e31c 100644 --- a/fs/squashfs/page_actor.c +++ b/fs/squashfs/page_actor.c @@ -53,6 +53,7 @@ struct squashfs_page_actor *squashfs_page_actor_init(void **buffer, actor->pages = pages; actor->next_page = 0; actor->tmp_buffer = NULL; + actor->last_page = NULL; actor->squashfs_first_page = cache_first_page; actor->squashfs_next_page = cache_next_page; actor->squashfs_finish_page = cache_finish_page; @@ -71,11 +72,13 @@ static void *handle_next_page(struct squashfs_page_actor *actor) (actor->next_index != actor->page[actor->next_page]->index)) { actor->next_index++; actor->returned_pages++; + actor->last_page = NULL; return actor->alloc_buffer ? actor->tmp_buffer : ERR_PTR(-ENOMEM); } actor->next_index++; actor->returned_pages++; + actor->last_page = actor->page[actor->next_page]; return actor->pageaddr = kmap_local_page(actor->page[actor->next_page++]); } diff --git a/fs/squashfs/page_actor.h b/fs/squashfs/page_actor.h index 95ffbb543d91..97d4983559b1 100644 --- a/fs/squashfs/page_actor.h +++ b/fs/squashfs/page_actor.h @@ -16,6 +16,7 @@ struct squashfs_page_actor { void *(*squashfs_first_page)(struct squashfs_page_actor *); void *(*squashfs_next_page)(struct squashfs_page_actor *); void (*squashfs_finish_page)(struct squashfs_page_actor *); + struct page *last_page; int pages; int length; int next_page; @@ -29,10 +30,13 @@ extern struct squashfs_page_actor *squashfs_page_actor_init(void **buffer, extern struct squashfs_page_actor *squashfs_page_actor_init_special( struct squashfs_sb_info *msblk, struct page **page, int pages, int length); -static inline void squashfs_page_actor_free(struct squashfs_page_actor *actor) +static inline struct page *squashfs_page_actor_free(struct squashfs_page_actor *actor) { + struct page *last_page = actor->last_page; + kfree(actor->tmp_buffer); kfree(actor); + return last_page; } static inline void *squashfs_first_page(struct squashfs_page_actor *actor) {