Bug 1371714 - btrfs module init creates a useless file in /sys/kernel/debug with 0666 permissions
Summary: btrfs module init creates a useless file in /sys/kernel/debug with 0666 permi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kernel
Version: 7.2
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Bill O'Donnell
QA Contact: xiaoli feng
URL:
Whiteboard:
Depends On:
Blocks: 1298243 1385242
TreeView+ depends on / blocked
 
Reported: 2016-08-30 22:24 UTC by Frank Sorenson
Modified: 2019-11-14 09:00 UTC (History)
3 users (show)

Fixed In Version: kernel-3.10.0-618.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-02 00:46:17 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1842 normal SHIPPED_LIVE Important: kernel security, bug fix, and enhancement update 2017-08-01 18:22:09 UTC

Description Frank Sorenson 2016-08-30 22:24:23 UTC
Description of problem:

The btrfs module creates /sys/kernel/debug/btrfs/test with 0666 permissions.  The file only sets the value of a u64 variable, but serves no purpose.

Customers are expressing concerns about the file being world-writable.


Version-Release number of selected component (if applicable):

kernel 3.10.0-327.10.1.el7.x86_64


How reproducible:

always


Steps to Reproduce:

# modprobe btrfs
# ls -l /sys/kernel/debug/btrfs/test


Actual results:
# ls -l /sys/kernel/debug/btrfs/test
-rw-rw-rw- 1 root root 0 Aug 30 08:02 /sys/kernel/debug/btrfs/test


Expected results:

either the file would serve some purpose, it would not be world-writable, or both


Additional info:

the file can be used to change the value of a variable, however the variable serves no purpose

Comment 1 Eric Sandeen 2016-08-30 22:40:18 UTC
Um, ok.  That's pretty weird.

It's exactly like it is upstream... so we'll need to address that first.

Comment 4 Eric Sandeen 2016-10-31 12:45:53 UTC
commit 07f6a480436595394a06a69d0ebc18fef6736197
Author: Eric Sandeen <sandeen@redhat.com>
Date:   Wed Aug 31 16:49:29 2016 -0500

    btrfs: fix perms on demonstration debugfs interface
    
    btrfs provides a helpful demonstration of how to export
    a global variable via debugfs; however, it is unique among
    other debugfs files in that it is world-writable, which causes
    some concern to people who are not familiar with its purpose.
    
    Fix it so that it is only user-writable.
    
    Signed-off-by: Eric Sandeen <sandeen@redhat.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>

Comment 6 Eric Sandeen 2017-04-20 16:12:03 UTC
This bug got fixed along with the updates for 1399590, so moving it to same state.

Comment 10 Eric Sandeen 2017-05-11 03:37:40 UTC
Well, it seems that BTRFS_DEBUG isn't set even on debug kernels.

That got added after I "fixed" the silly permissions:

commit 59554e9e18a858f3cee90e6840696c826b63c67f
Author: Bill O'Donnell <billodo@redhat.com>
Date:   Tue Mar 7 00:02:50 2017 -0500

    [fs] btrfs: create example debugfs file only in debugging build

(upstream commit b0de6c4c81099494d7863a31db06366f74395cda) so indeed, there is no longer anything to test in RHEL7...

Perhaps you can simply verify that "there is no world-writable file in /sys/kernel/debug/btrfs/ now" :)

-Eric

Comment 11 Eryu Guan 2017-05-11 03:54:17 UTC
(In reply to Eric Sandeen from comment #10)
> Well, it seems that BTRFS_DEBUG isn't set even on debug kernels.

Didn't notice that..

> 
> That got added after I "fixed" the silly permissions:
> 
> commit 59554e9e18a858f3cee90e6840696c826b63c67f
> Author: Bill O'Donnell <billodo@redhat.com>
> Date:   Tue Mar 7 00:02:50 2017 -0500
> 
>     [fs] btrfs: create example debugfs file only in debugging build
> 
> (upstream commit b0de6c4c81099494d7863a31db06366f74395cda) so indeed, there
> is no longer anything to test in RHEL7...
> 
> Perhaps you can simply verify that "there is no world-writable file in
> /sys/kernel/debug/btrfs/ now" :)

I agreed. Thanks Eric!

Eryu

Comment 14 errata-xmlrpc 2017-08-02 00:46:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:1842

Comment 15 errata-xmlrpc 2017-08-02 01:39:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:1842


Note You need to log in before you can comment on or make changes to this bug.