Merge tag 'lsm-pr-20221212' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 13 Dec 2022 17:47:48 +0000 (09:47 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 13 Dec 2022 17:47:48 +0000 (09:47 -0800)
Pull lsm updates from Paul Moore:

 - Improve the error handling in the device cgroup such that memory
   allocation failures when updating the access policy do not
   potentially alter the policy.

 - Some minor fixes to reiserfs to ensure that it properly releases
   LSM-related xattr values.

 - Update the security_socket_getpeersec_stream() LSM hook to take
   sockptr_t values.

   Previously the net/BPF folks updated the getsockopt code in the
   network stack to leverage the sockptr_t type to make it easier to
   pass both kernel and __user pointers, but unfortunately when they did
   so they didn't convert the LSM hook.

   While there was/is no immediate risk by not converting the LSM hook,
   it seems like this is a mistake waiting to happen so this patch
   proactively does the LSM hook conversion.

 - Convert vfs_getxattr_alloc() to return an int instead of a ssize_t
   and cleanup the callers. Internally the function was never going to
   return anything larger than an int and the callers were doing some
   very odd things casting the return value; this patch fixes all that
   and helps bring a bit of sanity to vfs_getxattr_alloc() and its
   callers.

 - More verbose, and helpful, LSM debug output when the system is booted
   with "lsm.debug" on the command line. There are examples in the
   commit description, but the quick summary is that this patch provides
   better information about which LSMs are enabled and the ordering in
   which they are processed.

 - General comment and kernel-doc fixes and cleanups.

* tag 'lsm-pr-20221212' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
  lsm: Fix description of fs_context_parse_param
  lsm: Add/fix return values in lsm_hooks.h and fix formatting
  lsm: Clarify documentation of vm_enough_memory hook
  reiserfs: Add missing calls to reiserfs_security_free()
  lsm,fs: fix vfs_getxattr_alloc() return type and caller error paths
  device_cgroup: Roll back to original exceptions after copy failure
  LSM: Better reporting of actual LSMs at boot
  lsm: make security_socket_getpeersec_stream() sockptr_t safe
  audit: Fix some kernel-doc warnings
  lsm: remove obsoleted comments for security hooks
  fs: edit a comment made in bad taste

15 files changed:
1  2 
fs/reiserfs/namei.c
fs/xattr.c
include/linux/fs_context.h
include/linux/lsm_hook_defs.h
include/linux/lsm_hooks.h
include/linux/security.h
include/linux/xattr.h
security/apparmor/domain.c
security/apparmor/lsm.c
security/commoncap.c
security/integrity/evm/evm_main.c
security/integrity/ima/ima_appraise.c
security/security.c
security/selinux/hooks.c
security/smack/smack_lsm.c

Simple merge
diff --cc fs/xattr.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -381,9 -379,8 +381,9 @@@ int cap_inode_getsecurity(struct user_n
                          struct inode *inode, const char *name, void **buffer,
                          bool alloc)
  {
-       int size, ret;
+       int size;
        kuid_t kroot;
 +      vfsuid_t vfsroot;
        u32 nsmagic, magic;
        uid_t root, mappedroot;
        char *tmpbuf = NULL;
@@@ -453,10 -513,16 +453,12 @@@ static int evm_xattr_change(struct user
        char *xattr_data = NULL;
        int rc = 0;
  
 -      if (posix_xattr_acl(xattr_name))
 -              return evm_xattr_acl_change(mnt_userns, dentry, xattr_name,
 -                                          xattr_value, xattr_value_len);
 -
        rc = vfs_getxattr_alloc(&init_user_ns, dentry, xattr_name, &xattr_data,
                                0, GFP_NOFS);
-       if (rc < 0)
-               return 1;
+       if (rc < 0) {
+               rc = 1;
+               goto out;
+       }
  
        if (rc == xattr_value_len)
                rc = !!memcmp(xattr_value, xattr_data, rc);
Simple merge
Simple merge
Simple merge
Simple merge