• L
    blktrace: ensure our debugfs dir exists · f5523543
    Luis Chamberlain 提交于
    mainline inclusion
    from mainline-v5.9-rc1
    commit b431ef837e3374da0db8ff6683170359aaa0859c
    category: bugfix
    bugzilla: 30213
    CVE: CVE-2019-19770
    
    ---------------------------
    
    We make an assumption that a debugfs directory exists, but since
    this can fail ensure it exists before allowing blktrace setup to
    complete. Otherwise we end up stuffing blktrace files on the debugfs
    root directory. In the worst case scenario this *in theory* can create
    an eventual panic *iff* in the future a similarly named file is created
    prior on the debugfs root directory. This theoretical crash can happen
    due to a recursive removal followed by a specific dentry removal.
    
    This doesn't fix any known crash, however I have seen the files
    go into the main debugfs root directory in cases where the debugfs
    directory was not created due to other internal bugs with blktrace
    now fixed.
    
    blktrace is also completely useless without this directory, so
    this ensures to userspace we only setup blktrace if the kernel
    can stuff files where they are supposed to go into.
    
    debugfs directory creations typically aren't checked for, and we have
    maintainers doing sweep removals of these checks, but since we need this
    check to ensure proper userspace blktrace functionality we make sure
    to annotate the justification for the check.
    Signed-off-by: NLuis Chamberlain <mcgrof@kernel.org>
    Reviewed-by: NChristoph Hellwig <hch@lst.de>
    Reviewed-by: NBart Van Assche <bvanassche@acm.org>
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    
    Conflict: kernel/trace/blktrace.c
    Signed-off-by: NYu Kuai <yukuai3@huawei.com>
    Reviewed-by: NYufen Yu <yuyufen@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    f5523543
blktrace.c 47.1 KB