Re: weirdness with ->mm vs ->active_mm handling

From: Linus Torvalds (torvalds@transmeta.com)
Date: Fri Aug 30 2002 - 00:10:53 EST


On Thu, 29 Aug 2002, Benjamin LaHaise wrote:
>
> In trying to track down a bug, I found routines like generic_file_read
> getting called with current->mm == NULL. This seems to be a valid state
> for lazy tlb tasks, but the code throughout the kernel doesn't seem to
> assume that.

Hmm.. Have you actually ever seen this?

When tsk->mm is NULL, you should never EVER get a page fault, except for
the one special case of the vmalloc'ed area (which is tested for in
do_page_fault() before we even _look_ at "tsk->mm").

In fact, do_page_fault() very much checks

        if (in_atomic() || !mm)
                goto no_context;

which says that a page fault when in a lazy TLB context should always
cause a trap, killing the thing (or, if the access has a fixup, calling
the fixup - although I don't think that should happen in any normal code)

In other words: I think your patch is "functionally correct", in that it
should work fine, but on the other hand having a NULL tsk->mm and trying
to do any user-level access is _so_ wrong that I'd much rather take a NULL
pointer fault than try to do something "sane" about it.

                Linus

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



This archive was generated by hypermail 2b29 : Sat Aug 31 2002 - 22:00:29 EST