]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'for-linus' of git://selinuxproject.org/~jmorris/linux-security
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Jan 2012 05:51:23 +0000 (21:51 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Jan 2012 05:51:23 +0000 (21:51 -0800)
* 'for-linus' of git://selinuxproject.org/~jmorris/linux-security: (32 commits)
  ima: fix invalid memory reference
  ima: free duplicate measurement memory
  security: update security_file_mmap() docs
  selinux: Casting (void *) value returned by kmalloc is useless
  apparmor: fix module parameter handling
  Security: tomoyo: add .gitignore file
  tomoyo: add missing rcu_dereference()
  apparmor: add missing rcu_dereference()
  evm: prevent racing during tfm allocation
  evm: key must be set once during initialization
  mpi/mpi-mpow: NULL dereference on allocation failure
  digsig: build dependency fix
  KEYS: Give key types their own lockdep class for key->sem
  TPM: fix transmit_cmd error logic
  TPM: NSC and TIS drivers X86 dependency fix
  TPM: Export wait_for_stat for other vendor specific drivers
  TPM: Use vendor specific function for status probe
  tpm_tis: add delay after aborting command
  tpm_tis: Check return code from getting timeouts/durations
  tpm: Introduce function to poll for result of self test
  ...

Fix up trivial conflict in lib/Makefile due to addition of CONFIG_MPI
and SIGSIG next to CONFIG_DQL addition.

1  2 
include/linux/security.h
lib/Kconfig
lib/Makefile
security/apparmor/lsm.c
security/tomoyo/common.h

diff --combined include/linux/security.h
index 98112cf93884e9d6ed84266841d96664907dccb6,dd5bbe88d6ee33fe61c77613f34bb4f765cf2107..0ccceb9b104640f91e9738c7b467e0da1a74c7b8
@@@ -186,7 -186,7 +186,7 @@@ static inline void security_free_mnt_op
   * Security module identifier.
   *
   * @name:
 - *    A string that acts as a unique identifeir for the LSM with max number
 + *    A string that acts as a unique identifier for the LSM with max number
   *    of characters = SECURITY_NAME_MAX.
   *
   * Security hooks for program execution operations.
   *    @copy copied data which will be passed to the security module.
   *    Returns 0 if the copy was successful.
   * @sb_remount:
 - *    Extracts security system specifc mount options and verifys no changes
 + *    Extracts security system specific mount options and verifies no changes
   *    are being made to those options.
   *    @sb superblock being remounted
   *    @data contains the filesystem-specific data.
   *    Return 0 if permission is granted.
   * @inode_mkdir:
   *    Check permissions to create a new directory in the existing directory
 - *    associated with inode strcture @dir.
 - *    @dir containst the inode structure of parent of the directory to be created.
 + *    associated with inode structure @dir.
 + *    @dir contains the inode structure of parent of the directory to be created.
   *    @dentry contains the dentry structure of new directory.
   *    @mode contains the mode of new directory.
   *    Return 0 if permission is granted.
   * @path_mkdir:
   *    Check permissions to create a new directory in the existing directory
 - *    associated with path strcture @path.
 - *    @dir containst the path structure of parent of the directory
 + *    associated with path structure @path.
 + *    @dir contains the path structure of parent of the directory
   *    to be created.
   *    @dentry contains the dentry structure of new directory.
   *    @mode contains the mode of new directory.
   *    @file contains the file structure.
   *    @cmd contains the operation to perform.
   *    @arg contains the operational arguments.
 - *    Check permission for an ioctl operation on @file.  Note that @arg can
 + *    Check permission for an ioctl operation on @file.  Note that @arg
   *    sometimes represents a user space pointer; in other cases, it may be a
   *    simple integer value.  When @arg represents a user space pointer, it
   *    should never be used by the security module.
   *    @reqprot contains the protection requested by the application.
   *    @prot contains the protection that will be applied by the kernel.
   *    @flags contains the operational flags.
+  *    @addr contains virtual address that will be used for the operation.
+  *    @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1.
   *    Return 0 if permission is granted.
   * @file_mprotect:
   *    Check permissions before changing memory access permissions.
   *    Return 0 if permission is granted.
   * @file_fcntl:
   *    Check permission before allowing the file operation specified by @cmd
 - *    from being performed on the file @file.  Note that @arg can sometimes
 + *    from being performed on the file @file.  Note that @arg sometimes
   *    represents a user space pointer; in other cases, it may be a simple
   *    integer value.  When @arg represents a user space pointer, it should
   *    never be used by the security module.
   *    information can be saved using the eff_cap field of the
   *    netlink_skb_parms structure.  Also may be used to provide fine
   *    grained control over message transmission.
 - *    @sk associated sock of task sending the message.,
 + *    @sk associated sock of task sending the message.
   *    @skb contains the sk_buff structure for the netlink message.
   *    Return 0 if the information was successfully saved and message
   *    is allowed to be transmitted.
   *    should free it.
   *    @key points to the key to be queried.
   *    @_buffer points to a pointer that should be set to point to the
 - *     resulting string (if no label or an error occurs).
 + *    resulting string (if no label or an error occurs).
   *    Return the length of the string (including terminating NUL) or -ve if
 - *      an error.
 + *    an error.
   *    May also return 0 (and a NULL buffer pointer) if there is no label.
   *
   * Security hooks affecting all System V IPC operations.
   *    credentials.
   *    @tsk contains the task_struct for the process.
   *    @cred contains the credentials to use.
 - *      @ns contains the user namespace we want the capability in
 + *    @ns contains the user namespace we want the capability in
   *    @cap contains the capability <include/linux/capability.h>.
   *    @audit: Whether to write an audit message or not
   *    Return 0 if the capability is granted for @tsk.
   *    @ctxlen contains the length of @ctx.
   *
   * @inode_getsecctx:
 - *    Returns a string containing all relavent security context information
 + *    Returns a string containing all relevant security context information
   *
   *    @inode we wish to get the security context of.
   *    @ctx is a pointer in which to place the allocated security context.
@@@ -1424,9 -1426,9 +1426,9 @@@ struct security_operations 
  
  #ifdef CONFIG_SECURITY_PATH
        int (*path_unlink) (struct path *dir, struct dentry *dentry);
 -      int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode);
 +      int (*path_mkdir) (struct path *dir, struct dentry *dentry, umode_t mode);
        int (*path_rmdir) (struct path *dir, struct dentry *dentry);
 -      int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
 +      int (*path_mknod) (struct path *dir, struct dentry *dentry, umode_t mode,
                           unsigned int dev);
        int (*path_truncate) (struct path *path);
        int (*path_symlink) (struct path *dir, struct dentry *dentry,
                          struct dentry *new_dentry);
        int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
                            struct path *new_dir, struct dentry *new_dentry);
 -      int (*path_chmod) (struct dentry *dentry, struct vfsmount *mnt,
 -                         mode_t mode);
 +      int (*path_chmod) (struct path *path, umode_t mode);
        int (*path_chown) (struct path *path, uid_t uid, gid_t gid);
        int (*path_chroot) (struct path *path);
  #endif
                                    const struct qstr *qstr, char **name,
                                    void **value, size_t *len);
        int (*inode_create) (struct inode *dir,
 -                           struct dentry *dentry, int mode);
 +                           struct dentry *dentry, umode_t mode);
        int (*inode_link) (struct dentry *old_dentry,
                           struct inode *dir, struct dentry *new_dentry);
        int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
        int (*inode_symlink) (struct inode *dir,
                              struct dentry *dentry, const char *old_name);
 -      int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
 +      int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, umode_t mode);
        int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
        int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
 -                          int mode, dev_t dev);
 +                          umode_t mode, dev_t dev);
        int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
                             struct inode *new_dir, struct dentry *new_dentry);
        int (*inode_readlink) (struct dentry *dentry);
