Re: [PATCH] sys_getppid oopses on debug kernel

From: Andi Kleen
Date: Tue Aug 08 2006 - 23:07:20 EST

Kirill Korotaev <dev@xxxxx> writes:

[adding linux-arch]

> > Accessing freed memory is a bug, always, not just *only* when slab
> > debugging is on, right? Doesn't this mean we could get junk, or that
> > the reader could potentially run off a bad pointer?
> no, read the comment in sys_getppid.
> It is a valid optimization. _safe_ and alowing to bypass taking the lock.
> BUT! This optimization relies on the fact that kernel memory (DMA + normal zone)
> is always mapped into virtual address space.
> Which is invalid for debug kernels only.

In x86 arch code we would use __get_user for this (and we do in a couple
of places). But it wouldn't be portable because sometimes _user is
in a different address space.

Maybe it would be time to make a similar facility (read/write_kernel_safe() or similar)
with error return available to generic code?

It should be easy to implement - iirc near all architectures already
use the exception handling frame work and it is a simple extension
of that. x86 could just define it to __put/get_user

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at