[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG_fn=XA5B4CO2q-+fSeKbT3DwYs+fExMP+h_x5qqdEKfejcow@mail.gmail.com>
Date: Mon, 16 Oct 2023 17:52:29 +0200
From: Alexander Potapenko <glider@...gle.com>
To: Pedro Falcato <pedro.falcato@...il.com>
Cc: kasan-dev@...glegroups.com, Marco Elver <elver@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm: kmsan: Panic on failure to allocate early boot metadata
On Mon, Oct 16, 2023 at 5:34 PM Pedro Falcato <pedro.falcato@...il.com> wrote:
>
> Given large enough allocations and a machine with low enough memory (i.e
> a default QEMU VM), it's entirely possible that
> kmsan_init_alloc_meta_for_range's shadow+origin allocation fails.
>
> Instead of eating a NULL deref kernel oops, check explicitly for
> memblock_alloc() failure and panic with a nice error message.
For posterity, it is generally quite important for the allocated
shadow and origin to be contiguous, otherwise an unaligned memory
write may result in memory corruption (the corresponding unaligned
shadow write will be assuming that shadow pages are adjacent).
So instead of panicking we could have split the range into smaller
ones until the allocation succeeds, but that would've led to
hard-to-debug problems in the future.
>
> Signed-off-by: Pedro Falcato <pedro.falcato@...il.com>
Reviewed-by: Alexander Potapenko <glider@...gle.com>
Powered by blists - more mailing lists