@@@ -1715,15 -1718,15 +1717,15 @@@ int security_inode_init_security(struc
  int security_old_inode_init_security(struct inode *inode, struct inode *dir,
                                     const struct qstr *qstr, char **name,
                                     void **value, size_t *len);
 -int security_inode_create(struct inode *dir, struct dentry *dentry, int mode);
 +int security_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode);
  int security_inode_link(struct dentry *old_dentry, struct inode *dir,
                         struct dentry *new_dentry);
  int security_inode_unlink(struct inode *dir, struct dentry *dentry);
  int security_inode_symlink(struct inode *dir, struct dentry *dentry,
                           const char *old_name);
 -int security_inode_mkdir(struct inode *dir, struct dentry *dentry, int mode);
 +int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode);
  int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
 -int security_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev);
 +int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
  int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
                          struct inode *new_dir, struct dentry *new_dentry);
  int security_inode_readlink(struct dentry *dentry);
@@@ -2043,7 -2046,7 +2045,7 @@@ static inline void security_inode_free(
  static inline int security_inode_init_security(struct inode *inode,
                                                struct inode *dir,
                                                const struct qstr *qstr,
-                                               initxattrs initxattrs,
+                                               const initxattrs initxattrs,
                                                void *fs_data)
  {
        return 0;
@@@ -2060,7 -2063,7 +2062,7 @@@ static inline int security_old_inode_in
  
  static inline int security_inode_create(struct inode *dir,
                                         struct dentry *dentry,
 -                                       int mode)
 +                                       umode_t mode)
  {
        return 0;
  }
@@@ -2854,9 -2857,9 +2856,9 @@@ static inline void security_skb_classif
  
  #ifdef CONFIG_SECURITY_PATH
  int security_path_unlink(struct path *dir, struct dentry *dentry);
 -int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
 +int security_path_mkdir(struct path *dir, struct dentry *dentry, umode_t mode);
  int security_path_rmdir(struct path *dir, struct dentry *dentry);
 -int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
 +int security_path_mknod(struct path *dir, struct dentry *dentry, umode_t mode,
                        unsigned int dev);
  int security_path_truncate(struct path *path);
  int security_path_symlink(struct path *dir, struct dentry *dentry,
@@@ -2865,7 -2868,8 +2867,7 @@@ int security_path_link(struct dentry *o
                       struct dentry *new_dentry);
  int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
                         struct path *new_dir, struct dentry *new_dentry);
 -int security_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
 -                      mode_t mode);
 +int security_path_chmod(struct path *path, umode_t mode);
  int security_path_chown(struct path *path, uid_t uid, gid_t gid);
  int security_path_chroot(struct path *path);
  #else /* CONFIG_SECURITY_PATH */
