Skip to content

Jailer: Incorrect handling of bind mounts within the rootfs #1089

@mcastelino

Description

@mcastelino

In Kata containers we bind mount device mapper devices into the chroot location.
This is needed as

  • hard links cannot cross file system boundaries
  • copy is not feasible as this is actually a block device

Jailer does not seem to be able to handle this correctly.
The same bind mount is handled properly when using without jailer (i.e. just firecracker)

Below is the file hierarchies with and without jailer.

Here drive_0's are bind mounted to device mapper device nodes, which are then passed as drives to firecracker

brw-rw---- 1 root disk 253, 0 May  3 15:22 /dev/dm-0
brw-rw---- 1 root disk 253, 1 May  3 15:22 /dev/dm-1
brw-rw---- 1 root disk 253, 2 May 10 15:48 /dev/dm-2
brw-rw---- 1 root disk 253, 3 May 10 15:49 /dev/dm-3
/var/lib/firecracker/
├── 34cbb0f3993d35148fb1c5ee424ae97c4f0fd956b8d93079a6f136b1cd38d9ad
│   └── root
│       ├── api.socket
│       ├── drive_0
│       ├── drive_1
│       ├── drive_2
│       ├── drive_3
│       ├── drive_4
│       ├── drive_5
│       ├── drive_6
│       ├── drive_7
│       ├── kata-containers-image_clearlinux_1.7.0-alpha1_agent_e3967e783b9.img
│       └── vmlinux-4.19.28-37
└── 57ab234c96ffab1dddf141d7400234ab310f09a736cee2d0de66f4117ce33e9e
    └── root
        ├── api.socket
        ├── dev
        │   ├── kvm
        │   ├── net
        │   │   └── tun
        │   └── vhost-vsock
        ├── drive_0
        ├── drive_1
        ├── drive_2
        ├── drive_3
        ├── drive_4
        ├── drive_5
        ├── drive_6
        ├── drive_7
        ├── firecracker
        ├── kata-containers-image_clearlinux_1.7.0-alpha1_agent_e3967e783b9.img
        └── vmlinux-4.19.28-37

Metadata

Metadata

Labels

Type: BugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions