landlock: Require LANDLOCK_ACCESS_FS_MAKE_REG for whiteout creation
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ cb2c7d1a1776057c9a1f48ed1250d85e94d4850d · < 0c3204aacbe8c07f9e87e3028f28ec6c166a1075| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
landlock: Require LANDLOCK_ACCESS_FS_MAKE_REG for whiteout creation
Whiteout objects are used in the upper layer of an OverlayFS to indicate that the file with this name does not exist in the unified view, even if it is present in one of the lower layer file systems.
For the userspace implementations of OverlayFS (fuse-overlayfs), whiteout objects can be created from userspace as well:
* mknod(2) with S_IFCHR and makedev(0, 0) * renameat2(2) with RENAME_WHITEOUT, creating the whiteout in the old place of the moved file.
This commit guards whiteout creation in both of these cases with LANDLOCK_ACCESS_FS_MAKE_REG. Whiteout objects are *not* considered character devices and are not bound to a driver.
LANDLOCK_ACCESS_FS_MAKE_REG describes the same permission class as a whiteout object: creating one is the only S_IFCHR creation that the VFS exempts from CAP_MKNOD, so it is as unprivileged as creating a regular file, while LANDLOCK_ACCESS_FS_MAKE_CHAR and LANDLOCK_ACCESS_FS_MAKE_BLOCK keep meaning the creation of devices that expose a kernel interface [1].
For the mknod(2) case, introduce a Landlock erratum. The creation of whiteout objects through mknod(2) was previously guarded using LANDLOCK_ACCESS_FS_MAKE_CHAR, and it is now guarded using LANDLOCK_ACCESS_FS_MAKE_REG.
From the CVE record · Linux
Landlock did not correctly enforce file-creation rights for whiteout objects used by userspace OverlayFS implementations. A local process could create a whiteout with renameat2() even when all Landlock creation rights were denied; mknod() whiteouts were checked against the character-device right instead of the regular-file right.
Engineers running Linux kernels that use Landlock should check their kernel against the vendor advisory; affected versions were not provided.