Red Hat Bugzilla – Bug 1371714
btrfs module init creates a useless file in /sys/kernel/debug with 0666 permissions
Last modified: 2017-08-01 21:39:21 EDT
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
Um, ok. That's pretty weird. It's exactly like it is upstream... so we'll need to address that first.
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>
This bug got fixed along with the updates for 1399590, so moving it to same state.
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
(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
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