1. 22 6月, 2017 2 次提交
  2. 28 1月, 2017 1 次提交
  3. 21 12月, 2016 5 次提交
  4. 30 6月, 2016 2 次提交
  5. 28 3月, 2016 1 次提交
  6. 21 2月, 2016 4 次提交
    • M
      ima: measure and appraise the IMA policy itself · 19f8a847
      Mimi Zohar 提交于
      Add support for measuring and appraising the IMA policy itself.
      
      Changelog v4:
      - use braces on both if/else branches, even if single line on one of the
      branches - Dmitry
      - Use the id mapping - Dmitry
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NPetko Manolov <petkan@mip-labs.com>
      Acked-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      19f8a847
    • M
      ima: support for kexec image and initramfs · d9ddf077
      Mimi Zohar 提交于
      Add IMA policy support for measuring/appraising the kexec image and
      initramfs. Two new IMA policy identifiers KEXEC_KERNEL_CHECK and
      KEXEC_INITRAMFS_CHECK are defined.
      
      Example policy rules:
      measure func=KEXEC_KERNEL_CHECK
      appraise func=KEXEC_KERNEL_CHECK appraise_type=imasig
      measure func=KEXEC_INITRAMFS_CHECK
      appraise func=KEXEC_INITRAMFS_CHECK appraise_type=imasig
      
      Moving the enumeration to the vfs layer simplified the patches, allowing
      the IMA changes, for the most part, to be separated from the other
      changes.  Unfortunately, passing either a kernel_read_file_id or a
      ima_hooks enumeration within IMA is messy.
      
      Option 1: duplicate kernel_read_file enumeration in ima_hooks
      
      enum kernel_read_file_id {
      	...
              READING_KEXEC_IMAGE,
              READING_KEXEC_INITRAMFS,
              READING_MAX_ID
      
      enum ima_hooks {
      	...
      	KEXEC_KERNEL_CHECK
      	KEXEC_INITRAMFS_CHECK
      
      Option 2: define ima_hooks as extension of kernel_read_file
      eg: enum ima_hooks {
              FILE_CHECK = READING_MAX_ID,
              MMAP_CHECK,
      
      In order to pass both kernel_read_file_id and ima_hooks values, we
      would need to specify a struct containing a union.
      
      struct caller_id {
              union {
                      enum ima_hooks func_id;
                      enum kernel_read_file_id read_id;
              };
      };
      
      Option 3: incorportate the ima_hooks enumeration into kernel_read_file_id,
      perhaps changing the enumeration name.
      
      For now, duplicate the new READING_KEXEC_IMAGE/INITRAMFS in the ima_hooks.
      
      Changelog v4:
      - replaced switch statement with a kernel_read_file_id to an ima_hooks
      id mapping array - Dmitry
      - renamed ima_hook tokens KEXEC_CHECK and INITRAMFS_CHECK to
      KEXEC_KERNEL_CHECK and KEXEC_INITRAMFS_CHECK respectively - Dave Young
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NPetko Manolov <petkan@mip-labs.com>
      Acked-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Cc: Dave Young <dyoung@redhat.com>
      d9ddf077
    • M
      ima: remove firmware and module specific cached status info · c6af8efe
      Mimi Zohar 提交于
      Each time a file is read by the kernel, the file should be re-measured and
      the file signature re-appraised, based on policy.  As there is no need to
      preserve the status information, this patch replaces the firmware and
      module specific cache status with a generic one named read_file.
      
      This change simplifies adding support for other files read by the kernel.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NPetko Manolov <petkan@mip-labs.com>
      Acked-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      c6af8efe
    • M
      ima: define a new hook to measure and appraise a file already in memory · cf222217
      Mimi Zohar 提交于
      This patch defines a new IMA hook ima_post_read_file() for measuring
      and appraising files read by the kernel. The caller loads the file into
      memory before calling this function, which calculates the hash followed by
      the normal IMA policy based processing.
      
      Changelog v5:
      - fail ima_post_read_file() if either file or buf is NULL
      v3:
      - rename ima_hash_and_process_file() to ima_post_read_file()
      
      v1:
      - split patch
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      cf222217
  7. 19 2月, 2016 3 次提交
  8. 25 12月, 2015 1 次提交
    • S
      IMA: policy can be updated zero times · 0112721d
      Sasha Levin 提交于
      Commit "IMA: policy can now be updated multiple times" assumed that the
      policy would be updated at least once.
      
      If there are zero updates, the temporary list head object will get added
      to the policy list, and later dereferenced as an IMA policy object, which
      means that invalid memory will be accessed.
      
      Changelog:
      - Move list_empty() test to ima_release_policy(), before audit msg - Mimi
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      0112721d
  9. 15 12月, 2015 1 次提交
  10. 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
  11. 16 6月, 2015 1 次提交
  12. 22 5月, 2015 2 次提交
    • R
      ima: pass iint to ima_add_violation() · 8d94eb9b
      Roberto Sassu 提交于
      This patch adds the iint associated to the current inode as a new
      parameter of ima_add_violation(). The passed iint is always not NULL
      if a violation is detected. This modification will be used to determine
      the inode for which there is a violation.
      
      Since the 'd' and 'd-ng' template field init() functions were detecting
      a violation from the value of the iint pointer, they now check the new
      field 'violation', added to the 'ima_event_data' structure.
      
      Changelog:
       - v1:
         - modified an old comment (Roberto Sassu)
      Signed-off-by: NRoberto Sassu <rsassu@suse.de>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      8d94eb9b
    • R
      ima: wrap event related data to the new ima_event_data structure · 23b57419
      Roberto Sassu 提交于
      All event related data has been wrapped into the new 'ima_event_data'
      structure. The main benefit of this patch is that a new information
      can be made available to template fields initialization functions
      by simply adding a new field to the new structure instead of modifying
      the definition of those functions.
      
      Changelog:
       - v2:
         - f_dentry replaced with f_path.dentry (Roberto Sassu)
         - removed declaration of temporary variables in template field functions
           when possible (suggested by Dmitry Kasatkin)
      Signed-off-by: NRoberto Sassu <rsassu@suse.de>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      23b57419
  13. 18 9月, 2014 2 次提交
    • R
      ima: added ima_policy_flag variable · a756024e
      Roberto Sassu 提交于
      This patch introduces the new variable 'ima_policy_flag', whose bits
      are set depending on the action of the current policy rules. Only the
      flags IMA_MEASURE, IMA_APPRAISE and IMA_AUDIT are set.
      
      The new variable will be used to improve performance by skipping the
      unnecessary execution of IMA code if the policy does not contain rules
      with the above actions.
      
      Changes in v6 (Roberto Sassu)
      * do not check 'ima_initialized' before calling ima_update_policy_flag()
        in ima_update_policy() (suggested by Dmitry)
      * calling ima_update_policy_flag() moved to init_ima to co-locate with
        ima_initialized (Dmitry)
      * add/revise comments (Mimi)
      
      Changes in v5 (Roberto Sassu)
      * reset IMA_APPRAISE flag in 'ima_policy_flag' if 'ima_appraise' is set
        to zero (reported by Dmitry)
      * update 'ima_policy_flag' only if IMA initialization is successful
        (suggested by Mimi and Dmitry)
      * check 'ima_policy_flag' instead of 'ima_initialized'
        (suggested by Mimi and Dmitry)
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      a756024e
    • D
      ima: provide 'ima_appraise=log' kernel option · 2faa6ef3
      Dmitry Kasatkin 提交于
      The kernel boot parameter "ima_appraise" currently defines 'off',
      'enforce' and 'fix' modes.  When designing a policy and labeling
      the system, access to files are either blocked in the default
      'enforce' mode or automatically fixed in the 'fix' mode.  It is
      beneficial to be able to run the system in a logging only mode,
      without fixing it, in order to properly analyze the system. This
      patch adds a 'log' mode to run the system in a permissive mode and
      log the appraisal results.
      Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      2faa6ef3
  14. 09 9月, 2014 3 次提交
  15. 26 7月, 2014 1 次提交
  16. 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
  17. 08 3月, 2014 1 次提交
    • R
      ima: restore the original behavior for sending data with ima template · c019e307
      Roberto Sassu 提交于
      With the new template mechanism introduced in IMA since kernel 3.13,
      the format of data sent through the binary_runtime_measurements interface
      is slightly changed. Now, for a generic measurement, the format of
      template data (after the template name) is:
      
      template_len | field1_len | field1 | ... | fieldN_len | fieldN
      
      In addition, fields containing a string now include the '\0' termination
      character.
      
      Instead, the format for the 'ima' template should be:
      
      SHA1 digest | event name length | event name
      
      It must be noted that while in the IMA 3.13 code 'event name length' is
      'IMA_EVENT_NAME_LEN_MAX + 1' (256 bytes), so that the template digest
      is calculated correctly, and 'event name' contains '\0', in the pre 3.13
      code 'event name length' is exactly the string length and 'event name'
      does not contain the termination character.
      
      The patch restores the behavior of the IMA code pre 3.13 for the 'ima'
      template so that legacy userspace tools obtain a consistent behavior
      when receiving data from the binary_runtime_measurements interface
      regardless of which kernel version is used.
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Cc: <stable@vger.kernel.org> # 3.3.13: 3ce1217d ima: define template fields library
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      c019e307
  18. 03 12月, 2013 1 次提交
    • R
      ima: properly free ima_template_entry structures · a7ed7c60
      Roberto Sassu 提交于
      The new templates management mechanism records information associated
      to an event into an array of 'ima_field_data' structures and makes it
      available through the 'template_data' field of the 'ima_template_entry'
      structure (the element of the measurements list created by IMA).
      
      Since 'ima_field_data' contains dynamically allocated data (which length
      varies depending on the data associated to a selected template field),
      it is not enough to just free the memory reserved for a
      'ima_template_entry' structure if something goes wrong.
      
      This patch creates the new function ima_free_template_entry() which
      walks the array of 'ima_field_data' structures, frees the memory
      referenced by the 'data' pointer and finally the space reserved for
      the 'ima_template_entry' structure. Further, it replaces existing kfree()
      that have a pointer to an 'ima_template_entry' structure as argument
      with calls to the new function.
      
      Fixes: a71dc65d: ima: switch to new template management mechanism
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      a7ed7c60
  19. 25 11月, 2013 2 次提交
  20. 01 11月, 2013 1 次提交
    • M
      ima: extend the measurement list to include the file signature · bcbc9b0c
      Mimi Zohar 提交于
      This patch defines a new template called 'ima-sig', which includes
      the file signature in the template data, in addition to the file's
      digest and pathname.
      
      A template is composed of a set of fields.  Associated with each
      field is an initialization and display function.  This patch defines
      a new template field called 'sig', the initialization function
      ima_eventsig_init(), and the display function ima_show_template_sig().
      
      This patch modifies the .field_init() function definition to include
      the 'security.ima' extended attribute and length.
      
      Changelog:
      - remove unused code (Dmitry Kasatkin)
      - avoid calling ima_write_template_field_data() unnecesarily (Roberto Sassu)
      - rename DATA_FMT_SIG to DATA_FMT_HEX
      - cleanup ima_eventsig_init() based on Roberto's comments
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      bcbc9b0c
  21. 26 10月, 2013 4 次提交
    • R
      ima: switch to new template management mechanism · a71dc65d
      Roberto Sassu 提交于
      This patch performs the switch to the new template mechanism by modifying
      the functions ima_alloc_init_template(), ima_measurements_show() and
      ima_ascii_measurements_show(). The old function ima_template_show() was
      removed as it is no longer needed. Also, if the template descriptor used
      to generate a measurement entry is not 'ima', the whole length of field
      data stored for an entry is provided before the data itself through the
      binary_runtime_measurement interface.
      
      Changelog:
      - unnecessary to use strncmp() (Mimi Zohar)
      - create new variable 'field' in ima_alloc_init_template() (Roberto Sassu)
      - use GFP_NOFS flag in ima_alloc_init_template() (Roberto Sassu)
      - new variable 'num_fields' in ima_store_template() (Roberto Sassu,
        proposed by Mimi Zohar)
      - rename ima_calc_buffer_hash/template_hash() to ima_calc_field_array_hash(),
        something more generic (Mimi, requested by Dmitry)
      - sparse error fix - Fengguang Wu
      - fix lindent warnings
      - always include the field length in the template data length
      - include the template field length variable size in the template data length
      - include both the template field data and field length in the template digest
        calculation. Simplifies verifying the template digest. (Mimi)
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      a71dc65d
    • R
      ima: define template fields library and new helpers · 3ce1217d
      Roberto Sassu 提交于
      This patch defines a library containing two initial template fields,
      inode digest (d) and file name (n), the 'ima' template descriptor,
      whose format is 'd|n', and two helper functions,
      ima_write_template_field_data() and ima_show_template_field_data().
      
      Changelog:
      - replace ima_eventname_init() parameter NULL checking with BUG_ON.
        (suggested by Mimi)
      - include "new template fields for inode digest (d) and file name (n)"
        definitions to fix a compiler warning.  - Mimi
      - unnecessary to prefix static function names with 'ima_'. remove
        prefix to resolve Lindent formatting changes. - Mimi
      - abbreviated/removed inline comments - Mimi
      - always send the template field length - Mimi
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      3ce1217d
    • R
      ima: new templates management mechanism · adf53a77
      Roberto Sassu 提交于
      The original 'ima' template is fixed length, containing the filedata hash
      and pathname.  The filedata hash is limited to 20 bytes (md5/sha1).  The
      pathname is a null terminated string, limited to 255 characters.  To
      overcome these limitations and to add additional file metadata, it is
      necessary to extend the current version of IMA by defining additional
      templates.
      
      The main reason to introduce this feature is that, each time a new
      template is defined, the functions that generate and display the
      measurement list would include the code for handling a new format and,
      thus, would significantly grow over time.
      
      This patch set solves this problem by separating the template management
      from the remaining IMA code. The core of this solution is the definition
      of two new data structures: a template descriptor, to determine which
      information should be included in the measurement list, and a template
      field, to generate and display data of a given type.
      
      To define a new template field, developers define the field identifier
      and implement two functions, init() and show(), respectively to generate
      and display measurement entries.  Initially, this patch set defines the
      following template fields (support for additional data types will be
      added later):
       - 'd': the digest of the event (i.e. the digest of a measured file),
              calculated with the SHA1 or MD5 hash algorithm;
       - 'n': the name of the event (i.e. the file name), with size up to
              255 bytes;
       - 'd-ng': the digest of the event, calculated with an arbitrary hash
                 algorithm (field format: [<hash algo>:]digest, where the digest
                 prefix is shown only if the hash algorithm is not SHA1 or MD5);
       - 'n-ng': the name of the event, without size limitations.
      
      Defining a new template descriptor requires specifying the template format,
      a string of field identifiers separated by the '|' character.  This patch
      set defines the following template descriptors:
       - "ima": its format is 'd|n';
       - "ima-ng" (default): its format is 'd-ng|n-ng'
      
      Further details about the new template architecture can be found in
      Documentation/security/IMA-templates.txt.
      
      Changelog:
      - don't defer calling ima_init_template() - Mimi
      - don't define ima_lookup_template_desc() until used - Mimi
      - squashed with documentation patch - Mimi
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      adf53a77
    • R
      ima: define new function ima_alloc_init_template() to API · 7bc5f447
      Roberto Sassu 提交于
      Instead of allocating and initializing the template entry from multiple
      places (eg. boot aggregate, violation, and regular measurements), this
      patch defines a new function called ima_alloc_init_template().  The new
      function allocates and initializes the measurement entry with the inode
      digest and the filename.
      
      In respect to the current behavior, it truncates the file name passed
      in the 'filename' argument if the latter's size is greater than 255 bytes
      and the passed file descriptor is NULL.
      
      Changelog:
      - initialize 'hash' variable for non TPM case - Mimi
      - conform to expectation for 'iint' to be defined as a pointer. - Mimi
      - add missing 'file' dependency for recalculating file hash. - Mimi
      Signed-off-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      7bc5f447