Root Cause Analysis
The crash is caused by a NULL pointer dereference via container_of() in squashfs_lookup() (fs/squashfs/namei.c:180-181).
Mechanism
In squashfs_lookup() (fs/squashfs/namei.c:166-181):
static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
unsigned int flags)
{
...
struct inode *inode = NULL;
...
TRACE("Entered squashfs_lookup [%llx:%x]\n", squashfs_i(inode)->start,
squashfs_i(inode)->offset);
- Wrong variable passed to
TRACE(): The local variable inode is initialized to NULL (it is only populated later on line 271 via squashfs_iget() when a matching directory entry is found). The TRACE() macro at lines 180–181 erroneously passes inode to squashfs_i() instead of the directory inode parameter dir (unlike lines 190, 200, and 285, which correctly use squashfs_i(dir)).
container_of(NULL, ...) arithmetic: squashfs_i() (fs/squashfs/squashfs_fs_i.h:37-40) computes container_of(inode, struct squashfs_inode_info, vfs_inode). In struct squashfs_inode_info (fs/squashfs/squashfs_fs_i.h:13-34), vfs_inode is at byte offset 64 (0x40), and start is at byte offset 0. Passing inode == NULL yields (struct squashfs_inode_info *)((char *)0 - 0x40) = 0xffffffffffffffc0.
- Trigger condition:
TRACE() expands to pr_debug(...) (fs/squashfs/squashfs.h:11). With CONFIG_DYNAMIC_DEBUG=y enabled and the dynamic debug call site activated (or if compiled with DEBUG), entering squashfs_lookup() during path lookup (e.g., openat() -> lookup_open() -> squashfs_lookup()) evaluates squashfs_i(inode)->start, reading from the unmapped address 0xffffffffffffffc0 (mov 0xffffffffffffffc0,%r14) and causing a supervisor read page fault.
Fix
Pass dir instead of inode to squashfs_i() in TRACE() at fs/squashfs/namei.c:180-181:
TRACE("Entered squashfs_lookup [%llx:%x]\n", squashfs_i(dir)->start,
squashfs_i(dir)->offset);