1. 18 7月, 2018 7 次提交
  2. 17 7月, 2018 5 次提交
  3. 01 6月, 2018 1 次提交
  4. 31 5月, 2018 5 次提交
  5. 23 5月, 2018 1 次提交
    • M
      ima: fix updating the ima_appraise flag · 6f0911a6
      Mimi Zohar 提交于
      As IMA policy rules are added, a mask of the type of rule (eg. kernel
      modules, firmware, IMA policy) is updated.  Unlike custom IMA policy
      rules, which replace the original builtin policy rules and update the
      mask, the builtin "secure_boot" policy rules were loaded, but did not
      update the mask.
      
      This patch refactors the code to load custom policies, defining a new
      function named ima_appraise_flag().  The new function is called either
      when loading the builtin "secure_boot" or custom policies.
      
      Fixes: 503ceaef ("ima: define a set of appraisal rules requiring file signatures")
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      6f0911a6
  6. 22 5月, 2018 2 次提交
    • M
      ima: based on policy verify firmware signatures (pre-allocated buffer) · fd90bc55
      Mimi Zohar 提交于
      Don't differentiate, for now, between kernel_read_file_id READING_FIRMWARE
      and READING_FIRMWARE_PREALLOC_BUFFER enumerations.
      
      Fixes: a098ecd2 firmware: support loading into a pre-allocated buffer (since 4.8)
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: Luis R. Rodriguez <mcgrof@suse.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Serge E. Hallyn <serge@hallyn.com>
      Cc: Stephen Boyd <stephen.boyd@linaro.org>
      fd90bc55
    • M
      ima: define a new policy condition based on the filesystem name · f1b08bbc
      Mimi Zohar 提交于
      If/when file data signatures are distributed with the file data, this
      patch will not be needed.  In the current environment where only some
      files are signed, the ability to differentiate between file systems is
      needed.  Some file systems consider the file system magic number
      internal to the file system.
      
      This patch defines a new IMA policy condition named "fsname", based on
      the superblock's file_system_type (sb->s_type) name. This allows policy
      rules to be expressed in terms of the filesystem name.
      
      The following sample rules require file signatures on rootfs files
      executed or mmap'ed.
      
      appraise func=BPRM_CHECK fsname=rootfs appraise_type=imasig
      appraise func=FILE_MMAP fsname=rootfs appraise_type=imasig
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Theodore Ts'o <tytso@mit.edu>
      f1b08bbc
  7. 19 5月, 2018 2 次提交
    • M
      EVM: Allow runtime modification of the set of verified xattrs · fa516b66
      Matthew Garrett 提交于
      Sites may wish to provide additional metadata alongside files in order
      to make more fine-grained security decisions[1]. The security of this is
      enhanced if this metadata is protected, something that EVM makes
      possible. However, the kernel cannot know about the set of extended
      attributes that local admins may wish to protect, and hardcoding this
      policy in the kernel makes it difficult to change over time and less
      convenient for distributions to enable.
      
      This patch adds a new /sys/kernel/security/integrity/evm/evm_xattrs node,
      which can be read to obtain the current set of EVM-protected extended
      attributes or written to in order to add new entries. Extending this list
      will not change the validity of any existing signatures provided that the
      file in question does not have any of the additional extended attributes -
      missing xattrs are skipped when calculating the EVM hash.
      
      [1] For instance, a package manager could install information about the
      package uploader in an additional extended attribute. Local LSM policy
      could then be associated with that extended attribute in order to
      restrict the privileges available to packages from less trusted
      uploaders.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Reviewed-by: NJames Morris <james.morris@microsoft.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      fa516b66
    • M
      EVM: turn evm_config_xattrnames into a list · 21af7663
      Matthew Garrett 提交于
      Use a list of xattrs rather than an array - this makes it easier to
      extend the list at runtime.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Reviewed-by: NJames Morris <james.morris@microsoft.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      21af7663
  8. 17 5月, 2018 4 次提交
  9. 15 5月, 2018 1 次提交
  10. 04 5月, 2018 1 次提交
  11. 25 3月, 2018 8 次提交
    • P
      ima: Fallback to the builtin hash algorithm · ab60368a
      Petr Vorel 提交于
      IMA requires having it's hash algorithm be compiled-in due to it's
      early use.  The default IMA algorithm is protected by Kconfig to be
      compiled-in.
      
      The ima_hash kernel parameter allows to choose the hash algorithm. When
      the specified algorithm is not available or available as a module, IMA
      initialization fails, which leads to a kernel panic (mknodat syscall calls
      ima_post_path_mknod()).  Therefore as fallback we force IMA to use
      the default builtin Kconfig hash algorithm.
      
      Fixed crash:
      
      $ grep CONFIG_CRYPTO_MD4 .config
      CONFIG_CRYPTO_MD4=m
      
      [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.14-2.3-default root=UUID=74ae8202-9ca7-4e39-813b-22287ec52f7a video=1024x768-16 plymouth.ignore-serial-consoles console=ttyS0 console=tty resume=/dev/disk/by-path/pci-0000:00:07.0-part3 splash=silent showopts ima_hash=md4
      ...
      [    1.545190] ima: Can not allocate md4 (reason: -2)
      ...
      [    2.610120] BUG: unable to handle kernel NULL pointer dereference at           (null)
      [    2.611903] IP: ima_match_policy+0x23/0x390
      [    2.612967] PGD 0 P4D 0
      [    2.613080] Oops: 0000 [#1] SMP
      [    2.613080] Modules linked in: autofs4
      [    2.613080] Supported: Yes
      [    2.613080] CPU: 0 PID: 1 Comm: systemd Not tainted 4.12.14-2.3-default #1
      [    2.613080] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
      [    2.613080] task: ffff88003e2d0040 task.stack: ffffc90000190000
      [    2.613080] RIP: 0010:ima_match_policy+0x23/0x390
      [    2.613080] RSP: 0018:ffffc90000193e88 EFLAGS: 00010296
      [    2.613080] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000004
      [    2.613080] RDX: 0000000000000010 RSI: 0000000000000001 RDI: ffff880037071728
      [    2.613080] RBP: 0000000000008000 R08: 0000000000000000 R09: 0000000000000000
      [    2.613080] R10: 0000000000000008 R11: 61c8864680b583eb R12: 00005580ff10086f
      [    2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000008000
      [    2.613080] FS:  00007f5c1da08940(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
      [    2.613080] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    2.613080] CR2: 0000000000000000 CR3: 0000000037002000 CR4: 00000000003406f0
      [    2.613080] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [    2.613080] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [    2.613080] Call Trace:
      [    2.613080]  ? shmem_mknod+0xbf/0xd0
      [    2.613080]  ima_post_path_mknod+0x1c/0x40
      [    2.613080]  SyS_mknod+0x210/0x220
      [    2.613080]  entry_SYSCALL_64_fastpath+0x1a/0xa5
      [    2.613080] RIP: 0033:0x7f5c1bfde570
      [    2.613080] RSP: 002b:00007ffde1c90dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000085
      [    2.613080] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c1bfde570
      [    2.613080] RDX: 0000000000000000 RSI: 0000000000008000 RDI: 00005580ff10086f
      [    2.613080] RBP: 00007ffde1c91040 R08: 00005580ff10086f R09: 0000000000000000
      [    2.613080] R10: 0000000000104000 R11: 0000000000000246 R12: 00005580ffb99660
      [    2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002
      [    2.613080] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 41 56 44 8d 14 09 41 55 41 54 55 53 44 89 d3 09 cb 48 83 ec 38 48 8b 05 c5 03 29 01 <4c> 8b 20 4c 39 e0 0f 84 d7 01 00 00 4c 89 44 24 08 89 54 24 20
      [    2.613080] RIP: ima_match_policy+0x23/0x390 RSP: ffffc90000193e88
      [    2.613080] CR2: 0000000000000000
      [    2.613080] ---[ end trace 9a9f0a8a73079f6a ]---
      [    2.673052] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
      [    2.673052]
      [    2.675337] Kernel Offset: disabled
      [    2.676405] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
      Signed-off-by: NPetr Vorel <pvorel@suse.cz>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      ab60368a
    • M
      ima: Add smackfs to the default appraise/measure list · 1c070b18
      Martin Townsend 提交于
      This is required to use SMACK and IMA/EVM together. Add it to the
      default nomeasure/noappraise list like other pseudo filesystems.
      Signed-off-by: NMartin Townsend <mtownsend1973@gmail.com>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      1c070b18
    • S
      evm: check for remount ro in progress before writing · 70946c4a
      Sascha Hauer 提交于
      EVM might update the evm xattr while the VFS performs a remount to
      readonly mode. This is not properly checked for, additionally check
      the s_readonly_remount superblock flag before writing.
      
      The bug can for example be observed with UBIFS. UBIFS checks the free
      space on the device before and after a remount. With EVM enabled the
      free space sometimes differs between both checks.
      Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      70946c4a
    • T
      ima: Improvements in ima_appraise_measurement() · f5e51fa3
      Thiago Jung Bauermann 提交于
      Replace nested ifs in the EVM xattr verification logic with a switch
      statement, making the code easier to understand.
      
      Also, add comments to the if statements in the out section and constify the
      cause variable.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
      Acked-by: NSerge Hallyn <serge@hallyn.com>
      f5e51fa3
    • T
      ima: Simplify ima_eventsig_init() · 1775cb87
      Thiago Jung Bauermann 提交于
      The "goto out" statement doesn't have any purpose since there's no cleanup
      to be done when returning early, so remove it. This also makes the rc
      variable unnecessary so remove it as well.
      
      Also, the xattr_len and fmt variables are redundant so remove them as well.
      Signed-off-by: NThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
      Acked-by: NSerge Hallyn <serge@hallyn.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      1775cb87
    • T
      integrity: Remove unused macro IMA_ACTION_RULE_FLAGS · 11c60f23
      Thiago Jung Bauermann 提交于
      This macro isn't used anymore since commit 0d73a552 ("ima: re-introduce
      own integrity cache lock"), so remove it.
      Signed-off-by: NThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
      Acked-by: NSerge Hallyn <serge@hallyn.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      11c60f23
    • T
      ima: drop vla in ima_audit_measurement() · e456ef88
      Tycho Andersen 提交于
      In keeping with the directive to get rid of VLAs [1], let's drop the VLA
      from ima_audit_measurement(). We need to adjust the return type of
      ima_audit_measurement, because now this function can fail if an allocation
      fails.
      
      [1]: https://lkml.org/lkml/2018/3/7/621
      
      v2: just use audit_log_format instead of doing a second allocation
      v3: ignore failures in ima_audit_measurement()
      Signed-off-by: NTycho Andersen <tycho@tycho.ws>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      e456ef88
    • J
      ima: Fix Kconfig to select TPM 2.0 CRB interface · fac37c62
      Jiandi An 提交于
      TPM_CRB driver provides TPM CRB 2.0 support.  If it is built as a
      module, the TPM chip is registered after IMA init.  tpm_pcr_read() in
      IMA fails and displays the following message even though eventually
      there is a TPM chip on the system.
      
      ima: No TPM chip found, activating TPM-bypass! (rc=-19)
      
      Fix IMA Kconfig to select TPM_CRB so TPM_CRB driver is built in the kernel
      and initializes before IMA.
      Signed-off-by: NJiandi An <anjiandi@codeaurora.org>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      fac37c62
  12. 23 3月, 2018 3 次提交