04 Apr, 2012

6 commits

  • It just bloats the audit data structure for no good reason, since the
    only time those fields are filled are just before calling the
    common_lsm_audit() function, which is also the only user of those
    fields.

    So just make them be the arguments to common_lsm_audit(), rather than
    bloating that structure that is passed around everywhere, and is
    initialized in hot paths.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • Instead of declaring the entire selinux_audit_data on the stack when we
    start an operation on declare it on the stack if we are going to use it.
    We know it's usefulness at the end of the security decision and can declare
    it there.

    Signed-off-by: Eric Paris
    Signed-off-by: Linus Torvalds

    Eric Paris
     
  • We don't use the argument, so remove it.

    Signed-off-by: Eric Paris
    Signed-off-by: Linus Torvalds

    Eric Paris
     
  • We do not use it. Remove it.

    Signed-off-by: Eric Paris
    Signed-off-by: Linus Torvalds

    Eric Paris
     
  • After shrinking the common_audit_data stack usage for private LSM data I'm
    not going to shrink the data union. To do this I'm going to move anything
    larger than 2 void * ptrs to it's own structure and require it to be declared
    separately on the calling stack. Thus hot paths which don't need more than
    a couple pointer don't have to declare space to hold large unneeded
    structures. I could get this down to one void * by dealing with the key
    struct and the struct path. We'll see if that is helpful after taking care of
    networking.

    Signed-off-by: Eric Paris
    Signed-off-by: Linus Torvalds

    Eric Paris
     
  • Linus found that the gigantic size of the common audit data caused a big
    perf hit on something as simple as running stat() in a loop. This patch
    requires LSMs to declare the LSM specific portion separately rather than
    doing it in a union. Thus each LSM can be responsible for shrinking their
    portion and don't have to pay a penalty just because other LSMs have a
    bigger space requirement.

    Signed-off-by: Eric Paris
    Signed-off-by: Linus Torvalds

    Eric Paris
     

01 Apr, 2012

5 commits

  • Pull second try at vfs part d#2 from Al Viro:
    "Miklos' first series (with do_lookup() rewrite split into edible
    chunks) + assorted bits and pieces.

    The 'untangling of do_lookup()' series is is a splitup of what used to
    be a monolithic patch from Miklos, so this series is basically "how do
    I convince myself that his patch is correct (or find a hole in it)".
    No holes found and I like the resulting cleanup, so in it went..."

    Changes from try 1: Fix a boot problem with selinux, and commit messages
    prettied up a bit.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (24 commits)
    vfs: fix out-of-date dentry_unhash() comment
    vfs: split __lookup_hash
    untangling do_lookup() - take __lookup_hash()-calling case out of line.
    untangling do_lookup() - switch to calling __lookup_hash()
    untangling do_lookup() - merge d_alloc_and_lookup() callers
    untangling do_lookup() - merge failure exits in !dentry case
    untangling do_lookup() - massage !dentry case towards __lookup_hash()
    untangling do_lookup() - get rid of need_reval in !dentry case
    untangling do_lookup() - eliminate a loop.
    untangling do_lookup() - expand the area under ->i_mutex
    untangling do_lookup() - isolate !dentry stuff from the rest of it.
    vfs: move MAY_EXEC check from __lookup_hash()
    vfs: don't revalidate just looked up dentry
    vfs: fix d_need_lookup/d_revalidate order in do_lookup
    ext3: move headers to fs/ext3/
    migrate ext2_fs.h guts to fs/ext2/ext2.h
    new helper: ext2_image_size()
    get rid of pointless includes of ext2_fs.h
    ext2: No longer export ext2_fs.h to user space
    mtdchar: kill persistently held vfsmount
    ...

    Linus Torvalds
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Now that all the slow-path code is gone from these functions, we can
    inline them into the main caller - avc_has_perm_flags().

    Now the compiler can see that 'avc' is allocated on the stack for this
    case, which helps register pressure a bit. It also actually shrinks the
    total stack frame, because the stack frame that avc_has_perm_flags()
    always needed (for that 'avc' allocation) is now sufficient for the
    inlined functions too.

    Inlining isn't bad - but mindless inlining of cold code (see the
    previous commit) is.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • The selinux AVC paths remain some of the hottest (and deepest) codepaths
    at filename lookup time, and we make it worse by having the slow path
    cases take up I$ and stack space even when they don't trigger. Gcc
    tends to always want to inline functions that are just called once -
    never mind that this might make for slower and worse code in the caller.

    So this tries to improve on it a bit by making the slow-path cases
    explicitly separate functions that are marked noinline, causing gcc to
    at least no longer allocate stack space for them unless they are
    actually called. It also seems to help register allocation a tiny bit,
    since gcc now doesn't take the slow case code into account.

    Uninlining the slow path may also allow us to inline the remaining hot
    path into the one caller that actually matters: avc_has_perm_flags().
    I'll have to look at that separately, but both avc_audit() and
    avc_has_perm_noaudit() are now small and lean enough that inlining them
    may make sense.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

