Skip to contentSkip to conversation

textrel_shlib_t handling

DISCUSSION Chris PeBenito 2 participants 3 messages Apr 22, 2006 – Apr 26, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

I remember seeing some discussion about RPM being enhanced so that it detects libraries with text relocations, and labels them textrel_shlib_t when installing them onto the filesystem. So I thought that it would be useful for Gentoo's Portage too. The problem is that if a library isn't already textrel_shlib_t in the file contexts, a relabel will reset them back to shlib_t. I came up with two possible solutions:

1. the package manager adds file contexts using semanage fcontext, then the library will get the right label by default. The problem with this is that this would need to be recorded somewhere (probably the package manager db) so the package manager removes this fcontext if the package is removed/upgraded.

2. textrel_shlib_t is made a customizable type. The problem is that the libs can still get set back to shlib_t if using -F on restorecon/setfiles.

While #1 is the best solution, it may require significant changes in the package manager, and may not be acceptable to the upstream because of that. #2 is a simpler solution, but has the -F problem. My feeling is that the -F problem is not a significant problem, so we should go with #2. Thoughts?

Signature · 8 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
Embedded Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243
#1 lore raw
Quoted 17 lines · Chris PeBenito

I remember seeing some discussion about RPM being enhanced so that it detects libraries with text relocations, and labels them textrel_shlib_t when installing them onto the filesystem. So I thought that it would be useful for Gentoo's Portage too. The problem is that if a library isn't already textrel_shlib_t in the file contexts, a relabel will reset them back to shlib_t. I came up with two possible solutions:

1. the package manager adds file contexts using semanage fcontext, then the library will get the right label by default. The problem with this is that this would need to be recorded somewhere (probably the package manager db) so the package manager removes this fcontext if the package is removed/upgraded.

2. textrel_shlib_t is made a customizable type. The problem is that the libs can still get set back to shlib_t if using -F on restorecon/setfiles.

Quoted 5 lines

While #1 is the best solution, it may require significant changes in the package manager, and may not be acceptable to the upstream because of that. #2 is a simpler solution, but has the -F problem. My feeling is that the -F problem is not a significant problem, so we should go with #2. Thoughts?

I had suggested #2 previously, but someone (Dan?) noted that we then have the problem that textrel_shlib_t will never get removed if the library is later updated to a version that no longer requires text relocations.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
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.
#2 lore raw
Quoted 24 lines · Stephen Smalley
Quoted 17 lines · Chris PeBenito

I remember seeing some discussion about RPM being enhanced so that it detects libraries with text relocations, and labels them textrel_shlib_t when installing them onto the filesystem. So I thought that it would be useful for Gentoo's Portage too. The problem is that if a library isn't already textrel_shlib_t in the file contexts, a relabel will reset them back to shlib_t. I came up with two possible solutions:

1. the package manager adds file contexts using semanage fcontext, then the library will get the right label by default. The problem with this is that this would need to be recorded somewhere (probably the package manager db) so the package manager removes this fcontext if the package is removed/upgraded.

2. textrel_shlib_t is made a customizable type. The problem is that the libs can still get set back to shlib_t if using -F on restorecon/setfiles.

Quoted 5 lines

While #1 is the best solution, it may require significant changes in the package manager, and may not be acceptable to the upstream because of that. #2 is a simpler solution, but has the -F problem. My feeling is that the -F problem is not a significant problem, so we should go with #2. Thoughts?

Quoted 4 lines

I had suggested #2 previously, but someone (Dan?) noted that we then have the problem that textrel_shlib_t will never get removed if the library is later updated to a version that no longer requires text relocations.

How is that? If the library is controlled by the package manager, then every time it is installed, it will be probed, and labeled appropriately. So if the text relocations get fixed, the library getting installed (shlib_t) will replace the textrel library; thus, the label should be correct. This works for Gentoo because Portage deletes the existing file and installs the new file. Does RPM just overwrite the old file?

Signature · 8 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
Embedded Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243