linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: syzbot+adbc983a1588b7805de3@syzkaller.appspotmail.com
Cc: 21cnbao@gmail.com, akpm@linux-foundation.org,
	chengming.zhou@linux.dev, hannes@cmpxchg.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	nphamcs@gmail.com, syzkaller-bugs@googlegroups.com,
	yosryahmed@google.com
Subject: Re: [syzbot] [mm?] kernel BUG in sg_init_one
Date: Tue, 19 Mar 2024 11:27:15 +1300	[thread overview]
Message-ID: <20240318222715.86329-1-21cnbao@gmail.com> (raw)
In-Reply-To: <0000000000009221d60613f58726@google.com>

> syzbot has tested the proposed patch but the reproducer is still triggering an issue:
> WARNING in __kmap_to_page
> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 3529 at mm/highmem.c:167 __kmap_to_page+0x100/0x194 mm/highmem.c:167
> Modules linked in:
> Kernel panic - not syncing: kernel: panic_on_warn set ...
> 

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git e5eb28f6d1afebed4bb7d740a797d0390bd3a357

diff --git a/mm/zswap.c b/mm/zswap.c
index 9dec853647c8..17bf6d87b274 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1080,7 +1080,8 @@ static void zswap_decompress(struct zswap_entry *entry, struct page *page)
 	mutex_lock(&acomp_ctx->mutex);
 
 	src = zpool_map_handle(zpool, entry->handle, ZPOOL_MM_RO);
-	if (acomp_ctx->is_sleepable && !zpool_can_sleep_mapped(zpool)) {
+	if ((acomp_ctx->is_sleepable && !zpool_can_sleep_mapped(zpool)) ||
+	    !virt_addr_valid(src)) {
 		memcpy(acomp_ctx->buffer, src, entry->length);
 		src = acomp_ctx->buffer;
 		zpool_unmap_handle(zpool, entry->handle);
@@ -1094,7 +1095,7 @@ static void zswap_decompress(struct zswap_entry *entry, struct page *page)
 	BUG_ON(acomp_ctx->req->dlen != PAGE_SIZE);
 	mutex_unlock(&acomp_ctx->mutex);
 
-	if (!acomp_ctx->is_sleepable || zpool_can_sleep_mapped(zpool))
+	if (src != acomp_ctx->buffer)
 		zpool_unmap_handle(zpool, entry->handle);
 }


  parent reply	other threads:[~2024-03-18 22:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 16:58 [syzbot] [mm?] kernel BUG in sg_init_one syzbot
2024-03-18 18:00 ` Nhat Pham
2024-03-18 20:17   ` Yosry Ahmed
2024-03-18 21:09     ` Johannes Weiner
2024-03-18 21:15       ` Barry Song
2024-03-18 21:32         ` Johannes Weiner
2024-03-18 21:37           ` Barry Song
2024-03-18 21:18       ` Yosry Ahmed
2024-03-18 21:21         ` Barry Song
2024-03-18 20:25   ` Barry Song
2024-03-18 20:34     ` Yosry Ahmed
2024-03-18 20:50       ` Barry Song
2024-03-18 20:59         ` Yosry Ahmed
2024-03-18 21:12           ` Barry Song
2024-03-18 20:42 ` Barry Song
2024-03-18 20:52   ` syzbot
2024-03-18 21:03     ` Barry Song
2025-02-12 17:20       ` Yosry Ahmed
2025-02-22  0:48         ` Yosry Ahmed
2025-02-26 16:01           ` Ira Weiny
2025-02-26 16:45             ` Yosry Ahmed
2025-02-26 20:36               ` Ira Weiny
2024-03-18 22:27     ` Barry Song [this message]
2024-03-18 22:52       ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240318222715.86329-1-21cnbao@gmail.com \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chengming.zhou@linux.dev \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=syzbot+adbc983a1588b7805de3@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=yosryahmed@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).