Re: [PATCH] zswap: do not crash the kernel on decompression failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 25, 2025 at 01:32:00PM -0800, Nhat Pham wrote:
> Currently, we crash the kernel when a decompression failure occurs in
> zswap (either because of memory corruption, or a bug in the compression
> algorithm). This is overkill. We should only SIGBUS the unfortunate
> process asking for the zswap entry on zswap load, and skip the corrupted
> entry in zswap writeback.

Some relevant observations/questions, but not really actionable for this
patch, perhaps some future work, or more likely some incoherent
illogical thoughts :

(1) It seems like not making the folio uptodate will cause shmem faults
to mark the swap entry as hwpoisoned, but I don't see similar handling
for do_swap_page(). So it seems like even if we SIGBUS the process,
other processes mapping the same page could follow in the same
footsteps.
 
(2) A hwpoisoned swap entry results in VM_FAULT_SIGBUS in some cases
(e.g. shmem_fault() -> shmem_get_folio_gfp() -> shmem_swapin_folio()),
even though we have VM_FAULT_HWPOISON. This patch falls under this
bucket, but unfortunately we cannot tell for sure if it's a hwpoision or
a decompression bug.

(3) If we run into a decompression failure, should we free the
underlying memory from zsmalloc? I don't know. On one hand if we free it
zsmalloc may start using it for more compressed objects. OTOH, I don't
think proper hwpoison handling will kick in until the page is freed.
Maybe we should tell zsmalloc to drop this page entirely and mark
objects within it as invalid? Probably not worth the hassle but
something to think about.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux