Skip to contentSkip to conversation

/proc woes

DISCUSSION Tom 3 participants 7 messages Oct 8, 2002 – Oct 9, 2002 SELinux security module

lore
Share & tools
lore

Tom

author
#0 lore raw

Forget my last posting. I noticed a few seconds after pressing send that of course all that is no good because /proc is not a supported filesystem.

So instead of having a patch, I have a question: My /proc is file_t:

dr-xr-xr-x root root system_u:object_r:file_t proc

Doing a chcon manually fails:

# chcon system_u:object_r:proc_t /proc
chcon: /proc: Permission denied

So, what went wrong and what can I do to fix it?

Signature · 8 lines
PGP/GPG key: http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 3 lines · Tom

So instead of having a patch, I have a question: My /proc is file_t:

dr-xr-xr-x root root system_u:object_r:file_t proc

This implies that your /proc is an empty mountpoint and is thus unused.

Quoted 4 lines

Doing a chcon manually fails:

# chcon system_u:object_r:proc_t /proc
chcon: /proc: Permission denied

Why do you need to assign a different type to this empty mountpoint? It doesn't need to be accessed by anything. Are you just trying to avoid audit messages about attempts to access it?

The permission denial is due to the filesystem associate permission check between the file type and the filesystem type. proc_t isn't authorized to be associated with an ordinary filesystem type like fs_t.

--
Stephen D. Smalley, NAI Labs
[email protected]

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#2 lore raw
Quoted 5 lines · Stephen Smalley
Quoted 3 lines

So instead of having a patch, I have a question: My /proc is file_t:

dr-xr-xr-x root root system_u:object_r:file_t proc

This implies that your /proc is an empty mountpoint and is thus unused.

No, it was populated and in use. (mount showed it mounted, and umount failed with busy).

Rebooting the machine fixed it, so this may have happened during either make relabel or make load (I installed a new policy today), though it's still a mystery to me how and I'm one of the people who believe that a reboot shouldn't be a valid solution. :)

Signature · 8 lines
PGP/GPG key: http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#3 lore raw
Quoted 4 lines · Tom

Rebooting the machine fixed it, so this may have happened during either make relabel or make load (I installed a new policy today), though it's still a mystery to me how and I'm one of the people who believe that a reboot shouldn't be a valid solution. :)

I can't see any reason why a 'make relabel' or a 'make load' would yield this behavior. 'make relabel' only runs setfiles on mounted ext[23] or reiserfs filesystems to create or update the persistent label mappings. 'make load' doesn't relabel anything, although it might invalidate security contexts if you removed types (like proc_t), leaving existing objects in unlabeled_t (but not file_t).

--
Stephen D. Smalley, NAI Labs
[email protected]

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#4 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 4 lines

Rebooting the machine fixed it, so this may have happened during either make relabel or make load (I installed a new policy today), though it's still a mystery to me how and I'm one of the people who believe that a reboot shouldn't be a valid solution. :)

I can't see any reason why a 'make relabel' or a 'make load' would yield this behavior. 'make relabel' only runs setfiles on mounted ext[23] or reiserfs filesystems to create or update the persistent label mappings. 'make load' doesn't relabel anything, although it might invalidate security contexts if you removed types (like proc_t), leaving existing objects in unlabeled_t (but not file_t).

Well, I *am* somewhat puzzled myself, but I've seen it happen. I will experiment a little tomorrow afternoon to see if I can recreate it (probably by replaying the bash history) and find out what caused this.

Signature · 8 lines
http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#5 lore raw
In reply to Tom
Quoted 7 lines · Tom
Quoted 5 lines · Stephen Smalley
Quoted 3 lines

So instead of having a patch, I have a question: My /proc is file_t:

dr-xr-xr-x root root system_u:object_r:file_t proc

This implies that your /proc is an empty mountpoint and is thus unused.

Quoted 8 lines

No, it was populated and in use. (mount showed it mounted, and umount failed with busy).

Rebooting the machine fixed it, so this may have happened during either make relabel or make load (I installed a new policy today), though it's still a mystery to me how and I'm one of the people who believe that a reboot shouldn't be a valid solution. :)

If you do the following:
echo /proc | setfiles -s -v /etc/selinux/file_contexts/file_contexts Then it will be relabelled to file_t.

The Debian package base-files "owns" /proc and therefore it will be relabelled in the fashion shown above if you upgrade your base-files package.

The solution to this is to add an entry to file_contexts for /proc.

In my tree I added the following as line 147 of types.fc to avoid this happening in future. Steve, please include something equivalent in the CVS, although it's only used by Debian now, the same issue will probably be faced by RPM distributions when they support SE Linux (and in any case it does no harm).
/proc(/.*)? <<none>>

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
author
#6 lore raw
Quoted 6 lines · Russell Coker

If you do the following:
echo /proc | setfiles -s -v /etc/selinux/file_contexts/file_contexts Then it will be relabelled to file_t.

The Debian package base-files "owns" /proc and therefore it will be relabelled in the fashion shown above if you upgrade your base-files package.

That sounds like it's what happened, since I did indeed do a major update that most likely included base-files.

Signature · 8 lines
PGP/GPG key: http://web.lemuria.org/pubkey.html
pub  1024D/2D7A04F5 2002-05-16 Tom Vogt <[email protected]>
     Key fingerprint = C731 64D1 4BCF 4C20 48A4  29B2 BF01 9FA1 2D7A 04F5

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.