1. 28 3月, 2016 15 次提交
  2. 04 3月, 2016 2 次提交
    • D
      X.509: Make algo identifiers text instead of enum · 4e8ae72a
      David Howells 提交于
      Make the identifier public key and digest algorithm fields text instead of
      enum.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      4e8ae72a
    • D
      akcipher: Move the RSA DER encoding check to the crypto layer · d43de6c7
      David Howells 提交于
      Move the RSA EMSA-PKCS1-v1_5 encoding from the asymmetric-key public_key
      subtype to the rsa crypto module's pkcs1pad template.  This means that the
      public_key subtype no longer has any dependencies on public key type.
      
      To make this work, the following changes have been made:
      
       (1) The rsa pkcs1pad template is now used for RSA keys.  This strips off the
           padding and returns just the message hash.
      
       (2) In a previous patch, the pkcs1pad template gained an optional second
           parameter that, if given, specifies the hash used.  We now give this,
           and pkcs1pad checks the encoded message E(M) for the EMSA-PKCS1-v1_5
           encoding and verifies that the correct digest OID is present.
      
       (3) The crypto driver in crypto/asymmetric_keys/rsa.c is now reduced to
           something that doesn't care about what the encryption actually does
           and and has been merged into public_key.c.
      
       (4) CONFIG_PUBLIC_KEY_ALGO_RSA is gone.  Module signing must set
           CONFIG_CRYPTO_RSA=y instead.
      
      Thoughts:
      
       (*) Should the encoding style (eg. raw, EMSA-PKCS1-v1_5) also be passed to
           the padding template?  Should there be multiple padding templates
           registered that share most of the code?
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTadeusz Struk <tadeusz.struk@intel.com>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      d43de6c7
  3. 21 2月, 2016 9 次提交
    • M
      ima: require signed IMA policy · 95ee08fa
      Mimi Zohar 提交于
      Require the IMA policy to be signed when additional rules can be added.
      
      v1:
      - initialize the policy flag
      - include IMA_APPRAISE_POLICY in the policy flag
      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>
      95ee08fa
    • 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
    • D
      ima: load policy using path · 7429b092
      Dmitry Kasatkin 提交于
      We currently cannot do appraisal or signature vetting of IMA policies
      since we currently can only load IMA policies by writing the contents
      of the policy directly in, as follows:
      
      cat policy-file > <securityfs>/ima/policy
      
      If we provide the kernel the path to the IMA policy so it can load
      the policy itself it'd be able to later appraise or vet the file
      signature if it has one.  This patch adds support to load the IMA
      policy with a given path as follows:
      
      echo /etc/ima/ima_policy > /sys/kernel/security/ima/policy
      
      Changelog v4+:
      - moved kernel_read_file_from_path() error messages to callers
      v3:
      - moved kernel_read_file_from_path() to a separate patch
      v2:
      - after re-ordering the patches, replace calling integrity_kernel_read()
        to read the file with kernel_read_file_from_path() (Mimi)
      - Patch description re-written by Luis R. Rodriguez
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      7429b092
    • 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
      module: replace copy_module_from_fd with kernel version · a1db7420
      Mimi Zohar 提交于
      Replace copy_module_from_fd() with kernel_read_file_from_fd().
      
      Although none of the upstreamed LSMs define a kernel_module_from_file
      hook, IMA is called, based on policy, to prevent unsigned kernel modules
      from being loaded by the original kernel module syscall and to
      measure/appraise signed kernel modules.
      
      The security function security_kernel_module_from_file() was called prior
      to reading a kernel module.  Preventing unsigned kernel modules from being
      loaded by the original kernel module syscall remains on the pre-read
      kernel_read_file() security hook.  Instead of reading the kernel module
      twice, once for measuring/appraising and again for loading the kernel
      module, the signature validation is moved to the kernel_post_read_file()
      security hook.
      
      This patch removes the security_kernel_module_from_file() hook and security
      call.
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Acked-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      a1db7420
    • M
      security: define kernel_read_file hook · 39eeb4fb
      Mimi Zohar 提交于
      The kernel_read_file security hook is called prior to reading the file
      into memory.
      
      Changelog v4+:
      - export security_kernel_read_file()
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Acked-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      Acked-by: NCasey Schaufler <casey@schaufler-ca.com>
      39eeb4fb
    • M
      firmware: replace call to fw_read_file_contents() with kernel version · e40ba6d5
      Mimi Zohar 提交于
      Replace the fw_read_file_contents with kernel_file_read_from_path().
      
      Although none of the upstreamed LSMs define a kernel_fw_from_file hook,
      IMA is called by the security function to prevent unsigned firmware from
      being loaded and to measure/appraise signed firmware, based on policy.
      
      Instead of reading the firmware twice, once for measuring/appraising the
      firmware and again for reading the firmware contents into memory, the
      kernel_post_read_file() security hook calculates the file hash based on
      the in memory file buffer.  The firmware is read once.
      
      This patch removes the LSM kernel_fw_from_file() hook and security call.
      
      Changelog v4+:
      - revert dropped buf->size assignment - reported by Sergey Senozhatsky
      v3:
      - remove kernel_fw_from_file hook
      - use kernel_file_read_from_path() - requested by Luis
      v2:
      - reordered and squashed firmware patches
      - fix MAX firmware size (Kees Cook)
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Acked-by: NLuis R. Rodriguez <mcgrof@kernel.org>
      e40ba6d5
    • 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
  4. 20 2月, 2016 1 次提交
  5. 19 2月, 2016 7 次提交
  6. 18 2月, 2016 2 次提交
  7. 17 2月, 2016 1 次提交
  8. 16 2月, 2016 1 次提交
    • D
      mm/gup: Introduce get_user_pages_remote() · 1e987790
      Dave Hansen 提交于
      For protection keys, we need to understand whether protections
      should be enforced in software or not.  In general, we enforce
      protections when working on our own task, but not when on others.
      We call these "current" and "remote" operations.
      
      This patch introduces a new get_user_pages() variant:
      
              get_user_pages_remote()
      
      Which is a replacement for when get_user_pages() is called on
      non-current tsk/mm.
      
      We also introduce a new gup flag: FOLL_REMOTE which can be used
      for the "__" gup variants to get this new behavior.
      
      The uprobes is_trap_at_addr() location holds mmap_sem and
      calls get_user_pages(current->mm) on an instruction address.  This
      makes it a pretty unique gup caller.  Being an instruction access
      and also really originating from the kernel (vs. the app), I opted
      to consider this a 'remote' access where protection keys will not
      be enforced.
      
      Without protection keys, this patch should not change any behavior.
      Signed-off-by: NDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: jack@suse.cz
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210154.3F0E51EA@viggo.jf.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      1e987790
  9. 12 2月, 2016 2 次提交