Re: [PATCH 3/5] exec: Remove recursion from search_binary_handler
From: Linus Torvalds
Date: Sun May 10 2020 - 15:46:21 EST
On Sat, May 9, 2020 at 9:30 PM Tetsuo Handa
<penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Wouldn't this change cause
>
> if (fd_binary > 0)
> ksys_close(fd_binary);
> bprm->interp_flags = 0;
> bprm->interp_data = 0;
>
> not to be called when "Search for the interpreter" failed?
Good catch. We seem to have some subtle magic wrt the fd_binary file
descriptor, which depends on the recursive behavior.
I'm not seeing how to fix it cleanly with the "turn it into a loop".
Basically, that binfmt_misc use-case isn't really a tail-call.
Eric, ideas?
Linus