security: move LSM xattrnames to xattr.h
Subsystems (5)
PATCH 1/1 security: move LSM xattrnames to xattr.h
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
--- include/linux/capability.h | 3 --- include/linux/xattr.h | 14 ++++++++++++++ security/selinux/hooks.c | 3 --- security/smack/smack.h | 10 ---------- 4 files changed, 14 insertions(+), 16 deletions(-)
include/linux/capability.h +0 -3
@@ -49,9 +49,6 @@ typedef struct __user_cap_data_struct { }__user *cap_user_data_t; -#define XATTR_CAPS_SUFFIX "capability" -#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX -#define VFS_CAP_REVISION_MASK 0xFF000000#define VFS_CAP_REVISION_SHIFT 24#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
include/linux/xattr.h +14 -0
@@ -33,6 +33,20 @@#define XATTR_USER_PREFIX "user."#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) +/* Security namespace */ +#define XATTR_SELINUX_SUFFIX "selinux" +#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX + +#define XATTR_SMACK_SUFFIX "SMACK64" +#define XATTR_SMACK_IPIN "SMACK64IPIN" +#define XATTR_SMACK_IPOUT "SMACK64IPOUT" +#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX +#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN +#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT + +#define XATTR_CAPS_SUFFIX "capability" +#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX +struct inode ;struct dentry ;
security/selinux/hooks.c +0 -3
@@ -87,9 +87,6 @@#include "netlabel.h" #include "audit.h" -#define XATTR_SELINUX_SUFFIX "selinux" -#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX -#define NUM_SEL_MNT_OPTS 5extern int selinux_nlmsg_lookup (u16 sclass,u16 nlmsg_type,u32 *perm);
security/smack/smack.h +0 -10
@@ -123,16 +123,6 @@ struct smack_known {#define SMK_FSHAT "smackfshat="#define SMK_FSROOT "smackfsroot=" -/* -* xattr names -*/ -#define XATTR_SMACK_SUFFIX "SMACK64" -#define XATTR_SMACK_IPIN "SMACK64IPIN" -#define XATTR_SMACK_IPOUT "SMACK64IPOUT" -#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX -#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN -#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT -#define SMACK_CIPSO_OPTION "-CIPSO"/*
Signature · 1 line
1.6.6.1
James Morris
maintainerQuoted 5 lines · Mimi Zohar
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
Signature · 2 lines
James Morris <[email protected]>
Cuma 02 Temmuz 2010 günü (saat 03:16:01) James Morris şunları yazmıştı:
Quoted 7 lines · Mimi Zohar
Quoted 5 lines
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>
This drops
#define XATTR_CAPS_SUFFIX "capability"
#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
definitions from capability.h and puts them in xattr.h's #ifdef __KERNEL__ section making them invisible to userspace like libcap-ng causing build failures.
Am I wrong?
---
Ozan Çağlayan
TUBITAK/UEKAE - Pardus Linux
http://www.pardus.org.tr/eng
Quoted 11 lines · Ozan Çağlayan
Cuma 02 Temmuz 2010 günü (saat 03:16:01) James Morris şunları yazmıştı:
Quoted 7 lines · Mimi Zohar
Quoted 5 lines
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>This drops
Quoted 8 lines
#define
XATTR_CAPS_SUFFIX"capability"
#defineXATTR_NAME_CAPSXATTR_SECURITY_PREFIXXATTR_CAPS_SUFFIXdefinitions from
capability.hand puts them in xattr.h's #ifdef__KERNEL__section making them invisible to userspace like libcap-ng causing build failures.Am I wrong?
You're correct. It's the same reason that cap-ng.c has to define 'security'.
#ifdef VFS_CAP_U32
#include <attr/xattr.h>
#define XATTR_SECURITY_PREFIX "security."
Am cc'ing Steve.
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 20 lines · Mimi Zohar
Quoted 10 lines · Ozan Çağlayan
Cuma 02 Temmuz 2010 günü (saat 03:16:01) James Morris şunları yazmıştı:
Quoted 6 lines · Mimi Zohar
Quoted 5 lines
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>This drops
Quoted 8 lines
#define
XATTR_CAPS_SUFFIX"capability"
#defineXATTR_NAME_CAPSXATTR_SECURITY_PREFIXXATTR_CAPS_SUFFIXdefinitions from
capability.hand puts them in xattr.h's #ifdef__KERNEL__section making them invisible to userspace like libcap-ng causing build failures.Am I wrong?
Quoted 8 lines
You're correct. It's the same reason that
cap-ng.chas to define 'security'.#ifdef
VFS_CAP_U32
#include <attr/xattr.h>
#defineXATTR_SECURITY_PREFIX"security."Am cc'ing Steve.
So does this mean I need to provide more definitions for libcap-ng to work with future kernels or are you asking my opinion? My opinion is that if user space needs it to work correctly, please let it be available so I don't have to make my own define which may be inaccurate one day.
Thanks,
-Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 30 lines · Steve Grubb
Quoted 20 lines · Mimi Zohar
Quoted 10 lines · Ozan Çağlayan
Cuma 02 Temmuz 2010 günü (saat 03:16:01) James Morris şunları yazmıştı:
Quoted 6 lines · Mimi Zohar
Quoted 5 lines
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>This drops
Quoted 8 lines
#define
XATTR_CAPS_SUFFIX"capability"
#defineXATTR_NAME_CAPSXATTR_SECURITY_PREFIXXATTR_CAPS_SUFFIXdefinitions from
capability.hand puts them in xattr.h's #ifdef__KERNEL__section making them invisible to userspace like libcap-ng causing build failures.Am I wrong?
Quoted 8 lines
You're correct. It's the same reason that
cap-ng.chas to define 'security'.#ifdef
VFS_CAP_U32
#include <attr/xattr.h>
#defineXATTR_SECURITY_PREFIX"security."Am cc'ing Steve.
Quoted 7 lines
So does this mean I need to provide more definitions for libcap-ng to work with future kernels or are you asking my opinion? My opinion is that if user space needs it to work correctly, please let it be available so I don't have to make my own define which may be inaccurate one day.
Thanks,
-Steve
Before making any changes to the kernel xattr.h, I want to understand the reason for two xattr.h files, one in /usr/include/linux/ and the other in /usr/include/xattr/. /usr/include/linux/xattr.h contains those elements not defined as __kernel__, while /usr/include/xattr/xattr.h contains that and other definitions. Will changing the kernel xattr.h version change both?
As long as we're making this change, should 'security' also be defined outside of the __kernel__ definitions?
thanks,
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 48 lines · Mimi Zohar
Quoted 31 lines · Steve Grubb
Quoted 23 lines · Mimi Zohar
Quoted 10 lines · Ozan Çağlayan
Cuma 02 Temmuz 2010 günü (saat 03:16:01) James Morris şunları yazmıştı:
Quoted 6 lines · Mimi Zohar
Quoted 5 lines
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>This drops
Quoted 8 lines
#define
XATTR_CAPS_SUFFIX"capability"
#defineXATTR_NAME_CAPSXATTR_SECURITY_PREFIXXATTR_CAPS_SUFFIXdefinitions from
capability.hand puts them in xattr.h's #ifdef__KERNEL__section making them invisible to userspace like libcap-ng causing build failures.Am I wrong?
You're correct. It's the same reason that
cap-ng.chas to define 'security'.Quoted 6 lines
#ifdef
VFS_CAP_U32#include <
attr/xattr.h>
#defineXATTR_SECURITY_PREFIX"security."Am cc'ing Steve.
Quoted 8 lines
So does this mean I need to provide more definitions for libcap-ng to work with future kernels or are you asking my opinion? My opinion is that if user space needs it to work correctly, please let it be available so I don't have to make my own define which may be inaccurate one day.
Thanks,
-SteveBefore making any changes to the kernel
xattr.h, I want to understand the reason for twoxattr.hfiles, one in/usr/include/linux/and the other in/usr/include/xattr/./usr/include/linux/xattr.hcontains those elements not defined as__kernel__, while/usr/include/xattr/xattr.hcontains that and other definitions. Will changing the kernelxattr.hversion change both?
Quoted 2 lines
As long as we're making this change, should 'security' also be defined outside of the
__kernel__definitions?
I guess no one fixed this before 2.6.36 was finalized. Removing the define has broke user space compilation for anything that works on file based capabilities. I can define it myself, but if the kernel folks ever change the string, then we have more than just a compile problem, we have runtime problems because I can no longer use the correct string.
So, what was the gain for breaking user space?
-Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 58 lines · Steve Grubb
Quoted 48 lines · Mimi Zohar
Quoted 31 lines · Steve Grubb
Quoted 23 lines · Mimi Zohar
Quoted 10 lines · Ozan Çağlayan
Cuma 02 Temmuz 2010 günü (saat 03:16:01) James Morris şunları yazmıştı:
Quoted 6 lines · Mimi Zohar
Quoted 5 lines
Make the security extended attributes names global. Updated to move the remaining Smack xattrs.
Signed-off-by Mimi Zohar <[email protected]>Acked-by Serge Hallyn <[email protected]>This drops
Quoted 8 lines
#define
XATTR_CAPS_SUFFIX"capability"
#defineXATTR_NAME_CAPSXATTR_SECURITY_PREFIXXATTR_CAPS_SUFFIXdefinitions from
capability.hand puts them in xattr.h's #ifdef__KERNEL__section making them invisible to userspace like libcap-ng causing build failures.Am I wrong?
You're correct. It's the same reason that
cap-ng.chas to define 'security'.Quoted 6 lines
#ifdef
VFS_CAP_U32#include <
attr/xattr.h>
#defineXATTR_SECURITY_PREFIX"security."Am cc'ing Steve.
Quoted 8 lines
So does this mean I need to provide more definitions for libcap-ng to work with future kernels or are you asking my opinion? My opinion is that if user space needs it to work correctly, please let it be available so I don't have to make my own define which may be inaccurate one day.
Thanks,
-SteveBefore making any changes to the kernel
xattr.h, I want to understand the reason for twoxattr.hfiles, one in/usr/include/linux/and the other in/usr/include/xattr/./usr/include/linux/xattr.hcontains those elements not defined as__kernel__, while/usr/include/xattr/xattr.hcontains that and other definitions. Will changing the kernelxattr.hversion change both?Quoted 2 lines
As long as we're making this change, should 'security' also be defined outside of the
__kernel__definitions?I guess no one fixed this before 2.6.36 was finalized. Removing the define has broke user space compilation for anything that works on file based capabilities. I can define it myself, but if the kernel folks ever change the string, then we have more than just a compile problem, we have runtime problems because I can no longer use the correct string.
Quoted 3 lines
So, what was the gain for breaking user space?
-Steve
Sorry I dropped the ball. Was expecting some kind of response to my question above, and then forgot about it.
All of the 'security' xattrs were moved to fsmagic.h, including capability. Not only those that EVM protects, but others like XATTR_NAME_SMACKIPIN/OUT (based on Casey's request).
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Mimi Zohar
Quoted 11 lines
Quoted 2 lines
As long as we're making this change, should 'security' also be defined outside of the
__kernel__definitions?I guess no one fixed this before 2.6.36 was finalized. Removing the define has broke user space compilation for anything that works on file based capabilities. I can define it myself, but if the kernel folks ever change the string, then we have more than just a compile problem, we have runtime problems because I can no longer use the correct string.
So, what was the gain for breaking user space?
Quoted 8 lines
Quoted 1 line
-Steve
Sorry I dropped the ball. Was expecting some kind of response to my question above, and then forgot about it.
All of the 'security' xattrs were moved to
fsmagic.h, including capability. Not only those that EVM protects, but others like XATTR_NAME_SMACKIPIN/OUT (based on Casey's request).
If user space has to know the exact contents of a string in order to do something that the kernel understands, then its part of a public API. I've made my own define and released a new copy of libcap-ng. So, if the contents of the string ever change, or becomes deprecated, you'll now have user space apps using the old values no matter what.
-Steve
Quoted 21 lines · Steve Grubb
Quoted 11 lines · Mimi Zohar
Quoted 11 lines
Quoted 2 lines
As long as we're making this change, should 'security' also be defined outside of the
__kernel__definitions?I guess no one fixed this before 2.6.36 was finalized. Removing the define has broke user space compilation for anything that works on file based capabilities. I can define it myself, but if the kernel folks ever change the string, then we have more than just a compile problem, we have runtime problems because I can no longer use the correct string.
So, what was the gain for breaking user space?
Quoted 8 lines
Quoted 1 line
-Steve
Sorry I dropped the ball. Was expecting some kind of response to my question above, and then forgot about it.
All of the 'security' xattrs were moved to
fsmagic.h, including capability. Not only those that EVM protects, but others like XATTR_NAME_SMACKIPIN/OUT (based on Casey's request).
Quoted 5 lines
If user space has to know the exact contents of a string in order to do something that the kernel understands, then its part of a public API. I've made my own define and released a new copy of libcap-ng. So, if the contents of the string ever change, or becomes deprecated, you'll now have user space apps using the old values no matter what.
You're right Steve, it is ABI, we broke it, and we can fix it. What are you having to define and what are you including. What files did you used to get these defines from?
-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 29 lines · Eric Paris
Quoted 22 lines · Steve Grubb
Quoted 12 lines · Mimi Zohar
Quoted 12 lines
Quoted 2 lines
As long as we're making this change, should 'security' also be defined outside of the
__kernel__definitions?I guess no one fixed this before 2.6.36 was finalized. Removing the define has broke user space compilation for anything that works on file based capabilities. I can define it myself, but if the kernel folks ever change the string, then we have more than just a compile problem, we have runtime problems because I can no longer use the correct string.
So, what was the gain for breaking user space?
Quoted 8 lines
Quoted 1 line
-Steve
Sorry I dropped the ball. Was expecting some kind of response to my question above, and then forgot about it.
All of the 'security' xattrs were moved to
fsmagic.h, including capability. Not only those that EVM protects, but others like XATTR_NAME_SMACKIPIN/OUT (based on Casey's request).Quoted 5 lines
If user space has to know the exact contents of a string in order to do something that the kernel understands, then its part of a public API. I've made my own define and released a new copy of libcap-ng. So, if the contents of the string ever change, or becomes deprecated, you'll now have user space apps using the old values no matter what.
Quoted 3 lines
You're right Steve, it is ABI, we broke it, and we can fix it. What are you having to define and what are you including. What files did you used to get these defines from?
I did this:
#define XATTR_CAPS_SUFFIX "capability"
#define XATTR_SECURITY_PREFIX "security."
#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
2 of them came from capability.h. The other was not public sometime in the past.
-Steve
Quoted 8 lines · Mimi Zohar
On Tue, 2010-10-12 at 09:19 -0400, Steve Grubb wrote:
Before making any changes to the kernel
xattr.h, I want to understand the reason for twoxattr.hfiles, one in/usr/include/linux/and the other in/usr/include/xattr/. /usr/include/linux/xattr.h contains those elements not defined as__kernel__, while/usr/include/xattr/xattr.hcontains that and other definitions. Will changing the kernelxattr.hversion change both?
I don't know what /usr/include/xattr/ is but /usr/include/linux/ is where the kernel-headers are supposed to end up. I'm guessing /usr/include/xattr/ is the glibc function definitions? (my glibc function definitions for xattrs are in /usr/include/sys/xattr.h)
I sent a patch to export them all. I didn't cc stable since it clearly change more than it needs to, but we really should send something to stable....
-Eric
Quoted 15 lines · Eric Paris
Quoted 8 lines · Mimi Zohar
On Tue, 2010-10-12 at 09:19 -0400, Steve Grubb wrote:
Before making any changes to the kernel
xattr.h, I want to understand the reason for twoxattr.hfiles, one in/usr/include/linux/and the other in/usr/include/xattr/./usr/include/linux/xattr.hcontains those elements not defined as__kernel__, while/usr/include/xattr/xattr.hcontains that and other definitions. Will changing the kernelxattr.hversion change both?I don't know what
/usr/include/xattr/is but/usr/include/linux/is where the kernel-headers are supposed to end up. I'm guessing/usr/include/xattr/is the glibc function definitions? (my glibc function definitions for xattrs are in/usr/include/sys/xattr.h)
Quoted 5 lines
I sent a patch to export them all. I didn't cc stable since it clearly change more than it needs to, but we really should send something to stable....
-Eric
Thanks Eric. Don't know what happened, but /usr/include/xattr/xattr.h is gone. /usr/include/sys/xattr.h contains the names of the user space xattr tools, not the kernel version. I'll create the patch for stable.
thanks,
Mimi