Skip to contentSkip to conversation

Problems applying SELinux patch to util-linux-2.11y

DISCUSSION Erlend Aasland 2 participants 2 messages Oct 7, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

I've just downloaded the SELinux patches for kernel 2.4, but when patching the userland utilities, I've encountered some problems. The patch for util-linux-2.11y _failes_ to apply clean. The rejected piece of code is from login-utils/login.c

--- 1253,1272 ----

         sigaction(SIGINT, &sa, NULL);
       while(wait(NULL) == -1 && errno == EINTR) /**/ ;
       openlog("login", LOG_ODELAY, LOG_AUTHPRIV);

+ #ifdef WITH_SELINUX
+ if (selinux_enabled)
+ {
+ /* We need to change the contexts of the terminal devices
back to
+ the system when the user's session ends. */
+ security_restorelabel_tty(ttyn,ttyn_context);
+ #ifdef CHOWNVCS
+ if (consoletty(0)) {
+ security_restorelabel_tty(vcsn,vcsn_context);
+ security_restorelabel_tty(vcsan.vcsan_context);
+ }
+ #endif

Is this a known problem? Should I apply the patch against a different version of util-linux? (I got the util-linux-2.11y source from www.kernel.org). I tried to manually apply the rejected code, and I placed the it ca. around line 1250:

if (childPid) {
	...
	signal();
	signal();
	signal();
	wait();
->	<the rejected code>
	PAM_EXIT;
	exit();
}

Is that correct?

Regards,
Erlend Aasland

--
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 · Erlend Aasland

Is this a known problem? Should I apply the patch against a different version of util-linux? (I got the util-linux-2.11y source from www.kernel.org).

The patch is applied after the other patches in the RH util-linux
SRPM. You can get the full SRPM (including the selinux patch) from
http://www.nsa.gov/selinux/SRPMS. The patch does apply cleanly relative to the preceding patches in that SRPM. In particular, it applies cleanly _after_ applying the util-linux-2.11r-ctty3.patch from that SRPM.

Quoted 14 lines

I tried to manually apply the rejected code, and I placed the it ca. around line 1250:

if (childPid) {
	...
	signal();
	signal();
	signal();
	wait();
->	<the rejected code>
	PAM_EXIT;
	exit();
}
Quoted 1 line

Is that correct?

Yes, this looks correct (but PAM_EXIT == PAM_END, right?).

Note that Dan Walsh of RH has developed a pam_selinux session module as an alternative to patching login at all. I think that it is included in his pam SRPM available from ftp://people.redhat.com/dwalsh/SELinux/srpms. With that module, you just add pam_selinux as a session module to login's pam configuration.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.