Alibaba Cloud Linux 3 with kernel 5.10.134-15.al8 crashes when you mount an Enhanced Read-Only File System (EROFS) on a block device. A bug in the __erofs_bread() function causes a NULL pointer dereference. Fix this by installing a kernel hotfix or upgrading the kernel.
Affected environment
| Component | Value |
|---|---|
| Image | Alibaba Cloud Linux 3.2104 |
| Kernel | 5.10.134-15.al8 |
Symptom
The system crashes with a kernel NULL pointer dereference when you mount an EROFS file system on a block device. The following commands reproduce the issue:
sudo yum install -y erofs-utils
mkdir -p test mnt
mkfs.erofs foo.erofs test
sudo mount -t erofs -o loop foo.erofs mntIf the system is affected, it crashes and the following call trace appears:
[ 225.747952] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000370
..
[ 225.752658] CPU: 3 PID: 5829 Comm: mount Kdump: loaded Not tainted 5.10.134-15.al8.aarch64 #1
[ 225.753089] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 1.0.0 01/01/2017
[ 225.754016] pc : __erofs_bread+0x64/0x1d0 [erofs]
[ 225.754271] lr : erofs_read_metabuf+0x44/0x80 [erofs]
..
[ 225.758508] Call trace:
[ 225.758636] __erofs_bread+0x64/0x1d0 [erofs]
[ 225.758859] erofs_read_metabuf+0x44/0x80 [erofs]
[ 225.759112] erofs_read_superblock+0x60/0x264 [erofs]
[ 225.759370] erofs_fc_fill_super+0xf0/0x310 [erofs]
[ 225.759621] get_tree_bdev+0x15c/0x250
[ 225.760109] erofs_fc_get_tree+0x38/0x54 [erofs]
[ 225.760662] vfs_get_tree+0x2c/0xf0
[ 225.761157] do_new_mount+0x164/0x1d0
[ 225.761652] path_mount+0x1bc/0x570
[ 225.762133] __arm64_sys_mount+0x114/0x140Root cause
The EROFS feature added in kernel 5.10.134-15.al8 modifies the __erofs_bread() function. The modified function does not correctly handle EROFS mounts on block devices, which causes a NULL pointer dereference and crashes the system.
Solutions
Solution 1: Install a kernel hotfix
Install the hotfix package that patches the __erofs_bread() function:
sudo yum install -y kernel-hotfix-18359162-5.10.134-15Solution 2: Upgrade the kernel (recommended)
Upgrade to kernel 5.10.134-15.1.al8 or later, which includes a fix for this issue. After the upgrade, reboot the instance for the new kernel to take effect.
For detailed instructions, see Change the kernel version.
Do not use kernel version 5.10.134-15.al8 if you need to mount EROFS file systems. Upgrade to 5.10.134-15.1.al8 or later.