1. 08 9月, 2012 1 次提交
    • M
      ima: integrity appraisal extension · 2fe5d6de
      Mimi Zohar 提交于
      IMA currently maintains an integrity measurement list used to assert the
      integrity of the running system to a third party.  The IMA-appraisal
      extension adds local integrity validation and enforcement of the
      measurement against a "good" value stored as an extended attribute
      'security.ima'.  The initial methods for validating 'security.ima' are
      hashed based, which provides file data integrity, and digital signature
      based, which in addition to providing file data integrity, provides
      authenticity.
      
      This patch creates and maintains the 'security.ima' xattr, containing
      the file data hash measurement.  Protection of the xattr is provided by
      EVM, if enabled and configured.
      
      Based on policy, IMA calls evm_verifyxattr() to verify a file's metadata
      integrity and, assuming success, compares the file's current hash value
      with the one stored as an extended attribute in 'security.ima'.
      
      Changelov v4:
      - changed iint cache flags to hex values
      
      Changelog v3:
      - change appraisal default for filesystems without xattr support to fail
      
      Changelog v2:
      - fix audit msg 'res' value
      - removed unused 'ima_appraise=' values
      
      Changelog v1:
      - removed unused iint mutex (Dmitry Kasatkin)
      - setattr hook must not reset appraised (Dmitry Kasatkin)
      - evm_verifyxattr() now differentiates between no 'security.evm' xattr
        (INTEGRITY_NOLABEL) and no EVM 'protected' xattrs included in the
        'security.evm' (INTEGRITY_NOXATTRS).
      - replace hash_status with ima_status (Dmitry Kasatkin)
      - re-initialize slab element ima_status on free (Dmitry Kasatkin)
      - include 'security.ima' in EVM if CONFIG_IMA_APPRAISE, not CONFIG_IMA
      - merged half "ima: ima_must_appraise_or_measure API change" (Dmitry Kasatkin)
      - removed unnecessary error variable in process_measurement() (Dmitry Kasatkin)
      - use ima_inode_post_setattr() stub function, if IMA_APPRAISE not configured
        (moved ima_inode_post_setattr() to ima_appraise.c)
      - make sure ima_collect_measurement() can read file
      
      Changelog:
      - add 'iint' to evm_verifyxattr() call (Dimitry Kasatkin)
      - fix the race condition between chmod, which takes the i_mutex and then
        iint->mutex, and ima_file_free() and process_measurement(), which take
        the locks in the reverse order, by eliminating iint->mutex. (Dmitry Kasatkin)
      - cleanup of ima_appraise_measurement() (Dmitry Kasatkin)
      - changes as a result of the iint not allocated for all regular files, but
        only for those measured/appraised.
      - don't try to appraise new/empty files
      - expanded ima_appraisal description in ima/Kconfig
      - IMA appraise definitions required even if IMA_APPRAISE not enabled
      - add return value to ima_must_appraise() stub
      - unconditionally set status = INTEGRITY_PASS *after* testing status,
        not before.  (Found by Joe Perches)
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@intel.com>
      2fe5d6de
  2. 07 9月, 2012 1 次提交
  3. 06 9月, 2012 1 次提交
  4. 23 8月, 2012 2 次提交
  5. 10 8月, 2012 1 次提交
  6. 01 8月, 2012 1 次提交
  7. 31 7月, 2012 1 次提交
  8. 30 7月, 2012 2 次提交
    • A
      selinux: fix selinux_inode_setxattr oops · e3fea3f7
      Al Viro 提交于
      OK, what we have so far is e.g.
      	setxattr(path, name, whatever, 0, XATTR_REPLACE)
      with name being good enough to get through xattr_permission().
      Then we reach security_inode_setxattr() with the desired value and size.
      Aha.  name should begin with "security.selinux", or we won't get that
      far in selinux_inode_setxattr().  Suppose we got there and have enough
      permissions to relabel that sucker.  We call security_context_to_sid()
      with value == NULL, size == 0.  OK, we want ss_initialized to be non-zero.
      I.e. after everything had been set up and running.  No problem...
      
      We do 1-byte kmalloc(), zero-length memcpy() (which doesn't oops, even
      thought the source is NULL) and put a NUL there.  I.e. form an empty
      string.  string_to_context_struct() is called and looks for the first
      ':' in there.  Not found, -EINVAL we get.  OK, security_context_to_sid_core()
      has rc == -EINVAL, force == 0, so it silently returns -EINVAL.
      All it takes now is not having CAP_MAC_ADMIN and we are fucked.
      
      All right, it might be a different bug (modulo strange code quoted in the
      report), but it's real.  Easily fixed, AFAICS:
      
      Deal with size == 0, value == NULL case in selinux_inode_setxattr()
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Tested-by: NDave Jones <davej@redhat.com>
      Reported-by: NDave Jones <davej@redhat.com>
      Signed-off-by: NJames Morris <james.l.morris@oracle.com>
      e3fea3f7
    • A
      smack: off by one error · 3b9fc372
      Alan Cox 提交于
      Consider the input case of a rule that consists entirely of non space
      symbols followed by a \0. Say 64 + \0
      
      In this case strlen(data) = 64
      kzalloc of subject and object are 64 byte objects
      sscanfdata, "%s %s %s", subject, ...)
      
      will put 65 bytes into subject.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJames Morris <james.l.morris@oracle.com>
      3b9fc372
  9. 27 7月, 2012 1 次提交
    • J
      posix_types.h: Cleanup stale __NFDBITS and related definitions · 8ded2bbc
      Josh Boyer 提交于
      Recently, glibc made a change to suppress sign-conversion warnings in
      FD_SET (glibc commit ceb9e56b3d1).  This uncovered an issue with the
      kernel's definition of __NFDBITS if applications #include
      <linux/types.h> after including <sys/select.h>.  A build failure would
      be seen when passing the -Werror=sign-compare and -D_FORTIFY_SOURCE=2
      flags to gcc.
      
      It was suggested that the kernel should either match the glibc
      definition of __NFDBITS or remove that entirely.  The current in-kernel
      uses of __NFDBITS can be replaced with BITS_PER_LONG, and there are no
      uses of the related __FDELT and __FDMASK defines.  Given that, we'll
      continue the cleanup that was started with commit 8b3d1cda
      ("posix_types: Remove fd_set macros") and drop the remaining unused
      macros.
      
      Additionally, linux/time.h has similar macros defined that expand to
      nothing so we'll remove those at the same time.
      Reported-by: NJeff Law <law@redhat.com>
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NJosh Boyer <jwboyer@redhat.com>
      [ .. and fix up whitespace as per akpm ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8ded2bbc
  10. 23 7月, 2012 4 次提交
  11. 16 7月, 2012 2 次提交
  12. 14 7月, 2012 4 次提交
  13. 06 7月, 2012 3 次提交
  14. 03 7月, 2012 4 次提交
  15. 02 7月, 2012 1 次提交
    • P
      security: Fix nommu build. · 659b5e76
      Paul Mundt 提交于
      The security + nommu configuration presently blows up with an undefined
      reference to BDI_CAP_EXEC_MAP:
      
      security/security.c: In function 'mmap_prot':
      security/security.c:687:36: error: dereferencing pointer to incomplete type
      security/security.c:688:16: error: 'BDI_CAP_EXEC_MAP' undeclared (first use in this function)
      security/security.c:688:16: note: each undeclared identifier is reported only once for each function it appears in
      
      include backing-dev.h directly to fix it up.
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      Signed-off-by: NJames Morris <james.l.morris@oracle.com>
      659b5e76
  16. 30 6月, 2012 1 次提交
    • P
      netlink: add netlink_kernel_cfg parameter to netlink_kernel_create · a31f2d17
      Pablo Neira Ayuso 提交于
      This patch adds the following structure:
      
      struct netlink_kernel_cfg {
              unsigned int    groups;
              void            (*input)(struct sk_buff *skb);
              struct mutex    *cb_mutex;
      };
      
      That can be passed to netlink_kernel_create to set optional configurations
      for netlink kernel sockets.
      
      I've populated this structure by looking for NULL and zero parameters at the
      existing code. The remaining parameters that always need to be set are still
      left in the original interface.
      
      That includes optional parameters for the netlink socket creation. This allows
      easy extensibility of this interface in the future.
      
      This patch also adapts all callers to use this new interface.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a31f2d17
  17. 27 6月, 2012 1 次提交
  18. 07 6月, 2012 1 次提交
  19. 01 6月, 2012 7 次提交
  20. 30 5月, 2012 1 次提交