public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups
@ 2008-04-23 17:52 eparis
  2008-04-23 17:52 ` [PATCH 2/4] capability: security/capability.c " eparis
  2008-04-24  1:54 ` [PATCH 1/4] capability: capability.h " Serge E. Hallyn
  0 siblings, 2 replies; 7+ messages in thread
From: eparis @ 2008-04-23 17:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: jmorris, serue, Eric Paris

From: Eric Paris <eparis@redhat.com>

This patch changes capability.h to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
location of { around structs and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
no assignments in if statements
include spaces around , in function calls
and any number of other things I forgot to mention

Signed-off-by: Eric Paris <eparis@redhat.com>
---
 include/linux/capability.h |  142 ++++++++++++++++++++++----------------------
 1 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/include/linux/capability.h b/include/linux/capability.h
index 7d50ff6..63aeeea 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -28,14 +28,14 @@ struct task_struct;
    library since the draft standard requires the use of malloc/free
    etc.. */
 
-#define _LINUX_CAPABILITY_VERSION_1  0x19980330
-#define _LINUX_CAPABILITY_U32S_1     1
+#define _LINUX_CAPABILITY_VERSION_1	0x19980330
+#define _LINUX_CAPABILITY_U32S_1	1
 
-#define _LINUX_CAPABILITY_VERSION_2  0x20071026
-#define _LINUX_CAPABILITY_U32S_2     2
+#define _LINUX_CAPABILITY_VERSION_2	0x20071026
+#define _LINUX_CAPABILITY_U32S_2	2
 
-#define _LINUX_CAPABILITY_VERSION    _LINUX_CAPABILITY_VERSION_2
-#define _LINUX_CAPABILITY_U32S       _LINUX_CAPABILITY_U32S_2
+#define _LINUX_CAPABILITY_VERSION	_LINUX_CAPABILITY_VERSION_2
+#define _LINUX_CAPABILITY_U32S		_LINUX_CAPABILITY_U32S_2
 
 typedef struct __user_cap_header_struct {
 	__u32 version;
@@ -43,9 +43,9 @@ typedef struct __user_cap_header_struct {
 } __user *cap_user_header_t;
 
 typedef struct __user_cap_data_struct {
-        __u32 effective;
-        __u32 permitted;
-        __u32 inheritable;
+	__u32 effective;
+	__u32 permitted;
+	__u32 inheritable;
 } __user *cap_user_data_t;
 
 
@@ -57,23 +57,23 @@ typedef struct __user_cap_data_struct {
 #define VFS_CAP_FLAGS_EFFECTIVE	0x000001
 
 #define VFS_CAP_REVISION_1	0x01000000
-#define VFS_CAP_U32_1           1
-#define XATTR_CAPS_SZ_1         (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
+#define VFS_CAP_U32_1		1
+#define XATTR_CAPS_SZ_1		(sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
 
 #define VFS_CAP_REVISION_2	0x02000000
-#define VFS_CAP_U32_2           2
-#define XATTR_CAPS_SZ_2         (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
+#define VFS_CAP_U32_2		2
+#define XATTR_CAPS_SZ_2		(sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
 
-#define XATTR_CAPS_SZ           XATTR_CAPS_SZ_2
-#define VFS_CAP_U32             VFS_CAP_U32_2
+#define XATTR_CAPS_SZ		XATTR_CAPS_SZ_2
+#define VFS_CAP_U32		VFS_CAP_U32_2
 #define VFS_CAP_REVISION	VFS_CAP_REVISION_2
 
 
 struct vfs_cap_data {
-	__le32 magic_etc;            /* Little endian */
+	__le32 magic_etc;		/* Little endian */
 	struct {
-		__le32 permitted;    /* Little endian */
-		__le32 inheritable;  /* Little endian */
+		__le32 permitted;	/* Little endian */
+		__le32 inheritable;	/* Little endian */
 	} data[VFS_CAP_U32];
 };
 
@@ -83,8 +83,8 @@ typedef struct kernel_cap_struct {
 	__u32 cap[_LINUX_CAPABILITY_U32S];
 } kernel_cap_t;
 
-#define _USER_CAP_HEADER_SIZE  (sizeof(struct __user_cap_header_struct))
-#define _KERNEL_CAP_T_SIZE     (sizeof(kernel_cap_t))
+#define _USER_CAP_HEADER_SIZE	(sizeof(struct __user_cap_header_struct))
+#define _KERNEL_CAP_T_SIZE	(sizeof(kernel_cap_t))
 
 #endif
 
@@ -97,25 +97,25 @@ typedef struct kernel_cap_struct {
    overrides the restriction of changing file ownership and group
    ownership. */
 
-#define CAP_CHOWN            0
+#define CAP_CHOWN		0
 
 /* Override all DAC access, including ACL execute access if
    [_POSIX_ACL] is defined. Excluding DAC access covered by
    CAP_LINUX_IMMUTABLE. */
 
-#define CAP_DAC_OVERRIDE     1
+#define CAP_DAC_OVERRIDE	1
 
 /* Overrides all DAC restrictions regarding read and search on files
    and directories, including ACL restrictions if [_POSIX_ACL] is
    defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
 
-#define CAP_DAC_READ_SEARCH  2
+#define CAP_DAC_READ_SEARCH	2
 
 /* Overrides all restrictions about allowed operations on files, where
    file owner ID must be equal to the user ID, except where CAP_FSETID
    is applicable. It doesn't override MAC and DAC restrictions. */
 
-#define CAP_FOWNER           3
+#define CAP_FOWNER		3
 
 /* Overrides the following restrictions that the effective user ID
    shall match the file owner ID when setting the S_ISUID and S_ISGID
@@ -124,24 +124,24 @@ typedef struct kernel_cap_struct {
    the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
    cleared on successful return from chown(2) (not implemented). */
 
-#define CAP_FSETID           4
+#define CAP_FSETID		4
 
 /* 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. */
 
-#define CAP_KILL             5
+#define CAP_KILL		5
 
 /* Allows setgid(2) manipulation */
 /* Allows setgroups(2) */
 /* Allows forged gids on socket credentials passing. */
 
-#define CAP_SETGID           6
+#define CAP_SETGID		6
 
 /* Allows set*uid(2) manipulation (including fsuid). */
 /* Allows forged pids on socket credentials passing. */
 
-#define CAP_SETUID           7
+#define CAP_SETUID		7
 
 
 /**
@@ -153,24 +153,24 @@ typedef struct kernel_cap_struct {
  *   remove any capability in your permitted set from any pid
  * With VFS support for capabilities (neither of above, but)
  *   Add any capability from current's capability bounding set
- *       to the current process' inheritable set
+ *	to the current process' inheritable set
  *   Allow taking bits out of capability bounding set
  */
 
-#define CAP_SETPCAP          8
+#define CAP_SETPCAP		8
 
 /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
 
-#define CAP_LINUX_IMMUTABLE  9
+#define CAP_LINUX_IMMUTABLE	9
 
 /* Allows binding to TCP/UDP sockets below 1024 */
 /* Allows binding to ATM VCIs below 32 */
 
-#define CAP_NET_BIND_SERVICE 10
+#define CAP_NET_BIND_SERVICE	10
 
 /* Allow broadcasting, listen to multicast */
 
-#define CAP_NET_BROADCAST    11
+#define CAP_NET_BROADCAST	11
 
 /* Allow interface configuration */
 /* Allow administration of IP firewall, masquerading and accounting */
@@ -186,42 +186,42 @@ typedef struct kernel_cap_struct {
 /* Allow read/write of device-specific registers */
 /* Allow activation of ATM control sockets */
 
-#define CAP_NET_ADMIN        12
+#define CAP_NET_ADMIN		12
 
 /* Allow use of RAW sockets */
 /* Allow use of PACKET sockets */
 
-#define CAP_NET_RAW          13
+#define CAP_NET_RAW		13
 
 /* Allow locking of shared memory segments */
 /* Allow mlock and mlockall (which doesn't really have anything to do
    with IPC) */
 
-#define CAP_IPC_LOCK         14
+#define CAP_IPC_LOCK		14
 
 /* Override IPC ownership checks */
 
-#define CAP_IPC_OWNER        15
+#define CAP_IPC_OWNER		15
 
 /* Insert and remove kernel modules - modify kernel without limit */
-#define CAP_SYS_MODULE       16
+#define CAP_SYS_MODULE		16
 
 /* Allow ioperm/iopl access */
 /* Allow sending USB messages to any device via /proc/bus/usb */
 
-#define CAP_SYS_RAWIO        17
+#define CAP_SYS_RAWIO		17
 
 /* Allow use of chroot() */
 
-#define CAP_SYS_CHROOT       18
+#define CAP_SYS_CHROOT		18
 
 /* Allow ptrace() of any process */
 
-#define CAP_SYS_PTRACE       19
+#define CAP_SYS_PTRACE		19
 
 /* Allow configuration of process accounting */
 
-#define CAP_SYS_PACCT        20
+#define CAP_SYS_PACCT		20
 
 /* Allow configuration of the secure attention key */
 /* Allow administration of the random device */
@@ -261,11 +261,11 @@ typedef struct kernel_cap_struct {
 /* Allow setting encryption key on loopback filesystem */
 /* Allow setting zone reclaim policy */
 
-#define CAP_SYS_ADMIN        21
+#define CAP_SYS_ADMIN		21
 
 /* Allow use of reboot() */
 
-#define CAP_SYS_BOOT         22
+#define CAP_SYS_BOOT		22
 
 /* Allow raising priority and setting priority on other (different
    UID) processes */
@@ -274,7 +274,7 @@ typedef struct kernel_cap_struct {
    process. */
 /* Allow setting cpu affinity on other processes */
 
-#define CAP_SYS_NICE         23
+#define CAP_SYS_NICE		23
 
 /* Override resource limits. Set resource limits. */
 /* Override quota limits. */
@@ -288,32 +288,32 @@ typedef struct kernel_cap_struct {
 /* Override max number of consoles on console allocation */
 /* Override max number of keymaps */
 
-#define CAP_SYS_RESOURCE     24
+#define CAP_SYS_RESOURCE	24
 
 /* Allow manipulation of system clock */
 /* Allow irix_stime on mips */
 /* Allow setting the real-time clock */
 
-#define CAP_SYS_TIME         25
+#define CAP_SYS_TIME		25
 
 /* Allow configuration of tty devices */
 /* Allow vhangup() of tty */
 
-#define CAP_SYS_TTY_CONFIG   26
+#define CAP_SYS_TTY_CONFIG	26
 
 /* Allow the privileged aspects of mknod() */
 
-#define CAP_MKNOD            27
+#define CAP_MKNOD		27
 
 /* Allow taking of leases on files */
 
-#define CAP_LEASE            28
+#define CAP_LEASE		28
 
-#define CAP_AUDIT_WRITE      29
+#define CAP_AUDIT_WRITE		29
 
-#define CAP_AUDIT_CONTROL    30
+#define CAP_AUDIT_CONTROL	30
 
-#define CAP_SETFCAP	     31
+#define CAP_SETFCAP		31
 
 /* Override MAC access.
    The base kernel enforces no MAC policy.
@@ -321,7 +321,7 @@ typedef struct kernel_cap_struct {
    to implement capability based overrides of that policy, this is
    the capability it should use to do so. */
 
-#define CAP_MAC_OVERRIDE     32
+#define CAP_MAC_OVERRIDE	32
 
 /* Allow MAC configuration or state changes.
    The base kernel requires no MAC configuration.
@@ -330,9 +330,9 @@ typedef struct kernel_cap_struct {
    policy or the data required to maintain it, this is the
    capability it should use to do so. */
 
-#define CAP_MAC_ADMIN        33
+#define CAP_MAC_ADMIN		33
 
-#define CAP_LAST_CAP         CAP_MAC_ADMIN
+#define CAP_LAST_CAP		CAP_MAC_ADMIN
 
 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
 
@@ -340,8 +340,8 @@ typedef struct kernel_cap_struct {
  * Bit location of each capability (used by user-space library and kernel)
  */
 
-#define CAP_TO_INDEX(x)     ((x) >> 5)        /* 1 << 5 == bits in __u32 */
-#define CAP_TO_MASK(x)      (1 << ((x) & 31)) /* mask for indexed __u32 */
+#define CAP_TO_INDEX(x)     ((x) >> 5)		/* 1 << 5 == bits in __u32 */
+#define CAP_TO_MASK(x)      (1 << ((x) & 31))	/* mask for indexed __u32 */
 
 #ifdef __KERNEL__
 
@@ -375,7 +375,7 @@ typedef struct kernel_cap_struct {
 
 #define CAP_INIT_INH_SET    CAP_EMPTY_SET
 
-# define cap_clear(c)         do { (c) = __cap_empty_set; } while (0)
+# define cap_clear(c)	      do { (c) = __cap_empty_set; } while (0)
 # define cap_set_full(c)      do { (c) = __cap_full_set; } while (0)
 # define cap_set_init_eff(c)  do { (c) = __cap_init_eff_set; } while (0)
 
@@ -383,20 +383,20 @@ typedef struct kernel_cap_struct {
 #define cap_lower(c, flag)  ((c).cap[CAP_TO_INDEX(flag)] &= ~CAP_TO_MASK(flag))
 #define cap_raised(c, flag) ((c).cap[CAP_TO_INDEX(flag)] & CAP_TO_MASK(flag))
 
-#define CAP_BOP_ALL(c, a, b, OP)                                    \
-do {                                                                \
-	unsigned __capi;                                            \
-	CAP_FOR_EACH_U32(__capi) {                                  \
-		c.cap[__capi] = a.cap[__capi] OP b.cap[__capi];     \
-	}                                                           \
+#define CAP_BOP_ALL(c, a, b, OP)				\
+do {								\
+	unsigned __capi;					\
+	CAP_FOR_EACH_U32(__capi) {				\
+		c.cap[__capi] = a.cap[__capi] OP b.cap[__capi];	\
+	}							\
 } while (0)
 
-#define CAP_UOP_ALL(c, a, OP)                                       \
-do {                                                                \
-	unsigned __capi;                                            \
-	CAP_FOR_EACH_U32(__capi) {                                  \
-		c.cap[__capi] = OP a.cap[__capi];                   \
-	}                                                           \
+#define CAP_UOP_ALL(c, a, OP)					\
+do {								\
+	unsigned __capi;					\
+	CAP_FOR_EACH_U32(__capi) {				\
+		c.cap[__capi] = OP a.cap[__capi];		\
+	}							\
 } while (0)
 
 static inline kernel_cap_t cap_combine(const kernel_cap_t a,
-- 
1.5.2.1


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

* [PATCH 2/4] capability: security/capability.c whitespace, syntax, and other cleanups
  2008-04-23 17:52 [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups eparis
@ 2008-04-23 17:52 ` eparis
  2008-04-23 17:52   ` [PATCH 3/4] capability: kernel/capability.c " eparis
  2008-04-24  1:54 ` [PATCH 1/4] capability: capability.h " Serge E. Hallyn
  1 sibling, 1 reply; 7+ messages in thread
From: eparis @ 2008-04-23 17:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: jmorris, serue, Eric Paris

From: Eric Paris <eparis@redhat.com>

This patch changes security/capability.c to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
location of { around structs and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
no assignments in if statements
include spaces around , in function calls
and any number of other things I forgot to mention

Signed-off-by: Eric Paris <eparis@redhat.com>
---
 security/capability.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/security/capability.c b/security/capability.c
index 2c6e06d..e77d5e4 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -46,9 +46,9 @@ static struct security_operations capability_ops = {
 	.task_post_setuid =		cap_task_post_setuid,
 	.task_reparent_to_init =	cap_task_reparent_to_init,
 
-	.syslog =                       cap_syslog,
+	.syslog =			cap_syslog,
 
-	.vm_enough_memory =             cap_vm_enough_memory,
+	.vm_enough_memory =		cap_vm_enough_memory,
 };
 
 /* flag to keep track of how we were registered */
@@ -57,25 +57,25 @@ static int secondary;
 static int capability_disable;
 module_param_named(disable, capability_disable, int, 0);
 
-static int __init capability_init (void)
+static int __init capability_init(void)
 {
 	if (capability_disable) {
 		printk(KERN_INFO "Capabilities disabled at initialization\n");
 		return 0;
 	}
 	/* register ourselves with the security framework */
-	if (register_security (&capability_ops)) {
+	if (register_security(&capability_ops)) {
 		/* try registering with primary module */
-		if (mod_reg_security (KBUILD_MODNAME, &capability_ops)) {
-			printk (KERN_INFO "Failure registering capabilities "
-				"with primary security module.\n");
+		if (mod_reg_security(KBUILD_MODNAME, &capability_ops)) {
+			printk(KERN_INFO "Failure registering capabilities "
+			       "with primary security module.\n");
 			return -EINVAL;
 		}
 		secondary = 1;
 	}
-	printk (KERN_INFO "Capability LSM initialized%s\n",
-		secondary ? " as secondary" : "");
+	printk(KERN_INFO "Capability LSM initialized%s\n",
+	       secondary ? " as secondary" : "");
 	return 0;
 }
 
-security_initcall (capability_init);
+security_initcall(capability_init);
-- 
1.5.2.1


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

* [PATCH 3/4] capability: kernel/capability.c whitespace, syntax, and other cleanups
  2008-04-23 17:52 ` [PATCH 2/4] capability: security/capability.c " eparis
@ 2008-04-23 17:52   ` eparis
  2008-04-23 17:52     ` [PATCH 4/4] capability: commoncap.c " eparis
  0 siblings, 1 reply; 7+ messages in thread
From: eparis @ 2008-04-23 17:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: jmorris, serue, Eric Paris

From: Eric Paris <eparis@redhat.com>

This patch changes kernel/capability.c to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
location of { around structs and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
no assignments in if statements
include spaces around , in function calls
and any number of other things I forgot to mention

Signed-off-by: Eric Paris <eparis@redhat.com>
---
 kernel/capability.c |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/kernel/capability.c b/kernel/capability.c
index 39e8193..0185d10 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -161,8 +161,8 @@ out:
  * group.  We call this holding task_capability_lock and tasklist_lock.
  */
 static inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective,
-			      kernel_cap_t *inheritable,
-			      kernel_cap_t *permitted)
+			     kernel_cap_t *inheritable,
+			     kernel_cap_t *permitted)
 {
 	struct task_struct *g, *target;
 	int ret = -EPERM;
@@ -195,27 +195,27 @@ static inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective,
  * and self.  We call this holding task_capability_lock and tasklist_lock.
  */
 static inline int cap_set_all(kernel_cap_t *effective,
-			       kernel_cap_t *inheritable,
-			       kernel_cap_t *permitted)
+			      kernel_cap_t *inheritable,
+			      kernel_cap_t *permitted)
 {
-     struct task_struct *g, *target;
-     int ret = -EPERM;
-     int found = 0;
-
-     do_each_thread(g, target) {
-             if (target == current || is_container_init(target->group_leader))
-                     continue;
-             found = 1;
-	     if (security_capset_check(target, effective, inheritable,
-						permitted))
-		     continue;
-	     ret = 0;
-	     security_capset_set(target, effective, inheritable, permitted);
-     } while_each_thread(g, target);
-
-     if (!found)
-	     ret = 0;
-     return ret;
+	struct task_struct *g, *target;
+	int ret = -EPERM;
+	int found = 0;
+
+	do_each_thread(g, target) {
+		if (target == current || is_container_init(target->group_leader))
+			continue;
+		found = 1;
+		if (security_capset_check(target, effective, inheritable,
+					  permitted))
+			continue;
+		ret = 0;
+		security_capset_set(target, effective, inheritable, permitted);
+	} while_each_thread(g, target);
+
+	if (!found)
+		ret = 0;
+	return ret;
 }
 
 /**
-- 
1.5.2.1


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

* [PATCH 4/4] capability: commoncap.c whitespace, syntax, and other cleanups
  2008-04-23 17:52   ` [PATCH 3/4] capability: kernel/capability.c " eparis
@ 2008-04-23 17:52     ` eparis
  0 siblings, 0 replies; 7+ messages in thread
From: eparis @ 2008-04-23 17:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: jmorris, serue, Eric Paris

From: Eric Paris <eparis@redhat.com>

This patch changes commoncap.c to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
location of { around structs and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
no assignments in if statements
include spaces around , in function calls
and any number of other things I forgot to mention

Signed-off-by: Eric Paris <eparis@redhat.com>
---
 security/commoncap.c |  112 +++++++++++++++++++++++--------------------------
 1 files changed, 53 insertions(+), 59 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index 8529057..96511ec 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -51,7 +51,7 @@ EXPORT_SYMBOL(cap_netlink_recv);
  * returns 0 when a task has a capability, but the kernel's capable()
  * returns 1 for this case.
  */
-int cap_capable (struct task_struct *tsk, int cap)
+int cap_capable(struct task_struct *tsk, int cap)
 {
 	/* Derived from include/linux/sched.h:capable. */
 	if (cap_raised(tsk->cap_effective, cap))
@@ -66,7 +66,7 @@ int cap_settime(struct timespec *ts, struct timezone *tz)
 	return 0;
 }
 
-int cap_ptrace (struct task_struct *parent, struct task_struct *child)
+int cap_ptrace(struct task_struct *parent, struct task_struct *child)
 {
 	/* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */
 	if (!cap_issubset(child->cap_permitted, parent->cap_permitted) &&
@@ -75,8 +75,8 @@ int cap_ptrace (struct task_struct *parent, struct task_struct *child)
 	return 0;
 }
 
-int cap_capget (struct task_struct *target, kernel_cap_t *effective,
-		kernel_cap_t *inheritable, kernel_cap_t *permitted)
+int cap_capget(struct task_struct *target, kernel_cap_t *effective,
+	       kernel_cap_t *inheritable, kernel_cap_t *permitted)
 {
 	/* Derived from kernel/capability.c:sys_capget. */
 	*effective = target->cap_effective;
@@ -113,12 +113,11 @@ static inline int cap_inh_is_capped(void) { return 1; }
 
 #endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */
 
-int cap_capset_check (struct task_struct *target, kernel_cap_t *effective,
-		      kernel_cap_t *inheritable, kernel_cap_t *permitted)
+int cap_capset_check(struct task_struct *target, kernel_cap_t *effective,
+		     kernel_cap_t *inheritable, kernel_cap_t *permitted)
 {
-	if (cap_block_setpcap(target)) {
+	if (cap_block_setpcap(target))
 		return -EPERM;
-	}
 	if (cap_inh_is_capped()
 	    && !cap_issubset(*inheritable,
 			     cap_combine(target->cap_inheritable,
@@ -134,22 +133,21 @@ int cap_capset_check (struct task_struct *target, kernel_cap_t *effective,
 	}
 
 	/* verify restrictions on target's new Permitted set */
-	if (!cap_issubset (*permitted,
-			   cap_combine (target->cap_permitted,
-					current->cap_permitted))) {
+	if (!cap_issubset(*permitted,
+			  cap_combine(target->cap_permitted,
+				      current->cap_permitted))) {
 		return -EPERM;
 	}
 
 	/* verify the _new_Effective_ is a subset of the _new_Permitted_ */
-	if (!cap_issubset (*effective, *permitted)) {
+	if (!cap_issubset(*effective, *permitted))
 		return -EPERM;
-	}
 
 	return 0;
 }
 
-void cap_capset_set (struct task_struct *target, kernel_cap_t *effective,
-		     kernel_cap_t *inheritable, kernel_cap_t *permitted)
+void cap_capset_set(struct task_struct *target, kernel_cap_t *effective,
+		    kernel_cap_t *inheritable, kernel_cap_t *permitted)
 {
 	target->cap_effective = *effective;
 	target->cap_inheritable = *inheritable;
@@ -171,7 +169,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)
 	int error;
 
 	if (!inode->i_op || !inode->i_op->getxattr)
-	       return 0;
+		return 0;
 
 	error = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, NULL, 0);
 	if (error <= 0)
@@ -184,7 +182,7 @@ int cap_inode_killpriv(struct dentry *dentry)
 	struct inode *inode = dentry->d_inode;
 
 	if (!inode->i_op || !inode->i_op->removexattr)
-	       return 0;
+		return 0;
 
 	return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS);
 }
@@ -215,11 +213,10 @@ static inline int cap_from_disk(struct vfs_cap_data *caps,
 		return -EINVAL;
 	}
 
-	if (magic_etc & VFS_CAP_FLAGS_EFFECTIVE) {
+	if (magic_etc & VFS_CAP_FLAGS_EFFECTIVE)
 		bprm->cap_effective = true;
-	} else {
+	else
 		bprm->cap_effective = false;
-	}
 
 	for (i = 0; i < tocopy; ++i) {
 		bprm->cap_permitted.cap[i] =
@@ -295,7 +292,7 @@ static inline int get_file_caps(struct linux_binprm *bprm)
 }
 #endif
 
-int cap_bprm_set_security (struct linux_binprm *bprm)
+int cap_bprm_set_security(struct linux_binprm *bprm)
 {
 	int ret;
 
@@ -312,10 +309,10 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
 	 *  and permitted sets of the executable file.
 	 */
 
-	if (!issecure (SECURE_NOROOT)) {
+	if (!issecure(SECURE_NOROOT)) {
 		if (bprm->e_uid == 0 || current->uid == 0) {
-			cap_set_full (bprm->cap_inheritable);
-			cap_set_full (bprm->cap_permitted);
+			cap_set_full(bprm->cap_inheritable);
+			cap_set_full(bprm->cap_permitted);
 		}
 		if (bprm->e_uid == 0)
 			bprm->cap_effective = true;
@@ -324,7 +321,7 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
 	return ret;
 }
 
-void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
+void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
 {
 	/* Derived from fs/exec.c:compute_creds. */
 	kernel_cap_t new_permitted, working;
@@ -336,7 +333,7 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
 	new_permitted = cap_combine(new_permitted, working);
 
 	if (bprm->e_uid != current->uid || bprm->e_gid != current->gid ||
-	    !cap_issubset (new_permitted, current->cap_permitted)) {
+	    !cap_issubset(new_permitted, current->cap_permitted)) {
 		set_dumpable(current->mm, suid_dumpable);
 		current->pdeath_signal = 0;
 
@@ -345,8 +342,8 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
 				bprm->e_uid = current->uid;
 				bprm->e_gid = current->gid;
 			}
-			if (!capable (CAP_SETPCAP)) {
-				new_permitted = cap_intersect (new_permitted,
+			if (!capable(CAP_SETPCAP)) {
+				new_permitted = cap_intersect(new_permitted,
 							current->cap_permitted);
 			}
 		}
@@ -371,7 +368,7 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
 	current->keep_capabilities = 0;
 }
 
-int cap_bprm_secureexec (struct linux_binprm *bprm)
+int cap_bprm_secureexec(struct linux_binprm *bprm)
 {
 	if (current->uid != 0) {
 		if (bprm->cap_effective)
@@ -414,7 +411,7 @@ int cap_inode_removexattr(struct dentry *dentry, char *name)
 }
 
 /* moved from kernel/sys.c. */
-/* 
+/*
  * cap_emulate_setxuid() fixes the effective / permitted capabilities of
  * a process after a call to setuid, setreuid, or setresuid.
  *
@@ -428,10 +425,10 @@ int cap_inode_removexattr(struct dentry *dentry, char *name)
  *  3) When set*uiding _from_ euid != 0 _to_ euid == 0, the effective
  *  capabilities are set to the permitted capabilities.
  *
- *  fsuid is handled elsewhere. fsuid == 0 and {r,e,s}uid!= 0 should 
+ *  fsuid is handled elsewhere. fsuid == 0 and {r,e,s}uid!= 0 should
  *  never happen.
  *
- *  -astor 
+ *  -astor
  *
  * cevans - New behaviour, Oct '99
  * A process may, via prctl(), elect to keep its capabilities when it
@@ -443,34 +440,31 @@ int cap_inode_removexattr(struct dentry *dentry, char *name)
  * files..
  * Thanks to Olaf Kirch and Peter Benie for spotting this.
  */
-static inline void cap_emulate_setxuid (int old_ruid, int old_euid,
-					int old_suid)
+static inline void cap_emulate_setxuid(int old_ruid, int old_euid,
+				       int old_suid)
 {
 	if ((old_ruid == 0 || old_euid == 0 || old_suid == 0) &&
 	    (current->uid != 0 && current->euid != 0 && current->suid != 0) &&
 	    !current->keep_capabilities) {
-		cap_clear (current->cap_permitted);
-		cap_clear (current->cap_effective);
-	}
-	if (old_euid == 0 && current->euid != 0) {
-		cap_clear (current->cap_effective);
+		cap_clear(current->cap_permitted);
+		cap_clear(current->cap_effective);
 	}
-	if (old_euid != 0 && current->euid == 0) {
+	if (old_euid == 0 && current->euid != 0)
+		cap_clear(current->cap_effective);
+	if (old_euid != 0 && current->euid == 0)
 		current->cap_effective = current->cap_permitted;
-	}
 }
 
-int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid,
-			  int flags)
+int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid,
+			 int flags)
 {
 	switch (flags) {
 	case LSM_SETID_RE:
 	case LSM_SETID_ID:
 	case LSM_SETID_RES:
 		/* Copied from kernel/sys.c:setreuid/setuid/setresuid. */
-		if (!issecure (SECURE_NO_SETUID_FIXUP)) {
-			cap_emulate_setxuid (old_ruid, old_euid, old_suid);
-		}
+		if (!issecure(SECURE_NO_SETUID_FIXUP))
+			cap_emulate_setxuid(old_ruid, old_euid, old_suid);
 		break;
 	case LSM_SETID_FS:
 		{
@@ -480,10 +474,10 @@ int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid,
 
 			/*
 			 * FIXME - is fsuser used for all CAP_FS_MASK capabilities?
-			 *          if not, we might be a bit too harsh here.
+			 *	   if not, we might be a bit too harsh here.
 			 */
 
-			if (!issecure (SECURE_NO_SETUID_FIXUP)) {
+			if (!issecure(SECURE_NO_SETUID_FIXUP)) {
 				if (old_fsuid == 0 && current->fsuid != 0) {
 					current->cap_effective =
 						cap_drop_fs_set(
@@ -511,7 +505,7 @@ int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid,
  * task_setnice, assumes that
  *   . if capable(cap_sys_nice), then those actions should be allowed
  *   . if not capable(cap_sys_nice), but acting on your own processes,
- *   	then those actions should be allowed
+ *	then those actions should be allowed
  * This is insufficient now since you can call code without suid, but
  * yet with increased caps.
  * So we check for increased caps on the target process.
@@ -524,18 +518,18 @@ static inline int cap_safe_nice(struct task_struct *p)
 	return 0;
 }
 
-int cap_task_setscheduler (struct task_struct *p, int policy,
-			   struct sched_param *lp)
+int cap_task_setscheduler(struct task_struct *p, int policy,
+			  struct sched_param *lp)
 {
 	return cap_safe_nice(p);
 }
 
-int cap_task_setioprio (struct task_struct *p, int ioprio)
+int cap_task_setioprio(struct task_struct *p, int ioprio)
 {
 	return cap_safe_nice(p);
 }
 
-int cap_task_setnice (struct task_struct *p, int nice)
+int cap_task_setnice(struct task_struct *p, int nice)
 {
 	return cap_safe_nice(p);
 }
@@ -557,22 +551,22 @@ long cap_prctl_drop(unsigned long cap)
 	return 0;
 }
 #else
-int cap_task_setscheduler (struct task_struct *p, int policy,
-			   struct sched_param *lp)
+int cap_task_setscheduler(struct task_struct *p, int policy,
+			  struct sched_param *lp)
 {
 	return 0;
 }
-int cap_task_setioprio (struct task_struct *p, int ioprio)
+int cap_task_setioprio(struct task_struct *p, int ioprio)
 {
 	return 0;
 }
-int cap_task_setnice (struct task_struct *p, int nice)
+int cap_task_setnice(struct task_struct *p, int nice)
 {
 	return 0;
 }
 #endif
 
-void cap_task_reparent_to_init (struct task_struct *p)
+void cap_task_reparent_to_init(struct task_struct *p)
 {
 	cap_set_init_eff(p->cap_effective);
 	cap_clear(p->cap_inheritable);
@@ -581,7 +575,7 @@ void cap_task_reparent_to_init (struct task_struct *p)
 	return;
 }
 
-int cap_syslog (int type)
+int cap_syslog(int type)
 {
 	if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
 		return -EPERM;
-- 
1.5.2.1


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

* Re: [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups
  2008-04-23 17:52 [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups eparis
  2008-04-23 17:52 ` [PATCH 2/4] capability: security/capability.c " eparis
@ 2008-04-24  1:54 ` Serge E. Hallyn
  2008-04-24 12:13   ` Eric Paris
  1 sibling, 1 reply; 7+ messages in thread
From: Serge E. Hallyn @ 2008-04-24  1:54 UTC (permalink / raw)
  To: eparis; +Cc: linux-kernel, jmorris, serue

Quoting eparis@redhat.com (eparis@redhat.com):
> From: Eric Paris <eparis@redhat.com>
> 
> This patch changes capability.h to fix whitespace and syntax issues.  Things that
> are fixed may include (does not not have to include)
> 
> whitespace at end of lines
> spaces followed by tabs
> spaces used instead of tabs
> spacing around parenthesis
> location of { around structs and else clauses
> location of * in pointer declarations
> removal of initialization of static data to keep it in the right section
> useless {} in if statemetns
> useless checking for NULL before kfree
> fixing of the indentation depth of switch statements
> no assignments in if statements
> include spaces around , in function calls
> and any number of other things I forgot to mention

Thanks.  Looks fine other than the inexplicable (afaics)
jumping of the capability #s by one tab for CAP_NET_ADMIN
and then again from CAP_IPC_OWNER on.

Hmm, well you also made some odd (inconsistent) tab+space choices at and
following cap_clear.

thanks,
-serge

> Signed-off-by: Eric Paris <eparis@redhat.com>
> ---
>  include/linux/capability.h |  142 ++++++++++++++++++++++----------------------
>  1 files changed, 71 insertions(+), 71 deletions(-)
> 
> diff --git a/include/linux/capability.h b/include/linux/capability.h
> index 7d50ff6..63aeeea 100644
> --- a/include/linux/capability.h
> +++ b/include/linux/capability.h
> @@ -28,14 +28,14 @@ struct task_struct;
>     library since the draft standard requires the use of malloc/free
>     etc.. */
> 
> -#define _LINUX_CAPABILITY_VERSION_1  0x19980330
> -#define _LINUX_CAPABILITY_U32S_1     1
> +#define _LINUX_CAPABILITY_VERSION_1	0x19980330
> +#define _LINUX_CAPABILITY_U32S_1	1
> 
> -#define _LINUX_CAPABILITY_VERSION_2  0x20071026
> -#define _LINUX_CAPABILITY_U32S_2     2
> +#define _LINUX_CAPABILITY_VERSION_2	0x20071026
> +#define _LINUX_CAPABILITY_U32S_2	2
> 
> -#define _LINUX_CAPABILITY_VERSION    _LINUX_CAPABILITY_VERSION_2
> -#define _LINUX_CAPABILITY_U32S       _LINUX_CAPABILITY_U32S_2
> +#define _LINUX_CAPABILITY_VERSION	_LINUX_CAPABILITY_VERSION_2
> +#define _LINUX_CAPABILITY_U32S		_LINUX_CAPABILITY_U32S_2
> 
>  typedef struct __user_cap_header_struct {
>  	__u32 version;
> @@ -43,9 +43,9 @@ typedef struct __user_cap_header_struct {
>  } __user *cap_user_header_t;
> 
>  typedef struct __user_cap_data_struct {
> -        __u32 effective;
> -        __u32 permitted;
> -        __u32 inheritable;
> +	__u32 effective;
> +	__u32 permitted;
> +	__u32 inheritable;
>  } __user *cap_user_data_t;
> 
> 
> @@ -57,23 +57,23 @@ typedef struct __user_cap_data_struct {
>  #define VFS_CAP_FLAGS_EFFECTIVE	0x000001
> 
>  #define VFS_CAP_REVISION_1	0x01000000
> -#define VFS_CAP_U32_1           1
> -#define XATTR_CAPS_SZ_1         (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
> +#define VFS_CAP_U32_1		1
> +#define XATTR_CAPS_SZ_1		(sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
> 
>  #define VFS_CAP_REVISION_2	0x02000000
> -#define VFS_CAP_U32_2           2
> -#define XATTR_CAPS_SZ_2         (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
> +#define VFS_CAP_U32_2		2
> +#define XATTR_CAPS_SZ_2		(sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
> 
> -#define XATTR_CAPS_SZ           XATTR_CAPS_SZ_2
> -#define VFS_CAP_U32             VFS_CAP_U32_2
> +#define XATTR_CAPS_SZ		XATTR_CAPS_SZ_2
> +#define VFS_CAP_U32		VFS_CAP_U32_2
>  #define VFS_CAP_REVISION	VFS_CAP_REVISION_2
> 
> 
>  struct vfs_cap_data {
> -	__le32 magic_etc;            /* Little endian */
> +	__le32 magic_etc;		/* Little endian */
>  	struct {
> -		__le32 permitted;    /* Little endian */
> -		__le32 inheritable;  /* Little endian */
> +		__le32 permitted;	/* Little endian */
> +		__le32 inheritable;	/* Little endian */
>  	} data[VFS_CAP_U32];
>  };
> 
> @@ -83,8 +83,8 @@ typedef struct kernel_cap_struct {
>  	__u32 cap[_LINUX_CAPABILITY_U32S];
>  } kernel_cap_t;
> 
> -#define _USER_CAP_HEADER_SIZE  (sizeof(struct __user_cap_header_struct))
> -#define _KERNEL_CAP_T_SIZE     (sizeof(kernel_cap_t))
> +#define _USER_CAP_HEADER_SIZE	(sizeof(struct __user_cap_header_struct))
> +#define _KERNEL_CAP_T_SIZE	(sizeof(kernel_cap_t))
> 
>  #endif
> 
> @@ -97,25 +97,25 @@ typedef struct kernel_cap_struct {
>     overrides the restriction of changing file ownership and group
>     ownership. */
> 
> -#define CAP_CHOWN            0
> +#define CAP_CHOWN		0
> 
>  /* Override all DAC access, including ACL execute access if
>     [_POSIX_ACL] is defined. Excluding DAC access covered by
>     CAP_LINUX_IMMUTABLE. */
> 
> -#define CAP_DAC_OVERRIDE     1
> +#define CAP_DAC_OVERRIDE	1
> 
>  /* Overrides all DAC restrictions regarding read and search on files
>     and directories, including ACL restrictions if [_POSIX_ACL] is
>     defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
> 
> -#define CAP_DAC_READ_SEARCH  2
> +#define CAP_DAC_READ_SEARCH	2
> 
>  /* Overrides all restrictions about allowed operations on files, where
>     file owner ID must be equal to the user ID, except where CAP_FSETID
>     is applicable. It doesn't override MAC and DAC restrictions. */
> 
> -#define CAP_FOWNER           3
> +#define CAP_FOWNER		3
> 
>  /* Overrides the following restrictions that the effective user ID
>     shall match the file owner ID when setting the S_ISUID and S_ISGID
> @@ -124,24 +124,24 @@ typedef struct kernel_cap_struct {
>     the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
>     cleared on successful return from chown(2) (not implemented). */
> 
> -#define CAP_FSETID           4
> +#define CAP_FSETID		4
> 
>  /* 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. */
> 
> -#define CAP_KILL             5
> +#define CAP_KILL		5
> 
>  /* Allows setgid(2) manipulation */
>  /* Allows setgroups(2) */
>  /* Allows forged gids on socket credentials passing. */
> 
> -#define CAP_SETGID           6
> +#define CAP_SETGID		6
> 
>  /* Allows set*uid(2) manipulation (including fsuid). */
>  /* Allows forged pids on socket credentials passing. */
> 
> -#define CAP_SETUID           7
> +#define CAP_SETUID		7
> 
> 
>  /**
> @@ -153,24 +153,24 @@ typedef struct kernel_cap_struct {
>   *   remove any capability in your permitted set from any pid
>   * With VFS support for capabilities (neither of above, but)
>   *   Add any capability from current's capability bounding set
> - *       to the current process' inheritable set
> + *	to the current process' inheritable set
>   *   Allow taking bits out of capability bounding set
>   */
> 
> -#define CAP_SETPCAP          8
> +#define CAP_SETPCAP		8
> 
>  /* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
> 
> -#define CAP_LINUX_IMMUTABLE  9
> +#define CAP_LINUX_IMMUTABLE	9
> 
>  /* Allows binding to TCP/UDP sockets below 1024 */
>  /* Allows binding to ATM VCIs below 32 */
> 
> -#define CAP_NET_BIND_SERVICE 10
> +#define CAP_NET_BIND_SERVICE	10
> 
>  /* Allow broadcasting, listen to multicast */
> 
> -#define CAP_NET_BROADCAST    11
> +#define CAP_NET_BROADCAST	11
> 
>  /* Allow interface configuration */
>  /* Allow administration of IP firewall, masquerading and accounting */
> @@ -186,42 +186,42 @@ typedef struct kernel_cap_struct {
>  /* Allow read/write of device-specific registers */
>  /* Allow activation of ATM control sockets */
> 
> -#define CAP_NET_ADMIN        12
> +#define CAP_NET_ADMIN		12
> 
>  /* Allow use of RAW sockets */
>  /* Allow use of PACKET sockets */
> 
> -#define CAP_NET_RAW          13
> +#define CAP_NET_RAW		13
> 
>  /* Allow locking of shared memory segments */
>  /* Allow mlock and mlockall (which doesn't really have anything to do
>     with IPC) */
> 
> -#define CAP_IPC_LOCK         14
> +#define CAP_IPC_LOCK		14
> 
>  /* Override IPC ownership checks */
> 
> -#define CAP_IPC_OWNER        15
> +#define CAP_IPC_OWNER		15
> 
>  /* Insert and remove kernel modules - modify kernel without limit */
> -#define CAP_SYS_MODULE       16
> +#define CAP_SYS_MODULE		16
> 
>  /* Allow ioperm/iopl access */
>  /* Allow sending USB messages to any device via /proc/bus/usb */
> 
> -#define CAP_SYS_RAWIO        17
> +#define CAP_SYS_RAWIO		17
> 
>  /* Allow use of chroot() */
> 
> -#define CAP_SYS_CHROOT       18
> +#define CAP_SYS_CHROOT		18
> 
>  /* Allow ptrace() of any process */
> 
> -#define CAP_SYS_PTRACE       19
> +#define CAP_SYS_PTRACE		19
> 
>  /* Allow configuration of process accounting */
> 
> -#define CAP_SYS_PACCT        20
> +#define CAP_SYS_PACCT		20
> 
>  /* Allow configuration of the secure attention key */
>  /* Allow administration of the random device */
> @@ -261,11 +261,11 @@ typedef struct kernel_cap_struct {
>  /* Allow setting encryption key on loopback filesystem */
>  /* Allow setting zone reclaim policy */
> 
> -#define CAP_SYS_ADMIN        21
> +#define CAP_SYS_ADMIN		21
> 
>  /* Allow use of reboot() */
> 
> -#define CAP_SYS_BOOT         22
> +#define CAP_SYS_BOOT		22
> 
>  /* Allow raising priority and setting priority on other (different
>     UID) processes */
> @@ -274,7 +274,7 @@ typedef struct kernel_cap_struct {
>     process. */
>  /* Allow setting cpu affinity on other processes */
> 
> -#define CAP_SYS_NICE         23
> +#define CAP_SYS_NICE		23
> 
>  /* Override resource limits. Set resource limits. */
>  /* Override quota limits. */
> @@ -288,32 +288,32 @@ typedef struct kernel_cap_struct {
>  /* Override max number of consoles on console allocation */
>  /* Override max number of keymaps */
> 
> -#define CAP_SYS_RESOURCE     24
> +#define CAP_SYS_RESOURCE	24
> 
>  /* Allow manipulation of system clock */
>  /* Allow irix_stime on mips */
>  /* Allow setting the real-time clock */
> 
> -#define CAP_SYS_TIME         25
> +#define CAP_SYS_TIME		25
> 
>  /* Allow configuration of tty devices */
>  /* Allow vhangup() of tty */
> 
> -#define CAP_SYS_TTY_CONFIG   26
> +#define CAP_SYS_TTY_CONFIG	26
> 
>  /* Allow the privileged aspects of mknod() */
> 
> -#define CAP_MKNOD            27
> +#define CAP_MKNOD		27
> 
>  /* Allow taking of leases on files */
> 
> -#define CAP_LEASE            28
> +#define CAP_LEASE		28
> 
> -#define CAP_AUDIT_WRITE      29
> +#define CAP_AUDIT_WRITE		29
> 
> -#define CAP_AUDIT_CONTROL    30
> +#define CAP_AUDIT_CONTROL	30
> 
> -#define CAP_SETFCAP	     31
> +#define CAP_SETFCAP		31
> 
>  /* Override MAC access.
>     The base kernel enforces no MAC policy.
> @@ -321,7 +321,7 @@ typedef struct kernel_cap_struct {
>     to implement capability based overrides of that policy, this is
>     the capability it should use to do so. */
> 
> -#define CAP_MAC_OVERRIDE     32
> +#define CAP_MAC_OVERRIDE	32
> 
>  /* Allow MAC configuration or state changes.
>     The base kernel requires no MAC configuration.
> @@ -330,9 +330,9 @@ typedef struct kernel_cap_struct {
>     policy or the data required to maintain it, this is the
>     capability it should use to do so. */
> 
> -#define CAP_MAC_ADMIN        33
> +#define CAP_MAC_ADMIN		33
> 
> -#define CAP_LAST_CAP         CAP_MAC_ADMIN
> +#define CAP_LAST_CAP		CAP_MAC_ADMIN
> 
>  #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
> 
> @@ -340,8 +340,8 @@ typedef struct kernel_cap_struct {
>   * Bit location of each capability (used by user-space library and kernel)
>   */
> 
> -#define CAP_TO_INDEX(x)     ((x) >> 5)        /* 1 << 5 == bits in __u32 */
> -#define CAP_TO_MASK(x)      (1 << ((x) & 31)) /* mask for indexed __u32 */
> +#define CAP_TO_INDEX(x)     ((x) >> 5)		/* 1 << 5 == bits in __u32 */
> +#define CAP_TO_MASK(x)      (1 << ((x) & 31))	/* mask for indexed __u32 */
> 
>  #ifdef __KERNEL__
> 
> @@ -375,7 +375,7 @@ typedef struct kernel_cap_struct {
> 
>  #define CAP_INIT_INH_SET    CAP_EMPTY_SET
> 
> -# define cap_clear(c)         do { (c) = __cap_empty_set; } while (0)
> +# define cap_clear(c)	      do { (c) = __cap_empty_set; } while (0)
>  # define cap_set_full(c)      do { (c) = __cap_full_set; } while (0)
>  # define cap_set_init_eff(c)  do { (c) = __cap_init_eff_set; } while (0)
> 
> @@ -383,20 +383,20 @@ typedef struct kernel_cap_struct {
>  #define cap_lower(c, flag)  ((c).cap[CAP_TO_INDEX(flag)] &= ~CAP_TO_MASK(flag))
>  #define cap_raised(c, flag) ((c).cap[CAP_TO_INDEX(flag)] & CAP_TO_MASK(flag))
> 
> -#define CAP_BOP_ALL(c, a, b, OP)                                    \
> -do {                                                                \
> -	unsigned __capi;                                            \
> -	CAP_FOR_EACH_U32(__capi) {                                  \
> -		c.cap[__capi] = a.cap[__capi] OP b.cap[__capi];     \
> -	}                                                           \
> +#define CAP_BOP_ALL(c, a, b, OP)				\
> +do {								\
> +	unsigned __capi;					\
> +	CAP_FOR_EACH_U32(__capi) {				\
> +		c.cap[__capi] = a.cap[__capi] OP b.cap[__capi];	\
> +	}							\
>  } while (0)
> 
> -#define CAP_UOP_ALL(c, a, OP)                                       \
> -do {                                                                \
> -	unsigned __capi;                                            \
> -	CAP_FOR_EACH_U32(__capi) {                                  \
> -		c.cap[__capi] = OP a.cap[__capi];                   \
> -	}                                                           \
> +#define CAP_UOP_ALL(c, a, OP)					\
> +do {								\
> +	unsigned __capi;					\
> +	CAP_FOR_EACH_U32(__capi) {				\
> +		c.cap[__capi] = OP a.cap[__capi];		\
> +	}							\
>  } while (0)
> 
>  static inline kernel_cap_t cap_combine(const kernel_cap_t a,
> -- 
> 1.5.2.1

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

* Re: [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups
  2008-04-24  1:54 ` [PATCH 1/4] capability: capability.h " Serge E. Hallyn
@ 2008-04-24 12:13   ` Eric Paris
  2008-04-24 12:26     ` Serge E. Hallyn
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Paris @ 2008-04-24 12:13 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: linux-kernel, jmorris

On Wed, 2008-04-23 at 20:54 -0500, Serge E. Hallyn wrote:
> Quoting eparis@redhat.com (eparis@redhat.com):
> > From: Eric Paris <eparis@redhat.com>
> > 
> > This patch changes capability.h to fix whitespace and syntax issues.  Things that
> > are fixed may include (does not not have to include)
> > 
> > whitespace at end of lines
> > spaces followed by tabs
> > spaces used instead of tabs
> > spacing around parenthesis
> > location of { around structs and else clauses
> > location of * in pointer declarations
> > removal of initialization of static data to keep it in the right section
> > useless {} in if statemetns
> > useless checking for NULL before kfree
> > fixing of the indentation depth of switch statements
> > no assignments in if statements
> > include spaces around , in function calls
> > and any number of other things I forgot to mention
> 
> Thanks.  Looks fine other than the inexplicable (afaics)
> jumping of the capability #s by one tab for CAP_NET_ADMIN
> and then again from CAP_IPC_OWNER on.

It just looks that way in the patch for things whose names are exactly
that long because of the + at the beginning of the line pushing them
over a tab column in your mailer.  They are correct after the patch
applies.

> Hmm, well you also made some odd (inconsistent) tab+space choices at and
> following cap_clear.

Same thing.  And I'll admit that it is a bit inconsistent, but a whole
new tab just pushed things too far to the right and I didn't want to
leave 8 spaces anywhere in the file.   So that's what I came up with...
I promise it looks nice in the end   :)

> 
> thanks,
> -serge


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

* Re: [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups
  2008-04-24 12:13   ` Eric Paris
@ 2008-04-24 12:26     ` Serge E. Hallyn
  0 siblings, 0 replies; 7+ messages in thread
From: Serge E. Hallyn @ 2008-04-24 12:26 UTC (permalink / raw)
  To: Eric Paris; +Cc: Serge E. Hallyn, linux-kernel, jmorris

Quoting Eric Paris (eparis@redhat.com):
> On Wed, 2008-04-23 at 20:54 -0500, Serge E. Hallyn wrote:
> > Quoting eparis@redhat.com (eparis@redhat.com):
> > > From: Eric Paris <eparis@redhat.com>
> > > 
> > > This patch changes capability.h to fix whitespace and syntax issues.  Things that
> > > are fixed may include (does not not have to include)
> > > 
> > > whitespace at end of lines
> > > spaces followed by tabs
> > > spaces used instead of tabs
> > > spacing around parenthesis
> > > location of { around structs and else clauses
> > > location of * in pointer declarations
> > > removal of initialization of static data to keep it in the right section
> > > useless {} in if statemetns
> > > useless checking for NULL before kfree
> > > fixing of the indentation depth of switch statements
> > > no assignments in if statements
> > > include spaces around , in function calls
> > > and any number of other things I forgot to mention
> > 
> > Thanks.  Looks fine other than the inexplicable (afaics)
> > jumping of the capability #s by one tab for CAP_NET_ADMIN
> > and then again from CAP_IPC_OWNER on.
> 
> It just looks that way in the patch for things whose names are exactly
> that long because of the + at the beginning of the line pushing them
> over a tab column in your mailer.  They are correct after the patch
> applies.
> 
> > Hmm, well you also made some odd (inconsistent) tab+space choices at and
> > following cap_clear.
> 
> Same thing.  And I'll admit that it is a bit inconsistent, but a whole
> new tab just pushed things too far to the right and I didn't want to
> leave 8 spaces anywhere in the file.   So that's what I came up with...
> I promise it looks nice in the end   :)

Okay, sounds good - something needed to be done about those files in any
case.  Thanks for doing that.

-serge

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

end of thread, other threads:[~2008-04-24 12:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 17:52 [PATCH 1/4] capability: capability.h whitespace, syntax, and other cleanups eparis
2008-04-23 17:52 ` [PATCH 2/4] capability: security/capability.c " eparis
2008-04-23 17:52   ` [PATCH 3/4] capability: kernel/capability.c " eparis
2008-04-23 17:52     ` [PATCH 4/4] capability: commoncap.c " eparis
2008-04-24  1:54 ` [PATCH 1/4] capability: capability.h " Serge E. Hallyn
2008-04-24 12:13   ` Eric Paris
2008-04-24 12:26     ` Serge E. Hallyn

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