• Alexander Gordeev's avatar
    s390/kasan: avoid short by one page shadow memory · 3e826100
    Alexander Gordeev authored
    Kernel Address Sanitizer uses 3 bits per byte to
    encode memory. That is the number of bits the start
    and end address of a memory range is shifted right
    when the corresponding shadow memory is created for
    that memory range.
    
    The used memory mapping routine expects page-aligned
    addresses, while the above described 3-bit shift might
    turn the shadow memory range start and end boundaries
    into non-page-aligned in case the size of the original
    memory range is less than (PAGE_SIZE << 3). As result,
    the resulting shadow memory range could be short on one
    page.
    
    Align on page boundary the start and end addresses when
    mapping a shadow memory range and avoid the described
    issue in the future.
    
    Note, that does not fix a real problem, since currently
    no virtual regions of size less than (PAGE_SIZE << 3)
    exist.
    Reviewed-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    3e826100
vmem.c 12.9 KB