Re: [PATCH 1/2] mm/swap: Fix race conditions in swap_slots cache init

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

 



On Fri, 21 Jul 2017 15:45:00 -0700 Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx> wrote:

> Memory allocations can happen before the swap_slots cache initialization
> is completed during cpu bring up.  If we are low on memory, we could call
> get_swap_page and access swap_slots_cache before it is fully initialized.
> 
> Add a check in get_swap_page for initialized swap_slots_cache
> to prevent this condition.  Similar check already exists in
> free_swap_slot.  Also annotate the checks to indicate the likely
> condition.
> 
> We also added a memory barrier to make sure that the locks
> initialization are done before the assignment of cache->slots
> and cache->slots_ret pointers. This ensures the assumption
> that it is safe to acquire the slots cache locks and use the slots
> cache when the corresponding cache->slots or cache->slots_ret
> pointers are non null.

I guess that the user-visible effect is "crash on boot on large
machine".  Or something.  Please don't make me guess!

Which kernel version(s) do you believe need this patch, and why?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[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