mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Pavlu <petr.pavlu@suse.com>
To: markus.rankl@mesutronic.de
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Daniel Gomez <da.gomez@kernel.org>,
	Sami Tolvanen <samitolvanen@google.com>,
	Aaron Tomlin <atomlin@atomlin.com>,
	"Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>,
	linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] module/decompress: fix kunmap_local() address in gzip path
Date: Mon, 30 Nov 2026 11:41:27 +0100	[thread overview]
Message-ID: <5893bd60-a943-4360-83ae-2281fe9c21f4@suse.com> (raw)
In-Reply-To: <20261129-module-decompress-fix-v1-1-c05da174f5fe@mesutronic.de>

On 11/29/26 7:26 PM, Markus Rankl via B4 Relay wrote:
> From: Markus Rankl <markus.rankl@mesutronic.de>
> 
> zlib_inflate() advances s.next_out past the bytes it has written, and
> module_gzip_decompress() then passes that pointer to kunmap_local().
> kunmap_local() rounds the address down to its page, so this works while
> the page is only partly filled. All pages of a module except the last
> one are filled completely, though, and s.next_out then points to the
> start of the following page.
> 
> For a highmem page that address is the neighbouring kmap_local fixmap
> slot. kunmap_local_indexed() warns about the mismatch, clears the wrong
> PTE and leaves the page mapped, and a later kmap_local_page() on that
> slot hits the BUG_ON() in __kmap_local_pfn_prot(). Lowmem pages are not
> affected because kunmap_local() does nothing for them.
> 
> Seen on a 32-bit ARM board (AM437x, 1 GiB RAM, CONFIG_HIGHMEM) loading
> gzip-compressed modules with CONFIG_MODULE_DECOMPRESS:
> 
>   WARNING: CPU: 0 PID: 224 at mm/highmem.c:623 kunmap_local_indexed+0x17c/0x184
>   Call trace:
>    kunmap_local_indexed from module_decompress+0x1ac/0x2d0
>    module_decompress from init_module_from_file+0xc8/0xe4
>    init_module_from_file from sys_finit_module+0x13c/0x304
>    sys_finit_module from ret_fast_syscall+0x0/0x54
>   ...
>   kernel BUG at mm/highmem.c:565!
>   PC is at __kmap_local_pfn_prot+0x164/0x168
> 
> Unmap the address returned by kmap_local_page(), as the xz and zstd
> paths do.
> 
> Fixes: 554694ba120b ("module: Replace kmap() with kmap_local_page()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Rankl <markus.rankl@mesutronic.de>

Looks ok to me. I've queued the patch on modules-next.

-- 
Thanks,
Petr

      reply	other threads:[~2026-11-30 10:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 18:26 Markus Rankl via B4 Relay
2026-11-30 10:41 ` Petr Pavlu [this message]

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=5893bd60-a943-4360-83ae-2281fe9c21f4@suse.com \
    --to=petr.pavlu@suse.com \
    --cc=atomlin@atomlin.com \
    --cc=da.gomez@kernel.org \
    --cc=fabio.m.de.francesco@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=markus.rankl@mesutronic.de \
    --cc=mcgrof@kernel.org \
    --cc=samitolvanen@google.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®