30 Mar, 2012

1 commit

  • Pull x32 support for x86-64 from Ingo Molnar:
    "This tree introduces the X32 binary format and execution mode for x86:
    32-bit data space binaries using 64-bit instructions and 64-bit kernel
    syscalls.

    This allows applications whose working set fits into a 32 bits address
    space to make use of 64-bit instructions while using a 32-bit address
    space with shorter pointers, more compressed data structures, etc."

    Fix up trivial context conflicts in arch/x86/{Kconfig,vdso/vma.c}

    * 'x86-x32-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (71 commits)
    x32: Fix alignment fail in struct compat_siginfo
    x32: Fix stupid ia32/x32 inversion in the siginfo format
    x32: Add ptrace for x32
    x32: Switch to a 64-bit clock_t
    x32: Provide separate is_ia32_task() and is_x32_task() predicates
    x86, mtrr: Use explicit sizing and padding for the 64-bit ioctls
    x86/x32: Fix the binutils auto-detect
    x32: Warn and disable rather than error if binutils too old
    x32: Only clear TIF_X32 flag once
    x32: Make sure TS_COMPAT is cleared for x32 tasks
    fs: Remove missed ->fds_bits from cessation use of fd_set structs internally
    fs: Fix close_on_exec pointer in alloc_fdtable
    x32: Drop non-__vdso weak symbols from the x32 VDSO
    x32: Fix coding style violations in the x32 VDSO code
    x32: Add x32 VDSO support
    x32: Allow x32 to be configured
    x32: If configured, add x32 system calls to system call tables
    x32: Handle process creation
    x32: Signal-related system calls
    x86: Add #ifdef CONFIG_COMPAT to
    ...

    Linus Torvalds
     

29 Mar, 2012

