Skip to content
Snippets Groups Projects
  1. Oct 28, 2021
  2. Oct 10, 2021
  3. Aug 27, 2021
  4. Aug 23, 2021
  5. Aug 16, 2021
    • THOBY Simon's avatar
      IMA: prevent SETXATTR_CHECK policy rules with unavailable algorithms · 8ecd39cb
      THOBY Simon authored
      
      SETXATTR_CHECK policy rules assume that any algorithm listed in the
      'appraise_algos' flag must be accepted when performing setxattr() on
      the security.ima xattr.  However nothing checks that they are
      available in the current kernel.  A userland application could hash
      a file with a digest that the kernel wouldn't be able to verify.
      However, if SETXATTR_CHECK is not in use, the kernel already forbids
      that xattr write.
      
      Verify that algorithms listed in appraise_algos are available to the
      current kernel and reject the policy update otherwise. This will fix
      the inconsistency between SETXATTR_CHECK and non-SETXATTR_CHECK
      behaviors.
      
      That filtering is only performed in ima_parse_appraise_algos() when
      updating policies so that we do not have to pay the price of
      allocating a hash object every time validate_hash_algo() is called
      in ima_inode_setxattr().
      
      Signed-off-by: default avatarTHOBY Simon <Simon.THOBY@viveris.fr>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      8ecd39cb
    • THOBY Simon's avatar
      IMA: introduce a new policy option func=SETXATTR_CHECK · 4f2946aa
      THOBY Simon authored
      
      While users can restrict the accepted hash algorithms for the
      security.ima xattr file signature when appraising said file, users
      cannot restrict the algorithms that can be set on that attribute:
      any algorithm built in the kernel is accepted on a write.
      
      Define a new value for the ima policy option 'func' that restricts
      globally the hash algorithms accepted when writing the security.ima
      xattr.
      
      When a policy contains a rule of the form
      	appraise func=SETXATTR_CHECK appraise_algos=sha256,sha384,sha512
      only values corresponding to one of these three digest algorithms
      will be accepted for writing the security.ima xattr.  Attempting to
      write the attribute using another algorithm (or "free-form" data)
      will be denied with an audit log message.  In the absence of such a
      policy rule, the default is still to only accept hash algorithms
      built in the kernel (with all the limitations that entails).
      
      Signed-off-by: default avatarTHOBY Simon <Simon.THOBY@viveris.fr>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      4f2946aa
    • THOBY Simon's avatar
      IMA: add a policy option to restrict xattr hash algorithms on appraisal · 583a80ae
      THOBY Simon authored
      
      The kernel has the ability to restrict the set of hash algorithms it
      accepts for the security.ima xattr when it appraises files.
      
      Define a new IMA policy rule option "appraise_algos=", using the
      mentioned mechanism to expose a user-toggable policy knob to opt-in
      to that restriction and select the desired set of algorithms that
      must be accepted.
      
      When a policy rule uses the 'appraise_algos' option, appraisal of a
      file referenced by that rule will now fail if the digest algorithm
      employed to hash the file was not one of those explicitly listed in
      the option.  In its absence, any hash algorithm compiled in the
      kernel will be accepted.
      
      For example, on a system where SELinux is properly deployed, the rule
      	appraise func=BPRM_CHECK obj_type=iptables_exec_t \
      		appraise_algos=sha256,sha384
      will block the execution of iptables if the xattr security.ima of its
      executables were not hashed with either sha256 or sha384.
      
      Signed-off-by: default avatarTHOBY Simon <Simon.THOBY@viveris.fr>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      583a80ae
    • THOBY Simon's avatar
      IMA: add support to restrict the hash algorithms used for file appraisal · 1624dc00
      THOBY Simon authored
      
      The kernel accepts any hash algorithm as a value for the security.ima
      xattr. Users may wish to restrict the accepted algorithms to only
      support strong cryptographic ones.
      
      Provide the plumbing to restrict the permitted set of hash algorithms
      used for verifying file hashes and signatures stored in security.ima
      xattr.
      
      Signed-off-by: default avatarTHOBY Simon <Simon.THOBY@viveris.fr>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      1624dc00
    • THOBY Simon's avatar
      IMA: block writes of the security.ima xattr with unsupported algorithms · 50f742dd
      THOBY Simon authored
      
      By default, writes to the extended attributes security.ima will be
      allowed even if the hash algorithm used for the xattr is not compiled
      in the kernel (which does not make sense because the kernel would not
      be able to appraise that file as it lacks support for validating the
      hash).
      
      Prevent and audit writes to the security.ima xattr if the hash algorithm
      used in the new value is not available in the current kernel.
      
      Signed-off-by: default avatarTHOBY Simon <Simon.THOBY@viveris.fr>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      50f742dd
    • THOBY Simon's avatar
      IMA: remove the dependency on CRYPTO_MD5 · 8510505d
      THOBY Simon authored
      
      MD5 is a weak digest algorithm that shouldn't be used for cryptographic
      operation. It hinders the efficiency of a patch set that aims to limit
      the digests allowed for the extended file attribute namely security.ima.
      MD5 is no longer a requirement for IMA, nor should it be used there.
      
      The sole place where we still use the MD5 algorithm inside IMA is setting
      the ima_hash algorithm to MD5, if the user supplies 'ima_hash=md5'
      parameter on the command line.  With commit ab60368a ("ima: Fallback
      to the builtin hash algorithm"), setting "ima_hash=md5" fails gracefully
      when CRYPTO_MD5 is not set:
      	ima: Can not allocate md5 (reason: -2)
      	ima: Allocating md5 failed, going to use default hash algorithm sha256
      
      Remove the CRYPTO_MD5 dependency for IMA.
      
      Signed-off-by: default avatarTHOBY Simon <Simon.THOBY@viveris.fr>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      [zohar@linux.ibm.com: include commit number in patch description for
      stable.]
      Cc: stable@vger.kernel.org # 4.17
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      8510505d
  6. Aug 10, 2021
    • Tushar Sugandhi's avatar
      dm ima: measure data on table load · 91ccbbac
      Tushar Sugandhi authored
      
      DM configures a block device with various target specific attributes
      passed to it as a table.  DM loads the table, and calls each target’s
      respective constructors with the attributes as input parameters.
      Some of these attributes are critical to ensure the device meets
      certain security bar.  Thus, IMA should measure these attributes, to
      ensure they are not tampered with, during the lifetime of the device.
      So that the external services can have high confidence in the
      configuration of the block-devices on a given system.
      
      Some devices may have large tables.  And a given device may change its
      state (table-load, suspend, resume, rename, remove, table-clear etc.)
      many times.  Measuring these attributes each time when the device
      changes its state will significantly increase the size of the IMA logs.
      Further, once configured, these attributes are not expected to change
      unless a new table is loaded, or a device is removed and recreated.
      Therefore the clear-text of the attributes should only be measured
      during table load, and the hash of the active/inactive table should be
      measured for the remaining device state changes.
      
      Export IMA function ima_measure_critical_data() to allow measurement
      of DM device parameters, as well as target specific attributes, during
      table load.  Compute the hash of the inactive table and store it for
      measurements during future state change.  If a load is called multiple
      times, update the inactive table hash with the hash of the latest
      populated table.  So that the correct inactive table hash is measured
      when the device transitions to different states like resume, remove,
      rename, etc.
      
      Signed-off-by: default avatarTushar Sugandhi <tusharsu@linux.microsoft.com>
      Signed-off-by: Colin Ian King <colin.king@canonical.com> # leak fix
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      91ccbbac
  7. Jul 23, 2021
    • Roberto Sassu's avatar
      ima: Add digest and digest_len params to the functions to measure a buffer · ca3c9bdb
      Roberto Sassu authored
      
      This patch performs the final modification necessary to pass the buffer
      measurement to callers, so that they provide a functionality similar to
      ima_file_hash(). It adds the 'digest' and 'digest_len' parameters to
      ima_measure_critical_data() and process_buffer_measurement().
      
      These functions calculate the digest even if there is no suitable rule in
      the IMA policy and, in this case, they simply return 1 before generating a
      new measurement entry.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      ca3c9bdb
    • Roberto Sassu's avatar
      ima: Return int in the functions to measure a buffer · ce5bb5a8
      Roberto Sassu authored
      
      ima_measure_critical_data() and process_buffer_measurement() currently
      don't return a result as, unlike appraisal-related functions, the result is
      not used by callers to deny an operation. Measurement-related functions
      instead rely on the audit subsystem to notify the system administrator when
      an error occurs.
      
      However, ima_measure_critical_data() and process_buffer_measurement() are a
      special case, as these are the only functions that can return a buffer
      measurement (for files, there is ima_file_hash()). In a subsequent patch,
      they will be modified to return the calculated digest.
      
      In preparation to return the result of the digest calculation, this patch
      modifies the return type from void to int, and returns 0 if the buffer has
      been successfully measured, a negative value otherwise.
      
      Given that the result of the measurement is still not necessary, this patch
      does not modify the behavior of existing callers by processing the returned
      value. For those, the return value is ignored.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Acked-by: Paul Moore <paul@paul-moore.com> (for the SELinux bits)
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      ce5bb5a8
    • Roberto Sassu's avatar
      ima: Introduce ima_get_current_hash_algo() · 5d1ef2ce
      Roberto Sassu authored
      
      Buffer measurements, unlike file measurements, are not accessible after the
      measurement is done, as buffers are not suitable for use with the
      integrity_iint_cache structure (there is no index, for files it is the
      inode number). In the subsequent patches, the measurement (digest) will be
      returned directly by the functions that perform the buffer measurement,
      ima_measure_critical_data() and process_buffer_measurement().
      
      A caller of those functions also needs to know the algorithm used to
      calculate the digest. Instead of adding the algorithm as a new parameter to
      the functions, this patch provides it separately with the new function
      ima_get_current_hash_algo().
      
      Since the hash algorithm does not change after the IMA setup phase, there
      is no risk of races (obtaining a digest calculated with a different
      algorithm than the one returned).
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      [zohar@linux.ibm.com: annotate ima_hash_algo as __ro_after_init]
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      5d1ef2ce
    • Austin Kim's avatar
      IMA: remove -Wmissing-prototypes warning · a32ad904
      Austin Kim authored
      
      With W=1 build, the compiler throws warning message as below:
      
         security/integrity/ima/ima_mok.c:24:12: warning:
         no previous prototype for ‘ima_mok_init’ [-Wmissing-prototypes]
             __init int ima_mok_init(void)
      
      Silence the warning by adding static keyword to ima_mok_init().
      
      Signed-off-by: default avatarAustin Kim <austin.kim@lge.com>
      Fixes: 41c89b64 ("IMA: create machine owner and blacklist keyrings")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      a32ad904
  8. Jun 21, 2021
    • Roberto Sassu's avatar
      evm: Check xattr size discrepancy between kernel and user · 907a399d
      Roberto Sassu authored
      
      The kernel and the user obtain an xattr value in two different ways:
      
      kernel (EVM): uses vfs_getxattr_alloc() which obtains the xattr value from
                    the filesystem handler (raw value);
      
      user (ima-evm-utils): uses vfs_getxattr() which obtains the xattr value
                            from the LSMs (normalized value).
      
      Normally, this does not have an impact unless security.selinux is set with
      setfattr, with a value not terminated by '\0' (this is not the recommended
      way, security.selinux should be set with the appropriate tools such as
      chcon and restorecon).
      
      In this case, the kernel and the user see two different xattr values: the
      former sees the xattr value without '\0' (raw value), the latter sees the
      value with '\0' (value normalized by SELinux).
      
      This could result in two different verification outcomes from EVM and
      ima-evm-utils, if a signature was calculated with a security.selinux value
      terminated by '\0' and the value set in the filesystem is not terminated by
      '\0'. The former would report verification failure due to the missing '\0',
      while the latter would report verification success (because it gets the
      normalized value with '\0').
      
      This patch mitigates this issue by comparing in evm_calc_hmac_or_hash() the
      size of the xattr returned by the two xattr functions and by warning the
      user if there is a discrepancy.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Suggested-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      907a399d
  9. Jun 20, 2021
  10. Jun 11, 2021
    • Tushar Sugandhi's avatar
      IMA: support for duplicate measurement records · 52c20839
      Tushar Sugandhi authored
      
      IMA measures contents of a given file/buffer/critical-data record,
      and properly re-measures it on change.  However, IMA does not measure
      the duplicate value for a given record, since TPM extend is a very
      expensive operation.  For example, if the record changes from value
      'v#1' to 'v#2', and then back to 'v#1', IMA will not measure and log
      the last change to 'v#1', since the hash of 'v#1' for that record is
      already present in the IMA htable.  This limits the ability of an
      external attestation service to accurately determine the current state
      of the system.  The service would incorrectly conclude that the latest
      value of the given record on the system is 'v#2', and act accordingly.
      
      Define and use a new Kconfig option IMA_DISABLE_HTABLE to permit
      duplicate records in the IMA measurement list.
      
      In addition to the duplicate measurement records described above,
      other duplicate file measurement records may be included in the log,
      when CONFIG_IMA_DISABLE_HTABLE is enabled.  For example,
          - i_version is not enabled,
          - i_generation changed,
          - same file present on different filesystems,
          - an inode is evicted from dcache
      
      Signed-off-by: default avatarTushar Sugandhi <tusharsu@linux.microsoft.com>
      Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
      [zohar@linux.ibm.com: updated list of duplicate measurement records]
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      52c20839
    • Lakshmi Ramasubramanian's avatar
      ima: Fix warning: no previous prototype for function 'ima_add_kexec_buffer' · c6791349
      Lakshmi Ramasubramanian authored
      
      The function prototype for ima_add_kexec_buffer() is present
      in 'linux/ima.h'.  But this header file is not included in
      ima_kexec.c where the function is implemented.  This results
      in the following compiler warning when "-Wmissing-prototypes" flag
      is turned on:
      
        security/integrity/ima/ima_kexec.c:81:6: warning: no previous prototype
        for function 'ima_add_kexec_buffer' [-Wmissing-prototypes]
      
      Include the header file 'linux/ima.h' in ima_kexec.c to fix
      the compiler warning.
      
      Fixes: dce92f6b (arm64: Enable passing IMA log to next kernel on kexec)
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarLakshmi Ramasubramanian <nramas@linux.microsoft.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      c6791349
  11. Jun 10, 2021
  12. Jun 09, 2021
  13. Jun 08, 2021
  14. Jun 03, 2021
    • Roberto Sassu's avatar
      evm: Don't return an error in evm_write_xattrs() if audit is not enabled · d721c15f
      Roberto Sassu authored
      
      This patch avoids that evm_write_xattrs() returns an error when audit is
      not enabled. The ab variable can be NULL and still be passed to the other
      audit_log_() functions, as those functions do not include any instruction.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      d721c15f
    • Roberto Sassu's avatar
      ima: Define new template evm-sig · 88016de3
      Roberto Sassu authored
      
      With the recent introduction of the evmsig template field, remote verifiers
      can obtain the EVM portable signature instead of the IMA signature, to
      verify file metadata.
      
      After introducing the new fields to include file metadata in the
      measurement list, this patch finally defines the evm-sig template, whose
      format is:
      
      d-ng|n-ng|evmsig|xattrnames|xattrlengths|xattrvalues|iuid|igid|imode
      
      xattrnames, xattrlengths and xattrvalues are populated only from defined
      EVM protected xattrs, i.e. the ones that EVM considers to verify the
      portable signature. xattrnames and xattrlengths are populated only if the
      xattr is present.
      
      xattrnames and xattrlengths are not necessary for verifying the EVM
      portable signature, but they are included for completeness of information,
      if a remote verifier wants to infer more from file metadata.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      88016de3
  15. Jun 02, 2021
  16. Jun 01, 2021
    • Roberto Sassu's avatar
      evm: Verify portable signatures against all protected xattrs · 8c7a703e
      Roberto Sassu authored
      
      Currently, the evm_config_default_xattrnames array contains xattr names
      only related to LSMs which are enabled in the kernel configuration.
      However, EVM portable signatures do not depend on local information and a
      vendor might include in the signature calculation xattrs that are not
      enabled in the target platform.
      
      Just including all xattrs names in evm_config_default_xattrnames is not a
      safe approach, because a target system might have already calculated
      signatures or HMACs based only on the enabled xattrs. After applying this
      patch, EVM would verify those signatures and HMACs with all xattrs instead.
      The non-enabled ones, which could possibly exist, would cause a
      verification error.
      
      Thus, this patch adds a new field named enabled to the xattr_list
      structure, which is set to true if the LSM associated to a given xattr name
      is enabled in the kernel configuration. The non-enabled xattrs are taken
      into account only in evm_calc_hmac_or_hash(), if the passed security.evm
      type is EVM_XATTR_PORTABLE_DIGSIG.
      
      The new function evm_protected_xattr_if_enabled() has been defined so that
      IMA can include all protected xattrs and not only the enabled ones in the
      measurement list, if the new template fields xattrnames, xattrlengths or
      xattrvalues have been included in the template format.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      8c7a703e
    • Roberto Sassu's avatar
      ima: Define new template field imode · f8216f6b
      Roberto Sassu authored
      
      This patch defines the new template field imode, which includes the
      inode mode. It can be used by a remote verifier to verify the EVM portable
      signature, if it was included with the template fields sig or evmsig.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      f8216f6b
    • Roberto Sassu's avatar
      ima: Define new template fields iuid and igid · 7dcfeacc
      Roberto Sassu authored
      
      This patch defines the new template fields iuid and igid, which include
      respectively the inode UID and GID. For idmapped mounts, still the original
      UID and GID are provided.
      
      These fields can be used to verify the EVM portable signature, if it was
      included with the template fields sig or evmsig.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      7dcfeacc
    • Roberto Sassu's avatar
      ima: Add ima_show_template_uint() template library function · cde1391a
      Roberto Sassu authored
      
      This patch introduces the new function ima_show_template_uint(). This can
      be used for showing integers of different sizes in ASCII format. The
      function ima_show_template_data_ascii() automatically determines how to
      print a stored integer by checking the integer size.
      
      If integers have been written in canonical format,
      ima_show_template_data_ascii() calls the appropriate leXX_to_cpu() function
      to correctly display the value.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      cde1391a
    • Roberto Sassu's avatar
      ima: Don't remove security.ima if file must not be appraised · ed1b472f
      Roberto Sassu authored
      
      Files might come from a remote source and might have xattrs, including
      security.ima. It should not be IMA task to decide whether security.ima
      should be kept or not. This patch removes the removexattr() system
      call in ima_inode_post_setattr().
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      ed1b472f
    • Roberto Sassu's avatar
      ima: Introduce template field evmsig and write to field sig as fallback · 026d7fc9
      Roberto Sassu authored
      
      With the patch to accept EVM portable signatures when the
      appraise_type=imasig requirement is specified in the policy, appraisal can
      be successfully done even if the file does not have an IMA signature.
      
      However, remote attestation would not see that a different signature type
      was used, as only IMA signatures can be included in the measurement list.
      This patch solves the issue by introducing the new template field 'evmsig'
      to show EVM portable signatures and by including its value in the existing
      field 'sig' if the IMA signature is not found.
      
      Suggested-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      026d7fc9
    • Roberto Sassu's avatar
      ima: Allow imasig requirement to be satisfied by EVM portable signatures · 7aa5783d
      Roberto Sassu authored
      
      System administrators can require that all accessed files have a signature
      by specifying appraise_type=imasig in a policy rule.
      
      Currently, IMA signatures satisfy this requirement. Appended signatures may
      also satisfy this requirement, but are not applicable as IMA signatures.
      IMA/appended signatures ensure data source authentication for file content
      and prevent any change. EVM signatures instead ensure data source
      authentication for file metadata. Given that the digest or signature of the
      file content must be included in the metadata, EVM signatures provide the
      same file data guarantees of IMA signatures, as well as providing file
      metadata guarantees.
      
      This patch lets systems protected with EVM signatures pass appraisal
      verification if the appraise_type=imasig requirement is specified in the
      policy. This facilitates deployment in the scenarios where only EVM
      signatures are available.
      
      The patch makes the following changes:
      
      file xattr types:
      security.ima: IMA_XATTR_DIGEST/IMA_XATTR_DIGEST_NG
      security.evm: EVM_XATTR_PORTABLE_DIGSIG
      
      execve(), mmap(), open() behavior (with appraise_type=imasig):
      before: denied (file without IMA signature, imasig requirement not met)
      after: allowed (file with EVM portable signature, imasig requirement met)
      
      open(O_WRONLY) behavior (without appraise_type=imasig):
      before: allowed (file without IMA signature, not immutable)
      after: denied (file with EVM portable signature, immutable)
      
      In addition, similarly to IMA signatures, this patch temporarily allows
      new files without or with incomplete metadata to be opened so that content
      can be written.
      
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      7aa5783d
    • Roberto Sassu's avatar
      evm: Allow setxattr() and setattr() for unmodified metadata · 1886ab01
      Roberto Sassu authored
      
      With the patch to allow xattr/attr operations if a portable signature
      verification fails, cp and tar can copy all xattrs/attrs so that at the
      end of the process verification succeeds.
      
      However, it might happen that the xattrs/attrs are already set to the
      correct value (taken at signing time) and signature verification succeeds
      before the copy has completed. For example, an archive might contains files
      owned by root and the archive is extracted by root.
      
      Then, since portable signatures are immutable, all subsequent operations
      fail (e.g. fchown()), even if the operation is legitimate (does not alter
      the current value).
      
      This patch avoids this problem by reporting successful operation to user
      space when that operation does not alter the current value of xattrs/attrs.
      
      With this patch, the one that introduces evm_hmac_disabled() and the one
      that allows a metadata operation on the INTEGRITY_FAIL_IMMUTABLE error, EVM
      portable signatures can be used without disabling metadata verification
      (by setting EVM_ALLOW_METADATA_WRITES). Due to keeping metadata
      verification enabled, altering immutable metadata protected with a portable
      signature that was successfully verified will be denied (existing
      behavior).
      
      Reported-by: kernel test robot <lkp@intel.com> [implicit declaration of function]
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Reviewed-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
      Cc: Andreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
      1886ab01
Loading