linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* /sys and access(2): Correctly implemented?
@ 2012-07-06  6:27 Ulrich Windl
  2012-07-08 23:24 ` Ryan Mallon
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Windl @ 2012-07-06  6:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ulrich Windl

Hi!

Recently I found a problem with the command (kernel 3.0.34-0.7-default from SLES 11 SP2, run as root):
test -r "$file" && cat "$file"
emitting "Permission denied"

Investigating, I found that "test" actually uses "access()" to check for permissions. Unfortunately there are some files in /sys that have "write-only" permission bits set (e.g. /sys/devices/system/cpu/probe).

~ # ll /sys/devices/system/cpu/probe
--w------- 1 root root 4096 Jun 29 12:43 /sys/devices/system/cpu/probe
~ # F=/sys/devices/system/cpu/probe
~ # test "$F" && cat "$F"
cat: /sys/devices/system/cpu/probe: Permission denied

In times of capabilities and ACLs, shouldn't there be a test for permissions that actually works?

Regards,
Ulrich
P.S. Please make sure my CC: gets your replies, too -- thanks


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

end of thread, other threads:[~2012-07-09  8:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06  6:27 /sys and access(2): Correctly implemented? Ulrich Windl
2012-07-08 23:24 ` Ryan Mallon
2012-07-09  6:23   ` Antw: " Ulrich Windl
2012-07-09  7:22     ` Ryan Mallon
2012-07-09  8:11       ` Ulrich Windl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).