mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][SELINUX] Fix selinux_inode_setattr hook
@ 2005-02-04 17:59 Stephen Smalley
  2005-02-04 18:14 ` Chris Wright
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2005-02-04 17:59 UTC (permalink / raw)
  To: Andrew Morton, James Morris, Chris Wright, lkml, selinux

This patch against 2.6.11-rc3 fixes the selinux_inode_setattr hook
function to honor the ATTR_FORCE flag, skipping any permission checking
in that case.  Otherwise, it is possible though unlikely for a denial
from the hook to prevent proper updating, e.g. for remove_suid upon
writing to a file.  This would only occur if the process had write
permission to a suid file but lacked setattr permission to it.  Please
apply.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@redhat.com>

 security/selinux/hooks.c |    3 +++
 1 files changed, 3 insertions(+)

Index: linux-2.6/security/selinux/hooks.c
===================================================================
RCS file: /nfshome/pal/CVS/linux-2.6/security/selinux/hooks.c,v
retrieving revision 1.150
diff -u -p -r1.150 hooks.c
--- linux-2.6/security/selinux/hooks.c	26 Jan 2005 21:20:59 -0000	1.150
+++ linux-2.6/security/selinux/hooks.c	4 Feb 2005 16:39:23 -0000
@@ -2142,6 +2142,9 @@ static int selinux_inode_setattr(struct 
 	if (rc)
 		return rc;
 
+	if (iattr->ia_valid & ATTR_FORCE)
+		return 0;
+
 	if (iattr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
 			       ATTR_ATIME_SET | ATTR_MTIME_SET))
 		return dentry_has_perm(current, NULL, dentry, FILE__SETATTR);


-- 
Stephen Smalley <sds@tycho.nsa.gov>
National Security Agency


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-02-04 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-04 17:59 [PATCH][SELINUX] Fix selinux_inode_setattr hook Stephen Smalley
2005-02-04 18:14 ` Chris Wright
2005-02-04 18:13   ` Stephen Smalley
2005-02-04 18:27     ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®