• Qu Wenruo's avatar
    btrfs: Enhance chunk validation check · f04b772b
    Qu Wenruo authored
    Enhance chunk validation:
    1) Num_stripes
       We already have such check but it's only in super block sys chunk
       array.
       Now check all on-disk chunks.
    
    2) Chunk logical
       It should be aligned to sector size.
       This behavior should be *DOUBLE CHECKED* for 64K sector size like
       PPC64 or AArch64.
       Maybe we can found some hidden bugs.
    
    3) Chunk length
       Same as chunk logical, should be aligned to sector size.
    
    4) Stripe length
       It should be power of 2.
    
    5) Chunk type
       Any bit out of TYPE_MAS | PROFILE_MASK is invalid.
    
    With all these much restrict rules, several fuzzed image reported in
    mail list should no longer cause kernel panic.
    Reported-by: default avatarVegard Nossum <vegard.nossum@oracle.com>
    Signed-off-by: default avatarQu Wenruo <quwenruo@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    f04b772b
volumes.c 182 KB