Re: [PATCH 5/5] exec: Move the call of prepare_binprm into search_binary_handler

From: Kees Cook
Date: Mon May 11 2020 - 18:24:14 EST


On Sat, May 09, 2020 at 02:42:52PM -0500, Eric W. Biederman wrote:
>
> The code in prepare_binary_handler needs to be run every time
> search_binary_handler is called so move the call into search_binary_handler
> itself to make the code simpler and easier to understand.
>
> Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>

Yes, nice. :) I don't see any ordering dependencies here. The only thing
I see is a potential for more "work done by kernel before bailing" in
the sense that the arg copying will be performed before we check the
kernel_read() result. I struggle to see how that might be a problem,
and this get us to fewer exec.c exports. Yay!

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook