[BUG] WARNING in bdev_getblk

From: Xianying Wang
Date: Mon Jun 09 2025 - 04:39:38 EST


Hi,

I encountered a kernel WARNING in the function bdev_getblk() when
fuzzing the Linux 6.12 kernel using Syzkaller. The crash occurs during
a block buffer allocation path, where __alloc_pages_noprof() fails
under memory pressure, and triggers a WARNING due to an internal
allocation failure.

Root Cause:

Code Path: The failure originates from the function bdev_getblk() in
fs/buffer.c, which attempts to allocate a new buffer via
grow_buffers() → grow_dev_folio() → __filemap_get_folio().
Memory Allocation Failure: Under specific memory pressure and
vm.zone_reclaim_mode settings, the internal call to alloc_pages() in
__alloc_pages_noprof() fails, resulting in the observed warning.

I recommend reviewing the block buffer allocation path in
bdev_getblk(), particularly how it handles allocation failures under
memory pressure.

This can be reproduced on:

HEAD commit:

commit adc218676eef25575469234709c2d87185ca223a

report: https://pastebin.com/raw/wqAeZJxF

console output : https://pastebin.com/raw/aLaVQpzR

kernel config : https://pastebin.com/x48ijkN8

C reproducer : https://pastebin.com/raw/whJgYnHk

Best regards,

Xianying