1. 25 Jan, 2020 2 commits
    • Ard Biesheuvel's avatar
      efi/x86: Disable instrumentation in the EFI runtime handling code · ac6119e7
      Ard Biesheuvel authored
      We already disable KASAN instrumentation specifically for the
      EFI routines that are known to dereference memory addresses that
      KASAN does not know about, avoiding false positive KASAN splats.
      
      However, as it turns out, having GCOV or KASAN instrumentation enabled
      interferes with the compiler's ability to optimize away function calls
      that are guarded by IS_ENABLED() checks that should have resulted in
      those references to have been const-propagated out of existence. But
      with instrumenation enabled, we may get build errors like:
      
         ld: arch/x86/platform/efi/efi_64.o: in function `efi_thunk_set_virtual_address_map':
         ld: arch/x86/platform/efi/efi_64.o: in function `efi_set_virtual_address_map':
      
      in builds where CONFIG_EFI=y but CONFIG_EFI_MIXED or CONFIG_X86_UV are not
      defined, even though the invocations are conditional on IS_ENABLED() checks
      against the respective Kconfig symbols.
      
      So let's disable instrumentation entirely for this subdirectory, which
      isn't that useful here to begin with.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: linux-efi@vger.kernel.org
      ac6119e7
    • Qian Cai's avatar
      efi/libstub/x86: Fix EFI server boot failure · cada0b6d
      Qian Cai authored
      x86_64 EFI systems are unable to boot due to a typo in a recent commit:
      
        EFI config tables not found.
         -- System halted
      
      This was probably due to the absense of CONFIG_EFI_MIXED=y in testing.
      
      Fixes: 796eb8d2 ("efi/libstub/x86: Use const attribute for efi_is_64bit()")
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: tglx@linutronix.de
      Cc: linux-efi@vger.kernel.org
      Link: https://lore.kernel.org/r/20200122191430.4888-1-cai@lca.pw
      cada0b6d
  2. 22 Jan, 2020 1 commit
    • Ard Biesheuvel's avatar
      efi/x86: Disallow efi=old_map in mixed mode · 0779221e
      Ard Biesheuvel authored
      Before:
      
        1f299fad: ("efi/x86: Limit EFI old memory map to SGI UV machines")
      
      enabling the old EFI memory map on mixed mode systems
      disabled EFI runtime services altogether.
      
      Given that efi=old_map is a debug feature designed to work around
      firmware problems related to EFI runtime services, and disabling
      them can be achieved more straightforwardly using 'noefi' or
      'efi=noruntime', it makes more sense to ignore efi=old_map on
      mixed mode systems.
      
      Currently, we do neither, and try to use the old memory map in
      combination with mixed mode routines, which results in crashes,
      so let's fix this by making efi=old_map functional on native
      systems only.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0779221e
  3. 20 Jan, 2020 17 commits
    • Ard Biesheuvel's avatar
      x86/boot/compressed: Relax sed symbol type regex for LLVM ld.lld · bc310baf
      Ard Biesheuvel authored
      The final build stage of the x86 kernel captures some symbol
      addresses from the decompressor binary and copies them into zoffset.h.
      It uses sed with a regular expression that matches the address, symbol
      type and symbol name, and mangles the captured addresses and the names
      of symbols of interest into #define directives that are added to
      zoffset.h
      
      The symbol type is indicated by a single letter, which we match
      strictly: only letters in the set 'ABCDGRSTVW' are matched, even
      though the actual symbol type is relevant and therefore ignored.
      
      Commit bc7c9d62 ("efi/libstub/x86: Force 'hidden' visibility for
      extern declarations") made a change to the way external symbol
      references are classified, resulting in 'startup_32' now being
      emitted as a hidden symbol. This prevents the use of GOT entries to
      refer to this symbol via its absolute address, which recent toolchains
      (including Clang based ones) already avoid by default, making this
      change a no-op in the majority of cases.
      
      However, as it turns out, the LLVM linker classifies such hidden
      symbols as symbols with static linkage in fully linked ELF binaries,
      causing tools such as NM to output a lowercase 't' rather than an upper
      case 'T' for the type of such symbols. Since our sed expression only
      matches upper case letters for the symbol type, the line describing
      startup_32 is disregarded, resulting in a build error like the following
      
        arch/x86/boot/header.S:568:18: error: symbol 'ZO_startup_32' can not be
                                              undefined in a subtraction expression
        init_size: .long (0x00000000008fd000 - ZO_startup_32 +
                          (((0x0000000001f6361c + ((0x0000000001f6361c >> 8) + 65536)
                           - 0x00000000008c32e5) + 4095) & ~4095)) # kernel initialization size
      
      Given that we are only interested in the value of the symbol, let's match
      any character in the set 'a-zA-Z' instead.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      bc310baf
    • Ard Biesheuvel's avatar
      efi/x86: avoid KASAN false positives when accessing the 1: 1 mapping · 3cc02861
      Ard Biesheuvel authored
      When installing the EFI virtual address map during early boot, we
      access the EFI system table to retrieve the 1:1 mapped address of
      the SetVirtualAddressMap() EFI runtime service. This memory is not
      known to KASAN, so on KASAN enabled builds, this may result in a
      splat like
      
        ==================================================================
        BUG: KASAN: user-memory-access in efi_set_virtual_address_map+0x141/0x354
        Read of size 4 at addr 000000003fbeef38 by task swapper/0/0
      
        CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.5.0-rc5+ #758
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
        Call Trace:
         dump_stack+0x8b/0xbb
         ? efi_set_virtual_address_map+0x141/0x354
         ? efi_set_virtual_address_map+0x141/0x354
         __kasan_report+0x176/0x192
         ? efi_set_virtual_address_map+0x141/0x354
         kasan_report+0xe/0x20
         efi_set_virtual_address_map+0x141/0x354
         ? efi_thunk_runtime_setup+0x148/0x148
         ? __inc_numa_state+0x19/0x90
         ? memcpy+0x34/0x50
         efi_enter_virtual_mode+0x5fd/0x67d
         start_kernel+0x5cd/0x682
         ? mem_encrypt_init+0x6/0x6
         ? x86_family+0x5/0x20
         ? load_ucode_bsp+0x46/0x154
         secondary_startup_64+0xa4/0xb0
        ==================================================================
      
      Since this code runs only a single time during early boot, let's annotate
      it as __no_sanitize_address so KASAN disregards it entirely.
      
      Fixes: 69829470 ("efi/x86: Split SetVirtualAddresMap() wrappers into ...")
      Reported-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      3cc02861
    • Dan Williams's avatar
      efi: Fix handling of multiple efi_fake_mem= entries · 484a418d
      Dan Williams authored
      Dave noticed that when specifying multiple efi_fake_mem= entries only
      the last entry was successfully being reflected in the efi memory map.
      This is due to the fact that the efi_memmap_insert() is being called
      multiple times, but on successive invocations the insertion should be
      applied to the last new memmap rather than the original map at
      efi_fake_memmap() entry.
      
      Rework efi_fake_memmap() to install the new memory map after each
      efi_fake_mem= entry is parsed.
      
      This also fixes an issue in efi_fake_memmap() that caused it to litter
      emtpy entries into the end of the efi memory map. An empty entry causes
      efi_memmap_insert() to attempt more memmap splits / copies than
      efi_memmap_split_count() accounted for when sizing the new map. When
      that happens efi_memmap_insert() may overrun its allocation, and if you
      are lucky will spill over to an unmapped page leading to crash
      signature like the following rather than silent corruption:
      
          BUG: unable to handle page fault for address: ffffffffff281000
          [..]
          RIP: 0010:efi_memmap_insert+0x11d/0x191
          [..]
          Call Trace:
           ? bgrt_init+0xbe/0xbe
           ? efi_arch_mem_reserve+0x1cb/0x228
           ? acpi_parse_bgrt+0xa/0xd
           ? acpi_table_parse+0x86/0xb8
           ? acpi_boot_init+0x494/0x4e3
           ? acpi_parse_x2apic+0x87/0x87
           ? setup_acpi_sci+0xa2/0xa2
           ? setup_arch+0x8db/0x9e1
           ? start_kernel+0x6a/0x547
           ? secondary_startup_64+0xb6/0xc0
      
      Commit af164898 "x86/efi: Update e820 with reserved EFI boot
      services data to fix kexec breakage" introduced more occurrences where
      efi_memmap_insert() is invoked after an efi_fake_mem= configuration has
      been parsed. Previously the side effects of vestigial empty entries were
      benign, but with commit af164898 that follow-on efi_memmap_insert()
      invocation triggers efi_memmap_insert() overruns.
      Reported-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20191231014630.GA24942@dhcp-128-65.nay.redhat.com
      Link: https://lore.kernel.org/r/20200113172245.27925-14-ardb@kernel.org
      484a418d
    • Dan Williams's avatar
      efi: Fix efi_memmap_alloc() leaks · f0ef6523
      Dan Williams authored
      With efi_fake_memmap() and efi_arch_mem_reserve() the efi table may be
      updated and replaced multiple times. When that happens a previous
      dynamically allocated efi memory map can be garbage collected. Use the
      new EFI_MEMMAP_{SLAB,MEMBLOCK} flags to detect when a dynamically
      allocated memory map is being replaced.
      
      Debug statements in efi_memmap_free() reveal:
      
        efi: __efi_memmap_free:37: phys: 0x23ffdd580 size: 2688 flags: 0x2
        efi: __efi_memmap_free:37: phys: 0x9db00 size: 2640 flags: 0x2
        efi: __efi_memmap_free:37: phys: 0x9e580 size: 2640 flags: 0x2
      
      ...a savings of 7968 bytes on a qemu boot with 2 entries specified to
      efi_fake_mem=.
      
      [ ardb: added a comment to clarify that efi_memmap_free() does nothing when
              called from efi_clean_memmap(), i.e., with data->flags == 0x0 ]
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-13-ardb@kernel.org
      f0ef6523
    • Dan Williams's avatar
      efi: Add tracking for dynamically allocated memmaps · 1db91035
      Dan Williams authored
      In preparation for fixing efi_memmap_alloc() leaks, add support for
      recording whether the memmap was dynamically allocated from slab,
      memblock, or is the original physical memmap provided by the platform.
      
      Given this tracking is established in efi_memmap_alloc() and needs to be
      carried to efi_memmap_install(), use 'struct efi_memory_map_data' to
      convey the flags.
      
      Some small cleanups result from this reorganization, specifically the
      removal of local variables for 'phys' and 'size' that are already
      tracked in @data.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-12-ardb@kernel.org
      1db91035
    • Dan Williams's avatar
      efi: Add a flags parameter to efi_memory_map · 26c0e44a
      Dan Williams authored
      In preparation for garbage collecting dynamically allocated EFI memory
      maps, where the allocation method of memblock vs slab needs to be
      recalled, convert the existing 'late' flag into a 'flags' bitmask.
      
      Arrange for the flag to be passed via 'struct efi_memory_map_data'. This
      structure grows additional flags in follow-on changes.
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-11-ardb@kernel.org
      26c0e44a
    • Anshuman Khandual's avatar
      efi: Fix comment for efi_mem_type() wrt absent physical addresses · 62b605b5
      Anshuman Khandual authored
      A previous commit f99afd08 ("efi: Update efi_mem_type() to return an
      error rather than 0") changed the return value from EFI_RESERVED_TYPE to
      -EINVAL when the searched physical address is not present in any memory
      descriptor. But the comment preceding the function never changed. Let's
      change the comment now to reflect the new return value -EINVAL.
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-10-ardb@kernel.org
      62b605b5
    • Ard Biesheuvel's avatar
      efi/arm: Defer probe of PCIe backed efifb on DT systems · 64c8a0cd
      Ard Biesheuvel authored
      The new of_devlink support breaks PCIe probing on ARM platforms booting
      via UEFI if the firmware exposes a EFI framebuffer that is backed by a
      PCI device. The reason is that the probing order gets reversed,
      resulting in a resource conflict on the framebuffer memory window when
      the PCIe probes last, causing it to give up entirely.
      
      Given that we rely on PCI quirks to deal with EFI framebuffers that get
      moved around in memory, we cannot simply drop the memory reservation, so
      instead, let's use the device link infrastructure to register this
      dependency, and force the probing to occur in the expected order.
      Co-developed-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-9-ardb@kernel.org
      64c8a0cd
    • Ard Biesheuvel's avatar
      efi/x86: Limit EFI old memory map to SGI UV machines · 1f299fad
      Ard Biesheuvel authored
      We carry a quirk in the x86 EFI code to switch back to an older
      method of mapping the EFI runtime services memory regions, because
      it was deemed risky at the time to implement a new method without
      providing a fallback to the old method in case problems arose.
      
      Such problems did arise, but they appear to be limited to SGI UV1
      machines, and so these are the only ones for which the fallback gets
      enabled automatically (via a DMI quirk). The fallback can be enabled
      manually as well, by passing efi=old_map, but there is very little
      evidence that suggests that this is something that is being relied
      upon in the field.
      
      Given that UV1 support is not enabled by default by the distros
      (Ubuntu, Fedora), there is no point in carrying this fallback code
      all the time if there are no other users. So let's move it into the
      UV support code, and document that efi=old_map now requires this
      support code to be enabled.
      
      Note that efi=old_map has been used in the past on other SGI UV
      machines to work around kernel regressions in production, so we
      keep the option to enable it by hand, but only if the kernel was
      built with UV support.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-8-ardb@kernel.org
      1f299fad
    • Ard Biesheuvel's avatar
      efi/x86: Avoid RWX mappings for all of DRAM · 97bb9cdc
      Ard Biesheuvel authored
      The EFI code creates RWX mappings for all memory regions that are
      occupied after the stub completes, and in the mixed mode case, it
      even creates RWX mappings for all of the remaining DRAM as well.
      
      Let's try to avoid this, by setting the NX bit for all memory
      regions except the ones that are marked as EFI runtime services
      code [which means text+rodata+data in practice, so we cannot mark
      them read-only right away]. For cases of buggy firmware where boot
      services code is called during SetVirtualAddressMap(), map those
      regions with exec permissions as well - they will be unmapped in
      efi_free_boot_services().
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-7-ardb@kernel.org
      97bb9cdc
    • Ard Biesheuvel's avatar
      efi/x86: Don't map the entire kernel text RW for mixed mode · d9e3d2c4
      Ard Biesheuvel authored
      The mixed mode thunking routine requires a part of it to be
      mapped 1:1, and for this reason, we currently map the entire
      kernel .text read/write in the EFI page tables, which is bad.
      
      In fact, the kernel_map_pages_in_pgd() invocation that installs
      this mapping is entirely redundant, since all of DRAM is already
      1:1 mapped read/write in the EFI page tables when we reach this
      point, which means that .rodata is mapped read-write as well.
      
      So let's remap both .text and .rodata read-only in the EFI
      page tables.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-6-ardb@kernel.org
      d9e3d2c4
    • Ard Biesheuvel's avatar
      x86/mm: Fix NX bit clearing issue in kernel_map_pages_in_pgd · 75fbef0a
      Ard Biesheuvel authored
      The following commit:
      
        15f003d2 ("x86/mm/pat: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd()")
      
      modified kernel_map_pages_in_pgd() to manage writable permissions
      of memory mappings in the EFI page table in a different way, but
      in the process, it removed the ability to clear NX attributes from
      read-only mappings, by clobbering the clear mask if _PAGE_RW is not
      being requested.
      
      Failure to remove the NX attribute from read-only mappings is
      unlikely to be a security issue, but it does prevent us from
      tightening the permissions in the EFI page tables going forward,
      so let's fix it now.
      
      Fixes: 15f003d2 ("x86/mm/pat: Don't implicitly allow _PAGE_RW in kernel_map_pages_in_pgd()
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-5-ardb@kernel.org
      75fbef0a
    • Arnd Bergmann's avatar
      efi/libstub/x86: Fix unused-variable warning · bd1d7093
      Arnd Bergmann authored
      The only users of these got removed, so they also need to be
      removed to avoid warnings:
      
        arch/x86/boot/compressed/eboot.c: In function 'setup_efi_pci':
        arch/x86/boot/compressed/eboot.c:117:16: error: unused variable 'nr_pci' [-Werror=unused-variable]
          unsigned long nr_pci;
                        ^~~~~~
        arch/x86/boot/compressed/eboot.c: In function 'setup_uga':
        arch/x86/boot/compressed/eboot.c:244:16: error: unused variable 'nr_ugas' [-Werror=unused-variable]
          unsigned long nr_ugas;
                        ^~~~~~~
      
      Fixes: 2732ea0d ("efi/libstub: Use a helper to iterate over a EFI handle array")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-4-ardb@kernel.org
      bd1d7093
    • Ard Biesheuvel's avatar
      efi/libstub/x86: Use mandatory 16-byte stack alignment in mixed mode · ac3c76cc
      Ard Biesheuvel authored
      Reduce the stack frame of the EFI stub's mixed mode thunk routine by
      8 bytes, by moving the GDT and return addresses to EBP and EBX, which
      we need to preserve anyway, since their top halves will be cleared by
      the call into 32-bit firmware code. Doing so results in the UEFI code
      being entered with a 16 byte aligned stack, as mandated by the UEFI
      spec, fixing the last occurrence in the 64-bit kernel where we violate
      this requirement.
      
      Also, move the saved GDT from a global variable to an unused part of the
      stack frame, and touch up some other parts of the code.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-3-ardb@kernel.org
      ac3c76cc
    • Ard Biesheuvel's avatar
      efi/libstub/x86: Use const attribute for efi_is_64bit() · 796eb8d2
      Ard Biesheuvel authored
      Reshuffle the x86 stub code a bit so that we can tag the efi_is_64bit()
      function with the 'const' attribute, which permits the compiler to
      optimize away any redundant calls. Since we have two different entry
      points for 32 and 64 bit firmware in the startup code, this also
      simplifies the C code since we'll enter it with the efi_is64 variable
      already set.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200113172245.27925-2-ardb@kernel.org
      796eb8d2
    • Ingo Molnar's avatar
      a786810c
    • Linus Torvalds's avatar
      Linux 5.5-rc7 · def9d278
      Linus Torvalds authored
      def9d278
  4. 19 Jan, 2020 8 commits
    • Linus Torvalds's avatar
      Merge tag 'riscv/for-v5.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 7008ee12
      Linus Torvalds authored
      Pull RISC-V fixes from Paul Walmsley:
       "Three fixes for RISC-V:
      
         - Don't free and reuse memory containing the code that CPUs parked at
           boot reside in.
      
         - Fix rv64 build problems for ubsan and some modules by adding
           logical and arithmetic shift helpers for 128-bit values. These are
           from libgcc and are similar to what's present for ARM64.
      
         - Fix vDSO builds to clean up their own temporary files"
      
      * tag 'riscv/for-v5.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Less inefficient gcc tishift helpers (and export their symbols)
        riscv: delete temporary files
        riscv: make sure the cores stay looping in .Lsecondary_park
      7008ee12
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 11a82729
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix non-blocking connect() in x25, from Martin Schiller.
      
       2) Fix spurious decryption errors in kTLS, from Jakub Kicinski.
      
       3) Netfilter use-after-free in mtype_destroy(), from Cong Wang.
      
       4) Limit size of TSO packets properly in lan78xx driver, from Eric
          Dumazet.
      
       5) r8152 probe needs an endpoint sanity check, from Johan Hovold.
      
       6) Prevent looping in tcp_bpf_unhash() during sockmap/tls free, from
          John Fastabend.
      
       7) hns3 needs short frames padded on transmit, from Yunsheng Lin.
      
       8) Fix netfilter ICMP header corruption, from Eyal Birger.
      
       9) Fix soft lockup when low on memory in hns3, from Yonglong Liu.
      
      10) Fix NTUPLE firmware command failures in bnxt_en, from Michael Chan.
      
      11) Fix memory leak in act_ctinfo, from Eric Dumazet.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (91 commits)
        cxgb4: reject overlapped queues in TC-MQPRIO offload
        cxgb4: fix Tx multi channel port rate limit
        net: sched: act_ctinfo: fix memory leak
        bnxt_en: Do not treat DSN (Digital Serial Number) read failure as fatal.
        bnxt_en: Fix ipv6 RFS filter matching logic.
        bnxt_en: Fix NTUPLE firmware command failures.
        net: systemport: Fixed queue mapping in internal ring map
        net: dsa: bcm_sf2: Configure IMP port for 2Gb/sec
        net: dsa: sja1105: Don't error out on disabled ports with no phy-mode
        net: phy: dp83867: Set FORCE_LINK_GOOD to default after reset
        net: hns: fix soft lockup when there is not enough memory
        net: avoid updating qdisc_xmit_lock_key in netdev_update_lockdep_key()
        net/sched: act_ife: initalize ife->metalist earlier
        netfilter: nat: fix ICMP header corruption on ICMP errors
        net: wan: lapbether.c: Use built-in RCU list checking
        netfilter: nf_tables: fix flowtable list del corruption
        netfilter: nf_tables: fix memory leak in nf_tables_parse_netdev_hooks()
        netfilter: nf_tables: remove WARN and add NLA_STRING upper limits
        netfilter: nft_tunnel: ERSPAN_VERSION must not be null
        netfilter: nft_tunnel: fix null-attribute check
        ...
      11a82729
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 5f436443
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Two runtime PM fixes and one leak fix"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: iop3xx: Fix memory leak in probe error path
        i2c: tegra: Properly disable runtime PM on driver's probe error
        i2c: tegra: Fix suspending in active runtime PM state
      5f436443
    • Rahul Lakkireddy's avatar
      cxgb4: reject overlapped queues in TC-MQPRIO offload · b2383ad9
      Rahul Lakkireddy authored
      A queue can't belong to multiple traffic classes. So, reject
      any such configuration that results in overlapped queues for a
      traffic class.
      
      Fixes: b1396c2b ("cxgb4: parse and configure TC-MQPRIO offload")
      Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b2383ad9
    • Rahul Lakkireddy's avatar
      cxgb4: fix Tx multi channel port rate limit · c856e2b6
      Rahul Lakkireddy authored
      T6 can support 2 egress traffic management channels per port to
      double the total number of traffic classes that can be configured.
      In this configuration, if the class belongs to the other channel,
      then all the queues must be bound again explicitly to the new class,
      for the rate limit parameters on the other channel to take effect.
      
      So, always explicitly bind all queues to the port rate limit traffic
      class, regardless of the traffic management channel that it belongs
      to. Also, only bind queues to port rate limit traffic class, if all
      the queues don't already belong to an existing different traffic
      class.
      
      Fixes: 4ec4762d ("cxgb4: add TC-MATCHALL classifier egress offload")
      Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c856e2b6
    • Eric Dumazet's avatar
      net: sched: act_ctinfo: fix memory leak · 09d4f10a
      Eric Dumazet authored
      Implement a cleanup method to properly free ci->params
      
      BUG: memory leak
      unreferenced object 0xffff88811746e2c0 (size 64):
        comm "syz-executor617", pid 7106, jiffies 4294943055 (age 14.250s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          c0 34 60 84 ff ff ff ff 00 00 00 00 00 00 00 00  .4`.............
        backtrace:
          [<0000000015aa236f>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
          [<0000000015aa236f>] slab_post_alloc_hook mm/slab.h:586 [inline]
          [<0000000015aa236f>] slab_alloc mm/slab.c:3320 [inline]
          [<0000000015aa236f>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3549
          [<000000002c946bd1>] kmalloc include/linux/slab.h:556 [inline]
          [<000000002c946bd1>] kzalloc include/linux/slab.h:670 [inline]
          [<000000002c946bd1>] tcf_ctinfo_init+0x21a/0x530 net/sched/act_ctinfo.c:236
          [<0000000086952cca>] tcf_action_init_1+0x400/0x5b0 net/sched/act_api.c:944
          [<000000005ab29bf8>] tcf_action_init+0x135/0x1c0 net/sched/act_api.c:1000
          [<00000000392f56f9>] tcf_action_add+0x9a/0x200 net/sched/act_api.c:1410
          [<0000000088f3c5dd>] tc_ctl_action+0x14d/0x1bb net/sched/act_api.c:1465
          [<000000006b39d986>] rtnetlink_rcv_msg+0x178/0x4b0 net/core/rtnetlink.c:5424
          [<00000000fd6ecace>] netlink_rcv_skb+0x61/0x170 net/netlink/af_netlink.c:2477
          [<0000000047493d02>] rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5442
          [<00000000bdcf8286>] netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
          [<00000000bdcf8286>] netlink_unicast+0x223/0x310 net/netlink/af_netlink.c:1328
          [<00000000fc5b92d9>] netlink_sendmsg+0x2c0/0x570 net/netlink/af_netlink.c:1917
          [<00000000da84d076>] sock_sendmsg_nosec net/socket.c:639 [inline]
          [<00000000da84d076>] sock_sendmsg+0x54/0x70 net/socket.c:659
          [<0000000042fb2eee>] ____sys_sendmsg+0x2d0/0x300 net/socket.c:2330
          [<000000008f23f67e>] ___sys_sendmsg+0x8a/0xd0 net/socket.c:2384
          [<00000000d838e4f6>] __sys_sendmsg+0x80/0xf0 net/socket.c:2417
          [<00000000289a9cb1>] __do_sys_sendmsg net/socket.c:2426 [inline]
          [<00000000289a9cb1>] __se_sys_sendmsg net/socket.c:2424 [inline]
          [<00000000289a9cb1>] __x64_sys_sendmsg+0x23/0x30 net/socket.c:2424
      
      Fixes: 24ec483c ("net: sched: Introduce act_ctinfo action")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Kevin 'ldir' Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Cc: Toke Høiland-Jørgensen <toke@redhat.com>
      Acked-by: default avatarKevin 'ldir' Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      09d4f10a
    • Olof Johansson's avatar
      riscv: Less inefficient gcc tishift helpers (and export their symbols) · fc585d4a
      Olof Johansson authored
      The existing __lshrti3 was really inefficient, and the other two helpers
      are also needed to compile some modules.
      
      Add the missing versions, and export all of the symbols like arm64
      already does.
      
      This code is based on the assembly generated by libgcc builds.
      
      This fixes a build break triggered by ubsan:
      
      riscv64-unknown-linux-gnu-ld: lib/ubsan.o: in function `.L2':
      ubsan.c:(.text.unlikely+0x38): undefined reference to `__ashlti3'
      riscv64-unknown-linux-gnu-ld: ubsan.c:(.text.unlikely+0x42): undefined reference to `__ashrti3'
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      [paul.walmsley@sifive.com: use SYM_FUNC_{START,END} instead of
       ENTRY/ENDPROC; note libgcc origin]
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      fc585d4a
    • Linus Torvalds's avatar
      Merge tag 'mtd/fixes-for-5.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · 8f8972a3
      Linus Torvalds authored
      Pull MTD fixes from Miquel Raynal:
       "Raw NAND:
         - GPMI: Fix the suspend/resume
      
        SPI-NOR:
         - Fix quad enable on Spansion like flashes
         - Fix selection of 4-byte addressing opcodes on Spansion"
      
      * tag 'mtd/fixes-for-5.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
        mtd: rawnand: gpmi: Fix suspend/resume problem
        mtd: spi-nor: Fix quad enable for Spansion like flashes
        mtd: spi-nor: Fix selection of 4-byte addressing opcodes on Spansion
      8f8972a3
  5. 18 Jan, 2020 12 commits
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-01-19' of git://anongit.freedesktop.org/drm/drm · 244dc268
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Back from LCA2020, fixes wasn't too busy last week, seems to have
        quieten down appropriately, some amdgpu, i915, then a core mst fix and
        one fix for virtio-gpu and one for rockchip:
      
        core mst:
         - serialize down messages and clear timeslots are on unplug
      
        amdgpu:
         - Update golden settings for renoir
         - eDP fix
      
        i915:
         - uAPI fix: Remove dash and colon from PMU names to comply with
           tools/perf
         - Fix for include file that was indirectly included
         - Two fixes to make sure VMA are marked active for error capture
      
        virtio:
         - maintain obj reservation lock when submitting cmds
      
        rockchip:
         - increase link rate var size to accommodate rates"
      
      * tag 'drm-fixes-2020-01-19' of git://anongit.freedesktop.org/drm/drm:
        drm/amd/display: Reorder detect_edp_sink_caps before link settings read.
        drm/amdgpu: update goldensetting for renoir
        drm/dp_mst: Have DP_Tx send one msg at a time
        drm/dp_mst: clear time slots for ports invalid
        drm/i915/pmu: Do not use colons or dashes in PMU names
        drm/rockchip: fix integer type used for storing dp data rate
        drm/i915/gt: Mark ring->vma as active while pinned
        drm/i915/gt: Mark context->state vma as active while pinned
        drm/i915/gt: Skip trying to unbind in restore_ggtt_mappings
        drm/i915: Add missing include file <linux/math64.h>
        drm/virtio: add missing virtio_gpu_array_lock_resv call
      244dc268
    • Ilie Halip's avatar
      riscv: delete temporary files · 95f4d9cc
      Ilie Halip authored
      Temporary files used in the VDSO build process linger on even after make
      mrproper: vdso-dummy.o.tmp, vdso.so.dbg.tmp.
      
      Delete them once they're no longer needed.
      Signed-off-by: default avatarIlie Halip <ilie.halip@gmail.com>
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      95f4d9cc
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0cc2682d
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Misc fixes:
      
         - a resctrl fix for uninitialized objects found by debugobjects
      
         - a resctrl memory leak fix
      
         - fix the unintended re-enabling of the of SME and SEV CPU flags if
           memory encryption was disabled at bootup via the MSR space"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/CPU/AMD: Ensure clearing of SME/SEV features is maintained
        x86/resctrl: Fix potential memory leak
        x86/resctrl: Fix an imbalance in domain_remove_cpu()
      0cc2682d
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7ff15cd0
      Linus Torvalds authored
      Pull timer fixes from Ingo Molnar:
       "Three fixes: fix link failure on Alpha, fix a Sparse warning and
        annotate/robustify a lockless access in the NOHZ code"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        tick/sched: Annotate lockless access to last_jiffies_update
        lib/vdso: Make __cvdso_clock_getres() static
        time/posix-stubs: Provide compat itimer supoprt for alpha
      7ff15cd0
    • Linus Torvalds's avatar
      Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9e79c523
      Linus Torvalds authored
      Pull cpu/SMT fix from Ingo Molnar:
       "Fix a build bug on CONFIG_HOTPLUG_SMT=y && !CONFIG_SYSFS kernels"
      
      * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpu/SMT: Fix x86 link error without CONFIG_SYSFS
      9e79c523
    • Linus Torvalds's avatar
      Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a186c112
      Linus Torvalds authored
      Pull x86 RAS fix from Ingo Molnar:
       "Fix a thermal throttling race that can result in easy to trigger boot
        crashes on certain Ice Lake platforms"
      
      * 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mce/therm_throt: Do not access uninitialized therm_work
      a186c112
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b07b9e8d
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Tooling fixes, three Intel uncore driver fixes, plus an AUX events fix
        uncovered by the perf fuzzer"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86/intel/uncore: Remove PCIe3 unit for SNR
        perf/x86/intel/uncore: Fix missing marker for snr_uncore_imc_freerunning_events
        perf/x86/intel/uncore: Add PCI ID of IMC for Xeon E3 V5 Family
        perf: Correctly handle failed perf_get_aux_event()
        perf hists: Fix variable name's inconsistency in hists__for_each() macro
        perf map: Set kmap->kmaps backpointer for main kernel map chunks
        perf report: Fix incorrectly added dimensions as switch perf data file
        tools lib traceevent: Fix memory leakage in filter_event
      b07b9e8d
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 124b5547
      Linus Torvalds authored
      Pull locking fixes from Ingo Molnar:
       "Three fixes:
      
          - Fix an rwsem spin-on-owner crash, introduced in v5.4
      
          - Fix a lockdep bug when running out of stack_trace entries,
            introduced in v5.4
      
          - Docbook fix"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rwsem: Fix kernel crash when spinning on RWSEM_OWNER_UNKNOWN
        futex: Fix kernel-doc notation warning
        locking/lockdep: Fix buffer overrun problem in stack_trace[]
      124b5547
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a1c6f87e
      Linus Torvalds authored
      Pull irq fix from Ingo Molnar:
       "Fix a recent regression in the Ingenic SoCs irqchip driver that floods
        the syslog"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/ingenic: Get rid of the legacy IRQ domain
      a1c6f87e
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e2f73d1e
      Linus Torvalds authored
      Pull EFI fixes from Ingo Molnar:
       "Three EFI fixes:
      
         - Fix a slow-boot-scrolling regression but making sure we use WC for
           EFI earlycon framebuffer mappings on x86
      
         - Fix a mixed EFI mode boot crash
      
         - Disable paging explicitly before entering startup_32() in mixed
           mode bootup"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/efistub: Disable paging at mixed mode entry
        efi/libstub/random: Initialize pointer variables to zero for mixed mode
        efi/earlycon: Fix write-combine mapping on x86
      e2f73d1e
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ba0f4722
      Linus Torvalds authored
      Pull rseq fixes from Ingo Molnar:
       "Two rseq bugfixes:
      
         - CLONE_VM !CLONE_THREAD didn't work properly, the kernel would end
           up corrupting the TLS of the parent. Technically a change in the
           ABI but the previous behavior couldn't resonably have been relied
           on by applications so this looks like a valid exception to the ABI
           rule.
      
         - Make the RSEQ_FLAG_UNREGISTER ABI behavior consistent with the
           handling of other flags. This is not thought to impact any
           applications either"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rseq: Unregister rseq for clone CLONE_VM
        rseq: Reject unknown flags on rseq unregister
      ba0f4722
    • Linus Torvalds's avatar
      Merge tag 'for-linus-2020-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux · 8cac8990
      Linus Torvalds authored
      Pull thread fixes from Christian Brauner:
       "Here is an urgent fix for ptrace_may_access() permission checking.
      
        Commit 69f594a3 ("ptrace: do not audit capability check when
        outputing /proc/pid/stat") introduced the ability to opt out of audit
        messages for accesses to various proc files since they are not
        violations of policy.
      
        While doing so it switched the check from ns_capable() to
        has_ns_capability{_noaudit}(). That means it switched from checking
        the subjective credentials (ktask->cred) of the task to using the
        objective credentials (ktask->real_cred). This is appears to be wrong.
        ptrace_has_cap() is currently only used in ptrace_may_access() And is
        used to check whether the calling task (subject) has the
        CAP_SYS_PTRACE capability in the provided user namespace to operate on
        the target task (object). According to the cred.h comments this means
        the subjective credentials of the calling task need to be used.
      
        With this fix we switch ptrace_has_cap() to use security_capable() and
        thus back to using the subjective credentials.
      
        As one example where this might be particularly problematic, Jann
        pointed out that in combination with the upcoming IORING_OP_OPENAT{2}
        feature, this bug might allow unprivileged users to bypass the
        capability checks while asynchronously opening files like /proc/*/mem,
        because the capability checks for this would be performed against
        kernel credentials.
      
        To illustrate on the former point about this being exploitable: When
        io_uring creates a new context it records the subjective credentials
        of the caller. Later on, when it starts to do work it creates a kernel
        thread and registers a callback. The callback runs with kernel creds
        for ktask->real_cred and ktask->cred.
      
        To prevent this from becoming a full-blown 0-day io_uring will call
        override_cred() and override ktask->cred with the subjective
        credentials of the creator of the io_uring instance. With
        ptrace_has_cap() currently looking at ktask->real_cred this override
        will be ineffective and the caller will be able to open arbitray proc
        files as mentioned above.
      
        Luckily, this is currently not exploitable but would be so once
        IORING_OP_OPENAT{2} land in v5.6. Let's fix it now.
      
        To minimize potential regressions I successfully ran the criu
        testsuite. criu makes heavy use of ptrace() and extensively hits
        ptrace_may_access() codepaths and has a good change of detecting any
        regressions.
      
        Additionally, I succesfully ran the ptrace and seccomp kernel tests"
      
      * tag 'for-linus-2020-01-18' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
        ptrace: reintroduce usage of subjective credentials in ptrace_has_cap()
      8cac8990