Re: [PATCH v4 2/3] fs/binfmts: Better handling of binfmt loops

From: Oleg Nesterov
Date: Fri Aug 16 2013 - 08:29:46 EST


On 08/15, Zach L wrote:
>
> On 08/14/2013 10:50 AM, Oleg Nesterov wrote:
> > On 08/14, Zach Levis wrote:
> >>
> > Honestly, I dislike this version even more, sorry. The patch becomes
> > much more complex, and and it is still not clear to me why do we want
> > these complications.
> >
> It's a larger patch but the majority of the increase is from is
> splitting the binfmt initialization code into a separate function to
> address the issue you brought up where the state of the binprm was not
> entirely restored

I understand the reason. But I do not understand the value. IMHO, the
problem this patch tries to fix falls into the "don't do this" category
and doesn't worth the trouble.

> [snip]

This certainly answers my question you snipped ;)

> > And btw, if we want this, then why we only do this if recursion_depth == 0?
> > Just condider '#!/path-to-the-binary-which-wants-this-patch".
> Unless recursion_depth is 0, there could be a binfmt in between that
> would expect its changes to the binprm to remain in effect in lower
> handlers, so even with your example

My point was, this doesn't fix the same problem if depth != 0.

But yes, "depth > 0" can't simply do init_bprm().

> > And again, the patch (afaics) translates -ELOOP into -ENOEXEC on failure,
> > not good.
> it doesn't do that,

It does, afaics. Just suppose that -ELOOP comes from load_script(). We
restore everything and call the next handler which returns ENOEXEC.

And at first glance v5 does the same.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/