1. 23 Feb, 2020 15 commits
    • Ard Biesheuvel's avatar
      efi/libstub: Clean up command line parsing routine · 91d150c0
      Ard Biesheuvel authored
      We currently parse the command non-destructively, to avoid having to
      allocate memory for a copy before passing it to the standard parsing
      routines that are used by the core kernel, and which modify the input
      to delineate the parsed tokens with NUL characters.
      
      Instead, we call strstr() and strncmp() to go over the input multiple
      times, and match prefixes rather than tokens, which implies that we
      would match, e.g., 'nokaslrfoo' in the stub and disable KASLR, while
      the kernel would disregard the option and run with KASLR enabled.
      
      In order to avoid having to reason about whether and how this behavior
      may be abused, let's clean up the parsing routines, and rebuild them
      on top of the existing helpers.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      91d150c0
    • Ard Biesheuvel's avatar
      efi/libstub: Take soft and hard memory limits into account for initrd loading · 31f5e546
      Ard Biesheuvel authored
      On x86, the preferred load address of the initrd is still below 4 GB,
      even though in some cases, we can cope with an initrd that is loaded
      above that.
      
      To simplify the code, and to make it more straightforward to introduce
      other ways to load the initrd, pass the soft and hard memory limits at
      the same time, and let the code handling the initrd= command line option
      deal with this.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      31f5e546
    • Ard Biesheuvel's avatar
      efi/libstub: Rewrite file I/O routine · 9302c1bb
      Ard Biesheuvel authored
      The file I/O routine that is used to load initrd or dtb files from
      the EFI system partition suffers from a few issues:
      - it converts the u8[] command line back to a UTF-16 string, which is
        pointless since we only handle initrd or dtb arguments provided via
        the loaded image protocol anyway, which is where we got the UTF-16[]
        command line from in the first place when booting via the PE entry
        point,
      - in the far majority of cases, only a single initrd= option is present,
        but it optimizes for multiple options, by going over the command line
        twice, allocating heap buffers for dynamically sized arrays, etc.
      - the coding style is hard to follow, with few comments, and all logic
        including string parsing etc all combined in a single routine.
      
      Let's fix this by rewriting most of it, based on the idea that in the
      case of multiple initrds, we can just allocate a new, bigger buffer
      and copy over the data before freeing the old one.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      9302c1bb
    • Ard Biesheuvel's avatar
      efi/libstub: Move file I/O support code into separate file · 5193a33d
      Ard Biesheuvel authored
      Split off the file I/O support code into a separate source file so
      it ends up in a separate object file in the static library, allowing
      the linker to omit it if the routines are not used.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      5193a33d
    • Ard Biesheuvel's avatar
      efi/libstub: Move get_dram_base() into arm-stub.c · b8717454
      Ard Biesheuvel authored
      get_dram_base() is only called from arm-stub.c so move it into
      the same source file as its caller.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      b8717454
    • Ard Biesheuvel's avatar
      efi/libstub: Move efi_random_alloc() into separate source file · 0ed02bda
      Ard Biesheuvel authored
      efi_random_alloc() is only used on arm64, but as it shares a source
      file with efi_random_get_seed(), the latter will pull in the former
      on other architectures as well.
      
      Let's take advantage of the fact that libstub is a static library,
      and so the linker will only incorporate objects that are needed to
      satisfy dependencies in other objects. This means we can move the
      random alloc code to a separate source file that gets built
      unconditionally, but only used when needed.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      0ed02bda
    • Ard Biesheuvel's avatar
      efi/libstub/x86: Permit cmdline data to be allocated above 4 GB · 1e45bf73
      Ard Biesheuvel authored
      We now support cmdline data that is located in memory that is not
      32-bit addressable, so relax the allocation limit on systems where
      this feature is enabled.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      1e45bf73
    • Ard Biesheuvel's avatar
      efi/libstub: Move stub specific declarations into efistub.h · 8166ec09
      Ard Biesheuvel authored
      Move all the declarations that are only used in stub code from
      linux/efi.h to efistub.h which is only included locally.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      8166ec09
    • Ard Biesheuvel's avatar
      efi/libstub/x86: Permit bootparams struct to be allocated above 4 GB · 6a4db9bf
      Ard Biesheuvel authored
      We now support bootparams structures that are located in memory that
      is not 32-bit addressable, so relax the allocation limit on systems
      where this feature is enabled.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      6a4db9bf
    • Ard Biesheuvel's avatar
      efi/libstub: Use consistent type names for file I/O protocols · a46a290a
      Ard Biesheuvel authored
      Align the naming of efi_file_io_interface_t and efi_file_handle_t with
      the UEFI spec, and call them efi_simple_file_system_protocol_t and
      efi_file_protocol_t, respectively, using the same convention we use
      for all other type definitions that originate in the UEFI spec.
      
      While at it, move the definitions to efistub.h, so they are only seen
      by code that needs them.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      a46a290a
    • Ard Biesheuvel's avatar
      efi/libstub/x86: Incorporate eboot.c into libstub · c2d0b470
      Ard Biesheuvel authored
      Most of the EFI stub source files of all architectures reside under
      drivers/firmware/efi/libstub, where they share a Makefile with special
      CFLAGS and an include file with declarations that are only relevant
      for stub code.
      
      Currently, we carry a lot of stub specific stuff in linux/efi.h only
      because eboot.c in arch/x86 needs them as well. So let's move eboot.c
      into libstub/, and move the contents of eboot.h that we still care
      about into efistub.h
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      c2d0b470
    • Ard Biesheuvel's avatar
      efi/libstub: Simplify efi_high_alloc() and rename to efi_allocate_pages() · a7495c28
      Ard Biesheuvel authored
      The implementation of efi_high_alloc() uses a complicated way of
      traversing the memory map to find an available region that is located
      as close as possible to the provided upper limit, and calls AllocatePages
      subsequently to create the allocation at that exact address.
      
      This is precisely what the EFI_ALLOCATE_MAX_ADDRESS allocation type
      argument to AllocatePages() does, and considering that EFI_ALLOC_ALIGN
      only exceeds EFI_PAGE_SIZE on arm64, let's use AllocatePages() directly
      and implement the alignment using code that the compiler can remove if
      it does not exceed EFI_PAGE_SIZE.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      a7495c28
    • Ard Biesheuvel's avatar
      efi/libstub: Move memory map handling and allocation routines to mem.c · f57db62c
      Ard Biesheuvel authored
      Create a new source file mem.c to keep the routines involved in memory
      allocation and deallocation and manipulation of the EFI memory map.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      f57db62c
    • Ard Biesheuvel's avatar
      efi/libstub/arm: Relax FDT alignment requirement · 184d7e0d
      Ard Biesheuvel authored
      The arm64 kernel no longer requires the FDT blob to fit inside a
      naturally aligned 2 MB memory block, so remove the code that aligns
      the allocation to 2 MB.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      184d7e0d
    • Ard Biesheuvel's avatar
      efi/libstub: Use hidden visibility for all source files · 6f05106e
      Ard Biesheuvel authored
      Instead of setting the visibility pragma for a small set of symbol
      declarations that could result in absolute references that we cannot
      support in the stub, declare hidden visibility for all code in the
      EFI stub, which is more robust and future proof.
      
      To ensure that the #pragma is taken into account before any other
      includes are processed, put it in a header file of its own and
      include it via the compiler command line using the -include option.
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      6f05106e
  2. 22 Feb, 2020 16 commits
  3. 10 Feb, 2020 2 commits
    • Linus Torvalds's avatar
      Linux 5.6-rc1 · bb6d3fb3
      Linus Torvalds authored
      bb6d3fb3
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · 89a47dd1
      Linus Torvalds authored
      Pull more Kbuild updates from Masahiro Yamada:
      
       - fix randconfig to generate a sane .config
      
       - rename hostprogs-y / always to hostprogs / always-y, which are more
         natual syntax.
      
       - optimize scripts/kallsyms
      
       - fix yes2modconfig and mod2yesconfig
      
       - make multiple directory targets ('make foo/ bar/') work
      
      * tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: make multiple directory targets work
        kconfig: Invalidate all symbols after changing to y or m.
        kallsyms: fix type of kallsyms_token_table[]
        scripts/kallsyms: change table to store (strcut sym_entry *)
        scripts/kallsyms: rename local variables in read_symbol()
        kbuild: rename hostprogs-y/always to hostprogs/always-y
        kbuild: fix the document to use extra-y for vmlinux.lds
        kconfig: fix broken dependency in randconfig-generated .config
      89a47dd1
  4. 09 Feb, 2020 7 commits
    • Linus Torvalds's avatar
      Merge tag 'zonefs-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs · 380a129e
      Linus Torvalds authored
      Pull new zonefs file system from Damien Le Moal:
       "Zonefs is a very simple file system exposing each zone of a zoned
        block device as a file.
      
        Unlike a regular file system with native zoned block device support
        (e.g. f2fs or the on-going btrfs effort), zonefs does not hide the
        sequential write constraint of zoned block devices to the user. As a
        result, zonefs is not a POSIX compliant file system. Its goal is to
        simplify the implementation of zoned block devices support in
        applications by replacing raw block device file accesses with a richer
        file based API, avoiding relying on direct block device file ioctls
        which may be more obscure to developers.
      
        One example of this approach is the implementation of LSM
        (log-structured merge) tree structures (such as used in RocksDB and
        LevelDB) on zoned block devices by allowing SSTables to be stored in a
        zone file similarly to a regular file system rather than as a range of
        sectors of a zoned device. The introduction of the higher level
        construct "one file is one zone" can help reducing the amount of
        changes needed in the application while at the same time allowing the
        use of zoned block devices with various programming languages other
        than C.
      
        Zonefs IO management implementation uses the new iomap generic code.
        Zonefs has been successfully tested using a functional test suite
        (available with zonefs userland format tool on github) and a prototype
        implementation of LevelDB on top of zonefs"
      
      * tag 'zonefs-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
        zonefs: Add documentation
        fs: New zonefs file system
      380a129e
    • Marc Zyngier's avatar
      irqchip/gic-v4.1: Avoid 64bit division for the sake of 32bit ARM · 490d332e
      Marc Zyngier authored
      In order to allow the GICv4 code to link properly on 32bit ARM,
      make sure we don't use 64bit divisions when it isn't strictly
      necessary.
      
      Fixes: 4e6437f1 ("irqchip/gic-v4.1: Ensure L2 vPE table is allocated at RD level")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Zenghui Yu <yuzenghui@huawei.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      490d332e
    • Linus Torvalds's avatar
      Merge tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6 · d1ea35f4
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "13 cifs/smb3 patches, most from testing at the SMB3 plugfest this week:
      
         - Important fix for multichannel and for modefromsid mounts.
      
         - Two reconnect fixes
      
         - Addition of SMB3 change notify support
      
         - Backup tools fix
      
         - A few additional minor debug improvements (tracepoints and
           additional logging found useful during testing this week)"
      
      * tag '5.6-rc-smb3-plugfest-patches' of git://git.samba.org/sfrench/cifs-2.6:
        smb3: Add defines for new information level, FileIdInformation
        smb3: print warning once if posix context returned on open
        smb3: add one more dynamic tracepoint missing from strict fsync path
        cifs: fix mode bits from dir listing when mounted with modefromsid
        cifs: fix channel signing
        cifs: add SMB3 change notification support
        cifs: make multichannel warning more visible
        cifs: fix soft mounts hanging in the reconnect code
        cifs: Add tracepoints for errors on flush or fsync
        cifs: log warning message (once) if out of disk space
        cifs: fail i/o on soft mounts if sessionsetup errors out
        smb3: fix problem with null cifs super block with previous patch
        SMB3: Backup intent flag missing from some more ops
      d1ea35f4
    • Linus Torvalds's avatar
      Merge branch 'work.vboxsf' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 5586c3c1
      Linus Torvalds authored
      Pull vboxfs from Al Viro:
       "This is the VirtualBox guest shared folder support by Hans de Goede,
        with fixups for fs_parse folded in to avoid bisection hazards from
        those API changes..."
      
      * 'work.vboxsf' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fs: Add VirtualBox guest shared folder (vboxsf) support
      5586c3c1
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1a2a76c2
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of fixes for X86:
      
         - Ensure that the PIT is set up when the local APIC is disable or
           configured in legacy mode. This is caused by an ordering issue
           introduced in the recent changes which skip PIT initialization when
           the TSC and APIC frequencies are already known.
      
         - Handle malformed SRAT tables during early ACPI parsing which caused
           an infinite loop anda boot hang.
      
         - Fix a long standing race in the affinity setting code which affects
           PCI devices with non-maskable MSI interrupts. The problem is caused
           by the non-atomic writes of the MSI address (destination APIC id)
           and data (vector) fields which the device uses to construct the MSI
           message. The non-atomic writes are mandated by PCI.
      
           If both fields change and the device raises an interrupt after
           writing address and before writing data, then the MSI block
           constructs a inconsistent message which causes interrupts to be
           lost and subsequent malfunction of the device.
      
           The fix is to redirect the interrupt to the new vector on the
           current CPU first and then switch it over to the new target CPU.
           This allows to observe an eventually raised interrupt in the
           transitional stage (old CPU, new vector) to be observed in the APIC
           IRR and retriggered on the new target CPU and the new vector.
      
           The potential spurious interrupts caused by this are harmless and
           can in the worst case expose a buggy driver (all handlers have to
           be able to deal with spurious interrupts as they can and do happen
           for various reasons).
      
         - Add the missing suspend/resume mechanism for the HYPERV hypercall
           page which prevents resume hibernation on HYPERV guests. This
           change got lost before the merge window.
      
         - Mask the IOAPIC before disabling the local APIC to prevent
           potentially stale IOAPIC remote IRR bits which cause stale
           interrupt lines after resume"
      
      * tag 'x86-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/apic: Mask IOAPIC entries when disabling the local APIC
        x86/hyperv: Suspend/resume the hypercall page for hibernation
        x86/apic/msi: Plug non-maskable MSI affinity race
        x86/boot: Handle malformed SRAT tables during early ACPI parsing
        x86/timer: Don't skip PIT setup when APIC is disabled or in legacy mode
      1a2a76c2
    • Linus Torvalds's avatar
      Merge tag 'smp-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f4137760
      Linus Torvalds authored
      Pull SMP fixes from Thomas Gleixner:
       "Two fixes for the SMP related functionality:
      
         - Make the UP version of smp_call_function_single() match SMP
           semantics when called for a not available CPU. Instead of emitting
           a warning and assuming that the function call target is CPU0,
           return a proper error code like the SMP version does.
      
         - Remove a superfluous check in smp_call_function_many_cond()"
      
      * tag 'smp-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        smp/up: Make smp_call_function_single() match SMP semantics
        smp: Remove superfluous cond_func check in smp_call_function_many_cond()
      f4137760
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ca21b9b3
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "A set of fixes and improvements for the perf subsystem:
      
        Kernel fixes:
      
         - Install cgroup events to the correct CPU context to prevent a
           potential list double add
      
         - Prevent an integer underflow in the perf mlock accounting
      
         - Add a missing prototype for arch_perf_update_userpage()
      
        Tooling:
      
         - Add a missing unlock in the error path of maps__insert() in perf
           maps.
      
         - Fix the build with the latest libbfd
      
         - Fix the perf parser so it does not delete parse event terms, which
           caused a regression for using perf with the ARM CoreSight as the
           sink configuration was missing due to the deletion.
      
         - Fix the double free in the perf CPU map merging test case
      
         - Add the missing ustring support for the perf probe command"
      
      * tag 'perf-urgent-2020-02-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf maps: Add missing unlock to maps__insert() error case
        perf probe: Add ustring support for perf probe command
        perf: Make perf able to build with latest libbfd
        perf test: Fix test case Merge cpu map
        perf parse: Copy string to perf_evsel_config_term
        perf parse: Refactor 'struct perf_evsel_config_term'
        kernel/events: Add a missing prototype for arch_perf_update_userpage()
        perf/cgroups: Install cgroup events to correct cpuctx
        perf/core: Fix mlock accounting in perf_mmap()
      ca21b9b3