05 Mar, 2009

1 commit

  • The following patch (against 2.6.29rc5) fixes a few issues in the
    smack/netlabel "unlabeled host support" functionnality that was added in
    2.6.29rc. It should go in before -final.

    1) smack_host_label disregard a "0.0.0.0/0 @" rule (or other label),
    preventing 'tagged' tasks to access Internet (many systems drop packets with
    IP options)

    2) netmasks were not handled correctly, they were stored in a way _not
    equivalent_ to conversion to be32 (it was equivalent for /0, /8, /16, /24,
    /32 masks but not other masks)

    3) smack_netlbladdr prefixes (IP/mask) were not consistent (mask&IP was not
    done), so there could have been different list entries for the same IP
    prefix; if those entries had different labels, well ...

    4) they were not sorted

    1) 2) 3) are bugs, 4) is a more cosmetic issue.
    The patch :

    -creates a new helper smk_netlbladdr_insert to insert a smk_netlbladdr,
    -sorted by netmask length

    -use the new sorted nature of smack_netlbladdrs list to simplify
    smack_host_label : the first match _will_ be the more specific

    -corrects endianness issues in smk_write_netlbladdr & netlbladdr_seq_show

    Signed-off-by:
    Acked-by: Casey Schaufler
    Reviewed-by: Paul Moore
    Signed-off-by: James Morris

    etienne
     

02 Mar, 2009

1 commit

  • Rick McNeal from LSI identified a panic in selinux_netlbl_inode_permission()
    caused by a certain sequence of SUNRPC operations. The problem appears to be
    due to the lack of NULL pointer checking in the function; this patch adds the
    pointer checks so the function will exit safely in the cases where the socket
    is not completely initialized.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

23 Feb, 2009

1 commit

  • At some point we (okay, I) managed to break the ability for users to use the
    setsockopt() syscall to set IPv4 options when NetLabel was not active on the
    socket in question. The problem was noticed by someone trying to use the
    "-R" (record route) option of ping:

    # ping -R 10.0.0.1
    ping: record route: No message of desired type

    The solution is relatively simple, we catch the unlabeled socket case and
    clear the error code, allowing the operation to succeed. Please note that we
    still deny users the ability to override IPv4 options on socket's which have
    NetLabel labeling active; this is done to ensure the labeling remains intact.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

28 Jan, 2009

1 commit

  • Given just how hard it is to find the code that uses MAY_APPEND
    it's probably not a big surprise that this went unnoticed for so
    long. The Smack rules loading code is incorrectly setting the
    MAY_READ bit when MAY_APPEND is requested.

    Signed-off-by: Casey Schaufler
    Reviewed-by: James Morris
    Signed-off-by: Linus Torvalds

    Casey Schaufler
     

18 Jan, 2009

1 commit


14 Jan, 2009

2 commits


09 Jan, 2009

