public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kenneth <liguozhu@huawei.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Problem with debugfs
Date: Sat, 25 Sep 2010 09:18:00 +0800	[thread overview]
Message-ID: <20100925011800.GA6073@localhost> (raw)
In-Reply-To: <20100921061310.GA11526@localhost>

Hi, all,

Yes, the problem is from code review, rather than in practice. I just wrote a
doc to introduce debugfs, and then I could not find a way to protect the
variable:)

I think add a comment to the header file will be good enough for this.

-- Kenneth


On Tue, Sep 21, 2010 at 02:13:10PM +0800, Kenneth wrote:
> Hello, Mr. Greg,
> 
> I'm sorry I had not checked the git before sending my last mail.
> 
> For the problem I mention, consider this scenarios:
> 
> 1. mm/hwpoinson-inject.c create a debugfs file with
>    debugfs_create_u64("corrupt-filter-flags-mask", ...,
>    &hwpoison_filter_flags_mask)
> 2. hwpoison_filter_flags_mask is supposed to be protected by filp->priv->mutex
>    of this file when it is accessed from user space.
> 3. but when it is accessed from mm/memory-failure.c:hwpoison_filter_flags,
>    there is no way for the function to protect the operation (so it simply
>    ignore it). This may create a competition problem.
> 
> It should be a problem.
> 
> I'm sorry from my poor English skill.
> 
> Best Regards
> Kenneth Lee
> 
> On Tue, Sep 21, 2010 at 10:21:12AM +0800, kenny wrote:
> > Hi, there,
> > 
> > I do not know who is the maintainer for debugfs now. But I think there is
> > problem with its API: It uses filp->priv->mutex to protect the read/write (to
> > the file) for the value of its attribute, but the mutex is not exported to the
> > API user.  Therefore, there is no way to protect its value when you directly
> > use the value in your module.
> > 
> > Is my understanding correct?
> > 
> > Thanks
> > 
> > 
> > Best Regards
> > Kenneth Lee
> 
> 


      parent reply	other threads:[~2010-09-25  1:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21  2:21 Problem with debugfs liguozhu
2010-09-21  3:43 ` Greg KH
2010-09-21  4:38   ` Randy Dunlap
2010-09-21 13:40     ` Greg KH
2010-09-21  6:13 ` Kenneth
2010-09-21  7:23   ` KOSAKI Motohiro
2010-09-21  7:31     ` Andi Kleen
2010-09-21  8:04       ` Wu Fengguang
2010-09-21  8:12         ` Andi Kleen
2010-09-25  1:18   ` Kenneth [this message]

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=20100925011800.GA6073@localhost \
    --to=liguozhu@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    /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