• John Johansen's avatar
    apparmor: Fix decompression of rawdata for read back to userspace · a2f31df0
    John Johansen authored
    The rawdata readback has a few of problems. First if compression is
    enabled when the data is read then the compressed data is read out
    instead decompressing the data. Second if compression of the data
    fails, the code does not handle holding onto the raw_data in
    uncompressed form. Third if the compression is enabled/disabled after
    the rawdata was loaded, the check against the global control of
    whether to use compression does not reflect what was already done to
    the data.
    
    Fix these by always storing the compressed size, along with the
    original data size even if compression fails or is not used. And use
    this to detect whether the rawdata is actually compressed.
    
    Fixes: 52ccc20c652b ("apparmor: use zstd compression for profile data")
    Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
    Acked-by: default avatarJon Tourville <jon.tourville@canonical.com>
    a2f31df0
apparmorfs.c 65.4 KB