3 commits

  • Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Acked-by: Theodore Ts'o
    Acked-by: Mark Fasheh
    Acked-by: David S. Miller
    Cc: James Morris
    Acked-by: Casey Schaufler
    Acked-by: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fernando Carrijo
     
  • The devcgroup_inode_permission() hook in the devices whitelist cgroup has
    always bypassed access checks on fifos. But the mknod hook did not. The
    devices whitelist is only about block and char devices, and fifos can't
    even be added to the whitelist, so fifos can't be created at all except by
    tasks which have 'a' in their whitelist (meaning they have access to all
    devices).

    Fix the behavior by bypassing access checks to mkfifo.

    Signed-off-by: Serge E. Hallyn
    Cc: Li Zefan
    Cc: Pavel Emelyanov
    Cc: Paul Menage
    Cc: Lai Jiangshan
    Cc: KOSAKI Motohiro
    Cc: James Morris
    Reported-by: Daniel Lezcano
    Cc: [2.6.27.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Serge E. Hallyn
     
  • We should use list_for_each_entry_rcu in RCU read site.

    Signed-off-by: Lai Jiangshan
    Cc: Paul Menage
    Cc: KAMEZAWA Hiroyuki
    Cc: Pavel Emelyanov
    Cc: Balbir Singh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lai Jiangshan
     

07 Jan, 2009

3 commits

  • James Morris
     
  • Fix a regression in cap_capable() due to:

    commit 3b11a1decef07c19443d24ae926982bc8ec9f4c0
    Author: David Howells
    Date: Fri Nov 14 10:39:26 2008 +1100

    CRED: Differentiate objective and effective subjective credentials on a task

    The problem is that the above patch allows a process to have two sets of
    credentials, and for the most part uses the subjective credentials when
    accessing current's creds.

    There is, however, one exception: cap_capable(), and thus capable(), uses the
    real/objective credentials of the target task, whether or not it is the current
    task.

    Ordinarily this doesn't matter, since usually the two cred pointers in current
    point to the same set of creds. However, sys_faccessat() makes use of this
    facility to override the credentials of the calling process to make its test,
    without affecting the creds as seen from other processes.

    One of the things sys_faccessat() does is to make an adjustment to the
    effective capabilities mask, which cap_capable(), as it stands, then ignores.

    The affected capability check is in generic_permission():

    if (!(mask & MAY_EXEC) || execute_ok(inode))
    if (capable(CAP_DAC_OVERRIDE))
    return 0;

    This change passes the set of credentials to be tested down into the commoncap
    and SELinux code. The security functions called by capable() and
    has_capability() select the appropriate set of credentials from the process
    being checked.

    This can be tested by compiling the following program from the XFS testsuite:

    /*
    * t_access_root.c - trivial test program to show permission bug.
    *
    * Written by Michael Kerrisk - copyright ownership not pursued.
    * Sourced from: http://linux.derkeiler.com/Mailing-Lists/Kernel/2003-10/6030.html
    */
    #include
    #include
    #include
    #include
    #include
    #include

    #define UID 500
    #define GID 100
    #define PERM 0
    #define TESTPATH "/tmp/t_access"

    static void
    errExit(char *msg)
    {
    perror(msg);
    exit(EXIT_FAILURE);
    } /* errExit */

    static void
    accessTest(char *file, int mask, char *mstr)
    {
    printf("access(%s, %s) returns %d\n", file, mstr, access(file, mask));
    } /* accessTest */

    int
    main(int argc, char *argv[])
    {
    int fd, perm, uid, gid;
    char *testpath;
    char cmd[PATH_MAX + 20];

    testpath = (argc > 1) ? argv[1] : TESTPATH;
    perm = (argc > 2) ? strtoul(argv[2], NULL, 8) : PERM;
    uid = (argc > 3) ? atoi(argv[3]) : UID;
    gid = (argc > 4) ? atoi(argv[4]) : GID;

    unlink(testpath);

    fd = open(testpath, O_RDWR | O_CREAT, 0);
    if (fd == -1) errExit("open");

    if (fchown(fd, uid, gid) == -1) errExit("fchown");
    if (fchmod(fd, perm) == -1) errExit("fchmod");
    close(fd);

    snprintf(cmd, sizeof(cmd), "ls -l %s", testpath);
    system(cmd);

    if (seteuid(uid) == -1) errExit("seteuid");

    accessTest(testpath, 0, "0");
    accessTest(testpath, R_OK, "R_OK");
    accessTest(testpath, W_OK, "W_OK");
    accessTest(testpath, X_OK, "X_OK");
    accessTest(testpath, R_OK | W_OK, "R_OK | W_OK");
    accessTest(testpath, R_OK | X_OK, "R_OK | X_OK");
    accessTest(testpath, W_OK | X_OK, "W_OK | X_OK");
    accessTest(testpath, R_OK | W_OK | X_OK, "R_OK | W_OK | X_OK");

    exit(EXIT_SUCCESS);
    } /* main */

    This can be run against an Ext3 filesystem as well as against an XFS
    filesystem. If successful, it will show:

    [root@andromeda src]# ./t_access_root /tmp/xxx 0 4043 4043
    ---------- 1 dhowells dhowells 0 2008-12-31 03:00 /tmp/xxx
    access(/tmp/xxx, 0) returns 0
    access(/tmp/xxx, R_OK) returns 0
    access(/tmp/xxx, W_OK) returns 0
    access(/tmp/xxx, X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK) returns 0
    access(/tmp/xxx, R_OK | X_OK) returns -1
    access(/tmp/xxx, W_OK | X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK | X_OK) returns -1

    If unsuccessful, it will show:

    [root@andromeda src]# ./t_access_root /tmp/xxx 0 4043 4043
    ---------- 1 dhowells dhowells 0 2008-12-31 02:56 /tmp/xxx
    access(/tmp/xxx, 0) returns 0
    access(/tmp/xxx, R_OK) returns -1
    access(/tmp/xxx, W_OK) returns -1
    access(/tmp/xxx, X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK) returns -1
    access(/tmp/xxx, R_OK | X_OK) returns -1
    access(/tmp/xxx, W_OK | X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK | X_OK) returns -1

    I've also tested the fix with the SELinux and syscalls LTP testsuites.

    Signed-off-by: David Howells
    Tested-by: J. Bruce Fields
    Acked-by: Serge Hallyn
    Signed-off-by: James Morris

    David Howells
     
  • This reverts commit 14eaddc967b16017d4a1a24d2be6c28ecbe06ed8.

    David has a better version to come.

    James Morris
     

06 Jan, 2009

3 commits

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
    inotify: fix type errors in interfaces
    fix breakage in reiserfs_new_inode()
    fix the treatment of jfs special inodes
    vfs: remove duplicate code in get_fs_type()
    add a vfs_fsync helper
    sys_execve and sys_uselib do not call into fsnotify
    zero i_uid/i_gid on inode allocation
    inode->i_op is never NULL
    ntfs: don't NULL i_op
    isofs check for NULL ->i_op in root directory is dead code
    affs: do not zero ->i_op
    kill suid bit only for regular files
    vfs: lseek(fd, 0, SEEK_CUR) race condition

    Linus Torvalds
     
  • ... and don't bother in callers. Don't bother with zeroing i_blocks,
    while we are at it - it's already been zeroed.

    i_mode is not worth the effort; it has no common default value.

    Signed-off-by: Al Viro

    Al Viro
     
  • We used to have rather schizophrenic set of checks for NULL ->i_op even
    though it had been eliminated years ago. You'd need to go out of your
    way to set it to NULL explicitly _and_ a bunch of code would die on
    such inodes anyway. After killing two remaining places that still
    did that bogosity, all that crap can go away.

    Signed-off-by: Al Viro

    Al Viro
     

05 Jan, 2009

4 commits

  • I started playing with pahole today and decided to put it against the
    selinux structures. Found we could save a little bit of space on x86_64
    (and no harm on i686) just reorganizing some structs.

    Object size changes:
    av_inherit: 24 -> 16
    selinux_class_perm: 48 -> 40
    context: 80 -> 72

    Admittedly there aren't many of av_inherit or selinux_class_perm's in
    the kernel (33 and 1 respectively) But the change to the size of struct
    context reverberate out a bit. I can get some hard number if they are
    needed, but I don't see why they would be. We do change which cacheline
    context->len and context->str would be on, but I don't see that as a
    problem since we are clearly going to have to load both if the context
    is to be of any value. I've run with the patch and don't seem to be
    having any problems.

    An example of what's going on using struct av_inherit would be:

    form: to:
    struct av_inherit { struct av_inherit {
    u16 tclass; const char **common_pts;
    const char **common_pts; u32 common_base;
    u32 common_base; u16 tclass;
    };

    (notice all I did was move u16 tclass to the end of the struct instead
    of the beginning)

    Memory layout before the change:
    struct av_inherit {
    u16 tclass; /* 2 */
    /* 6 bytes hole */
    const char** common_pts; /* 8 */
    u32 common_base; /* 4 */
    /* 4 byes padding */

    /* size: 24, cachelines: 1 */
    /* sum members: 14, holes: 1, sum holes: 6 */
    /* padding: 4 */
    };

    Memory layout after the change:
    struct av_inherit {
    const char ** common_pts; /* 8 */
    u32 common_base; /* 4 */
    u16 tclass; /* 2 */
    /* 2 bytes padding */

    /* size: 16, cachelines: 1 */
    /* sum members: 14, holes: 0, sum holes: 0 */
    /* padding: 2 */
    };

    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     
  • Fix a regression in cap_capable() due to:

    commit 5ff7711e635b32f0a1e558227d030c7e45b4a465
    Author: David Howells
    Date: Wed Dec 31 02:52:28 2008 +0000

    CRED: Differentiate objective and effective subjective credentials on a task

    The problem is that the above patch allows a process to have two sets of
    credentials, and for the most part uses the subjective credentials when
    accessing current's creds.

    There is, however, one exception: cap_capable(), and thus capable(), uses the
    real/objective credentials of the target task, whether or not it is the current
    task.

    Ordinarily this doesn't matter, since usually the two cred pointers in current
    point to the same set of creds. However, sys_faccessat() makes use of this
    facility to override the credentials of the calling process to make its test,
    without affecting the creds as seen from other processes.

    One of the things sys_faccessat() does is to make an adjustment to the
    effective capabilities mask, which cap_capable(), as it stands, then ignores.

    The affected capability check is in generic_permission():

    if (!(mask & MAY_EXEC) || execute_ok(inode))
    if (capable(CAP_DAC_OVERRIDE))
    return 0;

    This change splits capable() from has_capability() down into the commoncap and
    SELinux code. The capable() security op now only deals with the current
    process, and uses the current process's subjective creds. A new security op -
    task_capable() - is introduced that can check any task's objective creds.

    strictly the capable() security op is superfluous with the presence of the
    task_capable() op, however it should be faster to call the capable() op since
    two fewer arguments need be passed down through the various layers.

    This can be tested by compiling the following program from the XFS testsuite:

    /*
    * t_access_root.c - trivial test program to show permission bug.
    *
    * Written by Michael Kerrisk - copyright ownership not pursued.
    * Sourced from: http://linux.derkeiler.com/Mailing-Lists/Kernel/2003-10/6030.html
    */
    #include
    #include
    #include
    #include
    #include
    #include

    #define UID 500
    #define GID 100
    #define PERM 0
    #define TESTPATH "/tmp/t_access"

    static void
    errExit(char *msg)
    {
    perror(msg);
    exit(EXIT_FAILURE);
    } /* errExit */

    static void
    accessTest(char *file, int mask, char *mstr)
    {
    printf("access(%s, %s) returns %d\n", file, mstr, access(file, mask));
    } /* accessTest */

    int
    main(int argc, char *argv[])
    {
    int fd, perm, uid, gid;
    char *testpath;
    char cmd[PATH_MAX + 20];

    testpath = (argc > 1) ? argv[1] : TESTPATH;
    perm = (argc > 2) ? strtoul(argv[2], NULL, 8) : PERM;
    uid = (argc > 3) ? atoi(argv[3]) : UID;
    gid = (argc > 4) ? atoi(argv[4]) : GID;

    unlink(testpath);

    fd = open(testpath, O_RDWR | O_CREAT, 0);
    if (fd == -1) errExit("open");

    if (fchown(fd, uid, gid) == -1) errExit("fchown");
    if (fchmod(fd, perm) == -1) errExit("fchmod");
    close(fd);

    snprintf(cmd, sizeof(cmd), "ls -l %s", testpath);
    system(cmd);

    if (seteuid(uid) == -1) errExit("seteuid");

    accessTest(testpath, 0, "0");
    accessTest(testpath, R_OK, "R_OK");
    accessTest(testpath, W_OK, "W_OK");
    accessTest(testpath, X_OK, "X_OK");
    accessTest(testpath, R_OK | W_OK, "R_OK | W_OK");
    accessTest(testpath, R_OK | X_OK, "R_OK | X_OK");
    accessTest(testpath, W_OK | X_OK, "W_OK | X_OK");
    accessTest(testpath, R_OK | W_OK | X_OK, "R_OK | W_OK | X_OK");

    exit(EXIT_SUCCESS);
    } /* main */

    This can be run against an Ext3 filesystem as well as against an XFS
    filesystem. If successful, it will show:

    [root@andromeda src]# ./t_access_root /tmp/xxx 0 4043 4043
    ---------- 1 dhowells dhowells 0 2008-12-31 03:00 /tmp/xxx
    access(/tmp/xxx, 0) returns 0
    access(/tmp/xxx, R_OK) returns 0
    access(/tmp/xxx, W_OK) returns 0
    access(/tmp/xxx, X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK) returns 0
    access(/tmp/xxx, R_OK | X_OK) returns -1
    access(/tmp/xxx, W_OK | X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK | X_OK) returns -1

    If unsuccessful, it will show:

    [root@andromeda src]# ./t_access_root /tmp/xxx 0 4043 4043
    ---------- 1 dhowells dhowells 0 2008-12-31 02:56 /tmp/xxx
    access(/tmp/xxx, 0) returns 0
    access(/tmp/xxx, R_OK) returns -1
    access(/tmp/xxx, W_OK) returns -1
    access(/tmp/xxx, X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK) returns -1
    access(/tmp/xxx, R_OK | X_OK) returns -1
    access(/tmp/xxx, W_OK | X_OK) returns -1
    access(/tmp/xxx, R_OK | W_OK | X_OK) returns -1

    I've also tested the fix with the SELinux and syscalls LTP testsuites.

    Signed-off-by: David Howells
    Signed-off-by: James Morris

    David Howells
     
  • James Morris
     
  • Don't store the field->op in the messy (and very inconvenient for e.g.
    audit_comparator()) form; translate to dense set of values and do full
    validation of userland-submitted value while we are at it.

    ->audit_init_rule() and ->audit_match_rule() get new values now; in-tree
    instances updated.

    Signed-off-by: Al Viro

    Al Viro
     

04 Jan, 2009

1 commit

  • …/git/tip/linux-2.6-tip

    * 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (77 commits)
    x86: setup_per_cpu_areas() cleanup
    cpumask: fix compile error when CONFIG_NR_CPUS is not defined
    cpumask: use alloc_cpumask_var_node where appropriate
    cpumask: convert shared_cpu_map in acpi_processor* structs to cpumask_var_t
    x86: use cpumask_var_t in acpi/boot.c
    x86: cleanup some remaining usages of NR_CPUS where s/b nr_cpu_ids
    sched: put back some stack hog changes that were undone in kernel/sched.c
    x86: enable cpus display of kernel_max and offlined cpus
    ia64: cpumask fix for is_affinity_mask_valid()
    cpumask: convert RCU implementations, fix
    xtensa: define __fls
    mn10300: define __fls
    m32r: define __fls
    h8300: define __fls
    frv: define __fls
    cris: define __fls
    cpumask: CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
    cpumask: zero extra bits in alloc_cpumask_var_node
    cpumask: replace for_each_cpu_mask_nr with for_each_cpu in kernel/time/
    cpumask: convert mm/
    ...

    Linus Torvalds
     

01 Jan, 2009

6 commits

  • Impact: cleanup

    In future, all cpumask ops will only be valid (in general) for bit
    numbers < nr_cpu_ids. So use that instead of NR_CPUS in iterators
    and other comparisons.

    This is always safe: no cpu number can be >= nr_cpu_ids, and
    nr_cpu_ids is initialized to NR_CPUS at boot.

    Signed-off-by: Rusty Russell
    Signed-off-by: Mike Travis
    Acked-by: Ingo Molnar
    Acked-by: James Morris
    Cc: Eric Biederman

    Rusty Russell
     
  • Fix the following sparse warning:

    CC security/keys/key.o
    security/keys/keyctl.c:1297:10: warning: incorrect type in argument 2 (different address spaces)
    security/keys/keyctl.c:1297:10: expected char [noderef] *buffer
    security/keys/keyctl.c:1297:10: got char *

    which appears to be caused by lack of __user annotation to the cast of
    a syscall argument.

    Signed-off-by: James Morris
    Acked-by: David Howells

    James Morris
     
  • Add new LSM hooks for path-based checks. Call them on directory-modifying
    operations at the points where we still know the vfsmount involved.

    Signed-off-by: Kentaro Takeda
    Signed-off-by: Tetsuo Handa
    Signed-off-by: Toshiharu Harada
    Signed-off-by: Al Viro

    Kentaro Takeda
     
  • Add support for unlabeled network hosts and networks.
    Relies heavily on Paul Moore's netlabel support.

    Creates a new entry in /smack called netlabel. Writes to /smack/netlabel
    take the form:

    A.B.C.D LABEL
    or
    A.B.C.D/N LABEL

    where A.B.C.D is a network address, N is an integer between 0-32,
    and LABEL is the Smack label to be used. If /N is omitted /32 is
    assumed. N designates the netmask for the address. Entries are
    matched by the most specific address/mask pair. 0.0.0.0/0 will
    match everything, while 192.168.1.117/32 will match exactly one
    host.

    A new system label "@", pronounced "web", is defined. Processes
    can not be assigned the web label. An address assigned the web
    label can be written to by any process, and packets coming from
    a web address can be written to any socket. Use of the web label
    is a violation of any strict MAC policy, but the web label has
    been requested many times.

    The nltype entry has been removed from /smack. It did not work right
    and the netlabel interface can be used to specify that all hosts
    be treated as unlabeled.

    CIPSO labels on incoming packets will be honored, even from designated
    single label hosts. Single label hosts can only be written to by
    processes with labels that can write to the label of the host.
    Packets sent to single label hosts will always be unlabeled.

    Once added a single label designation cannot be removed, however
    the label may be changed.

    The behavior of the ambient label remains unchanged.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Paul Moore

    Casey Schaufler
     
  • This patch is the first step towards removing the old "compat_net" code from
    the kernel. Secmark, the "compat_net" replacement was first introduced in
    2.6.18 (September 2006) and the major Linux distributions with SELinux support
    have transitioned to Secmark so it is time to start deprecating the "compat_net"
    mechanism. Testing a patched version of 2.6.28-rc6 with the initial release of
    Fedora Core 5 did not show any problems when running in enforcing mode.

    This patch adds an entry to the feature-removal-schedule.txt file and removes
    the SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT configuration option, forcing
    Secmark on by default although it can still be disabled at runtime. The patch
    also makes the Secmark permission checks "dynamic" in the sense that they are
    only executed when Secmark is configured; this should help prevent problems
    with older distributions that have not yet migrated to Secmark.

    Signed-off-by: Paul Moore
    Acked-by: James Morris

    Paul Moore
     
  • Update the NetLabel kernel API to expose the new features added in kernel
    releases 2.6.25 and 2.6.28: the static/fallback label functionality and network
    address based selectors.

    Signed-off-by: Paul Moore

    Paul Moore
     

29 Dec, 2008

3 commits

  • Fix variable uninitialisation warnings introduced in:

    commit 8bbf4976b59fc9fc2861e79cab7beb3f6d647640
    Author: David Howells
    Date: Fri Nov 14 10:39:14 2008 +1100

    KEYS: Alter use of key instantiation link-to-keyring argument

    As:

    security/keys/keyctl.c: In function 'keyctl_negate_key':
    security/keys/keyctl.c:976: warning: 'dest_keyring' may be used uninitialized in this function
    security/keys/keyctl.c: In function 'keyctl_instantiate_key':
    security/keys/keyctl.c:898: warning: 'dest_keyring' may be used uninitialized in this function

    Some versions of gcc notice that get_instantiation_key() doesn't always set
    *_dest_keyring, but fail to observe that if this happens then *_dest_keyring
    will not be read by the caller.

    Reported-by: Linus Torvalds
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    David Howells
     
  • James Morris
     
  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1429 commits)
    net: Allow dependancies of FDDI & Tokenring to be modular.
    igb: Fix build warning when DCA is disabled.
    net: Fix warning fallout from recent NAPI interface changes.
    gro: Fix potential use after free
    sfc: If AN is enabled, always read speed/duplex from the AN advertising bits
    sfc: When disabling the NIC, close the device rather than unregistering it
    sfc: SFT9001: Add cable diagnostics
    sfc: Add support for multiple PHY self-tests
    sfc: Merge top-level functions for self-tests
    sfc: Clean up PHY mode management in loopback self-test
    sfc: Fix unreliable link detection in some loopback modes
    sfc: Generate unique names for per-NIC workqueues
    802.3ad: use standard ethhdr instead of ad_header
    802.3ad: generalize out mac address initializer
    802.3ad: initialize ports LACPDU from const initializer
    802.3ad: remove typedef around ad_system
    802.3ad: turn ports is_individual into a bool
    802.3ad: turn ports is_enabled into a bool
    802.3ad: make ntt bool
    ixgbe: Fix set_ringparam in ixgbe to use the same memory pools.
    ...

    Fixed trivial IPv4/6 address printing conflicts in fs/cifs/connect.c due
    to the conversion to %pI (in this networking merge) and the addition of
    doing IPv6 addresses (from the earlier merge of CIFS).

    Linus Torvalds
     