2 commits

  • …m/linux/kernel/git/dhowells/linux-asm_system

    Pull "Disintegrate and delete asm/system.h" from David Howells:
    "Here are a bunch of patches to disintegrate asm/system.h into a set of
    separate bits to relieve the problem of circular inclusion
    dependencies.

    I've built all the working defconfigs from all the arches that I can
    and made sure that they don't break.

    The reason for these patches is that I recently encountered a circular
    dependency problem that came about when I produced some patches to
    optimise get_order() by rewriting it to use ilog2().

    This uses bitops - and on the SH arch asm/bitops.h drags in
    asm-generic/get_order.h by a circuituous route involving asm/system.h.

    The main difficulty seems to be asm/system.h. It holds a number of
    low level bits with no/few dependencies that are commonly used (eg.
    memory barriers) and a number of bits with more dependencies that
    aren't used in many places (eg. switch_to()).

    These patches break asm/system.h up into the following core pieces:

    (1) asm/barrier.h

    Move memory barriers here. This already done for MIPS and Alpha.

    (2) asm/switch_to.h

    Move switch_to() and related stuff here.

    (3) asm/exec.h

    Move arch_align_stack() here. Other process execution related bits
    could perhaps go here from asm/processor.h.

    (4) asm/cmpxchg.h

    Move xchg() and cmpxchg() here as they're full word atomic ops and
    frequently used by atomic_xchg() and atomic_cmpxchg().

    (5) asm/bug.h

    Move die() and related bits.

    (6) asm/auxvec.h

    Move AT_VECTOR_SIZE_ARCH here.

    Other arch headers are created as needed on a per-arch basis."

    Fixed up some conflicts from other header file cleanups and moving code
    around that has happened in the meantime, so David's testing is somewhat
    weakened by that. We'll find out anything that got broken and fix it..

    * tag 'split-asm_system_h-for-linus-20120328' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-asm_system: (38 commits)
    Delete all instances of asm/system.h
    Remove all #inclusions of asm/system.h
    Add #includes needed to permit the removal of asm/system.h
    Move all declarations of free_initmem() to linux/mm.h
    Disintegrate asm/system.h for OpenRISC
    Split arch_align_stack() out from asm-generic/system.h
    Split the switch_to() wrapper out of asm-generic/system.h
    Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h
    Create asm-generic/barrier.h
    Make asm-generic/cmpxchg.h #include asm-generic/cmpxchg-local.h
    Disintegrate asm/system.h for Xtensa
    Disintegrate asm/system.h for Unicore32 [based on ver #3, changed by gxt]
    Disintegrate asm/system.h for Tile
    Disintegrate asm/system.h for Sparc
    Disintegrate asm/system.h for SH
    Disintegrate asm/system.h for Score
    Disintegrate asm/system.h for S390
    Disintegrate asm/system.h for PowerPC
    Disintegrate asm/system.h for PA-RISC
    Disintegrate asm/system.h for MN10300
    ...

    Linus Torvalds
     
  • Remove all #inclusions of asm/system.h preparatory to splitting and killing
    it. Performed with the following command:

    perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *`

    Signed-off-by: David Howells

    David Howells
     

27 Mar, 2012

1 commit

  • Fix failure in aa_change_onexec api when the request is made from a confined
    task. This failure was caused by two problems

    The AA_MAY_ONEXEC perm was not being mapped correctly for this case.

    The executable name was being checked as second time instead of using the
    requested onexec profile name, which may not be the same as the exec
    profile name. This mistake can not be exploited to grant extra permission
    because of the above flaw where the ONEXEC permission was not being mapped
    so it will not be granted.

    BugLink: http://bugs.launchpad.net/bugs/963756

    Signed-off-by: John Johansen
    Signed-off-by: James Morris

    John Johansen
     

26 Mar, 2012

1 commit

  • selinux/xfrm.h needs to #include net/flow.h or else suffer:

    In file included from security/selinux/ss/services.c:69:0:
    security/selinux/include/xfrm.h: In function 'selinux_xfrm_notify_policyload':
    security/selinux/include/xfrm.h:53:14: error: 'flow_cache_genid' undeclared (first use in this function)
    security/selinux/include/xfrm.h:53:14: note: each undeclared identifier is reported only once for each function it appears in

    Signed-off-by: David Howells

    David Howells
     

24 Mar, 2012

2 commits

  • No functional changes. It is not sane to use UMH_KILLABLE with enum
    umh_wait, but obviously we do not want another argument in
    call_usermodehelper_* helpers. Kill this enum, use the plain int.

    Signed-off-by: Oleg Nesterov
    Cc: Tetsuo Handa
    Cc: Rusty Russell
    Cc: Tejun Heo
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • A few call_usermodehelper() callers use the hardcoded constant instead of
    the proper UMH_WAIT_PROC, fix them.

    Reported-by: Tetsuo Handa
    Signed-off-by: Oleg Nesterov
    Cc: Lars Ellenberg
    Cc: Greg Kroah-Hartman
    Cc: Michal Januszewski
    Cc: Florian Tobias Schandinat
    Cc: Kentaro Takeda
    Cc: Tetsuo Handa
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

23 Mar, 2012

2 commits

  • Pull NFS client updates for Linux 3.4 from Trond Myklebust:
    "New features include:
    - Add NFS client support for containers.

    This should enable most of the necessary functionality, including
    lockd support, and support for rpc.statd, NFSv4 idmapper and
    RPCSEC_GSS upcalls into the correct network namespace from which
    the mount system call was issued.

    - NFSv4 idmapper scalability improvements

    Base the idmapper cache on the keyring interface to allow
    concurrent access to idmapper entries. Start the process of
    migrating users from the single-threaded daemon-based approach to
    the multi-threaded request-key based approach.

    - NFSv4.1 implementation id.

    Allows the NFSv4.1 client and server to mutually identify each
    other for logging and debugging purposes.

    - Support the 'vers=4.1' mount option for mounting NFSv4.1 instead of
    having to use the more counterintuitive 'vers=4,minorversion=1'.

    - SUNRPC tracepoints.

    Start the process of adding tracepoints in order to improve
    debugging of the RPC layer.

    - pNFS object layout support for autologin.

    Important bugfixes include:

    - Fix a bug in rpc_wake_up/rpc_wake_up_status that caused them to
    fail to wake up all tasks when applied to priority waitqueues.

    - Ensure that we handle read delegations correctly, when we try to
    truncate a file.

    - A number of fixes for NFSv4 state manager loops (mostly to do with
    delegation recovery)."

    * tag 'nfs-for-3.4-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (224 commits)
    NFS: fix sb->s_id in nfs debug prints
    xprtrdma: Remove assumption that each segment is ls_state in release_lockowner
    NFS: ncommit count is being double decremented
    SUNRPC: We must not use list_for_each_entry_safe() in rpc_wake_up()
    Try using machine credentials for RENEW calls
    NFSv4.1: Fix a few issues in filelayout_commit_pagelist
    NFSv4.1: Clean ups and bugfixes for the pNFS read/writeback/commit code
    ...

    Linus Torvalds
     
  • avc_audit() did a lot of jumping around and had a big stack frame, all
    for the uncommon case.

    Split up the uncommon case (which we really can't make go fast anyway)
    into its own slow function, and mark the conditional branches
    appropriately for the common likely case.

    This causes avc_audit() to no longer show up as one of the hottest
    functions on the branch profiles (the new "perf -b" thing), and makes
    the cycle profiles look really nice and dense too.

    The whole audit path is still annoyingly very much one of the biggest
    costs of name lookup, so these things are worth optimizing for. I wish
    we could just tell people to turn it off, but realistically we do need
    it: we just need to make sure that the overhead of the necessary evil is
    as low as possible.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

22 Mar, 2012

3 commits

  • Pull vfs pile 1 from Al Viro:
    "This is _not_ all; in particular, Miklos' and Jan's stuff is not there
    yet."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (64 commits)
    ext4: initialization of ext4_li_mtx needs to be done earlier
    debugfs-related mode_t whack-a-mole
    hfsplus: add an ioctl to bless files
    hfsplus: change finder_info to u32
    hfsplus: initialise userflags
    qnx4: new helper - try_extent()
    qnx4: get rid of qnx4_bread/qnx4_getblk
    take removal of PF_FORKNOEXEC to flush_old_exec()
    trim includes in inode.c
    um: uml_dup_mmap() relies on ->mmap_sem being held, but activate_mm() doesn't hold it
    um: embed ->stub_pages[] into mmu_context
    gadgetfs: list_for_each_safe() misuse
    ocfs2: fix leaks on failure exits in module_init
    ecryptfs: make register_filesystem() the last potential failure exit
    ntfs: forgets to unregister sysctls on register_filesystem() failure
    logfs: missing cleanup on register_filesystem() failure
    jfs: mising cleanup on register_filesystem() failure
    make configfs_pin_fs() return root dentry on success
    configfs: configfs_create_dir() has parent dentry in dentry->d_parent
    configfs: sanitize configfs_create()
    ...

    Linus Torvalds
     
  • Pull security subsystem updates for 3.4 from James Morris:
    "The main addition here is the new Yama security module from Kees Cook,
    which was discussed at the Linux Security Summit last year. Its
    purpose is to collect miscellaneous DAC security enhancements in one
    place. This also marks a departure in policy for LSM modules, which
    were previously limited to being standalone access control systems.
    Chromium OS is using Yama, and I believe there are plans for Ubuntu,
    at least.

    This patchset also includes maintenance updates for AppArmor, TOMOYO
    and others."

    Fix trivial conflict in due to the jumo_label->static_key
    rename.

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (38 commits)
    AppArmor: Fix location of const qualifier on generated string tables
    TOMOYO: Return error if fails to delete a domain
    AppArmor: add const qualifiers to string arrays
    AppArmor: Add ability to load extended policy
    TOMOYO: Return appropriate value to poll().
    AppArmor: Move path failure information into aa_get_name and rename
    AppArmor: Update dfa matching routines.
    AppArmor: Minor cleanup of d_namespace_path to consolidate error handling
    AppArmor: Retrieve the dentry_path for error reporting when path lookup fails
    AppArmor: Add const qualifiers to generated string tables
    AppArmor: Fix oops in policy unpack auditing
    AppArmor: Fix error returned when a path lookup is disconnected
    KEYS: testing wrong bit for KEY_FLAG_REVOKED
    TOMOYO: Fix mount flags checking order.
    security: fix ima kconfig warning
    AppArmor: Fix the error case for chroot relative path name lookup
    AppArmor: fix mapping of META_READ to audit and quiet flags
    AppArmor: Fix underflow in xindex calculation
    AppArmor: Fix dropping of allowed operations that are force audited
    AppArmor: Add mising end of structure test to caps unpacking
    ...

    Linus Torvalds
     
  • Pull kmap_atomic cleanup from Cong Wang.

    It's been in -next for a long time, and it gets rid of the (no longer
    used) second argument to k[un]map_atomic().

    Fix up a few trivial conflicts in various drivers, and do an "evil
    merge" to catch some new uses that have come in since Cong's tree.

    * 'kmap_atomic' of git://github.com/congwang/linux: (59 commits)
    feature-removal-schedule.txt: schedule the deprecated form of kmap_atomic() for removal
    highmem: kill all __kmap_atomic() [swarren@nvidia.com: highmem: Fix ARM build break due to __kmap_atomic rename]
    drbd: remove the second argument of k[un]map_atomic()
    zcache: remove the second argument of k[un]map_atomic()
    gma500: remove the second argument of k[un]map_atomic()
    dm: remove the second argument of k[un]map_atomic()
    tomoyo: remove the second argument of k[un]map_atomic()
    sunrpc: remove the second argument of k[un]map_atomic()
    rds: remove the second argument of k[un]map_atomic()
    net: remove the second argument of k[un]map_atomic()
    mm: remove the second argument of k[un]map_atomic()
    lib: remove the second argument of k[un]map_atomic()
    power: remove the second argument of k[un]map_atomic()
    kdb: remove the second argument of k[un]map_atomic()
    udf: remove the second argument of k[un]map_atomic()
    ubifs: remove the second argument of k[un]map_atomic()
    squashfs: remove the second argument of k[un]map_atomic()
    reiserfs: remove the second argument of k[un]map_atomic()
    ocfs2: remove the second argument of k[un]map_atomic()
    ntfs: remove the second argument of k[un]map_atomic()
    ...

    Linus Torvalds
     

21 Mar, 2012

2 commits

  • Signed-off-by: Al Viro

    Al Viro
     
  • Pull cgroup changes from Tejun Heo:
    "Out of the 8 commits, one fixes a long-standing locking issue around
    tasklist walking and others are cleanups."

    * 'for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
    cgroup: Walk task list under tasklist_lock in cgroup_enable_task_cg_list
    cgroup: Remove wrong comment on cgroup_enable_task_cg_list()
    cgroup: remove cgroup_subsys argument from callbacks
    cgroup: remove extra calls to find_existing_css_set
    cgroup: replace tasklist_lock with rcu_read_lock
    cgroup: simplify double-check locking in cgroup_attach_proc
    cgroup: move struct cgroup_pidlist out from the header file
    cgroup: remove cgroup_attach_task_current_cg()

    Linus Torvalds
     

20 Mar, 2012

4 commits


15 Mar, 2012

4 commits


14 Mar, 2012

7 commits