@@@ -2875,7 -2879,7 +2877,7 @@@ static inline int security_path_unlink(
  }
  
  static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
 -                                    int mode)
 +                                    umode_t mode)
  {
        return 0;
  }
@@@ -2886,7 -2890,7 +2888,7 @@@ static inline int security_path_rmdir(s
  }
  
  static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
 -                                    int mode, unsigned int dev)
 +                                    umode_t mode, unsigned int dev)
  {
        return 0;
  }
@@@ -2917,7 -2921,9 +2919,7 @@@ static inline int security_path_rename(
        return 0;
  }
  
 -static inline int security_path_chmod(struct dentry *dentry,
 -                                    struct vfsmount *mnt,
 -                                    mode_t mode)
 +static inline int security_path_chmod(struct path *path, umode_t mode)
  {
        return 0;
  }
@@@ -3006,7 -3012,7 +3008,7 @@@ static inline void security_audit_rule_
  
  #ifdef CONFIG_SECURITYFS
  
 -extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
 +extern struct dentry *securityfs_create_file(const char *name, umode_t mode,
                                             struct dentry *parent, void *data,
                                             const struct file_operations *fops);
  extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
@@@ -3021,7 -3027,7 +3023,7 @@@ static inline struct dentry *securityfs
  }
  
  static inline struct dentry *securityfs_create_file(const char *name,
 -                                                  mode_t mode,
 +                                                  umode_t mode,
                                                    struct dentry *parent,
                                                    void *data,
                                                    const struct file_operations *fops)
