Re: cgroup_release_agent() with call_usermodehelper() withUMH_WAIT_EXEC may crash

From: Heiko Carstens
Date: Sat Feb 04 2012 - 05:03:48 EST


On Fri, Feb 03, 2012 at 08:48:08AM -0800, Linus Torvalds wrote:
> On Fri, Feb 3, 2012 at 8:04 AM, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > Can't we simply move that code into flush_old_exec() ? (wrapped into
> > the new helper).
>
> Sure. It would kind of make sense to do it as part of exec_mmap().
> That's what associates us with the new mm, after all.
>
> That said, I think my *preferred* approach would be to still do the final
>
> set_task_comm(current, tcomm);
>
> in setup_new_exec(), because that's really when we set up the new mm.
>
> So my preferred solution would be to simply move the "char tcomm[];"
> array from the stack (currently automatic in setup_new_exec()) into
> the struct linux_binprm, and then copy it from the filename early. We
> could copy it arbitrarily early, perhaps in "prepare_binprm()".
>
> Hmm?

Something like the patch below? Still boots...