canonical / classic-snap

The `classic` snap
16 stars 9 forks source link

Using classic clobbers /dev/pts on ubuntu-core 16 systems #32

Open zyga opened 5 years ago

zyga commented 5 years ago

tl;dr; installation and usage of classic changes the permission of /dev/pts as follows:

-7 4 2:3 / /dev/pts rw,nosuid,noexec,relatime shared:6 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+7 4 2:3 / /dev/pts rw,nosuid,noexec,relatime shared:6 - devpts devpts rw,mode=666,ptmxmode=666

This can be reproduced by running spread -shell-before google:ubuntu-core-16-64:tests/main/ubuntu-core-classic and then following with those commands:

State before

google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# mountinfo-tool /dev/pts
22 21 0:14 / /dev/pts rw,nosuid,noexec,relatime shared:49 - devpts devpts rw,gid=5,mode=620,ptmxmode=000

Installation & startup of classic

google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# sudo snap install --devmode --beta classic
classic (beta) 16.04 from Canonical✓ installed
google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# mountinfo-tool /dev/pts
22 21 0:14 / /dev/pts rw,nosuid,noexec,relatime shared:49 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# classic
Creating classic environment
(redacted for brevity)
(classic)test@jul251846-303208:~$ exit
logout

State after

At this point /dev/pts is changed, even after you remove the snap.

google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# mountinfo-tool /dev/pts
22 21 0:14 / /dev/pts rw,nosuid,noexec,relatime shared:49 - devpts devpts rw,mode=666,ptmxmode=666
zyga commented 5 years ago

The working theory based on the old behaviour of devpts being somehow magically shared unless newinstance mount option is used has been defeated. Since 2016 this behaviour is gone and all mounts are independent. See: https://github.com/torvalds/linux/commit/eedf265aa003b4781de24cfed40a655a664457e6

jdstrand commented 5 years ago

Does the xenial kernel have that patch backported to it? It looks like it was introduced 2 months after xenial was released and you mentioned this is on uc16.