diff --combined lib/Kconfig
index 7f6b8bca8c25b51bd0f528a8feb136d703c422ae,5634e473ff6d56f9fd59ec589baed5bdf4371d90..201e1b33d721bf2ff83e6cd5ca817ea243861c39
@@@ -19,13 -19,6 +19,13 @@@ config RATIONA
  config GENERIC_FIND_FIRST_BIT
        bool
  
 +config GENERIC_PCI_IOMAP
 +      bool
 +
 +config GENERIC_IOMAP
 +      bool
 +      select GENERIC_PCI_IOMAP
 +
  config CRC_CCITT
        tristate "CRC-CCITT functions"
        help
@@@ -251,9 -244,6 +251,9 @@@ config CPU_RMA
        bool
        depends on SMP
  
 +config DQL
 +      bool
 +
  #
  # Netlink attribute parsing support is select'ed if needed
  #
@@@ -280,9 -270,35 +280,34 @@@ config AVERAG
          If unsure, say N.
  
  config CORDIC
 -      tristate "Cordic function"
 +      tristate "CORDIC algorithm"
        help
 -        The option provides arithmetic function using cordic algorithm
 -        so its calculations are in fixed point. Modules can select this
 -        when they require this function. Module will be called cordic.
 +        This option provides an implementation of the CORDIC algorithm;
 +        calculations are in fixed point. Module will be called cordic.
  
+ config MPILIB
+       tristate "Multiprecision maths library"
+       help
+         Multiprecision maths library from GnuPG.
+         It is used to implement RSA digital signature verification,
+         which is used by IMA/EVM digital signature extension.
+ config MPILIB_EXTRA
+       bool "Multiprecision maths library - additional sources"
+       depends on MPILIB
+       help
+         Multiprecision maths library from GnuPG.
+         It is used to implement RSA digital signature verification,
+         which is used by IMA/EVM digital signature extension.
+         This code in unnecessary for RSA digital signature verification,
+         and can be compiled if needed.
+ config DIGSIG
+       tristate "In-kernel signature checker"
+       depends on KEYS
+       select MPILIB
+       help
+         Digital signature verification. Currently only RSA is supported.
+         Implementation is done using GnuPG MPI library
  endmenu
diff --combined lib/Makefile
index 884ed376164d2ea688d7251fa503a4e86db3ca61,0f5cff267aff41261b3679a3aa46916ab2a6ee8d..dace162c7e1c2f063498ded701e5576f3c16b75a
@@@ -17,7 -17,7 +17,7 @@@ lib-y := ctype.o string.o vsprintf.o cm
  lib-$(CONFIG_MMU) += ioremap.o
  lib-$(CONFIG_SMP) += cpumask.o
  
 -lib-y += kobject.o kref.o klist.o
 +lib-y += kobject.o klist.o
  
  obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
         bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
@@@ -33,7 -33,6 +33,7 @@@ endi
  
  lib-$(CONFIG_HOTPLUG) += kobject_uevent.o
  obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
 +obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
  obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
  obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
  obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
@@@ -116,8 -115,9 +116,11 @@@ obj-$(CONFIG_CPU_RMAP) += cpu_rmap.
  
  obj-$(CONFIG_CORDIC) += cordic.o
  
 +obj-$(CONFIG_DQL) += dynamic_queue_limits.o
 +
+ obj-$(CONFIG_MPILIB) += mpi/
+ obj-$(CONFIG_DIGSIG) += digsig.o
  hostprogs-y   := gen_crc32table
  clean-files   := crc32table.h
  
