Research
.
Skip Search Box

SELinux Mailing List

Re: libselinux rpm_execon should not fail in permissive mode.

From: Stephen Smalley <sds_at_epoch.ncsc.mil>
Date: Wed, 26 Jan 2005 08:32:28 -0500


On Mon, 2005-01-24 at 15:43, Daniel J Walsh wrote:
> diff --exclude-from=exclude -N -u -r nsalibselinux/src/rpm.c libselinux-1.21.1/src/rpm.c
> --- nsalibselinux/src/rpm.c 2004-11-09 09:13:54.000000000 -0500
> +++ libselinux-1.21.1/src/rpm.c 2005-01-24 15:24:33.000000000 -0500
> @@ -41,8 +41,10 @@
> rc = setexeccon(newcon);
> if (rc < 0)
> goto out;
> - rc = execve(filename, argv, envp);
> out:
> + if ( ( rc == 0 ) ||
> + (security_getenforce() == 0 ))
> + rc = execve(filename, argv, envp);
> context_free(con);
> freecon(newcon);
> freecon(fcon);

I don't see how this fixes the rpm --root issue, as security_getenforce() cannot succeed either if /selinux is not mounted, as it attempts to read /selinux/enforce. What about the attached patch instead, which causes rpm_execcon() to simply call execve() if is_selinux_enabled() returns < 1? is_selinux_enabled() will return -1 if /proc isn't mounted, so this would cause it to fallback to a regular exec in the chroot'd environment.

-- 
Stephen Smalley <sds@epoch.ncsc.mil>
National Security Agency

-- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message.

Received on Wed 26 Jan 2005 - 08:38:52 EST
 

Date Posted: Jan 15, 2009 | Last Modified: Jan 15, 2009 | Last Reviewed: Jan 15, 2009

 
bottom

National Security Agency / Central Security Service