1. 22 6月, 2017 14 次提交
    • T
      ima: Simplify policy_func_show. · 2663218b
      Thiago Jung Bauermann 提交于
      If the func_tokens array uses the same indices as enum ima_hooks,
      policy_func_show can be a lot simpler, and the func_* enum becomes
      unnecessary.
      
      Also, if we use the same macro trick used by kernel_read_file_id_str we can
      use one hooks list for both the enum and the string array, making sure they
      are always in sync (suggested by Mimi Zohar).
      
      Finally, by using the printf pattern for the function token directly
      instead of using the pt macro we can simplify policy_func_show even further
      and avoid needing a temporary buffer.
      Signed-off-by: NThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      2663218b
    • 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
    • R
      ima: fix get_binary_runtime_size() · e4586c79
      Roberto Sassu 提交于
      Remove '+ 1' from 'size += strlen(entry->template_desc->name) + 1;',
      as the template name is sent to userspace without the '\0' character.
      Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      e4586c79
    • R
      ima: use ima_parse_buf() to parse template data · 28a8dc41
      Roberto Sassu 提交于
      The binary_field_data structure definition has been removed from
      ima_restore_template_data(). The lengths and data pointers are directly
      stored into the template_data array of the ima_template_entry structure.
      For template data, both the number of fields and buffer end checks can
      be done, as these information are known (respectively from the template
      descriptor, and from the measurement header field).
      Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      28a8dc41
    • R
      ima: use ima_parse_buf() to parse measurements headers · 47fdee60
      Roberto Sassu 提交于
      The binary_hdr_v1 and binary_data_v1 structures defined in
      ima_restore_measurement_list() have been replaced with an array of four
      ima_field_data structures where pcr, digest, template name and
      template data lengths and pointers are stored.
      
      The length of pcr and digest in the ima_field_data array and the bits
      in the bitmap are set before ima_parse_buf() is called. The ENFORCE_FIELDS
      bit is set for all entries except the last one (there is still data to
      parse), and ENFORCE_BUFEND is set only for the last entry.
      Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      47fdee60
    • R
      ima: introduce ima_parse_buf() · b17fd9ec
      Roberto Sassu 提交于
      ima_parse_buf() takes as input the buffer start and end pointers, and
      stores the result in a static array of ima_field_data structures,
      where the len field contains the length parsed from the buffer, and
      the data field contains the address of the buffer just after the length.
      Optionally, the function returns the current value of the buffer pointer
      and the number of array elements written.
      
      A bitmap has been added as parameter of ima_parse_buf() to handle
      the cases where the length is not prepended to data. Each bit corresponds
      to an element of the ima_field_data array. If a bit is set, the length
      is not parsed from the buffer, but is read from the corresponding element
      of the array (the length must be set before calling the function).
      
      ima_parse_buf() can perform three checks upon request by callers,
      depending on the enforce mask passed to it:
      
      - ENFORCE_FIELDS: matching of number of fields (length-data combination)
        - there must be enough data in the buffer to parse the number of fields
          requested (output: current value of buffer pointer)
      - ENFORCE_BUFEND: matching of buffer end
        - the ima_field_data array must be large enough to contain lengths and
          data pointers for the amount of data requested (output: number
          of fields written)
      - ENFORCE_FIELDS | ENFORCE_BUFEND: matching of both
      
      Use cases
      
      - measurement entry header: ENFORCE_FIELDS | ENFORCE_BUFEND
        - four fields must be parsed: pcr, digest, template name, template data
        - ENFORCE_BUFEND is enforced only for the last measurement entry
      - template digest (Crypto Agile): ENFORCE_BUFEND
        - since only the total template digest length is known, the function
          parses length-data combinations until the buffer end is reached
      - template data: ENFORCE_FIELDS | ENFORCE_BUFEND
        - since the number of fields and the total template data length
          are known, the function can perform both checks
      Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      b17fd9ec
    • L
      ima: Add cgroups2 to the defaults list · 82e3bb4d
      Laura Abbott 提交于
      cgroups2 is beginning to show up in wider usage. Add it to the default
      nomeasure/noappraise list like other filesystems.
      Signed-off-by: NLaura Abbott <labbott@redhat.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      82e3bb4d
    • G
      ima: use memdup_user_nul · b4e28030
      Geliang Tang 提交于
      Use memdup_user_nul() helper instead of open-coding to simplify the
      code.
      Signed-off-by: NGeliang Tang <geliangtang@gmail.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      b4e28030
    • T
      ima: fix up #endif comments · 5d659f28
      Tycho Andersen 提交于
      While reading the code, I noticed that these #endif comments don't match
      how they're actually nested. This patch fixes that.
      Signed-off-by: NTycho Andersen <tycho@docker.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      5d659f28
    • B
      IMA: Correct Kconfig dependencies for hash selection · 38d19268
      Ben Hutchings 提交于
      IMA uses the hash algorithm too early to be able to use a module.
      Require the selected hash algorithm to be built-in.
      Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      38d19268
    • M
      ima: define is_ima_appraise_enabled() · 6f6723e2
      Mimi Zohar 提交于
      Only return enabled if in enforcing mode, not fix or log modes.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      
      Changes:
      - Define is_ima_appraise_enabled() as a bool (Thiago Bauermann)
      6f6723e2
    • M
      ima: define Kconfig IMA_APPRAISE_BOOTPARAM option · e1f5e01f
      Mimi Zohar 提交于
      Permit enabling the different "ima_appraise=" modes (eg. log, fix)
      from the boot command line.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      e1f5e01f
    • M
      ima: define a set of appraisal rules requiring file signatures · 503ceaef
      Mimi Zohar 提交于
      The builtin "ima_appraise_tcb" policy should require file signatures for
      at least a few of the hooks (eg. kernel modules, firmware, and the kexec
      kernel image), but changing it would break the existing userspace/kernel
      ABI.
      
      This patch defines a new builtin policy named "secure_boot", which
      can be specified on the "ima_policy=" boot command line, independently
      or in conjunction with the "ima_appraise_tcb" policy, by specifing
      ima_policy="appraise_tcb | secure_boot".  The new appraisal rules
      requiring file signatures will be added prior to the "ima_appraise_tcb"
      rules.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      
      Changelog:
      - Reference secure boot in the new builtin policy name. (Thiago Bauermann)
      503ceaef
    • M
      ima: extend the "ima_policy" boot command line to support multiple policies · 33ce9549
      Mimi Zohar 提交于
      Add support for providing multiple builtin policies on the "ima_policy="
      boot command line.  Use "|" as the delimitor separating the policy names.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      33ce9549
  2. 21 6月, 2017 1 次提交
  3. 19 6月, 2017 2 次提交
  4. 14 6月, 2017 15 次提交
  5. 11 6月, 2017 8 次提交