BUG: unable to handle kernel NULL pointer dereference in page_cache_ra_order

Status: moderation: reported on 2026/12/01 16:22
Subsystems: mm
Labels: prio:high
[Documentation on labels]
Reported-by: syzbot+38a306e828b593e8b4aa@syzkaller.appspotmail.com
First crash: 4d01h, last: 4d01h
✨ AI cause bisection: introduced by (AI job) :
commit a5f7a5bb3b7f28ba7e4fa246775b29a0e5537255
Author: Jinke Han <jinkehan@didiglobal.com>
Date: Tue Sep 8 07:37:42 2026 +0000

  x86/kprobes: Fix crash when probing CS CALL instructions

✨ AI-generated root cause summary:

The crash occurs in __alloc_frozen_pages_noprof+0x185 (mm/page_alloc.c:5540) when kernel execution resumes 1 byte into the 5-byte call prepare_alloc_pages instruction (e8 d7 d3 ff ff) rather than at the return address (+0x189). Decoding from +0x185 executes the 0xd7 displacement byte as an x86 xlatb instruction, which reads *(u8 *)(RBX + AL) (0x2 + 0x1 = 0x3) and triggers a supervisor read #PF at CR2=0x3. Thorough inspection of prepare_alloc_pages(), its callees, and the caller path (pagemap_read -> filemap_fault -> page_cache_ra_order -> alloc_pages_mpol) shows no local stack-write bug that could alter the saved return address by -4, making the exact origin of the return-address/RIP corruption inconclusive (e.g., concurrent external stack corruption or an interrupt/preemption/platform anomaly).

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit a9c48428cbd8:

Crash Mechanism

The fault occurs at __alloc_frozen_pages_noprof+0x185 (mm/page_alloc.c:5540) because kernel execution landed mid-instruction inside the 5-byte direct call to prepare_alloc_pages():

  1. Triggering path (fs/proc/task_mmu.c -> mm/filemap.c -> mm/readahead.c -> mm/mempolicy.c -> mm/page_alloc.c):

    • Userspace invokes pread64 on a /proc/<pid>/pagemap descriptor (pagemap_read() at fs/proc/task_mmu.c:2277).
    • pagemap_read() drops mmap_read_lock and calls copy_to_user(buf, pm.buffer, len).
    • rep_movs_alternative (arch/x86/lib/copy_user_64.S:74) crosses a user page boundary (0x200000138000) and triggers do_user_addr_fault() -> handle_mm_fault() -> filemap_fault() (mm/filemap.c:3610).
    • do_async_mmap_readahead() -> page_cache_ra_order() (mm/readahead.c:535) allocates a folio with order = 2 (%rbx = 0x2) and gfp = 0x152c40 (%r14d = 0x152c40) via alloc_pages_mpol() (mm/mempolicy.c:2587) -> __alloc_frozen_pages_noprof() (mm/page_alloc.c:5500).
  2. Instruction stream and register state at __alloc_frozen_pages_noprof+0x185:

    • The machine code around RIP (__alloc_frozen_pages_noprof+0x185) decodes as:
      48 8d 44 24 38     lea    0x38(%rsp), %rax        ; 7th arg (&alloc_gfp / &fastpath_alloc_flags)
      4c 8d 4c 24 3c     lea    0x3c(%rsp), %r9         ; 6th arg
      44 89 f7           mov    %r14d, %edi             ; 1st arg (gfp)
      89 de              mov    %ebx, %esi              ; 2nd arg (order = 2)
      8b 54 24 20        mov    0x20(%rsp), %edx        ; 3rd arg (preferred_nid)
      48 8b 4c 24 30     mov    0x30(%rsp), %rcx        ; 4th arg (nodemask)
      4d 89 f8           mov    %r15, %r8               ; 5th arg (&ac = 0xffffc900025df1e0)
      50                 push   %rax                    ; pushes 7th arg; RSP becomes 0xffffc900025df178
      e8 d7 d3 ff ff     call   prepare_alloc_pages     ; at +0x184..+0x188, return addr = +0x189
      48 83 c4 08        add    $0x8, %rsp              ; at +0x189
      84 c0              test   %al, %al
      
    • Register state confirms that prepare_alloc_pages() (mm/page_alloc.c:5193) actually executed and returned true:
      • RSP is 0xffffc900025df178, matching the stack pointer right after push %rax (and before add $0x8, %rsp at +0x189).
      • RDI (0xffffc900025df200, i.e., &ac + 0x20 = &ac.spread_dirty_pages), R8 (0xffffffff823dc44c), R11 (0xfffff520004bbe42, KASAN shadow), R12 (0x1ffff920004bbe38), and RAX (0x1ffff920004bbe01, with AL = 0x01 corresponding to return true;) all reflect work done inside prepare_alloc_pages().
    • Instead of resuming at the return address __alloc_frozen_pages_noprof+0x189 (48 83 c4 08), control flow resumed at __alloc_frozen_pages_noprof+0x185 (call_site + 1, i.e., return_addr - 4), pointing at the 0xd7 displacement byte of e8 d7 d3 ff ff.
    • On x86-64, opcode 0xd7 is xlatb, which performs an unsigned byte read from *(u8 *)(RBX + AL). With RBX = 0x0000000000000002 (order) and AL = 0x01 (return value of prepare_alloc_pages()), the CPU attempted to read 0x2 + 0x1 = 0x0000000000000003, triggering the supervisor read #PF at CR2 = 0x0000000000000003.

