Package: src:linux
Version: 6.1.192-1
Severity: important

Dear Maintainer,

after upgrading a bookworm amd64 VM from linux-image-6.1.0-53-amd64
(6.1.187-1) to linux-image-6.1.0-55-amd64 (6.1.192-1), the kernel oopses
with a NULL pointer dereference in ext4_mb_load_buddy_gfp shortly after a
large file is written to the root filesystem. The task dies with IRQs
disabled, after which everything touching the filesystem blocks:
systemd-journald becomes unkillable, new SSH sessions hang, a clean
shutdown is impossible and the VM has to be powered off.

6.1.0-53 ran on this machine for 29 days without any problem and handles
the same workload fine, so this looks like a regression between 6.1.187-1
and 6.1.192-1.

System
------
  Debian 12 (bookworm), amd64
  Linode VM (QEMU/KVM), virtio-scsi disk
  Root filesystem: ext4 directly on /dev/sda (no partition table),
    156G, 84% used, mounted with ordered data mode
  RAM 7.8G, swap 511M (swap unused)

How it was triggered
--------------------
Both times by "apt install gitlab-ee", which downloads a 1.4 GB .deb into
/var/cache/apt/archives.

  1. Boot 6.1.0-55. About 5 minutes after boot, apt finished downloading
     the 1.4 GB package. Two seconds later dpkg-deb failed with
       "rm command for cleanup subprocess was killed by signal (Killed)"
     and the console showed
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       note: rm[1818] exited with irqs disabled
     The rest of the trace was lost because journald hung.

  2. Hard power-off, boot 6.1.0-55 again. "apt install --download-only
     gitlab-ee" died during the download with
       E: Method https has died unexpectedly!
       E: Sub-process https received signal 9.
     Same oops, this time in the apt https method, in close(2)
     (ORIG_RAX = 3). Trace below.

So 2 out of 2 attempts on 6.1.0-55 crashed. In between, running
"dpkg-deb --info" three times on an older 1.4 GB .deb already present in
the cache (no large write beforehand) did not trigger it.

  3. Booted 6.1.0-53 (6.1.187-1). The same "apt install gitlab-ee",
     including the 1.4 GB download and the full unpack of the package,
     completed without errors.

Oops (second occurrence)
------------------------
The beginning of the trace scrolled out of my capture; this is the part I
have. The captured dmesg tail is attached (dmesg-6.1.0-55-oops.txt).

  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
 RIP: 0033:0x7f110dd169f0
 RSP: 002b:00007fff33fd25e8 EFLAGS: 00000202 ORIG_RAX: 0000000000000003
  </TASK>
 CR2: 0000000000000000
 ---[ end trace 0000000000000000 ]---
 RIP: 0010:ext4_mb_load_buddy_gfp+0xbc/0x380 [ext4]
 Code: 89 44 24 08 f7 3c 24 48 63 d8 89 54 24 0c ba 01 00 00 00 48 89 de
       e8 d3 de e7 ca 49 89 c7 48 3d 00 f0 ff ff 0f 87 28 01 00 00
       <48> 8b 00 a8 04 0f 84 12 01 00 00 49 8b 07 a8 01 0f 85 07 01 00 00
 RSP: 0018:ffffcd714334f7c8 EFLAGS: 00010207
 RAX: 0000000000000000 RBX: 0000000000000090 RCX: 0000000000000001
 RDX: 0000000000000010 RSI: ffff8d12c45126c8 RDI: ffff8d12de73b380
 RBP: ffff8d12e063a800 R08: ffff8d12ca84a750 R09: 0000000000000000
 R10: 0000000000000000 R11: 0000000000000000 R12: ffffcd714334f860
 R13: 0000000000008c40 R14: ffff8d12c0427590 R15: 0000000000000000
 CR2: 0000000000000000 CR3: 000000011e5f4006 CR4: 0000000000770ee0
 note: https[2098] exited with irqs disabled

Afterwards:

 systemd[1]: systemd-journald.service: State 'stop-watchdog' timed out.
Killing.
 systemd[1]: systemd-journald.service: Processes still around after
SIGKILL. Ignoring.

Observations
------------
The faulting instruction sequence appears to be

   mov  %rax,%r15
   cmp  $0xfffffffffffff000,%rax    ; IS_ERR() style check
   ja   ...
   mov  (%rax),%rax                 ; <-- faults, RAX = 0
   test $0x4,%al                    ; looks like an uptodate flag test

i.e. the result of a page cache lookup is checked with IS_ERR() but not
for NULL before its flags are read. That is the shape of the upstream
folio code in ext4_mb_load_buddy_gfp():

   folio = __filemap_get_folio(inode->i_mapping, pnum, FGP_ACCESSED, 0);
   if (IS_ERR(folio) || !folio_test_uptodate(folio)) {

which is only correct on kernels where __filemap_get_folio() returns an
ERR_PTR. As far as I understand, on 6.1 it still returns NULL when the
folio is not in the page cache. I have not checked the 6.1.192 source,
so please treat this as a guess.

A very similar oops (NULL dereference in ext4_mb_load_buddy_gfp, reached
from close() via ext4_release_file -> ext4_discard_preallocations) was
reported during the 6.1.167-rc1 stable review in March 2026 and bisected
there to the backport of "ext4: convert bd_bitmap_page to
bd_bitmap_folio":

  https://lkml.iu.edu/2603.3/01242.html
  https://lkml.iu.edu/2603.3/01511.html

It may be worth checking whether that conversion, or a related one,
went into 6.1.y again between 6.1.187 and 6.1.192.

Workaround
----------
Booting linux-image-6.1.0-53-amd64 (6.1.187-1).

Regards,
Alexander

Reply via email to