2016-03-06 19:59:33

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH 0/2] debugfs: fixup to file removal protection series

Version v4 of the series ("fix debugfs file removal races")
to be found at http://lkml.kernel.org/g/[email protected]
has been applied to the driver-core tree's driver-core-testing branch.

Unfortunately, the kbuild test robot discovered two minor issues.

To fix these, there are two options. The first one is to replace the
v4 version of the aforementioned series with v5 available at
http://lkml.kernel.org/g/[email protected]

The other, rebaseless option is to apply the two fixup patches
contained within this series.

Both ways lead to identical code in the end.

This series is applicable to the the driver-core tree's
driver-core-testing branch.

Nicolai Stange (2):
debugfs: fix DocBook comment of debugfs_use_file_start()
debugfs: inline dummy implementations of
debugfs_use_file_start()/_finish()

fs/debugfs/file.c | 2 +-
include/linux/debugfs.h | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)

--
2.7.2


2016-03-06 19:59:36

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH 1/2] debugfs: fix DocBook comment of debugfs_use_file_start()

In commit 055cd38ba671 ("debugfs: prevent access to possibly dead
file_operations at file open")
debugfs_use_file_start() has been introduced. Unfortunately, the associated
DocBook comment hasn't been updated to properly reflect the change of the
'file' argument into 'dentry' during the evolution of the aforementioned
patch.

Catch up on this and rename '@file' to '@dentry' in the DocBook comment
associated with debugfs_use_file_start().

Signed-off-by: Nicolai Stange <[email protected]>
---
fs/debugfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 1a03e99..6a4b667 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -50,7 +50,7 @@ const struct file_operations debugfs_noop_file_operations = {

/**
* debugfs_use_file_start - mark the beginning of file data access
- * @file: the file object whose data is being accessed.
+ * @dentry: the dentry object whose data is being accessed.
* @srcu_idx: a pointer to some memory to store a SRCU index in.
*
* Up to a matching call to debugfs_use_file_finish(), any
--
2.7.2

2016-03-06 19:59:45

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH 2/2] debugfs: inline dummy implementations of debugfs_use_file_start()/_finish()

In commit 921d5cbeb37c ("debugfs: prevent access to removed files'
private data")
the functions debugfs_use_file_start() and debugfs_use_file_finish() have
been exported from the debugfs core.

Unfortunately, the inline keyword has been missed at their noop
implementations provided for the CONFIG_DEBUG_FS=n case.

Due to this lapse, the kbuild test robot moans on a powerpc defconfig
build:

In file included from arch/powerpc/kernel/irq.c:54:0:
include/linux/debugfs.h:185:12: error: 'debugfs_use_file_start'
defined but not used [-Werror=unused-function]
static int debugfs_use_file_start(const struct dentry *dentry,
int *srcu_idx)

include/linux/debugfs.h:191:13: error: 'debugfs_use_file_finish'
defined but not used [-Werror=unused-function]
static void debugfs_use_file_finish(int srcu_idx)

Add the inline keyword to the CONFIG_DEBUG_FS=n noop implementations of
debugfs_use_file_start() and debugfs_use_file_finish().

Signed-off-by: Nicolai Stange <[email protected]>
---
include/linux/debugfs.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e7d2a99..1438e23 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -205,13 +205,15 @@ static inline void debugfs_remove(struct dentry *dentry)
static inline void debugfs_remove_recursive(struct dentry *dentry)
{ }

-static int debugfs_use_file_start(const struct dentry *dentry, int *srcu_idx)
+static inline int debugfs_use_file_start(const struct dentry *dentry,
+ int *srcu_idx)
__acquires(&debugfs_srcu)
{
return 0;
}

-static void debugfs_use_file_finish(int srcu_idx) __releases(&debugfs_srcu)
+static inline void debugfs_use_file_finish(int srcu_idx)
+ __releases(&debugfs_srcu)
{ }

#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
--
2.7.2

2016-03-22 13:17:12

by Nicolai Stange

[permalink] [raw]
Subject: Re: [PATCH 0/2] debugfs: fixup to file removal protection series

Please drop as this has been fixed in the current v6 of the offending
series to be found here:

http://lkml.kernel.org/g/[email protected]

Thank you!

Nicolai