Merge branch 'master' into next
authorJames Morris <jmorris@namei.org>
Mon, 8 Jun 2009 23:27:53 +0000 (09:27 +1000)
committerJames Morris <jmorris@namei.org>
Mon, 8 Jun 2009 23:27:53 +0000 (09:27 +1000)
1  2 
Documentation/kernel-parameters.txt
fs/nfsd/vfs.c
fs/proc/base.c
kernel/ptrace.c

@@@ -914,12 -914,6 +914,12 @@@ and is between 256 and 4096 characters
                        Formt: { "sha1" | "md5" }
                        default: "sha1"
  
 +      ima_tcb         [IMA]
 +                      Load a policy which meets the needs of the Trusted
 +                      Computing Base.  This means IMA will measure all
 +                      programs exec'd, files mmap'd for exec, and all files
 +                      opened for read by uid=0.
 +
        in2000=         [HW,SCSI]
                        See header of drivers/scsi/in2000.c.
  
                        register save and restore. The kernel will only save
                        legacy floating-point registers on task switch.
  
+       noxsave         [BUGS=X86] Disables x86 extended register state save
+                       and restore using xsave. The kernel will fallback to
+                       enabling legacy floating-point and sse state.
        nohlt           [BUGS=ARM,SH] Tells the kernel that the sleep(SH) or
                        wfi(ARM) instruction doesn't work correctly and not to
                        use it. This is also useful when using JTAG debugger.
diff --combined fs/nfsd/vfs.c
@@@ -55,7 -55,6 +55,7 @@@
  #include <linux/security.h>
  #endif /* CONFIG_NFSD_V4 */
  #include <linux/jhash.h>
 +#include <linux/ima.h>
  
  #include <asm/uaccess.h>
  
@@@ -736,8 -735,6 +736,8 @@@ nfsd_open(struct svc_rqst *rqstp, struc
                            flags, cred);
        if (IS_ERR(*filp))
                host_err = PTR_ERR(*filp);
 +      else
 +              ima_counts_get(*filp);
  out_nfserr:
        err = nfserrno(host_err);
  out:
@@@ -1018,6 -1015,7 +1018,7 @@@ nfsd_vfs_write(struct svc_rqst *rqstp, 
        host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset);
        set_fs(oldfs);
        if (host_err >= 0) {
+               *cnt = host_err;
                nfsdstats.io_write += host_err;
                fsnotify_modify(file->f_path.dentry);
        }
        }
  
        dprintk("nfsd: write complete host_err=%d\n", host_err);
-       if (host_err >= 0) {
+       if (host_err >= 0)
                err = 0;
-               *cnt = host_err;
-       } else
+       else
                err = nfserrno(host_err);
  out:
        return err;
@@@ -2027,7 -2024,6 +2027,7 @@@ nfsd_permission(struct svc_rqst *rqstp
                                        struct dentry *dentry, int acc)
  {
        struct inode    *inode = dentry->d_inode;
 +      struct path     path;
        int             err;
  
        if (acc == NFSD_MAY_NOP)
        if (err == -EACCES && S_ISREG(inode->i_mode) &&
            acc == (NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE))
                err = inode_permission(inode, MAY_EXEC);
 +      if (err)
 +              goto nfsd_out;
  
 +      /* Do integrity (permission) checking now, but defer incrementing
 +       * IMA counts to the actual file open.
 +       */
 +      path.mnt = exp->ex_path.mnt;
 +      path.dentry = dentry;
 +      err = ima_path_check(&path, acc & (MAY_READ | MAY_WRITE | MAY_EXEC),
 +                           IMA_COUNT_LEAVE);
 +nfsd_out:
        return err? nfserrno(err) : 0;
  }
  
diff --combined fs/proc/base.c
@@@ -1956,7 -1956,7 +1956,7 @@@ static struct dentry *proc_pident_insta
        const struct pid_entry *p = ptr;
        struct inode *inode;
        struct proc_inode *ei;
-       struct dentry *error = ERR_PTR(-EINVAL);
+       struct dentry *error = ERR_PTR(-ENOENT);
  
        inode = proc_pid_make_inode(dir->i_sb, task);
        if (!inode)
@@@ -2128,15 -2128,9 +2128,15 @@@ static ssize_t proc_pid_attr_write(stru
        if (copy_from_user(page, buf, count))
                goto out_free;
  
 +      /* Guard against adverse ptrace interaction */
 +      length = mutex_lock_interruptible(&task->cred_guard_mutex);
 +      if (length < 0)
 +              goto out_free;
 +
        length = security_setprocattr(task,
                                      (char*)file->f_path.dentry->d_name.name,
                                      (void*)page, count);
 +      mutex_unlock(&task->cred_guard_mutex);
  out_free:
        free_page((unsigned long) page);
  out:
diff --combined kernel/ptrace.c
@@@ -185,11 -185,10 +185,11 @@@ int ptrace_attach(struct task_struct *t
        if (same_thread_group(task, current))
                goto out;
  
 -      /* Protect exec's credential calculations against our interference;
 -       * SUID, SGID and LSM creds get determined differently under ptrace.
 +      /* Protect the target's credential calculations against our
 +       * interference; SUID, SGID and LSM creds get determined differently
 +       * under ptrace.
         */
 -      retval = mutex_lock_interruptible(&task->cred_exec_mutex);
 +      retval = mutex_lock_interruptible(&task->cred_guard_mutex);
        if (retval  < 0)
                goto out;
  
@@@ -233,7 -232,7 +233,7 @@@ repeat
  bad:
        write_unlock_irqrestore(&tasklist_lock, flags);
        task_unlock(task);
 -      mutex_unlock(&task->cred_exec_mutex);
 +      mutex_unlock(&task->cred_guard_mutex);
  out:
        return retval;
  }
@@@ -305,6 -304,8 +305,8 @@@ int ptrace_detach(struct task_struct *c
        if (child->ptrace) {
                child->exit_code = data;
                dead = __ptrace_detach(current, child);
+               if (!child->exit_state)
+                       wake_up_process(child);
        }
        write_unlock_irq(&tasklist_lock);