Support for C flag
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
binfmt-support |
Fix Released
|
Undecided
|
Unassigned | ||
binfmt-support (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: binfmt-support
Hi
By default, binfmt-misc doesn't keep the security context of the original binary when launching the interpreter, so the setuid bit gets dropped:
ubuntu@bee:/$ sudo id
sudo: must be setuid root
(this is withing an armel chroot under x86-64 with qemu-kvm-
However, linux/Documenta
[...]
- 'interpreter' is the program that should be invoked with the binary as first
argument (specify the full path)
- 'flags' is an optional field that controls several aspects of the invocation
of the interpreter. It is a string of capital letters, each controls a certain
aspect. The following flags are supported -
'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite the
this purpose, thus preserving the original argv[0].
'O' - open-binary. Legacy behavior of binfmt_misc is to pass the full path
of the binary to the interpreter as an argument. When this flag is
the interpreter to execute non-readable binaries. This feature should
be used with care - the interpreter has to be trusted not to emit
the contents of the non-readable binary.
'C' - credentials. Currently, the behavior of binfmt_misc is to calculate
the credentials and security token of the new process according to
the interpreter. When this flag is included, these attributes are
This feature should be used with care as the interpreter
will run with root permissions when a setuid binary owned by root
is run with binfmt_misc.
Note that after setting manually the C flag, I wasn't able to observe the documented behavior of the implied 'O' flag: qemu-arm-static "just worked" and was passed the name of the binary it should invoke on the cmdline; I didn't see any fd number or a path to /dev/fd/n on the interpreter args (I checked with a static binary dumping argv in place of qemu-arm-static).
I propose we add "credentials yes" to binfmt format files to turn on this flag.
This would allow:
ubuntu@bee:/$ sudo id
uid=0(root) gid=0(root) groups=0(root)
Thanks,
tags: | added: armel |
Changed in binfmt-support: | |
status: | New → Fix Committed |
status: | Fix Committed → Fix Released |
I tested the linked branch with the qemu-arm binfmt spec in the qemu-kvm- extras- static package; with "credentials yes" sudo worked and without a "credentials" line or with "credentials no" it didn't work but other binaries still worked.