lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20081031140321.GA11996@us.ibm.com>
Date:	Fri, 31 Oct 2008 09:03:21 -0500
From:	"Serge E. Hallyn" <serue@...ibm.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	"Andrew G. Morgan" <morgan@...nel.org>, dhowells@...hat.com,
	Andrew Morton <akpm@...ux-foundation.org>, chrisw@...s-sol.org,
	linux-security-module@...r.kernel.org
Subject: [PATCH 1/1] file caps: always start with clear bprm->caps_*

(Sorry, resending as I seemed to have dropped lkml from the headers on
yesterday's post)

>From c7b9b5534182566b4526e6a5bd4641bd0ae99676 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serue@...ibm.com>
Date: Thu, 30 Oct 2008 11:52:23 -0500
Subject: [PATCH 1/1] file caps: always start with clear bprm->caps_*

While Linux doesn't honor setuid on scripts.  However, it mistakenly
behaves differently for file capabilities.

This patch fixes that behavior by making sure that get_file_caps()
begins with empty bprm->caps_*.  That way when a script is loaded,
its bprm->caps_* may be filled when binfmt_misc calls prepare_binprm(),
but they will be cleared again when binfmt_elf calls prepare_binprm()
next to read the interpreter's file capabilities.

Signed-off-by: Serge Hallyn <serue@...ibm.com>
Acked-by: David Howells <dhowells@...hat.com>
Acked-by: Andrew G. Morgan <morgan@...nel.org>
---
 security/commoncap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index 399bfdb..3976613 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -279,10 +279,10 @@ static int get_file_caps(struct linux_binprm *bprm)
 	struct vfs_cap_data vcaps;
 	struct inode *inode;
 
-	if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID) {
-		bprm_clear_caps(bprm);
+	bprm_clear_caps(bprm);
+
+	if (bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)
 		return 0;
-	}
 
 	dentry = dget(bprm->file->f_dentry);
 	inode = dentry->d_inode;
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