Re: [PATCH v4] mempool: Do not use ksize() for poisoning

From: Vlastimil Babka
Date: Tue Nov 01 2022 - 15:36:04 EST


On 11/1/22 18:15, Kees Cook wrote:
On Mon, Oct 31, 2022 at 04:00:25PM +0100, Vlastimil Babka wrote:
From a4a5a40852723dfadb2429bee1d5e1f9d3b75f39 Mon Sep 17 00:00:00 2001
From: Vlastimil Babka <vbabka@xxxxxxx>
Date: Mon, 31 Oct 2022 15:55:47 +0100
Subject: [PATCH] mempool: Do not use ksize() for poisoning-fix

For slab mempools (not kmalloc), pool_data is not object size, but a
kmem_cache pointer; we need to extract the size via kmem_cache_size().

Reported-by: Anders Roxell <anders.roxell@xxxxxxxxxx>
Link: https://lore.kernel.org/all/20221031105514.GB69385@mutt/
Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
Link: https://lore.kernel.org/oe-lkp/202210312110.1fe5d224-oliver.sang@xxxxxxxxx
Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks again for fixing this. I don't see it in -next yet? Should I
resend this directly, or how would be best to land it?

I think Andrew will add it from here, but maybe is waiting for Anders acknowledging that it fixes the bug for him?

-Kees