Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169174
b: refs/heads/master
c: b3a222e
h: refs/heads/master
v: v3
  • Loading branch information
Serge E. Hallyn authored and James Morris committed Nov 24, 2009
1 parent 3060768 commit 33f881c
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 88 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0bce95279909aa4cc401a2e3140b4295ca22e72a
refs/heads/master: b3a222e52e4d4be77cc4520a57af1a4a0d8222d1
2 changes: 0 additions & 2 deletions trunk/include/linux/capability.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ struct vfs_cap_data {
#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3

#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
extern int file_caps_enabled;
#endif

typedef struct kernel_cap_struct {
__u32 cap[_KERNEL_CAPABILITY_U32S];
Expand Down
4 changes: 0 additions & 4 deletions trunk/include/linux/init_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,12 @@ extern struct group_info init_groups;
#define INIT_IDS
#endif

#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
/*
* Because of the reduced scope of CAP_SETPCAP when filesystem
* capabilities are in effect, it is safe to allow CAP_SETPCAP to
* be available in the default configuration.
*/
# define CAP_INIT_BSET CAP_FULL_SET
#else
# define CAP_INIT_BSET CAP_INIT_EFF_SET
#endif

#ifdef CONFIG_TREE_PREEMPT_RCU
#define INIT_TASK_RCU_PREEMPT(tsk) \
Expand Down
2 changes: 0 additions & 2 deletions trunk/kernel/capability.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ EXPORT_SYMBOL(__cap_empty_set);
EXPORT_SYMBOL(__cap_full_set);
EXPORT_SYMBOL(__cap_init_eff_set);

#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
int file_caps_enabled = 1;

static int __init file_caps_disable(char *str)
Expand All @@ -38,7 +37,6 @@ static int __init file_caps_disable(char *str)
return 1;
}
__setup("no_file_caps", file_caps_disable);
#endif

/*
* More recent versions of libcap are available from:
Expand Down
9 changes: 0 additions & 9 deletions trunk/security/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ config SECURITY_PATH
implement pathname based access controls.
If you are unsure how to answer this question, answer N.

config SECURITY_FILE_CAPABILITIES
bool "File POSIX Capabilities"
default n
help
This enables filesystem capabilities, allowing you to give
binaries a subset of root's powers without using setuid 0.

If in doubt, answer N.

config INTEL_TXT
bool "Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)"
depends on HAVE_INTEL_TXT
Expand Down
72 changes: 2 additions & 70 deletions trunk/security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,13 @@ int cap_capget(struct task_struct *target, kernel_cap_t *effective,
*/
static inline int cap_inh_is_capped(void)
{
#ifdef CONFIG_SECURITY_FILE_CAPABILITIES

/* they are so limited unless the current task has the CAP_SETPCAP
* capability
*/
if (cap_capable(current, current_cred(), CAP_SETPCAP,
SECURITY_CAP_AUDIT) == 0)
return 0;
#endif
return 1;
}

Expand Down Expand Up @@ -239,8 +237,6 @@ static inline void bprm_clear_caps(struct linux_binprm *bprm)
bprm->cap_effective = false;
}

#ifdef CONFIG_SECURITY_FILE_CAPABILITIES

/**
* cap_inode_need_killpriv - Determine if inode change affects privileges
* @dentry: The inode/dentry in being changed with change marked ATTR_KILL_PRIV
Expand Down Expand Up @@ -421,49 +417,6 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective)
return rc;
}

#else
int cap_inode_need_killpriv(struct dentry *dentry)
{
return 0;
}

int cap_inode_killpriv(struct dentry *dentry)
{
return 0;
}

int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps)
{
memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data));
return -ENODATA;
}

static inline int get_file_caps(struct linux_binprm *bprm, bool *effective)
{
bprm_clear_caps(bprm);
return 0;
}
#endif

/*
* Determine whether a exec'ing process's new permitted capabilities should be
* limited to just what it already has.
*
* This prevents processes that are being ptraced from gaining access to
* CAP_SETPCAP, unless the process they're tracing already has it, and the
* binary they're executing has filecaps that elevate it.
*
* Returns 1 if they should be limited, 0 if they are not.
*/
static inline int cap_limit_ptraced_target(void)
{
#ifndef CONFIG_SECURITY_FILE_CAPABILITIES
if (capable(CAP_SETPCAP))
return 0;
#endif
return 1;
}

/**
* cap_bprm_set_creds - Set up the proposed credentials for execve().
* @bprm: The execution parameters, including the proposed creds
Expand Down Expand Up @@ -523,9 +476,8 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
new->euid = new->uid;
new->egid = new->gid;
}
if (cap_limit_ptraced_target())
new->cap_permitted = cap_intersect(new->cap_permitted,
old->cap_permitted);
new->cap_permitted = cap_intersect(new->cap_permitted,
old->cap_permitted);
}

new->suid = new->fsuid = new->euid;
Expand Down Expand Up @@ -739,7 +691,6 @@ int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags)
return 0;
}

#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
/*
* Rationale: code calling task_setscheduler, task_setioprio, and
* task_setnice, assumes that
Expand Down Expand Up @@ -820,22 +771,6 @@ static long cap_prctl_drop(struct cred *new, unsigned long cap)
return 0;
}

#else
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)
{
return 0;
}
int cap_task_setnice (struct task_struct *p, int nice)
{
return 0;
}
#endif

/**
* cap_task_prctl - Implement process control functions for this security module
* @option: The process control function requested
Expand Down Expand Up @@ -866,7 +801,6 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
error = !!cap_raised(new->cap_bset, arg2);
goto no_change;

#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
case PR_CAPBSET_DROP:
error = cap_prctl_drop(new, arg2);
if (error < 0)
Expand Down Expand Up @@ -917,8 +851,6 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
error = new->securebits;
goto no_change;

#endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */

case PR_GET_KEEPCAPS:
if (issecure(SECURE_KEEP_CAPS))
error = 1;
Expand Down

0 comments on commit 33f881c

Please sign in to comment.