AppArmor profile prohibits classic snap from inheriting file descriptors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
AppArmor |
Confirmed
|
Medium
|
Unassigned | ||
snapd (Ubuntu) |
In Progress
|
Wishlist
|
Ian Johnson |
Bug Description
For example, with the ‘node’ classic snap:
$ touch /tmp/test.js
$ /snap/bin/node
Welcome to Node.js v12.13.0.
Type ".help" for more information.
> fd = fs.openSync(
21
> child_process.
events.js:187
throw er; // Unhandled 'error' event
^
Error: EACCES: permission denied, read
Emitted 'error' event on ReadStream instance at:
at internal/
at FSReqCallback.
errno: -13,
code: 'EACCES',
syscall: 'read'
}
Thrown:
Error: Command failed: /snap/bin/node
at checkExecSyncError (child_
at Object.execFileSync (child_
status: 1,
signal: null,
output: [ null, null, null ],
pid: 30020,
stdout: null,
stderr: null
}
> .exit
$ dmesg
…
[69583.236304] audit: type=1400 audit(157196646
This breaks all sorts of things. I ran into this when trying to use prettier-emacs with the ‘emacs’ and ‘node’ classic snaps.
ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: snapd 2.41+19.10.1
ProcVersionSign
Uname: Linux 5.3.0-19-lowlatency x86_64
NonfreeKernelMo
ApportVersion: 2.20.11-0ubuntu9
Architecture: amd64
CurrentDesktop: GNOME
Date: Thu Oct 24 18:07:19 2019
EcryptfsInUse: Yes
InstallationDate: Installed on 2016-02-19 (1343 days ago)
InstallationMedia: Ubuntu-GNOME 16.04 LTS "Xenial Xerus" - Alpha amd64 (20160218)
SourcePackage: snapd
UpgradeStatus: Upgraded to focal on 2019-06-23 (123 days ago)
Changed in snapd (Ubuntu): | |
assignee: | nobody → Ian Johnson (anonymouse67) |
So this is an existing issue that we sometimes tried to work around by granting snap-confine more permissions. This is a limitation in apparmor itself, where we cannot say that snap-confine can inherit and pass a file descriptor to another process, whatever that file may be.
I had a quick look if that workaround handles /tmp/* but I couldn't see anything. Perhaps it needs to be added but I'd like to write a test first.