Re: [PATCH 1/2] task_struct cleanup: move binfmt field to mm_struct

From: Oleg Nesterov
Date: Tue Jul 28 2009 - 10:41:26 EST


On 07/28, Hiroshi Shimamoto wrote:
>
> Oleg Nesterov wrote:
> > (add Rusty)
> >
> > On 07/27, Hiroshi Shimamoto wrote:
> >> void set_binfmt(struct linux_binfmt *new)
> >> {
> >> - if (current->binfmt)
> >> - module_put(current->binfmt->module);
> >> + struct mm_struct *mm = current->mm;
> >> +
> >> + BUG_ON(!mm);
> >> + if (mm->binfmt)
> >
> > I am not sure we need this BUG_ON() above. If mm == NULL we will
> > have the same debug info after the crash.
>
> Ah, right. It will crash at accessing mm->binfmt and we'll get the
> same information. I didn't think seriously.
> BTW, now I noticed that it looks similar the security issue with
> NULL page mapping. If the kernel has the page mapping to NULL,
> it causes unstable behavior, no?

The kernel can't have NULL mapped. The task can, but in this case
it must have a valid ->mm != NULL.

IOW, if current->mm == NULL, current uses init_mm and thus NULL
can't be mapped.

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/