1. 12 11月, 2019 1 次提交
    • N
      ima: Check against blacklisted hashes for files with modsig · 273df864
      Nayna Jain 提交于
      Asymmetric private keys are used to sign multiple files. The kernel
      currently supports checking against blacklisted keys. However, if the
      public key is blacklisted, any file signed by the blacklisted key will
      automatically fail signature verification. Blacklisting the public key
      is not fine enough granularity, as we might want to only blacklist a
      particular file.
      
      This patch adds support for checking against the blacklisted hash of
      the file, without the appended signature, based on the IMA policy. It
      defines a new policy option "appraise_flag=check_blacklist".
      
      In addition to the blacklisted binary hashes stored in the firmware
      "dbx" variable, the Linux kernel may be configured to load blacklisted
      binary hashes onto the .blacklist keyring as well. The following
      example shows how to blacklist a specific kernel module hash.
      
        $ sha256sum kernel/kheaders.ko
        77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3
        kernel/kheaders.ko
      
        $ grep BLACKLIST .config
        CONFIG_SYSTEM_BLACKLIST_KEYRING=y
        CONFIG_SYSTEM_BLACKLIST_HASH_LIST="blacklist-hash-list"
      
        $ cat certs/blacklist-hash-list
        "bin:77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3"
      
      Update the IMA custom measurement and appraisal policy
      rules (/etc/ima-policy):
      
        measure func=MODULE_CHECK template=ima-modsig
        appraise func=MODULE_CHECK appraise_flag=check_blacklist
        appraise_type=imasig|modsig
      
      After building, installing, and rebooting the kernel:
      
         545660333 ---lswrv      0     0   \_ blacklist:
        bin:77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3
      
        measure func=MODULE_CHECK template=ima-modsig
        appraise func=MODULE_CHECK appraise_flag=check_blacklist
        appraise_type=imasig|modsig
      
        modprobe: ERROR: could not insert 'kheaders': Permission denied
      
        10 0c9834db5a0182c1fb0cdc5d3adcf11a11fd83dd ima-sig
        sha256:3bc6ed4f0b4d6e31bc1dbc9ef844605abc7afdc6d81a57d77a1ec9407997c40
        2 /usr/lib/modules/5.4.0-rc3+/kernel/kernel/kheaders.ko
      
        10 82aad2bcc3fa8ed94762356b5c14838f3bcfa6a0 ima-modsig
        sha256:3bc6ed4f0b4d6e31bc1dbc9ef844605abc7afdc6d81a57d77a1ec9407997c40
        2 /usr/lib/modules/5.4.0rc3+/kernel/kernel/kheaders.ko  sha256:77fa889b3
        5a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3
        3082029a06092a864886f70d010702a082028b30820287020101310d300b0609608648
        016503040201300b06092a864886f70d01070131820264....
      
        10 25b72217cc1152b44b134ce2cd68f12dfb71acb3 ima-buf
        sha256:8b58427fedcf8f4b20bc8dc007f2e232bf7285d7b93a66476321f9c2a3aa132
        b blacklisted-hash
        77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3
      Signed-off-by: NNayna Jain <nayna@linux.ibm.com>
      [zohar@linux.ibm.com: updated patch description]
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/1572492694-6520-8-git-send-email-zohar@linux.ibm.com
      273df864
  2. 06 8月, 2019 2 次提交
  3. 11 7月, 2019 1 次提交
  4. 01 7月, 2019 1 次提交
    • T
      integrity: Introduce struct evm_xattr · 650b29db
      Thiago Jung Bauermann 提交于
      Even though struct evm_ima_xattr_data includes a fixed-size array to hold a
      SHA1 digest, most of the code ignores the array and uses the struct to mean
      "type indicator followed by data of unspecified size" and tracks the real
      size of what the struct represents in a separate length variable.
      
      The only exception to that is the EVM code, which correctly uses the
      definition of struct evm_ima_xattr_data.
      
      So make this explicit in the code by removing the length specification from
      the array in struct evm_ima_xattr_data. Also, change the name of the
      element from digest to data since in most places the array doesn't hold a
      digest.
      
      A separate struct evm_xattr is introduced, with the original definition of
      evm_ima_xattr_data to be used in the places that actually expect that
      definition, specifically the EVM HMAC code.
      Signed-off-by: NThiago Jung Bauermann <bauerman@linux.ibm.com>
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      650b29db
  5. 28 6月, 2019 1 次提交
    • D
      keys: Replace uid/gid/perm permissions checking with an ACL · 2e12256b
      David Howells 提交于
      Replace the uid/gid/perm permissions checking on a key with an ACL to allow
      the SETATTR and SEARCH permissions to be split.  This will also allow a
      greater range of subjects to represented.
      
      ============
      WHY DO THIS?
      ============
      
      The problem is that SETATTR and SEARCH cover a slew of actions, not all of
      which should be grouped together.
      
      For SETATTR, this includes actions that are about controlling access to a
      key:
      
       (1) Changing a key's ownership.
      
       (2) Changing a key's security information.
      
       (3) Setting a keyring's restriction.
      
      And actions that are about managing a key's lifetime:
      
       (4) Setting an expiry time.
      
       (5) Revoking a key.
      
      and (proposed) managing a key as part of a cache:
      
       (6) Invalidating a key.
      
      Managing a key's lifetime doesn't really have anything to do with
      controlling access to that key.
      
      Expiry time is awkward since it's more about the lifetime of the content
      and so, in some ways goes better with WRITE permission.  It can, however,
      be set unconditionally by a process with an appropriate authorisation token
      for instantiating a key, and can also be set by the key type driver when a
      key is instantiated, so lumping it with the access-controlling actions is
      probably okay.
      
      As for SEARCH permission, that currently covers:
      
       (1) Finding keys in a keyring tree during a search.
      
       (2) Permitting keyrings to be joined.
      
       (3) Invalidation.
      
      But these don't really belong together either, since these actions really
      need to be controlled separately.
      
      Finally, there are number of special cases to do with granting the
      administrator special rights to invalidate or clear keys that I would like
      to handle with the ACL rather than key flags and special checks.
      
      
      ===============
      WHAT IS CHANGED
      ===============
      
      The SETATTR permission is split to create two new permissions:
      
       (1) SET_SECURITY - which allows the key's owner, group and ACL to be
           changed and a restriction to be placed on a keyring.
      
       (2) REVOKE - which allows a key to be revoked.
      
      The SEARCH permission is split to create:
      
       (1) SEARCH - which allows a keyring to be search and a key to be found.
      
       (2) JOIN - which allows a keyring to be joined as a session keyring.
      
       (3) INVAL - which allows a key to be invalidated.
      
      The WRITE permission is also split to create:
      
       (1) WRITE - which allows a key's content to be altered and links to be
           added, removed and replaced in a keyring.
      
       (2) CLEAR - which allows a keyring to be cleared completely.  This is
           split out to make it possible to give just this to an administrator.
      
       (3) REVOKE - see above.
      
      
      Keys acquire ACLs which consist of a series of ACEs, and all that apply are
      unioned together.  An ACE specifies a subject, such as:
      
       (*) Possessor - permitted to anyone who 'possesses' a key
       (*) Owner - permitted to the key owner
       (*) Group - permitted to the key group
       (*) Everyone - permitted to everyone
      
      Note that 'Other' has been replaced with 'Everyone' on the assumption that
      you wouldn't grant a permit to 'Other' that you wouldn't also grant to
      everyone else.
      
      Further subjects may be made available by later patches.
      
      The ACE also specifies a permissions mask.  The set of permissions is now:
      
      	VIEW		Can view the key metadata
      	READ		Can read the key content
      	WRITE		Can update/modify the key content
      	SEARCH		Can find the key by searching/requesting
      	LINK		Can make a link to the key
      	SET_SECURITY	Can change owner, ACL, expiry
      	INVAL		Can invalidate
      	REVOKE		Can revoke
      	JOIN		Can join this keyring
      	CLEAR		Can clear this keyring
      
      
      The KEYCTL_SETPERM function is then deprecated.
      
      The KEYCTL_SET_TIMEOUT function then is permitted if SET_SECURITY is set,
      or if the caller has a valid instantiation auth token.
      
      The KEYCTL_INVALIDATE function then requires INVAL.
      
      The KEYCTL_REVOKE function then requires REVOKE.
      
      The KEYCTL_JOIN_SESSION_KEYRING function then requires JOIN to join an
      existing keyring.
      
      The JOIN permission is enabled by default for session keyrings and manually
      created keyrings only.
      
      
      ======================
      BACKWARD COMPATIBILITY
      ======================
      
      To maintain backward compatibility, KEYCTL_SETPERM will translate the
      permissions mask it is given into a new ACL for a key - unless
      KEYCTL_SET_ACL has been called on that key, in which case an error will be
      returned.
      
      It will convert possessor, owner, group and other permissions into separate
      ACEs, if each portion of the mask is non-zero.
      
      SETATTR permission turns on all of INVAL, REVOKE and SET_SECURITY.  WRITE
      permission turns on WRITE, REVOKE and, if a keyring, CLEAR.  JOIN is turned
      on if a keyring is being altered.
      
      The KEYCTL_DESCRIBE function translates the ACL back into a permissions
      mask to return depending on possessor, owner, group and everyone ACEs.
      
      It will make the following mappings:
      
       (1) INVAL, JOIN -> SEARCH
      
       (2) SET_SECURITY -> SETATTR
      
       (3) REVOKE -> WRITE if SETATTR isn't already set
      
       (4) CLEAR -> WRITE
      
      Note that the value subsequently returned by KEYCTL_DESCRIBE may not match
      the value set with KEYCTL_SETATTR.
      
      
      =======
      TESTING
      =======
      
      This passes the keyutils testsuite for all but a couple of tests:
      
       (1) tests/keyctl/dh_compute/badargs: The first wrong-key-type test now
           returns EOPNOTSUPP rather than ENOKEY as READ permission isn't removed
           if the type doesn't have ->read().  You still can't actually read the
           key.
      
       (2) tests/keyctl/permitting/valid: The view-other-permissions test doesn't
           work as Other has been replaced with Everyone in the ACL.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      2e12256b
  6. 05 6月, 2019 1 次提交
  7. 18 12月, 2018 1 次提交
  8. 13 12月, 2018 2 次提交
  9. 18 7月, 2018 1 次提交
  10. 17 5月, 2018 1 次提交
  11. 25 3月, 2018 1 次提交
  12. 23 3月, 2018 2 次提交
    • M
      ima: fail signature verification based on policy · 9e67028e
      Mimi Zohar 提交于
      This patch addresses the fuse privileged mounted filesystems in
      environments which are unwilling to accept the risk of trusting the
      signature verification and want to always fail safe, but are for example
      using a pre-built kernel.
      
      This patch defines a new builtin policy named "fail_securely", which can
      be specified on the boot command line as an argument to "ima_policy=".
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: Seth Forshee <seth.forshee@canonical.com>
      Cc: Dongsu Park <dongsu@kinvolk.io>
      Cc: Alban Crequy <alban@kinvolk.io>
      Acked-by: NSerge Hallyn <serge@hallyn.com>
      Acked-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      9e67028e
    • M
      IMA: Support using new creds in appraisal policy · d906c10d
      Matthew Garrett 提交于
      The existing BPRM_CHECK functionality in IMA validates against the
      credentials of the existing process, not any new credentials that the
      child process may transition to. Add an additional CREDS_CHECK target
      and refactor IMA to pass the appropriate creds structure. In
      ima_bprm_check(), check with both the existing process credentials and
      the credentials that will be committed when the new process is started.
      This will not change behaviour unless the system policy is extended to
      include CREDS_CHECK targets - BPRM_CHECK will continue to check the same
      credentials that it did previously.
      
      After this patch, an IMA policy rule along the lines of:
      
      measure func=CREDS_CHECK subj_type=unconfined_t
      
      will trigger if a process is executed and runs as unconfined_t, ignoring
      the context of the parent process. This is in contrast to:
      
      measure func=BPRM_CHECK subj_type=unconfined_t
      
      which will trigger if the process that calls exec() is already executing
      in unconfined_t, ignoring the context that the child process executes
      into.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      
      Changelog:
      - initialize ima_creds_status
      d906c10d
  13. 18 12月, 2017 1 次提交
    • M
      ima: support new "hash" and "dont_hash" policy actions · da1b0029
      Mimi Zohar 提交于
      The builtin ima_appraise_tcb policy, which is specified on the boot
      command line, can be replaced with a custom policy, normally early in
      the boot process.  Custom policies can be more restrictive in some ways,
      like requiring file signatures, but can be less restrictive in other
      ways, like not appraising mutable files.  With a less restrictive policy
      in place, files in the builtin policy might not be hashed and labeled
      with a security.ima hash.  On reboot, files which should be labeled in
      the ima_appraise_tcb are not labeled, possibly preventing the system
      from booting properly.
      
      To resolve this problem, this patch extends the existing IMA policy
      actions "measure", "dont_measure", "appraise", "dont_appraise", and
      "audit" with "hash" and "dont_hash".  The new "hash" action will write
      the file hash as security.ima, but without requiring the file to be
      appraised as well.
      
      For example, the builtin ima_appraise_tcb policy includes the rule,
      "appraise fowner=0".  Adding the "hash fowner=0" rule to a custom
      policy, will cause the needed file hashes to be calculated and written
      as security.ima xattrs.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
      da1b0029
  14. 12 12月, 2017 2 次提交
    • D
      ima: re-introduce own integrity cache lock · 0d73a552
      Dmitry Kasatkin 提交于
      Before IMA appraisal was introduced, IMA was using own integrity cache
      lock along with i_mutex. process_measurement and ima_file_free took
      the iint->mutex first and then the i_mutex, while setxattr, chmod and
      chown took the locks in reverse order. To resolve the potential deadlock,
      i_mutex was moved to protect entire IMA functionality and the redundant
      iint->mutex was eliminated.
      
      Solution was based on the assumption that filesystem code does not take
      i_mutex further. But when file is opened with O_DIRECT flag, direct-io
      implementation takes i_mutex and produces deadlock. Furthermore, certain
      other filesystem operations, such as llseek, also take i_mutex.
      
      More recently some filesystems have replaced their filesystem specific
      lock with the global i_rwsem to read a file.  As a result, when IMA
      attempts to calculate the file hash, reading the file attempts to take
      the i_rwsem again.
      
      To resolve O_DIRECT related deadlock problem, this patch re-introduces
      iint->mutex. But to eliminate the original chmod() related deadlock
      problem, this patch eliminates the requirement for chmod hooks to take
      the iint->mutex by introducing additional atomic iint->attr_flags to
      indicate calling of the hooks. The allowed locking order is to take
      the iint->mutex first and then the i_rwsem.
      
      Original flags were cleared in chmod(), setxattr() or removwxattr()
      hooks and tested when file was closed or opened again. New atomic flags
      are set or cleared in those hooks and tested to clear iint->flags on
      close or on open.
      
      Atomic flags are following:
      * IMA_CHANGE_ATTR - indicates that chATTR() was called (chmod, chown,
        chgrp) and file attributes have changed. On file open, it causes IMA
        to clear iint->flags to re-evaluate policy and perform IMA functions
        again.
      * IMA_CHANGE_XATTR - indicates that setxattr or removexattr was called
        and extended attributes have changed. On file open, it causes IMA to
        clear iint->flags IMA_DONE_MASK to re-appraise.
      * IMA_UPDATE_XATTR - indicates that security.ima needs to be updated.
        It is cleared if file policy changes and no update is needed.
      * IMA_DIGSIG - indicates that file security.ima has signature and file
        security.ima must not update to file has on file close.
      * IMA_MUST_MEASURE - indicates the file is in the measurement policy.
      
      Fixes: Commit 65523218 ("xfs: remove i_iolock and use i_rwsem in
      the VFS inode instead")
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      0d73a552
    • M
      EVM: Add support for portable signature format · 50b97748
      Matthew Garrett 提交于
      The EVM signature includes the inode number and (optionally) the
      filesystem UUID, making it impractical to ship EVM signatures in
      packages. This patch adds a new portable format intended to allow
      distributions to include EVM signatures. It is identical to the existing
      format but hardcodes the inode and generation numbers to 0 and does not
      include the filesystem UUID even if the kernel is configured to do so.
      
      Removing the inode means that the metadata and signature from one file
      could be copied to another file without invalidating it. This is avoided
      by ensuring that an IMA xattr is present during EVM validation.
      
      Portable signatures are intended to be immutable - ie, they will never
      be transformed into HMACs.
      
      Based on earlier work by Dmitry Kasatkin and Mikhail Kurinnoi.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Cc: Dmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Cc: Mikhail Kurinnoi <viewizard@viewizard.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      50b97748
  15. 09 11月, 2017 1 次提交
  16. 22 6月, 2017 1 次提交
    • T
      integrity: Small code improvements · bb543e39
      Thiago Jung Bauermann 提交于
      These changes are too small to warrant their own patches:
      
      The keyid and sig_size members of struct signature_v2_hdr are in BE format,
      so use a type that makes this assumption explicit. Also, use beXX_to_cpu
      instead of __beXX_to_cpu to read them.
      
      Change integrity_kernel_read to take a void * buffer instead of char *
      buffer, so that callers don't have to use a cast if they provide a buffer
      that isn't a char *.
      
      Add missing #endif comment in ima.h pointing out which macro it refers to.
      
      Add missing fall through comment in ima_appraise.c.
      
      Constify mask_tokens and func_tokens arrays.
      Signed-off-by: NThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      bb543e39
  17. 30 6月, 2016 1 次提交
  18. 01 5月, 2016 1 次提交
  19. 04 3月, 2016 1 次提交
  20. 21 2月, 2016 2 次提交
  21. 15 12月, 2015 1 次提交
  22. 24 11月, 2015 1 次提交
    • D
      integrity: define '.evm' as a builtin 'trusted' keyring · f4dc3778
      Dmitry Kasatkin 提交于
      Require all keys added to the EVM keyring be signed by an
      existing trusted key on the system trusted keyring.
      
      This patch also switches IMA to use integrity_init_keyring().
      
      Changes in v3:
      * Added 'init_keyring' config based variable to skip initializing
        keyring instead of using  __integrity_init_keyring() wrapper.
      * Added dependency back to CONFIG_IMA_TRUSTED_KEYRING
      
      Changes in v2:
      * Replace CONFIG_EVM_TRUSTED_KEYRING with IMA and EVM common
        CONFIG_INTEGRITY_TRUSTED_KEYRING configuration option
      * Deprecate CONFIG_IMA_TRUSTED_KEYRING but keep it for config
        file compatibility. (Mimi Zohar)
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      f4dc3778
  23. 22 5月, 2015 1 次提交
  24. 18 11月, 2014 3 次提交
  25. 28 10月, 2014 1 次提交
    • D
      ima: check xattr value length and type in the ima_inode_setxattr() · a48fda9d
      Dmitry Kasatkin 提交于
      ima_inode_setxattr() can be called with no value. Function does not
      check the length so that following command can be used to produce
      kernel oops: setfattr -n security.ima FOO. This patch fixes it.
      
      Changes in v3:
      * for stable reverted "allow setting hash only in fix or log mode"
        It will be a separate patch.
      
      Changes in v2:
      * testing validity of xattr type
      * allow setting hash only in fix or log mode (Mimi)
      
      [  261.562522] BUG: unable to handle kernel NULL pointer dereference at           (null)
      [  261.564109] IP: [<ffffffff812af272>] ima_inode_setxattr+0x3e/0x5a
      [  261.564109] PGD 3112f067 PUD 42965067 PMD 0
      [  261.564109] Oops: 0000 [#1] SMP
      [  261.564109] Modules linked in: bridge stp llc evdev serio_raw i2c_piix4 button fuse
      [  261.564109] CPU: 0 PID: 3299 Comm: setxattr Not tainted 3.16.0-kds+ #2924
      [  261.564109] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [  261.564109] task: ffff8800428c2430 ti: ffff880042be0000 task.ti: ffff880042be0000
      [  261.564109] RIP: 0010:[<ffffffff812af272>]  [<ffffffff812af272>] ima_inode_setxattr+0x3e/0x5a
      [  261.564109] RSP: 0018:ffff880042be3d50  EFLAGS: 00010246
      [  261.564109] RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000015
      [  261.564109] RDX: 0000001500000000 RSI: 0000000000000000 RDI: ffff8800375cc600
      [  261.564109] RBP: ffff880042be3d68 R08: 0000000000000000 R09: 00000000004d6256
      [  261.564109] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88002149ba00
      [  261.564109] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [  261.564109] FS:  00007f6c1e219740(0000) GS:ffff88005da00000(0000) knlGS:0000000000000000
      [  261.564109] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  261.564109] CR2: 0000000000000000 CR3: 000000003b35a000 CR4: 00000000000006f0
      [  261.564109] Stack:
      [  261.564109]  ffff88002149ba00 ffff880042be3df8 0000000000000000 ffff880042be3d98
      [  261.564109]  ffffffff812a101b ffff88002149ba00 ffff880042be3df8 0000000000000000
      [  261.564109]  0000000000000000 ffff880042be3de0 ffffffff8116d08a ffff880042be3dc8
      [  261.564109] Call Trace:
      [  261.564109]  [<ffffffff812a101b>] security_inode_setxattr+0x48/0x6a
      [  261.564109]  [<ffffffff8116d08a>] vfs_setxattr+0x6b/0x9f
      [  261.564109]  [<ffffffff8116d1e0>] setxattr+0x122/0x16c
      [  261.564109]  [<ffffffff811687e8>] ? mnt_want_write+0x21/0x45
      [  261.564109]  [<ffffffff8114d011>] ? __sb_start_write+0x10f/0x143
      [  261.564109]  [<ffffffff811687e8>] ? mnt_want_write+0x21/0x45
      [  261.564109]  [<ffffffff811687c0>] ? __mnt_want_write+0x48/0x4f
      [  261.564109]  [<ffffffff8116d3e6>] SyS_setxattr+0x6e/0xb0
      [  261.564109]  [<ffffffff81529da9>] system_call_fastpath+0x16/0x1b
      [  261.564109] Code: 48 89 f7 48 c7 c6 58 36 81 81 53 31 db e8 73 27 04 00 85 c0 75 28 bf 15 00 00 00 e8 8a a5 d9 ff 84 c0 75 05 83 cb ff eb 15 31 f6 <41> 80 7d 00 03 49 8b 7c 24 68 40 0f 94 c6 e8 e1 f9 ff ff 89 d8
      [  261.564109] RIP  [<ffffffff812af272>] ima_inode_setxattr+0x3e/0x5a
      [  261.564109]  RSP <ffff880042be3d50>
      [  261.564109] CR2: 0000000000000000
      [  261.599998] ---[ end trace 39a89a3fc267e652 ]---
      Reported-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      a48fda9d
  26. 08 10月, 2014 2 次提交
  27. 09 9月, 2014 2 次提交
  28. 26 7月, 2014 1 次提交
  29. 17 7月, 2014 1 次提交
    • M
      ima: define '.ima' as a builtin 'trusted' keyring · 7d2ce232
      Mimi Zohar 提交于
      Require all keys added to the IMA keyring be signed by an
      existing trusted key on the system trusted keyring.
      
      Changelog v6:
      - remove ifdef CONFIG_IMA_TRUSTED_KEYRING in C code - Dmitry
      - update Kconfig dependency and help
      - select KEYS_DEBUG_PROC_KEYS - Dmitry
      
      Changelog v5:
      - Move integrity_init_keyring() to init_ima() - Dmitry
      - reset keyring[id] on failure - Dmitry
      
      Changelog v1:
      - don't link IMA trusted keyring to user keyring
      
      Changelog:
      - define stub integrity_init_keyring() function (reported-by Fengguang Wu)
      - differentiate between regular and trusted keyring names.
      - replace printk with pr_info (D. Kasatkin)
      - only make the IMA keyring a trusted keyring (reported-by D. Kastatkin)
      - define stub integrity_init_keyring() definition based on
        CONFIG_INTEGRITY_SIGNATURE, not CONFIG_INTEGRITY_ASYMMETRIC_KEYS.
        (reported-by Jim Davis)
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      7d2ce232
  30. 04 6月, 2014 1 次提交
    • M
      ima: audit log files opened with O_DIRECT flag · f9b2a735
      Mimi Zohar 提交于
      Files are measured or appraised based on the IMA policy.  When a
      file, in policy, is opened with the O_DIRECT flag, a deadlock
      occurs.
      
      The first attempt at resolving this lockdep temporarily removed the
      O_DIRECT flag and restored it, after calculating the hash.  The
      second attempt introduced the O_DIRECT_HAVELOCK flag. Based on this
      flag, do_blockdev_direct_IO() would skip taking the i_mutex a second
      time.  The third attempt, by Dmitry Kasatkin, resolves the i_mutex
      locking issue, by re-introducing the IMA mutex, but uncovered
      another problem.  Reading a file with O_DIRECT flag set, writes
      directly to userspace pages.  A second patch allocates a user-space
      like memory.  This works for all IMA hooks, except ima_file_free(),
      which is called on __fput() to recalculate the file hash.
      
      Until this last issue is addressed, do not 'collect' the
      measurement for measuring, appraising, or auditing files opened
      with the O_DIRECT flag set.  Based on policy, permit or deny file
      access.  This patch defines a new IMA policy rule option named
      'permit_directio'.  Policy rules could be defined, based on LSM
      or other criteria, to permit specific applications to open files
      with the O_DIRECT flag set.
      
      Changelog v1:
      - permit or deny file access based IMA policy rules
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Cc: <stable@vger.kernel.org>
      f9b2a735
  31. 24 11月, 2013 1 次提交