• Deven Bowers's avatar
    dm-verity: expose root hash digest and signature data to LSMs · a6af7bc3
    Deven Bowers authored
    dm-verity provides a strong guarantee of a block device's integrity. As
    a generic way to check the integrity of a block device, it provides
    those integrity guarantees to its higher layers, including the filesystem
    level.
    
    However, critical security metadata like the dm-verity roothash and its
    signing information are not easily accessible to the LSMs.
    To address this limitation, this patch introduces a mechanism to store
    and manage these essential security details within a newly added LSM blob
    in the block_device structure.
    
    This addition allows LSMs to make access control decisions on the integrity
    data stored within the block_device, enabling more flexible security
    policies. For instance, LSMs can now revoke access to dm-verity devices
    based on their roothashes, ensuring that only authorized and verified
    content is accessible. Additionally, LSMs can enforce policies to only
    allow files from dm-verity devices that have a valid digital signature to
    execute, effectively blocking any unsigned files from execution, thus
    enhancing security against unauthorized modifications.
    
    The patch includes new hook calls, `security_bdev_setintegrity()`, in
    dm-verity to expose the dm-verity roothash and the roothash signature to
    LSMs via preresume() callback. By using the preresume() callback, it
    ensures that the security metadata is consistently in sync with the
    metadata of the dm-verity target in the current active mapping table.
    The hook calls are depended on CONFIG_SECURITY.
    Signed-off-by: default avatarDeven Bowers <deven.desai@linux.microsoft.com>
    Signed-off-by: default avatarFan Wu <wufan@linux.microsoft.com>
    Reviewed-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    [PM: moved sig_size field as discussed]
    Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
    a6af7bc3
dm-verity.h 4.07 KB