Invariants Checked & What Remains Inconclusive

  • Callers and prepare_alloc_pages() lifecycle:

    • pagemap_read() (fs/proc/task_mmu.c:2277), filemap_fault() (mm/filemap.c:3610), page_cache_ra_order() (mm/readahead.c:535), and alloc_pages_mpol() (mm/mempolicy.c:2587) pass valid GFP flags (0x152c40), order = 2, and stack-local pointers (&ac at 0xffffc900025df1e0, &alloc_gfp / &fastpath_alloc_flags at 0xffffc900025df1b8 / 0x1bc).
    • prepare_alloc_pages() (mm/page_alloc.c:5193) and its callees (gfp_zone(), node_zonelist(), might_alloc(), fs_reclaim_acquire(), should_fail_alloc_page() / should_fail_ex(), alloc_flags_cma(), first_zones_zonelist() / __next_zones_zonelist()) only write to *alloc_gfp, *alloc_flags, and fields of struct alloc_context *acβ€”all located at 0xffffc900025df1b8 or above, well above the saved return address slot at 0xffffc900025df170.
    • Stack overflow is ruled out (RSP = 0xffffc900025df178, ~3.7 KiB into a 16 KiB stack), and CONFIG_KASAN_STACK=y is enabled without any KASAN stack-OOB report.
    • CONFIG_CALL_THUNKS=y (arch/x86/kernel/callthunks.c) and CONFIG_MITIGATION_ITS=y (arch/x86/lib/retpoline.S) patch call targets / return thunks without altering the 5-byte e8 <rel32> call length or shifting saved return addresses by -4.
  • Inconclusive root trigger:

    • The crash report does not capture why RIP became __alloc_frozen_pages_noprof+0x185 (return_addr - 4) upon returning from prepare_alloc_pages(). Possible explanationsβ€”such as concurrent external corruption of the kernel stack slot 0xffffc900025df170 by another thread/subsystem, or an interrupt/preemption (PREEMPT(full)) / softlockup (Tainted: [L]=SOFTLOCKUP) / hypervisor-level state corruption while inside prepare_alloc_pages()β€”cannot be pinpointed from the crash report and source inspection alone because no offending writer or allocation/free trace is recorded.
▶ ▼ ✨ AI Jobs (3)
ID Workflow Result Correct Bug Created Started Finished Revision
409ce22e repro-c πŸ’₯ BUG: unable to handle kernel NULL pointer dereference in page_cache_ra_order 2026/11/30 06:10 2026/11/30 06:10 2026/11/30 12:29 e1f06033
316fa4d1 bisect-cause IsRelease: ❌ ❓ BUG: unable to handle kernel NULL pointer dereference in page_cache_ra_order 2026/11/27 15:51 2026/11/27 15:51 2026/11/27 16:39 55735c54
73718ae5 assessment-security DenialOfService: βœ… Exploitable: βœ… FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: βœ… NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: βœ… UserNamespace: βœ… VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ BUG: unable to handle kernel NULL pointer dereference in page_cache_ra_order 2026/11/27 15:22 2026/11/27 15:22 2026/11/27 16:18 55735c54