25 Dec, 2008

1 commit

  • smackfs: check for allocation failures in smk_set_access()

    While adding a new subject/object pair to smack_list, smk_set_access()
    didn't check the return of kzalloc().

    This patch changes smk_set_access() to return 0 or -ENOMEM, based on
    kzalloc()'s return. It also updates its caller, smk_write_load(), to
    check for smk_set_access()'s return, given it is no longer a void
    return function.

    Signed-off-by: Sergio Luis
    To: Casey Schaufler
    Cc: Ahmed S. Darwish
    Cc: LSM
    Cc: LKLM

    Acked-by: Casey Schaufler

    Sergio Luis
     

20 Dec, 2008

3 commits


25 Nov, 2008

1 commit

  • Impact: fix sparse warnings

    Fix the following sparse warnings:

    security/security.c:228:2: warning: returning void-valued expression
    security/security.c:233:2: warning: returning void-valued expression
    security/security.c:616:2: warning: returning void-valued expression

    Signed-off-by: Hannes Eder
    Signed-off-by: James Morris

    Hannes Eder
     

15 Nov, 2008

1 commit


14 Nov, 2008

4 commits

  • Allow kernel services to override LSM settings appropriate to the actions
    performed by a task by duplicating a set of credentials, modifying it and then
    using task_struct::cred to point to it when performing operations on behalf of
    a task.

    This is used, for example, by CacheFiles which has to transparently access the
    cache on behalf of a process that thinks it is doing, say, NFS accesses with a
    potentially inappropriate (with respect to accessing the cache) set of
    credentials.

    This patch provides two LSM hooks for modifying a task security record:

    (*) security_kernel_act_as() which allows modification of the security datum
    with which a task acts on other objects (most notably files).

    (*) security_kernel_create_files_as() which allows modification of the
    security datum that is used to initialise the security data on a file that
    a task creates.

    The patch also provides four new credentials handling functions, which wrap the
    LSM functions:

    (1) prepare_kernel_cred()

    Prepare a set of credentials for a kernel service to use, based either on
    a daemon's credentials or on init_cred. All the keyrings are cleared.

    (2) set_security_override()

    Set the LSM security ID in a set of credentials to a specific security
    context, assuming permission from the LSM policy.

    (3) set_security_override_from_ctx()

    As (2), but takes the security context as a string.

    (4) set_create_files_as()

    Set the file creation LSM security ID in a set of credentials to be the
    same as that on a particular inode.

    Signed-off-by: Casey Schaufler [Smack changes]
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    David Howells
     
  • Add a 'kernel_service' object class to SELinux and give this object class two
    access vectors: 'use_as_override' and 'create_files_as'.

    The first vector is used to grant a process the right to nominate an alternate
    process security ID for the kernel to use as an override for the SELinux
    subjective security when accessing stuff on behalf of another process.

    For example, CacheFiles when accessing the cache on behalf on a process
    accessing an NFS file needs to use a subjective security ID appropriate to the
    cache rather then the one the calling process is using. The cachefilesd
    daemon will nominate the security ID to be used.

    The second vector is used to grant a process the right to nominate a file
    creation label for a kernel service to use.

    Signed-off-by: David Howells
    Signed-off-by: James Morris

    David Howells
     
  • Differentiate the objective and real subjective credentials from the effective
    subjective credentials on a task by introducing a second credentials pointer
    into the task_struct.

    task_struct::real_cred then refers to the objective and apparent real
    subjective credentials of a task, as perceived by the other tasks in the
    system.

    task_struct::cred then refers to the effective subjective credentials of a
    task, as used by that task when it's actually running. These are not visible
    to the other tasks in the system.

    __task_cred(task) then refers to the objective/real credentials of the task in
    question.

    current_cred() refers to the effective subjective credentials of the current
    task.

    prepare_creds() uses the objective creds as a base and commit_creds() changes
    both pointers in the task_struct (indeed commit_creds() requires them to be the
    same).

    override_creds() and revert_creds() change the subjective creds pointer only,
    and the former returns the old subjective creds. These are used by NFSD,
    faccessat() and do_coredump(), and will by used by CacheFiles.

    In SELinux, current_has_perm() is provided as an alternative to
    task_has_perm(). This uses the effective subjective context of current,
    whereas task_has_perm() uses the objective/real context of the subject.

    Signed-off-by: David Howells
    Signed-off-by: James Morris

    David Howells
     
  • Prettify commoncap.c.

    Signed-off-by: David Howells
    Acked-by: Serge Hallyn
    Reviewed-by: James Morris
    Signed-off-by: James Morris

    David Howells