LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Why does the filesystem think /selinux/enforce is an empty file? (https://www.linuxquestions.org/questions/linux-general-1/why-does-the-filesystem-think-selinux-enforce-is-an-empty-file-691204/)

openSauce 12-17-2008 06:58 AM

Why does the filesystem think /selinux/enforce is an empty file?
 
The file /selinux/enforce contains 1 character, according to cat, but apparently it has zero size. What's going on here?

Code:

$ cat /selinux/enforce
1$ ls -l /selinux/enforce
-rw-r--r-- 1 root root 0 2008-12-17 12:36 /selinux/enforce
$ du -b /selinux/enforce
0      /selinux/enforce
$ file /selinux/enforce
/selinux/enforce: empty
$


PTrenholme 12-17-2008 08:07 AM

Yes, that's strange. Perhaps you should ask he moderators to move his thread to the security forum. I suspect that it's a security issue. Speaking of zero length files with content, look at this:
Code:

$ ls -l /selinux/
total 0
-rw-rw-rw-  1 root root    0 2008-12-16 21:33 access
dr-xr-xr-x  2 root root    0 2008-12-16 21:33 avc
dr-xr-xr-x  2 root root    0 2008-12-16 21:33 booleans
-rw-r--r--  1 root root    0 2008-12-16 21:33 checkreqprot
dr-xr-xr-x 75 root root    0 2008-12-16 21:33 class
--w-------  1 root root    0 2008-12-16 21:33 commit_pending_bools
-rw-r--r--  1 root root    0 2008-12-16 21:33 compat_net
-rw-rw-rw-  1 root root    0 2008-12-16 21:33 context
-rw-rw-rw-  1 root root    0 2008-12-16 21:33 create
-r--r--r--  1 root root    0 2008-12-16 21:33 deny_unknown
--w-------  1 root root    0 2008-12-16 21:33 disable
-rw-r--r--  1 root root    0 2008-12-16 21:33 enforce
dr-xr-xr-x  2 root root    0 2008-12-16 21:33 initial_contexts
-rw-------  1 root root    0 2008-12-16 21:33 load
-rw-rw-rw-  1 root root    0 2008-12-16 21:33 member
-r--r--r--  1 root root    0 2008-12-16 21:33 mls
crw-rw-rw-  1 root root 1, 3 2008-12-16 21:33 null
dr-xr-xr-x  2 root root    0 2008-12-16 21:33 policy_capabilities
-r--r--r--  1 root root    0 2008-12-16 21:33 policyvers
-r--r--r--  1 root root    0 2008-12-16 21:33 reject_unknown
-rw-rw-rw-  1 root root    0 2008-12-16 21:33 relabel
-rw-rw-rw-  1 root root    0 2008-12-16 21:33 user

Note the date/time is the time I last turned off the system . . .

Valery Reznic 12-18-2008 02:58 AM

It's not only /slinux but /proc too.
All files but links has zero size.
Looks like kernel doesn't bother to export correct file size for stat


All times are GMT -5. The time now is 04:16 PM.