Re: [PATCH 3/5] exec: Remove recursion from search_binary_handler

From: Kees Cook
Date: Tue May 12 2020 - 19:47:24 EST


On Tue, May 12, 2020 at 04:08:56PM -0700, Kees Cook wrote:
> I'm nearly certain the answer is "yes", but I wonder if we should stop
> for a moment and ask "does anything still use MISC_FMT_OPEN_BINARY ? It
> looks like either "O" or "C" binfmt_misc registration flag. My installed
> binfmts on Ubuntu don't use them...
>
> I'm currently pulling a list of all the packages in Debian than depend
> on the binfmt-support package and checking their flags.

So, binfmt-support in Debian doesn't in _support_ MISC_FMT_OPEN_BINARY
("O"):


credentials =
(binfmt->credentials && !strcmp (binfmt->credentials, "yes"))
? "C" : "";
preserve = (binfmt->preserve && !strcmp (binfmt->preserve, "yes"))
? "P" : "";
fix_binary =
(binfmt->fix_binary && !strcmp (binfmt->fix_binary, "yes"))
? "F" : "";
...
regstring = xasprintf (":%s:%c:%s:%s:%s:%s:%s%s%s\n",
name, type, binfmt->offset, binfmt->magic,
binfmt->mask, interpreter,
credentials, preserve, fix_binary);

However, "credentials" ("C") does imply MISC_FMT_OPEN_BINARY.


I looked at every Debian package using binfmt-support, and "only" qemu
uses "credential".

And now I wonder if qemu actually uses the resulting AT_EXECFD ...

--
Kees Cook