Sample crash report:
BUG: kernel NULL pointer dereference, address: 0000000000000003
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 8000000050e6d067 P4D 8000000050e6d067 PUD 0 
Oops: Oops: 0000 [#1] SMP KASAN PTI
CPU: 1 UID: 0 PID: 9261 Comm: syz.3.1398 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:__alloc_frozen_pages_noprof+0x185/0x450 mm/page_alloc.c:5540
Code: 74 24 3c 8b 05 5c 6d 2b 0e 89 44 24 2c 48 8d 44 24 38 4c 8d 4c 24 3c 44 89 f7 89 de 8b 54 24 20 48 8b 4c 24 30 4d 89 f8 50 e8 <d7> d3 ff ff 48 83 c4 08 84 c0 0f 84 f1 00 00 00 83 7c 24 1c 00 75
RSP: 0018:ffffc900025df178 EFLAGS: 00010282
RAX: 1ffff920004bbe01 RBX: 0000000000000002 RCX: 0000000000000002
RDX: 0000000000000000 RSI: dffffc0000000000 RDI: ffffc900025df200
RBP: ffffc900025df290 R08: ffffffff823dc44c R09: 0000000000000000
R10: ffffc900025df1e0 R11: fffff520004bbe42 R12: 1ffff920004bbe38
R13: dffffc0000000000 R14: 0000000000152c40 R15: ffffc900025df1e0
FS:  00007f24a4f376c0(0000) GS:ffff888122ff0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000003 CR3: 000000005cdf8000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 alloc_pages_mpol+0x21e/0x390 mm/mempolicy.c:2587
 alloc_frozen_pages_noprof mm/mempolicy.c:2658 [inline]
 alloc_pages_noprof+0xb1/0x2b0 mm/mempolicy.c:2678
 folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2688
 filemap_alloc_folio_noprof+0x111/0x460 mm/filemap.c:1020
 ractl_alloc_folio mm/readahead.c:200 [inline]
 ra_alloc_folio mm/readahead.c:463 [inline]
 page_cache_ra_order+0x560/0xf00 mm/readahead.c:535
 do_async_mmap_readahead mm/filemap.c:3511 [inline]
 filemap_fault+0x606/0x12c0 mm/filemap.c:3610
 __do_fault+0x139/0x410 mm/memory.c:5719
 do_shared_fault mm/memory.c:6259 [inline]
 do_fault mm/memory.c:6333 [inline]
 do_pte_missing+0x612/0x34d0 mm/memory.c:4800
 handle_pte_fault mm/memory.c:6748 [inline]
 __handle_mm_fault mm/memory.c:6900 [inline]
 handle_mm_fault+0x1807/0x2f80 mm/memory.c:7067
 do_user_addr_fault+0x7f6/0x1480 arch/x86/mm/fault.c:1394
 handle_page_fault arch/x86/mm/fault.c:1483 [inline]
 exc_page_fault+0x6a/0xc0 arch/x86/mm/fault.c:1536
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:595
RIP: 0010:rep_movs_alternative+0x4a/0xa0 arch/x86/lib/copy_user_64.S:74
Code: cc cc cc 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 8b 06 48 89 07 48 83 c6 08 48 83 c7 08 83 e9 08 74 db 83 f9 08 73 e8 eb c5 <f3> a4 e9 bf 75 04 00 48 8b 06 48 89 07 48 8d 47 08 48 83 e0 f8 48
RSP: 0018:ffffc900025dfb48 EFLAGS: 00050206
RAX: ffffffff850f8801 RBX: 0000000000001000 RCX: 0000000000000100
RDX: 0000000000000000 RSI: ffff888079d4cf00 RDI: 0000200000138000
RBP: ffffc900025dfc90 R08: ffff888079d4cfff R09: 1ffff1100f3a99ff
R10: dffffc0000000000 R11: ffffed100f3a9a00 R12: 0000200000138100
R13: 00007ffffffff000 R14: ffff888079d4c000 R15: 0000200000137100
 copy_user_generic arch/x86/include/asm/uaccess_64.h:126 [inline]
 raw_copy_to_user arch/x86/include/asm/uaccess_64.h:147 [inline]
 _inline_copy_to_user include/linux/uaccess.h:202 [inline]
 _copy_to_user+0x8a/0xb0 lib/usercopy.c:24
 copy_to_user include/linux/uaccess.h:230 [inline]
 pagemap_read+0x4dc/0x7c0 fs/proc/task_mmu.c:2277
 vfs_read+0x213/0xa80 fs/read_write.c:557
 ksys_pread64 fs/read_write.c:1459 [inline]
 __do_sys_pread64 fs/read_write.c:1467 [inline]
 __se_sys_pread64 fs/read_write.c:1464 [inline]
 __x64_sys_pread64+0x210/0x2c0 fs/read_write.c:1464
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x00007f24a3fa9b59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f24a4f37028 EFLAGS: 00000246 ORIG_RAX: 0000000000000011
RAX: ffffffffffffffda RBX: 00007f24a4236098 RCX: 00007f24a3fa9b59
RDX: 0000000000200000 RSI: 0000200000000400 RDI: 0000000000000003
RBP: 00007f24a403a18b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000300 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f24a4236130 R14: 00007f24a4236098 R15: 00007ffdd78da048
 </TASK>
Modules linked in:
CR2: 0000000000000003
---[ end trace 0000000000000000 ]---
RIP: 0010:__alloc_frozen_pages_noprof+0x185/0x450 mm/page_alloc.c:5540
Code: 74 24 3c 8b 05 5c 6d 2b 0e 89 44 24 2c 48 8d 44 24 38 4c 8d 4c 24 3c 44 89 f7 89 de 8b 54 24 20 48 8b 4c 24 30 4d 89 f8 50 e8 <d7> d3 ff ff 48 83 c4 08 84 c0 0f 84 f1 00 00 00 83 7c 24 1c 00 75
RSP: 0018:ffffc900025df178 EFLAGS: 00010282
RAX: 1ffff920004bbe01 RBX: 0000000000000002 RCX: 0000000000000002
RDX: 0000000000000000 RSI: dffffc0000000000 RDI: ffffc900025df200
RBP: ffffc900025df290 R08: ffffffff823dc44c R09: 0000000000000000
R10: ffffc900025df1e0 R11: fffff520004bbe42 R12: 1ffff920004bbe38
R13: dffffc0000000000 R14: 0000000000152c40 R15: ffffc900025df1e0
FS:  00007f24a4f376c0(0000) GS:ffff888122ff0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000003 CR3: 000000005cdf8000 CR4: 00000000003526f0
----------------
Code disassembly (best guess):
   0:	cc                   	int3
   1:	cc                   	int3
   2:	cc                   	int3
   3:	66 2e 0f 1f 84 00 00 	cs nopw 0x0(%rax,%rax,1)
   a:	00 00 00
   d:	0f 1f 00             	nopl   (%rax)
  10:	48 8b 06             	mov    (%rsi),%rax
  13:	48 89 07             	mov    %rax,(%rdi)
  16:	48 83 c6 08          	add    $0x8,%rsi
  1a:	48 83 c7 08          	add    $0x8,%rdi
  1e:	83 e9 08             	sub    $0x8,%ecx
  21:	74 db                	je     0xfffffffe
  23:	83 f9 08             	cmp    $0x8,%ecx
  26:	73 e8                	jae    0x10
  28:	eb c5                	jmp    0xffffffef
* 2a:	f3 a4                	rep movsb %ds:(%rsi),%es:(%rdi) <-- trapping instruction
  2c:	e9 bf 75 04 00       	jmp    0x475f0
  31:	48 8b 06             	mov    (%rsi),%rax
  34:	48 89 07             	mov    %rax,(%rdi)
  37:	48 8d 47 08          	lea    0x8(%rdi),%rax
  3b:	48 83 e0 f8          	and    $0xfffffffffffffff8,%rax
  3f:	48                   	rex.W

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/27 15:21 linux-next a9c48428cbd8 55735c54 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-rust-kasan-gce BUG: unable to handle kernel NULL pointer dereference in page_cache_ra_order
* Struck through repros no longer work on HEAD.