Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jmorris/selinux-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6:
  security: enhance DEFAULT_MMAP_MIN_ADDR description
  SELinux: add netport.[ch]
  SELinux: Add network port SID cache
  SELinux: turn mount options strings into defines
  selinux/ss/services.c should #include <linux/selinux.h>
  selinux: introduce permissive types
  selinux: remove ptrace_sid
  SELinux: requesting no permissions in avc_has_perm_noaudit is a BUG()
  security: code cleanup
  security: replace remaining __FUNCTION__ occurrences
  SELinux: create new open permission
  selinux: selinux/netlabel.c should #include "netlabel.h"
  SELinux: unify printk messages
  SELinux: remove unused backpointers from security objects
  SELinux: Correct the NetLabel locking for the sk_security_struct
  • Loading branch information
torvalds committed Apr 18, 2008
2 parents 4cba84b + 5f46ce1 commit 30bc945
Show file tree
Hide file tree
Showing 25 changed files with 617 additions and 270 deletions.
10 changes: 6 additions & 4 deletions security/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ config SECURITY_DEFAULT_MMAP_MIN_ADDR
from userspace allocation. Keeping a user from writing to low pages
can help reduce the impact of kernel NULL pointer bugs.

For most users with lots of address space a value of 65536 is
reasonable and should cause no problems. Programs which use vm86
functionality would either need additional permissions from either
the LSM or the capabilities module or have this protection disabled.
For most ia64, ppc64 and x86 users with lots of address space
a value of 65536 is reasonable and should cause no problems.
On arm and other archs it should not be higher than 32768.
Programs which use vm86 functionality would either need additional
permissions from either the LSM or the capabilities module or have
this protection disabled.

This value can be changed after boot using the
/proc/sys/vm/mmap_min_addr tunable.
Expand Down
4 changes: 2 additions & 2 deletions security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ static int get_file_caps(struct linux_binprm *bprm)
rc = cap_from_disk(&vcaps, bprm, rc);
if (rc)
printk(KERN_NOTICE "%s: cap_from_disk returned %d for %s\n",
__FUNCTION__, rc, bprm->filename);
__func__, rc, bprm->filename);

out:
dput(dentry);
Expand Down Expand Up @@ -302,7 +302,7 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
ret = get_file_caps(bprm);
if (ret)
printk(KERN_NOTICE "%s: get_file_caps returned %d for %s\n",
__FUNCTION__, ret, bprm->filename);
__func__, ret, bprm->filename);

/* To support inheritance of root-permissions and suid-root
* executables under compatibility mode, we raise all three
Expand Down
8 changes: 4 additions & 4 deletions security/keys/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ void no_printk(const char *fmt, ...)

#ifdef __KDEBUG
#define kenter(FMT, ...) \
printk(KERN_DEBUG "==> %s("FMT")\n", __FUNCTION__, ##__VA_ARGS__)
printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
#define kleave(FMT, ...) \
printk(KERN_DEBUG "<== %s()"FMT"\n", __FUNCTION__, ##__VA_ARGS__)
printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
#define kdebug(FMT, ...) \
printk(KERN_DEBUG "xxx" FMT"yyy\n", ##__VA_ARGS__)
#else
#define kenter(FMT, ...) \
no_printk(KERN_DEBUG "==> %s("FMT")\n", __FUNCTION__, ##__VA_ARGS__)
no_printk(KERN_DEBUG "==> %s("FMT")\n", __func__, ##__VA_ARGS__)
#define kleave(FMT, ...) \
no_printk(KERN_DEBUG "<== %s()"FMT"\n", __FUNCTION__, ##__VA_ARGS__)
no_printk(KERN_DEBUG "<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
#define kdebug(FMT, ...) \
no_printk(KERN_DEBUG FMT"\n", ##__VA_ARGS__)
#endif
Expand Down
2 changes: 1 addition & 1 deletion security/root_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module_param(debug, bool, 0600);
do { \
if (debug) \
printk(KERN_DEBUG "%s: %s: " fmt , \
MY_NAME , __FUNCTION__ , \
MY_NAME , __func__ , \
## arg); \
} while (0)

Expand Down
8 changes: 4 additions & 4 deletions security/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int __init security_init(void)

if (verify(&dummy_security_ops)) {
printk(KERN_ERR "%s could not verify "
"dummy_security_ops structure.\n", __FUNCTION__);
"dummy_security_ops structure.\n", __func__);
return -EIO;
}

Expand All @@ -82,7 +82,7 @@ int register_security(struct security_operations *ops)
{
if (verify(ops)) {
printk(KERN_DEBUG "%s could not verify "
"security_operations structure.\n", __FUNCTION__);
"security_operations structure.\n", __func__);
return -EINVAL;
}

Expand Down Expand Up @@ -110,13 +110,13 @@ int mod_reg_security(const char *name, struct security_operations *ops)
{
if (verify(ops)) {
printk(KERN_INFO "%s could not verify "
"security operations.\n", __FUNCTION__);
"security operations.\n", __func__);
return -EINVAL;
}

if (ops == security_ops) {
printk(KERN_INFO "%s security operations "
"already registered.\n", __FUNCTION__);
"already registered.\n", __func__);
return -EINVAL;
}

Expand Down
2 changes: 1 addition & 1 deletion security/selinux/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ config SECURITY_SELINUX_POLICYDB_VERSION_MAX
config SECURITY_SELINUX_POLICYDB_VERSION_MAX_VALUE
int "NSA SELinux maximum supported policy format version value"
depends on SECURITY_SELINUX_POLICYDB_VERSION_MAX
range 15 22
range 15 23
default 19
help
This option sets the value for the maximum policy format version
Expand Down
1 change: 1 addition & 0 deletions security/selinux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ selinux-y := avc.o \
nlmsgtab.o \
netif.o \
netnode.o \
netport.o \
exports.o

selinux-$(CONFIG_SECURITY_NETWORK_XFRM) += xfrm.o
Expand Down
13 changes: 8 additions & 5 deletions security/selinux/avc.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,8 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,
int rc = 0;
u32 denied;

BUG_ON(!requested);

rcu_read_lock();

node = avc_lookup(ssid, tsid, tclass, requested);
Expand All @@ -890,13 +892,14 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid,

denied = requested & ~(p_ae->avd.allowed);

if (!requested || denied) {
if (selinux_enforcing || (flags & AVC_STRICT))
if (denied) {
if (flags & AVC_STRICT)
rc = -EACCES;
else if (!selinux_enforcing || security_permissive_sid(ssid))
avc_update_node(AVC_CALLBACK_GRANT, requested, ssid,
tsid, tclass);
else
if (node)
avc_update_node(AVC_CALLBACK_GRANT,requested,
ssid,tsid,tclass);
rc = -EACCES;
}

rcu_read_unlock();
Expand Down
Loading

0 comments on commit 30bc945

Please sign in to comment.