Comment 7 for bug 1857257

Revision history for this message
Andrew Vagin (avagin-b) wrote :

The root cause of this fail is a wrong mount ID which is reported for file mappings:

Steps to reproduce:

root@ubuntu-s-4vcpu-8gb-nyc1-01:~# uname -a
Linux ubuntu-s-4vcpu-8gb-nyc1-01 5.3.0-26-generic #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

root@ubuntu-s-4vcpu-8gb-nyc1-01:~# docker run -it --rm --privileged busybox
/ # ls -l /proc/1/map_files/
total 0
lr-------- 1 root root 64 Jan 7 18:59 400000-401000 -> /bin/sh
lr-------- 1 root root 64 Jan 7 19:00 401000-4dd000 -> /bin/sh
lr-------- 1 root root 64 Jan 7 19:00 4dd000-514000 -> /bin/sh
lr-------- 1 root root 64 Jan 7 19:00 514000-516000 -> /bin/sh

/ # exec 50</proc/1/map_files/400000-401000
/ # cat /proc/self/fdinfo/50
pos: 0
flags: 0100000
mnt_id: 551
/ # cat /proc/self/mountinfo | grep 551

We can see that the mount 551 isn't listed in container mounts.

If we will try to open /bin/sh directly, we will see the mount ID of the container root mount.

/ # exec 50</bin/sh
/ # cat /proc/self/fdinfo/50
pos: 0
flags: 0100000
mnt_id: 607
/ # cat /proc/self/mountinfo | grep '^607'
607 567 0:51 / / rw,relatime master:308 - overlay overlay rw,lowerdir=/var/lib/docker/overlay2/l/DCAEKRDYRDTVUIECWWPMTFAKAO:/var/lib/docker/overlay2/l/BEYAU2IKCGHGS5UYC7C6Q6HIHG,upperdir=/var/lib/docker/overlay2/1c92eec684804fbc8642a9a4698a0099c9ff5c39915289e1fcd1b39493558c65/diff,workdir=/var/lib/docker/overlay2/1c92eec684804fbc8642a9a4698a0099c9ff5c39915289e1fcd1b39493558c65/work,xino=off