On Fri, 1 Jun 2007 15:20:05 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:
hm, I hadn't thought of it that way actually. I was thinking it was
specific to kmalloc(0) but as you point out, the situation is
generalisable.
Yes, if someone does kmalloc(42) and we satisfy the allocation from the
size-64 slab, we should poison and then check the allegedly-unused 22
bytes.
Please ;)
(vaguely stunned that we didn't think of doing this years ago).
It'll be a large patch, I expect?
Actually, I have this vague memory that slab would take that kmalloc(42)
and would then return kmalloc(64)+22, so the returned memory is
"right-aligned". This way the existing overrun-detection is applicable to
all kmallocs. Maybe I dreamed it.
-