To reproduce this bug the file must be in an OverlayFS mount
Reproduced on:
- linux-image-4.4.0-159-generic/xenial-updates,xenial-security,now 4.4.0-159.187 amd64
- linux-image-4.4.0-165-generic/xenial-updates,xenial-security,now 4.4.0-165.193 amd64
Install packages libacl1-dev
, build-essential
, and gcc
.
Included is a C program that reproduces the bug and two scripts. Run them in order.
make-overlay.sh
: creates directories in /tmp and mounts /tmp/overlay as an overlay filesystemtest.sh
: compiles the c program and executes it. additionally attempts to read the file and checks its permissions after the program exits.
Output:
ubuntu@:~/ctr$ ./make-overlay.sh
ubuntu@:~/ctr$ ./test.sh
st_mode is 100644
open failed: -1
cat: /tmp/overlay/animal: Permission denied
-rw-r--r-- 1 ubuntu ubuntu 0 Oct 4 19:40 /tmp/overlay/animal