public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Stange <nicstange@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Nicolai Stange <nicstange@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Jan Kara <jack@suse.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] fix debugfs file removal races
Date: Mon, 08 Feb 2016 16:00:10 +0100	[thread overview]
Message-ID: <87fux3memd.fsf@gmail.com> (raw)

Original v1 thread is here:

  http://lkml.kernel.org/r/8737vnvzt0.fsf@gmail.com

Paul E. McKenney has judged on v1's SRCU usage already and I did
not change anything in the related logic.

Regarding Greg K-H's comment to v1 about moving as much stuff as
possible from debugfs.h into a separate internal.h: in my opinion, new
users of debugfs should really use DEBUGFS_DEFINE_ATTRIBUTE() or
manage lifetime from their custom readers and writers via
debugfs_file_use_data_*() from now on and thus, I kept the declaration
of these within the public debugfs.h. The rest has been moved either into
internal.h or in the case of definitions, into file.c though.

Changes v1 -> v2:
  [1/2] ("debugfs: prevent access to possibly dead file_operations at file open")
   - Resolve trivial diff conflict in debugfs_remove_recursive():
     in the meanwhile, an unrelated 'mutex_unlock(...)' had been rewritten to
     'inode_unlock(...)' which broke the diff's context.
   - Introduce the fs/debugfs/internal.h header and move the declarations of
     debugfs_noop_file_operations, debugfs_proxy_file_operations and
     debugfs_rcu from include/linux/debugfs.h thereinto. Include this header
     from file.c and inode.c.
   - Add a word about the new internal header to the commit message.
   - Move the inclusion of linux/srcu.h from include/linux/debugfs.h
     into file.c and inode.c respectively.

  [2/2] ("debugfs: prevent access to removed files' private data")
   - Move the definitions of debugfs_file_use_data_start() and
     debugfs_file_use_data_finish() from include/linux/debugfs.h to
     file.c. Export them and keep their declarations in debugfs.h,
   - In order to be able to attach proper __acquires() and __releases() tags
     to the decalarations of debugfs_file_use_data_*() in debugfs.h,
     move the debugfs_srcu declaration from internal.h into debugfs.h.
   - Since the definitions as well as the docstrings of
     debugfs_file_use_data_*() have been moved into file.c,
     there is no need to run DocBook on debugfs.h: do not modify
     Documentation/DocBook/filesystems.tmpl anymore.
   - In the commit message, encourage new users of debugfs to prefer
     DEFINE_DEBUGFS_ATTRIBUTE() and friends over DEFINE_SIMPLE_ATTRIBUTE().
     
Nicolai Stange (2):
  debugfs: prevent access to possibly dead file_operations at file open
  debugfs: prevent access to removed files' private data

 fs/debugfs/file.c       | 252 +++++++++++++++++++++++++++++++++++++++---------
 fs/debugfs/inode.c      |  18 +++-
 fs/debugfs/internal.h   |  23 +++++
 include/linux/debugfs.h |  29 +++++-
 lib/Kconfig.debug       |   1 +
 5 files changed, 273 insertions(+), 50 deletions(-)
 create mode 100644 fs/debugfs/internal.h

-- 
2.7.0

             reply	other threads:[~2016-02-08 15:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 15:00 Nicolai Stange [this message]
2016-02-08 15:02 ` [PATCH v2 1/2] debugfs: prevent access to possibly dead file_operations at file open Nicolai Stange
2016-02-08 15:03 ` [PATCH v2 2/2] debugfs: prevent access to removed files' private data Nicolai Stange
2016-02-08 16:17   ` Greg Kroah-Hartman
2016-02-08 17:14     ` Nicolai Stange
2016-02-08 19:16       ` Greg Kroah-Hartman
2016-02-08 20:00         ` Nicolai Stange
2016-02-08 20:08           ` Greg Kroah-Hartman
2016-02-09 22:03             ` Nicolai Stange
2016-02-09 22:24               ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fux3memd.fsf@gmail.com \
    --to=nicstange@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox