Skip to content
  • Linus Torvalds's avatar
    mm: fix pageblock bitmap allocation · 7c45512d
    Linus Torvalds authored
    Commit c060f943 ("mm: use aligned zone start for pfn_to_bitidx
    calculation") fixed out calculation of the index into the pageblock
    bitmap when a !SPARSEMEM zome was not aligned to pageblock_nr_pages.
    
    However, the _allocation_ of that bitmap had never taken this alignment
    requirement into accout, so depending on the exact size and alignment of
    the zone, the use of that index could then access past the allocation,
    resulting in some very subtle memory corruption.
    
    This was reported (and bisected) by Ingo Molnar: one of his random
    config builds would hang with certain very specific kernel command line
    options.
    
    In the meantime, commit c060f943
    
     has been marked for stable, so this
    fix needs to be back-ported to the stable kernels that backported the
    commit to use the right alignment.
    
    Bisected-and-tested-by: default avatarIngo Molnar <mingo@kernel.org>
    Acked-by: default avatarMel Gorman <mgorman@suse.de>
    Cc: stable@kernel.org
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7c45512d