tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kmem_alloc(0, f)
> Date: Sun, 30 Jul 2017 15:23:50 -0000 (UTC)
> From: mlelstv%serpens.de@localhost (Michael van Elst)
>
> So what does kmem_alloc(0, KM_SLEEP) do? fail where KM_SLEEP says it
> cannot fail? I don't think that it can return a zero sized allocation
> (i.e. ptr != NULL that cannot be dereferenced).
Does kmem_alloc(1, KM_SLEEP) always return a pointer p such that p + 1
and p - 1 cannot be dereferenced in practice? (Easy to arrange that
for one of the two, but not both simultaneously.)
We could just make kmem_alloc(0, f) always do the same as
kmem_alloc(1, f), and likewise kmem_free(p, 0) -> kmem_free(p, 1).
Could also put an 8-bit randomized hash of the address at p[0] on
kmem_alloc and check it on kmem_free to raise the probability of
detecting accidental writes there.
Home |
Main Index |
Thread Index |
Old Index