Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb

Vegard Nossum
2011-05-10T12:24:52Z

On Tue, 10 May 2011 13:19:35 +0300, Pekka Enberg
<penberg@cs.helsinki.fi> wrote:
> On 5/10/11 1:17 PM, Eric Dumazet wrote:
>> Le mardi 10 mai 2011 à 13:03 +0300, Pekka Enberg a écrit :
>>
>>> Can't we fix the issue by putting kmemcheck_mark_initialized() to
>>> set_freepointer()?
>>
>> This would solve kmemcheck problem, not DEBUG_PAGEALLOC
>
> Oh, right. Christoph? We need to support DEBUG_PAGEALLOC with SLUB.

Hi,

Disclaimer: I don't know how the algorithm is supposed to work, so
please excuse me if this makes no sense at all. But here goes:

Presumably the problem is that the page can get freed, and that with
DEBUG_PAGEALLOC, the page will therefore not be present and subsequently
trigger a page fault when doing this cmpxchg() on the possibly freed
object.

Regardless of DEBUG_PAGEALLOC or kmemcheck, what happens if the page
gets freed, then allocated again for a completely different purpose in
another part of the kernel, and new user of the page by chance writes
the same "tid" number that the cmpxchg() is expecting?

I guess I'm asking: Are we relying on the fact that this has a
negligible probability of happening? Or did I just misunderstand what
the algorithm does, and it is in fact provable (in theory) that nothing
wrong can happen?

Thanks,

Vegard