diff --combined security/apparmor/lsm.c
index 2c0a0ff413991f2ab73480017db4d28e84eab3f2,41ae0c6cb903e17941a7ac915ad707d06072de3b..d7f06f8b283721df6f450bff880aa6d87a40bb50
@@@ -262,7 -262,7 +262,7 @@@ static int apparmor_path_unlink(struct 
  }
  
  static int apparmor_path_mkdir(struct path *dir, struct dentry *dentry,
 -                             int mode)
 +                             umode_t mode)
  {
        return common_perm_create(OP_MKDIR, dir, dentry, AA_MAY_CREATE,
                                  S_IFDIR);
@@@ -274,7 -274,7 +274,7 @@@ static int apparmor_path_rmdir(struct p
  }
  
  static int apparmor_path_mknod(struct path *dir, struct dentry *dentry,
 -                             int mode, unsigned int dev)
 +                             umode_t mode, unsigned int dev)
  {
        return common_perm_create(OP_MKNOD, dir, dentry, AA_MAY_CREATE, mode);
  }
@@@ -344,12 -344,13 +344,12 @@@ static int apparmor_path_rename(struct 
        return error;
  }
  
 -static int apparmor_path_chmod(struct dentry *dentry, struct vfsmount *mnt,
 -                             mode_t mode)
 +static int apparmor_path_chmod(struct path *path, umode_t mode)
  {
 -      if (!mediated_filesystem(dentry->d_inode))
 +      if (!mediated_filesystem(path->dentry->d_inode))
                return 0;
  
 -      return common_perm_mnt_dentry(OP_CHMOD, mnt, dentry, AA_MAY_CHMOD);
 +      return common_perm_mnt_dentry(OP_CHMOD, path->mnt, path->dentry, AA_MAY_CHMOD);
  }
  
  static int apparmor_path_chown(struct path *path, uid_t uid, gid_t gid)
@@@ -670,7 -671,7 +670,7 @@@ static struct security_operations appar
  
  static int param_set_aabool(const char *val, const struct kernel_param *kp);
  static int param_get_aabool(char *buffer, const struct kernel_param *kp);
- #define param_check_aabool(name, p) __param_check(name, p, int)
+ #define param_check_aabool param_check_bool
  static struct kernel_param_ops param_ops_aabool = {
        .set = param_set_aabool,
        .get = param_get_aabool
  
  static int param_set_aauint(const char *val, const struct kernel_param *kp);
  static int param_get_aauint(char *buffer, const struct kernel_param *kp);
- #define param_check_aauint(name, p) __param_check(name, p, int)
+ #define param_check_aauint param_check_uint
  static struct kernel_param_ops param_ops_aauint = {
        .set = param_set_aauint,
        .get = param_get_aauint
  
  static int param_set_aalockpolicy(const char *val, const struct kernel_param *kp);
  static int param_get_aalockpolicy(char *buffer, const struct kernel_param *kp);
- #define param_check_aalockpolicy(name, p) __param_check(name, p, int)
+ #define param_check_aalockpolicy param_check_bool
  static struct kernel_param_ops param_ops_aalockpolicy = {
        .set = param_set_aalockpolicy,
        .get = param_get_aalockpolicy
diff --combined security/tomoyo/common.h
index deeab7be5b9747a93f57ac1024bf4c48792ccacc,cb9f5c2d6f3ab6c27d6a79f3f7c8786a5cb82ad7..9512222d558181d5b14be1c6716d9be5d42015f4
@@@ -564,7 -564,7 +564,7 @@@ struct tomoyo_mini_stat 
        uid_t uid;
        gid_t gid;
        ino_t ino;
 -      mode_t mode;
 +      umode_t mode;
        dev_t dev;
        dev_t rdev;
  };
@@@ -1122,7 -1122,7 +1122,7 @@@ static inline pid_t tomoyo_sys_getppid(
  {
        pid_t pid;
        rcu_read_lock();
-       pid = task_tgid_vnr(current->real_parent);
+       pid = task_tgid_vnr(rcu_dereference(current->real_parent));
        rcu_read_unlock();
        return pid;
  }