public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* debugfs & vfs file permission issue?
@ 2009-01-06  2:57 Robin Getz
  2009-01-06  5:48 ` Greg KH
  0 siblings, 1 reply; 14+ messages in thread
From: Robin Getz @ 2009-01-06  2:57 UTC (permalink / raw)
  To: Greg KH, viro; +Cc: linux-kernel

On 2.6.28-rc2, If I create a debugfs file with

    debugfs_create_x16("SPORT1_TX", 0200 , parent, 0xFFC00910);

Although the file shows up as write only (no read):

root:/> ls -l /sys/kernel/debug/blackfin/SPORT/SPORT1_TX
--w-------    1 root     root            0 Jan  1  
2007 /sys/kernel/debug/blackfin/SPORT/SPORT1_TX

root:/> cat /sys/kernel/debug/blackfin/SPORT/SPORT1_TX

Still works - and causes the read to occur, which crashes :(

System MMR Error
.....

I can do the same to any file by hand too.

root:/> ls -l /sys/kernel/debug/blackfin/RTC/RTC_STAT
-rw-------    1 root     root            0 Jan  1  
2007 /sys/kernel/debug/blackfin/RTC/RTC_STAT
root:/> cat /sys/kernel/debug/blackfin/RTC/RTC_STAT
0xb81d3181
root:/> chmod 0000 /sys/kernel/debug/blackfin/RTC/RTC_STAT
root:/> ls -l /sys/kernel/debug/blackfin/RTC/RTC_STAT
----------    1 root     root            0 Jan  1  
2007 /sys/kernel/debug/blackfin/RTC/RTC_STAT
root:/> cat /sys/kernel/debug/blackfin/RTC/RTC_STAT
0xb81d31a5

?

>From what I can tell from the call trace:

cat (userspace)
  system_call (into kernel)
    sys_read
      vfs_read
        simple_attr_read
          debugfs_u16_get
            crash


I would think that vfs_read should fail....

./fs/read_write.c:vfs_read()

        if (!(file->f_mode & FMODE_READ))
                return -EBADF; 

I don't understand while the inode that is created 

fs/debugfs/inode.c:debugfs_get_inode()

     inode->i_mode = mode; 

isn't setting the f_mode properly.

Any suggestions?

Thanks

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-06-02 23:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-06  2:57 debugfs & vfs file permission issue? Robin Getz
2009-01-06  5:48 ` Greg KH
2009-01-06  5:54   ` Mike Frysinger
2009-01-06  6:19     ` Greg KH
2009-01-06  6:32       ` Mike Frysinger
2009-01-06 12:05         ` Robin Getz
2009-01-06 15:12           ` Robin Getz
2009-01-06 15:20             ` Mike Frysinger
2009-01-06 21:20               ` Robin Getz
2009-01-06 23:11             ` Greg KH
2009-01-07  3:30               ` Robin Getz
2009-01-25 21:34             ` Greg KH
2009-06-02  7:00               ` [PATCH] debugfs: use specified mode to possibly mark files read/write only Mike Frysinger
2009-06-02 23:23                 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox