Bug 1371714

Summary: btrfs module init creates a useless file in /sys/kernel/debug with 0666 permissions
Product: Red Hat Enterprise Linux 7 Reporter: Frank Sorenson <fsorenso>
Component: kernelAssignee: Bill O'Donnell <billodo>
kernel sub component: Btrfs QA Contact: xiaoli feng <xifeng>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: dwysocha, eguan, esandeen
Version: 7.2Keywords: Patch, Reproducer
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-3.10.0-618.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:46:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1298243, 1385242    

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>
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>
    Reviewed-by: David Sterba <dsterba>
    Signed-off-by: David Sterba <dsterba>

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>
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>
> 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