1. 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
  2. 23 3月, 2018 10 次提交
  3. 19 3月, 2018 7 次提交
    • K
      exec: Set file unwritable before LSM check · 7bd698b3
      Kees Cook 提交于
      The LSM check should happen after the file has been confirmed to be
      unchanging. Without this, we could have a race between the Time of Check
      (the call to security_kernel_read_file() which could read the file and
      make access policy decisions) and the Time of Use (starting with
      kernel_read_file()'s reading of the file contents). In theory, file
      contents could change between the two.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      Signed-off-by: NJames Morris <james.morris@microsoft.com>
      7bd698b3
    • L
      Linux 4.16-rc6 · c698ca52
      Linus Torvalds 提交于
      c698ca52
    • L
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9e1909b9
      Linus Torvalds 提交于
      Pull x86/pti updates from Thomas Gleixner:
       "Another set of melted spectrum updates:
      
         - Iron out the last late microcode loading issues by actually
           checking whether new microcode is present and preventing the CPU
           synchronization to run into a timeout induced hang.
      
         - Remove Skylake C2 from the microcode blacklist according to the
           latest Intel documentation
      
         - Fix the VM86 POPF emulation which traps if VIP is set, but VIF is
           not. Enhance the selftests to catch that kind of issue
      
         - Annotate indirect calls/jumps for objtool on 32bit. This is not a
           functional issue, but for consistency sake its the right thing to
           do.
      
         - Fix a jump label build warning observed on SPARC64 which uses 32bit
           storage for the code location which is casted to 64 bit pointer w/o
           extending it to 64bit first.
      
         - Add two new cpufeature bits. Not really an urgent issue, but
           provides them for both x86 and x86/kvm work. No impact on the
           current kernel"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/microcode: Fix CPU synchronization routine
        x86/microcode: Attempt late loading only when new microcode is present
        x86/speculation: Remove Skylake C2 from Speculation Control microcode blacklist
        jump_label: Fix sparc64 warning
        x86/speculation, objtool: Annotate indirect calls/jumps for objtool on 32-bit kernels
        x86/vm86/32: Fix POPF emulation
        selftests/x86/entry_from_vm86: Add test cases for POPF
        selftests/x86/entry_from_vm86: Exit with 1 if we fail
        x86/cpufeatures: Add Intel PCONFIG cpufeature
        x86/cpufeatures: Add Intel Total Memory Encryption cpufeature
      9e1909b9
    • L
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · df4fe178
      Linus Torvalds 提交于
      Pull x86 fix from Thomas Gleixner:
       "A single fix for vmalloc_fault() which uses p*d_huge() unconditionally
        whether CONFIG_HUGETLBFS is set or not. In case of CONFIG_HUGETLBFS=n
        this results in a crash as p*d_huge() returns 0 in that case"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Fix vmalloc_fault to use pXd_large
      df4fe178
    • L
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d2149e13
      Linus Torvalds 提交于
      Pull irq fixes from Thomas Gleixner:
       "Three fixes for irq chip drivers:
      
         - Make sure the allocations in the GIC-V3 ITS driver are large enough
           to accomodate the interrupt space
      
         - Fix a misplaced __iomem annotation which causes a splat of 26
           sparse warnings
      
         - Remove an unused function in the IMX GPCV2 driver which causes
           build warnings"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/irq-imx-gpcv2: Remove unused function
        irqchip/gic-v3-its: Ensure nr_ites >= nr_lpis
        irqchip/gic-v3-its: Fix misplaced __iomem annotations
      d2149e13
    • L
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 23fe85ae
      Linus Torvalds 提交于
      Pull EFI fix from Thomas Gleixner:
       "A single fix to prevent partially initialized pointers in mixed mode
        (64bit kernel on 32bit UEFI)"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/libstub/tpm: Initialize pointer variables to zero for mixed mode
      23fe85ae
    • L
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 3cd1d327
      Linus Torvalds 提交于
      Pull KVM fixes from Paolo Bonzini:
       "PPC:
         - fix bug leading to lost IPIs and smp_call_function_many() lockups
           on POWER9
      
        ARM:
         - locking fix
         - reset fix
         - GICv2 multi-source SGI injection fix
         - GICv2-on-v3 MMIO synchronization fix
         - make the console less verbose.
      
        x86:
         - fix device passthrough on AMD SME"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: x86: Fix device passthrough when SME is active
        kvm: arm/arm64: vgic-v3: Tighten synchronization for guests using v2 on v3
        KVM: arm/arm64: vgic: Don't populate multiple LRs with the same vintid
        KVM: arm/arm64: Reduce verbosity of KVM init log
        KVM: arm/arm64: Reset mapped IRQs on VM reset
        KVM: arm/arm64: Avoid vcpu_load for other vcpu ioctls than KVM_RUN
        KVM: arm/arm64: vgic: Add missing irq_lock to vgic_mmio_read_pending
        KVM: PPC: Book3S HV: Fix trap number return from __kvmppc_vcore_entry
      3cd1d327
  4. 17 3月, 2018 6 次提交
    • J
      parisc: Handle case where flush_cache_range is called with no context · 9ef0f88f
      John David Anglin 提交于
      Just when I had decided that flush_cache_range() was always called with
      a valid context, Helge reported two cases where the
      "BUG_ON(!vma->vm_mm->context);" was hit on the phantom buildd:
      
       kernel BUG at /mnt/sdb6/linux/linux-4.15.4/arch/parisc/kernel/cache.c:587!
       CPU: 1 PID: 3254 Comm: kworker/1:2 Tainted: G D 4.15.0-1-parisc64-smp #1 Debian 4.15.4-1+b1
       Workqueue: events free_ioctx
        IAOQ[0]: flush_cache_range+0x164/0x168
        IAOQ[1]: flush_cache_page+0x0/0x1c8
        RP(r2): unmap_page_range+0xae8/0xb88
       Backtrace:
        [<00000000404a6980>] unmap_page_range+0xae8/0xb88
        [<00000000404a6ae0>] unmap_single_vma+0xc0/0x188
        [<00000000404a6cdc>] zap_page_range_single+0x134/0x1f8
        [<00000000404a702c>] unmap_mapping_range+0x1cc/0x208
        [<0000000040461518>] truncate_pagecache+0x98/0x108
        [<0000000040461624>] truncate_setsize+0x9c/0xb8
        [<00000000405d7f30>] put_aio_ring_file+0x80/0x100
        [<00000000405d803c>] aio_free_ring+0x8c/0x290
        [<00000000405d82c0>] free_ioctx+0x80/0x180
        [<0000000040284e6c>] process_one_work+0x21c/0x668
        [<00000000402854c4>] worker_thread+0x20c/0x778
        [<0000000040291d44>] kthread+0x2d4/0x2e0
        [<0000000040204020>] end_fault_vector+0x20/0xc0
      
      This indicates that we need to handle the no context case in
      flush_cache_range() as we do in flush_cache_mm().
      
      In thinking about this, I realized that we don't need to flush the TLB
      when there is no context.  So, I added context checks to the large flush
      cases in flush_cache_mm() and flush_cache_range().  The large flush case
      occurs frequently in flush_cache_mm() and the change should improve fork
      performance.
      
      The v2 version of this change removes the BUG_ON from flush_cache_page()
      by skipping the TLB flush when there is no context.  I also added code
      to flush the TLB in flush_cache_mm() and flush_cache_range() when we
      have a context that's not current.  Now all three routines handle TLB
      flushes in a similar manner.
      Signed-off-by: NJohn David Anglin <dave.anglin@bell.net>
      Cc: stable@vger.kernel.org # 4.9+
      Signed-off-by: NHelge Deller <deller@gmx.de>
      9ef0f88f
    • L
      Merge tag 'for-4.16-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 8f5fd927
      Linus Torvalds 提交于
      Pull btrfs fixes from David Sterba:
       "There's an important revert in this pull request that needs to go to
        stable as it causes a corruption on big endian machines.
      
        The other fix is for FIEMAP incorrectly reporting shared extents
        before a sync and one fix for a crash in raid56.
      
        So far we got only one report about the BE corruption, the stable
        kernels were out for like a week, so hopefully the scope of the damage
        is low"
      
      * tag 'for-4.16-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        Revert "btrfs: use proper endianness accessors for super_copy"
        btrfs: add missing initialization in btrfs_check_shared
        btrfs: Fix NULL pointer exception in find_bio_stripe
      8f5fd927
    • L
      Merge tag 'microblaze-4.16-rc6' of git://git.monstr.eu/linux-2.6-microblaze · 8757ae23
      Linus Torvalds 提交于
      Pull microblaze fixes from Michal Simek:
      
       - Use NO_BOOTMEM to fix boot issue
      
       - Fix opt lib endian dependencies
      
      * tag 'microblaze-4.16-rc6' of git://git.monstr.eu/linux-2.6-microblaze:
        microblaze: switch to NO_BOOTMEM
        microblaze: remove unused alloc_maybe_bootmem
        microblaze: Setup dependencies for ASM optimized lib functions
      8757ae23
    • B
      x86/microcode: Fix CPU synchronization routine · bb8c13d6
      Borislav Petkov 提交于
      Emanuel reported an issue with a hang during microcode update because my
      dumb idea to use one atomic synchronization variable for both rendezvous
      - before and after update - was simply bollocks:
      
        microcode: microcode_reload_late: late_cpus: 4
        microcode: __reload_late: cpu 2 entered
        microcode: __reload_late: cpu 1 entered
        microcode: __reload_late: cpu 3 entered
        microcode: __reload_late: cpu 0 entered
        microcode: __reload_late: cpu 1 left
        microcode: Timeout while waiting for CPUs rendezvous, remaining: 1
      
      CPU1 above would finish, leave and the others will still spin waiting for
      it to join.
      
      So do two synchronization atomics instead, which makes the code a lot more
      straightforward.
      
      Also, since the update is serialized and it also takes quite some time per
      microcode engine, increase the exit timeout by the number of CPUs on the
      system.
      
      That's ok because the moment all CPUs are done, that timeout will be cut
      short.
      
      Furthermore, panic when some of the CPUs timeout when returning from a
      microcode update: we can't allow a system with not all cores updated.
      
      Also, as an optimization, do not do the exit sync if microcode wasn't
      updated.
      Reported-by: NEmanuel Czirai <xftroxgpx@protonmail.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NEmanuel Czirai <xftroxgpx@protonmail.com>
      Tested-by: NAshok Raj <ashok.raj@intel.com>
      Tested-by: NTom Lendacky <thomas.lendacky@amd.com>
      Link: https://lkml.kernel.org/r/20180314183615.17629-2-bp@alien8.de
      bb8c13d6
    • B
      x86/microcode: Attempt late loading only when new microcode is present · 2613f36e
      Borislav Petkov 提交于
      Return UCODE_NEW from the scanning functions to denote that new microcode
      was found and only then attempt the expensive synchronization dance.
      Reported-by: NEmanuel Czirai <xftroxgpx@protonmail.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NEmanuel Czirai <xftroxgpx@protonmail.com>
      Tested-by: NAshok Raj <ashok.raj@intel.com>
      Tested-by: NTom Lendacky <thomas.lendacky@amd.com>
      Link: https://lkml.kernel.org/r/20180314183615.17629-1-bp@alien8.de
      2613f36e
    • L
      Merge tag 'drm-fixes-for-v4.16-rc6' of git://people.freedesktop.org/~airlied/linux · 1660a76a
      Linus Torvalds 提交于
      Pull drm fixes from Dave Airlie:
       "i915, amd and nouveau fixes.
      
        i915:
         - backlight fix for some panels
         - pm fix
         - fencing fix
         - some GVT fixes
      
        amdgpu:
         - backlight fix across suspend/resume
         - object destruction ordering issue fix
         - displayport fix
      
        nouveau:
         - two backlight fixes
         - fix for some lockups
      
        Pretty quiet week, seems like everyone was fixing backlights"
      
      * tag 'drm-fixes-for-v4.16-rc6' of git://people.freedesktop.org/~airlied/linux:
        drm/nouveau/bl: fix backlight regression
        drm/nouveau/bl: Fix oops on driver unbind
        drm/nouveau/mmu: ALIGN_DOWN correct variable
        drm/i915/gvt: fix user copy warning by whitelist workload rb_tail field
        drm/i915/gvt: Correct the privilege shadow batch buffer address
        drm/amdgpu/dce: Don't turn off DP sink when disconnected
        drm/amdgpu: save/restore backlight level in legacy dce code
        drm/radeon: fix prime teardown order
        drm/amdgpu: fix prime teardown order
        drm/i915: Kick the rps worker when changing the boost frequency
        drm/i915: Only prune fences after wait-for-all
        drm/i915: Enable VBT based BL control for DP
        drm/i915/gvt: keep oa config in shadow ctx
        drm/i915/gvt: Add runtime_pm_get/put into gvt_switch_mmio
      1660a76a
  5. 16 3月, 2018 9 次提交