summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* audit: remove dirlen argument to audit_compare_dname_pathJeff Layton2012-10-124-10/+5
| | | | | | | All the callers set this to NULL now. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* audit: set the name_len in audit_inode for parent lookupsJeff Layton2012-10-128-34/+87
| | | | | | | | | | | | | | | | | | Currently, this gets set mostly by happenstance when we call into audit_inode_child. While that might be a little more efficient, it seems wrong. If the syscall ends up failing before audit_inode_child ever gets called, then you'll have an audit_names record that shows the full path but has the parent inode info attached. Fix this by passing in a parent flag when we call audit_inode that gets set to the value of LOOKUP_PARENT. We can then fix up the pathname for the audit entry correctly from the get-go. While we're at it, clean up the no-op macro for audit_inode in the !CONFIG_AUDITSYSCALL case. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* audit: add a new "type" field to audit_names structJeff Layton2012-10-122-5/+15
| | | | | | | | | | | | | For now, we just have two possibilities: UNKNOWN: for a new audit_names record that we don't know anything about yet NORMAL: for everything else In later patches, we'll add other types so we can distinguish and update records created under different circumstances. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* audit: reverse arguments to audit_inode_childJeff Layton2012-10-125-19/+19
| | | | | | | | | | | | Most of the callers get called with an inode and dentry in the reverse order. The compiler then has to reshuffle the arg registers and/or stack in order to pass them on to audit_inode_child. Reverse those arguments for a micro-optimization. Reported-by: Eric Paris <eparis@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* audit: no need to walk list in audit_inode if name is NULLJeff Layton2012-10-121-1/+5
| | | | | | | | | If name is NULL then the condition in the loop will never be true. Also, with this change, we can eliminate the check for n->name == NULL since the equivalence check will never be true if it is. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* audit: pass in dentry to audit_copy_inode wherever possibleJeff Layton2012-10-121-2/+2
| | | | | | | | In some cases, we were passing in NULL even when we have a dentry. Reported-by: Eric Paris <eparis@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* audit: remove unnecessary NULL ptr checks from do_path_lookupJeff Layton2012-10-121-6/+2
| | | | | | | | | | As best I can tell, whenever retval == 0, nd->path.dentry and nd->inode are also non-NULL. Eliminate those checks and the superfluous audit_context check. Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Merge branch 'for-linus' of ↵Linus Torvalds2012-10-1239-170/+166
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull pile 2 of vfs updates from Al Viro: "Stuff in this one - assorted fixes, lglock tidy-up, death to lock_super(). There'll be a VFS pile tomorrow (with patches from Jeff Layton, sanitizing getname() and related parts of audit and preparing for ESTALE fixes), but I'd rather push the stuff in this one ASAP - some of the bugs closed here are quite unpleasant." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: vfs: bogus warnings in fs/namei.c consitify do_mount() arguments lglock: add DEFINE_STATIC_LGLOCK() lglock: make the per_cpu locks static lglock: remove unused DEFINE_LGLOCK_LOCKDEP() MAX_LFS_FILESIZE definition for 64bit needs LL... tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checking vfs: drop lock/unlock super ufs: drop lock/unlock super sysv: drop lock/unlock super hpfs: drop lock/unlock super fat: drop lock/unlock super ext3: drop lock/unlock super exofs: drop lock/unlock super dup3: Return an error when oldfd == newfd. fs: handle failed audit_log_start properly fs: prevent use after free in auditing when symlink following was denied
| * vfs: bogus warnings in fs/namei.cArnd Bergmann2012-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The follow_link() function always initializes its *p argument, or returns an error, but when building with 'gcc -s', the compiler gets confused by the __always_inline attribute to the function and can no longer detect where the cookie was initialized. The solution is to always initialize the pointer from follow_link, even in the error path. When building with -O2, this has zero impact on generated code and adds a single instruction in the error path for a -Os build on ARM. Without this patch, building with gcc-4.6 through gcc-4.8 and CONFIG_CC_OPTIMIZE_FOR_SIZE results in: fs/namei.c: In function 'link_path_walk': fs/namei.c:649:24: warning: 'cookie' may be used uninitialized in this function [-Wuninitialized] fs/namei.c:1544:9: note: 'cookie' was declared here fs/namei.c: In function 'path_lookupat': fs/namei.c:649:24: warning: 'cookie' may be used uninitialized in this function [-Wuninitialized] fs/namei.c:1934:10: note: 'cookie' was declared here fs/namei.c: In function 'path_openat': fs/namei.c:649:24: warning: 'cookie' may be used uninitialized in this function [-Wuninitialized] fs/namei.c:2899:9: note: 'cookie' was declared here Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * consitify do_mount() argumentsAl Viro2012-10-1110-26/+27
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * lglock: add DEFINE_STATIC_LGLOCK()Lai Jiangshan2012-10-102-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | When the lglock doesn't need to be exported we can use DEFINE_STATIC_LGLOCK(). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * lglock: make the per_cpu locks staticLai Jiangshan2012-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The per_cpu locks are not used outside the file which contains the DEFINE_LGLOCK(), so we can make these symbols static. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * lglock: remove unused DEFINE_LGLOCK_LOCKDEP()Lai Jiangshan2012-10-101-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | struct lglocks use their own lock_key/lock_dep_map which are defined in struct lglock. DEFINE_LGLOCK_LOCKDEP() is unused, so remove it and save a small piece of memory. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * MAX_LFS_FILESIZE definition for 64bit needs LL...Al Viro2012-10-101-1/+1
| | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * tmpfs,ceph,gfs2,isofs,reiserfs,xfs: fix fh_len checkingHugh Dickins2012-10-096-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fuzzing with trinity oopsed on the 1st instruction of shmem_fh_to_dentry(), u64 inum = fid->raw[2]; which is unhelpfully reported as at the end of shmem_alloc_inode(): BUG: unable to handle kernel paging request at ffff880061cd3000 IP: [<ffffffff812190d0>] shmem_alloc_inode+0x40/0x40 Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC Call Trace: [<ffffffff81488649>] ? exportfs_decode_fh+0x79/0x2d0 [<ffffffff812d77c3>] do_handle_open+0x163/0x2c0 [<ffffffff812d792c>] sys_open_by_handle_at+0xc/0x10 [<ffffffff83a5f3f8>] tracesys+0xe1/0xe6 Right, tmpfs is being stupid to access fid->raw[2] before validating that fh_len includes it: the buffer kmalloc'ed by do_sys_name_to_handle() may fall at the end of a page, and the next page not be present. But some other filesystems (ceph, gfs2, isofs, reiserfs, xfs) are being careless about fh_len too, in fh_to_dentry() and/or fh_to_parent(), and could oops in the same way: add the missing fh_len checks to those. Reported-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Sage Weil <sage@inktank.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: stable@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * vfs: drop lock/unlock superMarco Stornelli2012-10-092-24/+0
| | | | | | | | | | | | | | Removed s_lock from super_block and removed lock/unlock super. Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ufs: drop lock/unlock superMarco Stornelli2012-10-094-33/+35
| | | | | | | | | | | | | | Removed lock/unlock super. Added a new private s_lock mutex. Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * sysv: drop lock/unlock superMarco Stornelli2012-10-095-18/+20
| | | | | | | | | | | | | | Removed lock/unlock super. Added a new private s_lock mutex. Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * hpfs: drop lock/unlock superMarco Stornelli2012-10-091-3/+0
| | | | | | | | | | | | | | | | Removed lock/unlock super. Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Acked-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fat: drop lock/unlock superMarco Stornelli2012-10-095-34/+36
| | | | | | | | | | | | | | Removed lock/unlock super. Added a new private s_lock mutex. Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * ext3: drop lock/unlock superMarco Stornelli2012-10-091-6/+0
| | | | | | | | | | | | | | | | Removed lock/unlock super. Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * exofs: drop lock/unlock superMarco Stornelli2012-10-091-4/+0
| | | | | | | | | | | | | | | | | | Removed lock/unlock super. Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Acked-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * dup3: Return an error when oldfd == newfd.Richard W.M. Jones2012-10-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have tested the attached patch to fix the dup3 regression. Rich. From 0944e30e12dec6544b3602626b60ff412375c78f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" <rjones@redhat.com> Date: Tue, 9 Oct 2012 14:42:45 +0100 Subject: [PATCH] dup3: Return an error when oldfd == newfd. The following commit: commit fe17f22d7fd0e344ef6447238f799bb49f670c6f Author: Al Viro <viro@zeniv.linux.org.uk> Date: Tue Aug 21 11:48:11 2012 -0400 take purely descriptor-related stuff from fcntl.c to file.c was supposed to be just code motion, but it dropped the following two lines: if (unlikely(oldfd == newfd)) return -EINVAL; from the dup3 system call. dup3 is not specified by POSIX, so Linux can do what it likes. However the POSIX proposal for dup3 [1] states that it should return an error if oldfd == newfd. [1] http://austingroupbugs.net/view.php?id=411 Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Tested-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: handle failed audit_log_start properlySasha Levin2012-10-091-0/+2
| | | | | | | | | | | | | | | | | | | | audit_log_start() may return NULL, this is unchecked by the caller in audit_log_link_denied() and could cause a NULL ptr deref. Introduced by commit a51d9eaa ("fs: add link restriction audit reporting"). Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * fs: prevent use after free in auditing when symlink following was deniedSasha Levin2012-10-091-1/+1
| | | | | | | | | | | | | | | | | | Commit "fs: add link restriction audit reporting" has added auditing of failed attempts to follow symlinks. Unfortunately, the auditing was being done after the struct path structure was released earlier. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | Merge branch 'for-linus' of ↵Linus Torvalds2012-10-1299-882/+344
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal Pull pile 2 of execve and kernel_thread unification work from Al Viro: "Stuff in there: kernel_thread/kernel_execve/sys_execve conversions for several more architectures plus assorted signal fixes and cleanups. There'll be more (in particular, real fixes for the alpha do_notify_resume() irq mess)..." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (43 commits) alpha: don't open-code trace_report_syscall_{enter,exit} Uninclude linux/freezer.h m32r: trim masks avr32: trim masks tile: don't bother with SIGTRAP in setup_frame microblaze: don't bother with SIGTRAP in setup_rt_frame() mn10300: don't bother with SIGTRAP in setup_frame() frv: no need to raise SIGTRAP in setup_frame() x86: get rid of duplicate code in case of CONFIG_VM86 unicore32: remove pointless test h8300: trim _TIF_WORK_MASK parisc: decide whether to go to slow path (tracesys) based on thread flags parisc: don't bother looping in do_signal() parisc: fix double restarts bury the rest of TIF_IRET sanitize tsk_is_polling() bury _TIF_RESTORE_SIGMASK unicore32: unobfuscate _TIF_WORK_MASK mips: NOTIFY_RESUME is not needed in TIF masks mips: merge the identical "return from syscall" per-ABI code ... Conflicts: arch/arm/include/asm/thread_info.h
| * | alpha: don't open-code trace_report_syscall_{enter,exit}Al Viro2012-10-012-26/+19
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | Uninclude linux/freezer.hRichard Weinberger2012-10-0112-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | This include is no longer needed. (seems to be a leftover from try_to_freeze()) Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | m32r: trim masksAl Viro2012-10-011-2/+2
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | avr32: trim masksAl Viro2012-10-011-7/+6
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | tile: don't bother with SIGTRAP in setup_frameAl Viro2012-10-012-19/+2
| | | | | | | | | | | | | | | | | | Tell signal_delivered() to do it instead. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | microblaze: don't bother with SIGTRAP in setup_rt_frame()Al Viro2012-10-011-5/+2
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | mn10300: don't bother with SIGTRAP in setup_frame()Al Viro2012-10-011-8/+0
| | | | | | | | | | | | | | | | | | ... just tell signal_delivered() to do it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | frv: no need to raise SIGTRAP in setup_frame()Al Viro2012-10-011-8/+0
| | | | | | | | | | | | | | | | | | signal_delivered() will do it in the same case... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | x86: get rid of duplicate code in case of CONFIG_VM86Al Viro2012-10-011-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | no need to have the call of do_notify_resume() + checks around it duplicated for vm86 case - a bit of rearranging of ifdefs and we'll have a perfectly fine copy to jump back to. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | unicore32: remove pointless testAl Viro2012-10-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | we can get into work_pending only if at least one of NEED_RESCHED, SIGPENDING or NOTIFY_RESUME is set. So once we'd found no NEED_RESCHED, there's no need to check that one of the other two is set. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | h8300: trim _TIF_WORK_MASKAl Viro2012-10-011-1/+2
| | | | | | | | | | | | | | | | | | | | | Only the three usual flags (NEED_RESCHED/SIGPENDING/NOTIFY_RESUME) are looked at in the code checking _TIF_WORK_MASK on that one. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | parisc: decide whether to go to slow path (tracesys) based on thread flagsAl Viro2012-10-012-3/+6
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | parisc: don't bother looping in do_signal()Al Viro2012-10-011-22/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entry.S code had been looping until no pending signals are left since 2005 anyway; no need to bother with that in do_signal() itself. If the failure to set a sigframe up raises SIGSEGV, we'll just pick it up the next time around the loop(s) in entry.S anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | parisc: fix double restartsAl Viro2012-10-013-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | Don't bother restoring r28 on syscall restarts; it's clobbered by syscall anyway. Reuse (now unused) ->orig_r28 as "no restarts allowed" flag. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | bury the rest of TIF_IRETAl Viro2012-10-015-10/+0
| | | | | | | | | | | | | | | | | | Some architectures had blindly copied it for no reason whatsoever. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | sanitize tsk_is_polling()Al Viro2012-10-0126-38/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make default just return 0. The current default (checking TIF_POLLING_NRFLAG) is taken to architectures that need it; ones that don't do polling in their idle threads don't need to defined TIF_POLLING_NRFLAG at all. ia64 defined both TS_POLLING (used by its tsk_is_polling()) and TIF_POLLING_NRFLAG (not used at all). Killed the latter... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | bury _TIF_RESTORE_SIGMASKAl Viro2012-10-0117-17/+0
| | | | | | | | | | | | | | | | | | never used... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | unicore32: unobfuscate _TIF_WORK_MASKAl Viro2012-10-011-1/+2
| | | | | | | | | | | | | | | | | | bits 3..7 in flags are never set there, so this 0xff is pointless Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | mips: NOTIFY_RESUME is not needed in TIF masksAl Viro2012-10-011-2/+1
| | | | | | | | | | | | | | | | | | | | | If it's set, SIGPENDING is also set. And SIGPENDING is present in the masks... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | mips: merge the identical "return from syscall" per-ABI codeAl Viro2012-10-015-51/+13
| | | | | | | | | | | | | | | | | | | | | No need to keep 4 copies of that stuff; merged and taken to entry.S, unused public symbols there killed off. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | mips: unobfuscate _TIF..._MASKAl Viro2012-10-011-3/+4
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | mips: prevent hitting do_notify_resume() with !user_mode(regs)Al Viro2012-10-012-8/+3
| | | | | | | | | | | | | | | | | | too late to do anything there... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ia64: can't reach do_signal() when returning to kernel modeAl Viro2012-10-011-8/+0
| | | | | | | | | | | | Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | score: fix bogus restarts on sigreturn()Al Viro2012-10-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | we *really* don't want to have restart logics hit when we are returning from sigreturn() - random replacement of %r4 with -4 just because a signal had been noticed from timer interrupt that came when %r4 happened to contain -514 is not nice at all. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
OpenPOWER on IntegriCloud