Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764001AbZCYRjs (ORCPT ); Wed, 25 Mar 2009 13:39:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1763929AbZCYRj0 (ORCPT ); Wed, 25 Mar 2009 13:39:26 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:33347 "EHLO e38.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763942AbZCYRjX (ORCPT ); Wed, 25 Mar 2009 13:39:23 -0400 Date: Wed, 25 Mar 2009 12:39:04 -0500 From: "Serge E. Hallyn" To: Marc-Christian Petersen Cc: mtk.manpages@gmail.com, Stephen Smalley , Andrew Morgan , linux-security-module@vger.kernel.org, lkml , linux-nfs@vger.kernel.org, Igor Zhbanov , stable@kernel.org, linux-api@vger.kernel.org, Chris Wright Subject: [PATCH 2.2] CAP_FS_MASK: add CAP_LINUX_IMMUTABLE Message-ID: <20090325173904.GA19269@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2268 Lines: 57 When POSIX capabilities were introduced during the 2.1 Linux cycle, the fs mask, which represents the capabilities which having fsuid==0 is supposed to grant, did not include CAP_MKNOD and CAP_LINUX_IMMUTABLE. However, before capabilities the privilege to call these did in fact depend upon fsuid==0. However, 2.2 does not have CAP_MKNOD, instead using CAP_SYS_ADMIN to authorize sys_mknod. We don't want to put CAP_SYS_ADMIN in CAP_FS_MASK because it carries too many non-fs implications. This patch introduces CAP_LINUX_IMMUTABLE into the fsmask. See the thread starting at http://lkml.org/lkml/2009/3/11/157 for reference. Reported-by: Igor Zhbanov Signed-off-by: Serge E. Hallyn Cc: stable@kernel.org --- include/linux/capability.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff -Nrup linux-2.2.26/include/linux/capability.h linux-2.2.26.new/include/linux/capability.h --- linux-2.2.26/include/linux/capability.h 2004-02-23 07:44:47.000000000 -0600 +++ linux-2.2.26.new/include/linux/capability.h 2009-03-25 11:12:08.000000000 -0500 @@ -98,10 +98,6 @@ typedef __u32 kernel_cap_t; #define CAP_FSETID 4 -/* Used to decide between falling back on the old suser() or fsuser(). */ - -#define CAP_FS_MASK 0x1f - /* Overrides the restriction that the real or effective user ID of a process sending a signal must match the real or effective user ID of the process receiving the signal. */ @@ -288,6 +284,15 @@ extern kernel_cap_t cap_bset; #endif +/* Used to decide between falling back on the old suser() or fsuser(). */ + +#define CAP_FS_MASK (CAP_TO_MASK(CAP_CHOWN) \ + | CAP_TO_MASK(CAP_DAC_OVERRIDE) \ + | CAP_TO_MASK(CAP_DAC_READ_SEARCH) \ + | CAP_TO_MASK(CAP_FOWNER) \ + | CAP_TO_MASK(CAP_FSETID) \ + | CAP_TO_MASK(CAP_LINUX_IMMUTABLE)) + #define CAP_EMPTY_SET to_cap_t(0) #define CAP_FULL_SET to_cap_t(~0) #define CAP_INIT_EFF_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP)) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/