]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
KMC_KVMEM disrupts kv_alloc() memory alignment expectations
authorloli10K <ezomori.nozomu@gmail.com>
Tue, 14 Jan 2020 17:09:59 +0000 (18:09 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 14 Jan 2020 17:09:59 +0000 (09:09 -0800)
commit7e2da7786ec089d1b9f9010677dc8e8a65dc01a1
treeccd99b4a45c9a1dc0a58b500eebf750101b1df52
parent68a192e4b7627f8f00d412ba68c291fcc90d3de9
KMC_KVMEM disrupts kv_alloc() memory alignment expectations

On kernels with KASAN enabled the following failure can be observed as
soon as the zfs module is loaded:

  VERIFY(IS_P2ALIGNED(ptr, PAGE_SIZE)) failed
  PANIC at spl-kmem-cache.c:228:kv_alloc()

The problem is kmalloc() has never guaranteed aligned allocations; this
requirement resulted in zfsonlinux/spl@8b45dda which removed all
kmalloc() usage in kv_alloc().

Until a GFP_ALIGNED flag (or equivalent functionality) is provided by
the kernel this commit partially reverts 66955885 and 6d948c35 to
prevent k(v)malloc() allocations in kv_alloc().

Reviewed-by: Kjeld Schouten <kjeld@schouten-lebbing.nl>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #9813
module/os/linux/spl/spl-kmem-cache.c