09 Apr, 2020

4 commits

  • Bug: 153164546
    Change-Id: Iedeef21a93e45d2266a049f360ffe7f5bbc5f943
    Signed-off-by: Nick Desaulniers

    Nick Desaulniers
     
  • When doing Clang builds of the kernel, it is possible to link with
    either ld.bfd (binutils) or ld.lld (LLVM), but it is not possible to
    discover this from a running kernel. Add the "$LD -v" output to
    /proc/version.

    Signed-off-by: Kees Cook
    Reviewed-by: Nick Desaulniers
    Tested-by: Nick Desaulniers
    Reviewed-by: Nathan Chancellor
    Tested-by: Nathan Chancellor
    Reviewed-by: Fangrui Song
    Reviewed-by: Sedat Dilek
    Tested-by: Sedat Dilek
    Signed-off-by: Masahiro Yamada

    Bug: 153484457
    (cherry picked from commit 6f04f056df3c
    https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
    for-next)
    Change-Id: Ifa5a98fe159392862e8d07a733c0f141fa9c7715
    Signed-off-by: Nick Desaulniers

    Kees Cook
     
  • Read log buffer can have multiple threads doing any of these
    operations simultaneously:
    - Polling for changes
    - Reading log records
    - Adding new log records
    - Updating log buffer size, or enabling/disabling it completely

    As we don't control the userspace, and it turns out that they
    all currently originate from different processes, code needs to
    be safe against parallel access to a read buffer and a request
    for reallocating it.

    This CL add an r/w spinlock to protect the buffer and its size.
    Each remount takes the write lock, while everything else takes
    a read lock. Remount makes sure it doesn't take too long by
    preallocating and precalculating all updates, while other
    operations don't care much about their critical section size -
    they all can still run together.

    Bug: 152633648
    Test: manual remount + reading
    Signed-off-by: Yurii Zubrytskyi
    Signed-off-by: Paul Lawrence
    Change-Id: I7271b4cb89f1ae2cbee6e5b073758f344c4ba66a

    Yurii Zubrytskyi
     
  • The CONFIG_USB_DWC3_DISABLE_GADGET_SG value was added to the
    db845c_gki.fragment before it was merged to support a patch that
    ended up being replaced with a upstream solution.

    However, the config was not cleared out of the
    db845c_gki.fragment before it was submitted.

    This patch simply removes the assignment of the non-existant
    config

    Signed-off-by: John Stultz
    Fixes: 8620e176990d ("ANDROID: db845c: add db845c_gki.fragment")
    Change-Id: Iedc98c8a1131f596d01333afad900d87702690b1

    John Stultz
     

08 Apr, 2020

9 commits

  • Found by sparse

    Bug: 153174547
    Test: make C=2 fs/incfs/incrementalfs.ko no errors, incfs_test pass
    Signed-off-by: Paul Lawrence
    Change-Id: I9ff4f4f35975fe09936724488b96cd8bdeeb719e

    Paul Lawrence
     
  • This led to a 20x speed improvement on QEMU. 512 is somewhat
    arbitrary - most of the gains are already there reading 64 records
    at a time, but since the record size is 10 bytes, 512 is just over
    a page and seems a good choice.

    Bug: 153170997
    Test: incfs_test passes. Adding logging to incfs_get_filled_blocks
    to measure performance shows a 20x improvement
    Signed-off-by: Paul Lawrence
    Change-Id: Ifb2da77cfd8c9d653c7047ba1eb7f39d795fa1c2

    Paul Lawrence
     
  • Same build problem is upstream, no one tested this thing :(

    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I1d3b5670a83e0e5b5876f162d6ce83d66f52323a

    Greg Kroah-Hartman
     
  • CONFIG_DEVMEM moved around a bit in the Kconfig files, so adjust that so
    the build continues to work.

    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I0d3a03af12ff9a8f90523653f09e5d4ee61b3a30

    Greg Kroah-Hartman
     
  • …ux/kernel/git/vgupta/arc") into android-mainline

    Steps along the 5.7-rc1 merge.

    Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
    Change-Id: Ib9f87147ac3d81985496818b0c61bdd086140eed

    Greg Kroah-Hartman
     
  • Fix a bad merge resolution with the Android-specific commit 8de80df7d7e4
    ("ANDROID: scsi: ufs: allow ufs variants to override sg entry size").

    Fixes: 7719f75e7391 ("Merge 79f51b7b9c47 ("Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi") into android-mainline")
    Reported-by: John Stultz
    Change-Id: I1d066f459a2613917467c95108494816f0fa5e71
    Signed-off-by: Eric Biggers

    Eric Biggers
     
  • It's long been possible to disable kernel module autoloading completely
    (while still allowing manual module insertion) by setting
    /proc/sys/kernel/modprobe to the empty string. This can be preferable
    to setting it to a nonexistent file since it avoids the overhead of an
    attempted execve(), avoids potential deadlocks, and avoids the call to
    security_kernel_module_request() and thus on SELinux-based systems
    eliminates the need to write SELinux rules to dontaudit module_request.

    However, when module autoloading is disabled in this way,
    request_module() returns 0. This is broken because callers expect 0 to
    mean that the module was successfully loaded.

    Apparently this was never noticed because this method of disabling
    module autoloading isn't used much, and also most callers don't use the
    return value of request_module() since it's always necessary to check
    whether the module registered its functionality or not anyway. But
    improperly returning 0 can indeed confuse a few callers, for example
    get_fs_type() in fs/filesystems.c where it causes a WARNING to be hit:

    if (!fs && (request_module("fs-%.*s", len, name) == 0)) {
    fs = __get_fs_type(name, len);
    WARN_ONCE(!fs, "request_module fs-%.*s succeeded, but still no fs?\n", len, name);
    }

    This is easily reproduced with:

    echo > /proc/sys/kernel/modprobe
    mount -t NONEXISTENT none /

    It causes:

    request_module fs-NONEXISTENT succeeded, but still no fs?
    WARNING: CPU: 1 PID: 1106 at fs/filesystems.c:275 get_fs_type+0xd6/0xf0
    [...]

    This should actually use pr_warn_once() rather than WARN_ONCE(), since
    it's also user-reachable if userspace immediately unloads the module.
    Regardless, request_module() should correctly return an error when it
    fails. So let's make it return -ENOENT, which matches the error when
    the modprobe binary doesn't exist.

    I've also sent patches to document and test this case.

    Acked-by: Luis Chamberlain
    Reviewed-by: Jessica Yu
    Reviewed-by: Kees Cook
    Cc: stable@vger.kernel.org
    Cc: Alexei Starovoitov
    Cc: Andrew Morton
    Cc: Greg Kroah-Hartman
    Cc: Jeff Vander Stoep
    Cc: NeilBrown
    Link: https://lore.kernel.org/r/20200318230515.171692-2-ebiggers@kernel.org
    Bug: 151589316
    [adelva: upstream bound, no Link because patch is in mm tree]
    Change-Id: I5e04f85e12a4f85da23e53bc11da1ade565abcd6
    Signed-off-by: Eric Biggers

    Eric Biggers
     
  • This feature is undesirable and not required by Android.

    Bug: 153460450
    Change-Id: I548bb44b9fecc90ba2589fb74b4e4693e639a8c9
    Signed-off-by: Alistair Delva

    Alistair Delva
     
  • …/kernel/git/jejb/scsi") into android-mainline

    Steps of the 5.7-rc1 merge

    Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
    Change-Id: Ic7f955d58b3d9872311b659766fc8b3548ad6369

    Greg Kroah-Hartman
     

07 Apr, 2020

15 commits


06 Apr, 2020

1 commit


05 Apr, 2020

3 commits

  • When the filesystem is mounted with '-o inlinecrypt', make fscrypt fall
    back to filesystem-layer crypto when inline crypto won't work, e.g. due
    to the hardware not supporting the encryption algorithm.

    When blk-crypto-fallback is disabled, this fixes '-o inlinecrypt' to not
    break any fscrypt policies that would otherwise work.

    This is needed for VtsKernelEncryptionTest to pass on some devices.

    Bug: 137270441
    Bug: 151100202
    Test: 'atest vts_kernel_encryption_test' on Pixel 4 with the
    inline crypto patches backported, and also on Cuttlefish.
    Change-Id: I3e730df4608efb12d7126d1a85faddcccb566764
    Signed-off-by: Eric Biggers

    Eric Biggers
     
  • We need a way to tell which type of keys the inline crypto hardware
    supports (standard, wrapped, or both), so that fallbacks can be used
    when needed (either blk-crypto-fallback, or fscrypt fs-layer crypto).

    We can't simply assume that

    keyslot_mgmt_ll_ops::derive_raw_secret == NULL

    means only standard keys are supported and that

    keyslot_mgmt_ll_ops::derive_raw_secret != NULL

    means that only wrapped keys are supported, because device-mapper
    devices always implement this method. Also, hardware might support both
    types of keys.

    Therefore, add a field keyslot_manager::features which contains a
    bitmask of flags which indicate the supported types of keys. Drivers
    will need to fill this in. This patch makes the UFS standard crypto
    code set BLK_CRYPTO_FEATURE_STANDARD_KEYS, but UFS variant drivers may
    need to set BLK_CRYPTO_FEATURE_WRAPPED_KEYS instead.

    Then, make keyslot_manager_crypto_mode_supported() take the key type
    into account.

    Bug: 137270441
    Bug: 151100202
    Test: 'atest vts_kernel_encryption_test' on Pixel 4 with the
    inline crypto patches backported, and also on Cuttlefish.
    Change-Id: Ied846c2767c1fd2f438792dcfd3649157e68b005
    Signed-off-by: Eric Biggers

    Eric Biggers
     
  • If blk-crypto-fallback is needed but is disabled by kconfig, make
    blk_crypto_start_using_mode() return an error rather than succeeding.
    Use ENOPKG, which matches the error code used by fscrypt when crypto API
    support is missing with fs-layer encryption.

    Also, if blk-crypto-fallback is needed but the algorithm is missing from
    the kernel's crypto API, change the error code from ENOENT to ENOPKG.

    This is needed for VtsKernelEncryptionTest to pass on some devices.

    Bug: 137270441
    Bug: 151100202
    Test: 'atest vts_kernel_encryption_test' on Pixel 4 with the
    inline crypto patches backported, and also on Cuttlefish.
    Change-Id: Iedf00ca8e48c74a5d4c40b12712f38738a04ef11
    Signed-off-by: Eric Biggers

    Eric Biggers
     

04 Apr, 2020

8 commits

  • …ams/working/fujitsu/integration") into android-mainline

    Step along the way for the 5.7-rc1 merge

    Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
    Change-Id: I831c2ac5045b0ee95d0d1a87b6b9e27b4c7b7335

    Greg Kroah-Hartman
     
  • clang's linker can not handle this at the moment, so revert it to keep
    the x86 build working properly.

    Bug: 153164546
    Cc:
    Signed-off-by: Greg Kroah-Hartman
    Change-Id: I87c587398065d91f1e9be8a317b755d1f7963c95

    Greg Kroah-Hartman
     
  • …ss") into android-mainline

    In a quest to divide up the 5.7-rc1 merge chunks into reviewable pieces.

    Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
    Change-Id: I2e5960415348c06e8f10e10cbefb3ee5c3745e73

    Greg Kroah-Hartman
     
  • Pull ARC updates from Vineet Gupta:

    - Support for DSP enabled userspace (save/restore regs)

    - Misc other platform fixes

    * tag 'arc-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
    ARC: allow userspace DSP applications to use AGU extensions
    ARC: add support for DSP-enabled userspace applications
    ARC: handle DSP presence in HW
    ARC: add helpers to sanitize config options
    ARC: [plat-axs10x]: PGU: remove unused encoder-slave property

    Linus Torvalds
     
  • Pull ARM devicetree updates from Arnd Bergmann:
    "Most of the commits are for additional hardware support and minor
    fixes for existing machines for all the usual platforms: qcom,
    amlogic, at91, gemini, mediatek, ti, socfpga, i.mx, layerscape,
    uniphier, rockchip, exynos, ux500, mvebu, tegra, stm32, renesas,
    sunxi, broadcom, omap, and versatile.

    The conversion of binding files to machine-readable yaml format
    continues, along with fixes found during the validation. Andre
    Przywara takes over maintainership for the old Calxeda Highbank
    platform and provides a number of updates.

    The OMAP2+ platforms see a continued move from platform data into dts
    files, for many devices that relied on a mix of auxiliary data in
    addition to the DT description

    A moderate number of new SoCs and machines are added, here is a full
    list:

    - Two new Qualcomm SoCs with their evaluation boards: Snapdragon 865
    (SM8250) is the current high-end phone chip, and IPQ6018 is a new
    WiFi-6 router chip.

    - Mediatek MT8516 application processor SoC for voice assistants,
    along with the "pumpkin" development board

    - NXP i.MX8M Plus SoC, a variant of the popular i.MX8M, along with an
    evaluation board.

    - Kontron "sl28" board family based on NXP LS1028A

    - Eleven variations of the new i.MX6 TechNexion Pico board, combining
    the "dwarf", "hobbit", "nymph" and "pi" baseboards with i.MX6/i.MX7
    SoM carriers

    - Three additional variants of the Toradex Colibri board family, all
    based on versions of the NXP i.MX7.

    - The Pinebook Pro laptop based on Rockchip RK3399

    - Samsung S7710 Galaxy Xcover 2, a 2013 vintage Android phone based
    on the ST-Ericsson u8500 platform

    - DH Electronics DHCOM SoM and PDK2 rev. 400 carrier based on
    STMicroelectronics stm32mp157

    - Renesas M3ULCB starter kit for R-Car M3-W+

    - Hoperun HiHope development board with Renesas RZ/G2M

    - Pine64 PineTab tablet and PinePhone phone, both based on Allwinner
    A64

    - Linutronix Testbox v2 for the Lamobo R1 router, based on Allwinner
    A20

    - PocketBook Touch Lux 3 ebook reader, based on Allwinner A13"

    * tag 'arm-dt-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (520 commits)
    ARM: dts: ux500: Fix missing node renames
    arm64: dts: Revert "specify console via command line"
    MAINTAINERS: Update Calxeda Highbank maintainership
    arm: dts: calxeda: Group port-phys and sgpio-gpio items
    arm: dts: calxeda: Fix interrupt grouping
    arm: dts: calxeda: Provide UART clock
    arm: dts: calxeda: Basic DT file fixes
    arm64: dts: specify console via command line
    ARM: dts: at91: sama5d27_wlsom1_ek: add USB device node
    ARM: dts: gemini: Add thermal zone to DIR-685
    ARM: dts: gemini: Rename IDE nodes
    ARM: socfpga: arria10: Add ptp_ref clock to ethernet nodes
    arm64: dts: ti: k3-j721e-mcu: add scm node and phy-gmii-sel nodes
    arm64: dts: ti: k3-am65-mcu: add phy-gmii-sel node
    arm64: dts: ti: k3-am65-mcu: Add DMA entries for ADC
    arm64: dts: ti: k3-am65-main: Add DMA entries for main_spi0
    arm64: dts: ti: k3-j721e-mcu-wakeup: Add DMA entries for ADC
    arm64: dts: ti: k3-am65: Add clocks to dwc3 nodes
    arm64: dts: meson-g12b-odroid-n2: add SPIFC controller node
    arm64: dts: khadas-vim3: add SPIFC controller node
    ...

    Linus Torvalds
     
  • Pull ARM defconfig updates from Arnd Bergmann:
    "As usual, tons of new drivers and other options got merged and are now
    enabled in the defconfig files, usually as loadable modules"

    * tag 'arm-defconfig-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (45 commits)
    ARM: omap2plus_defconfig: Update for moved and dropped options
    ARM: omap2plus_defconfig: Enable ina2xx_adc as a loadable module
    ARM: omap2plus_defconfig: Enable McPDM optional PMIC clock as modules
    ARM: omap2plus_defconfig: Enable more droid4 devices as loadable modules
    ARM: omap2plus_defconfig: Enable zram as loadable modules
    ARM: omap2plus_defconfig: Enable simple-pm-bus
    arm64: defconfig: Enable Qualcomm SDM845 audio configs
    arm64: defconfig: Enable e1000 device
    arm64: defconfig: Enable PHY devices used on QorIQ boards
    arm64: defconfig: Enable RTC devices for QorIQ boards
    arm64: defconfig: Enable flash device drivers for QorIQ boards
    arm64: defconfig: Enable ARM Mali display driver
    arm64: defconfig: Enable QorIQ GPIO driver
    arm64: defconfig: Enable QorIQ IFC NAND controller driver
    arm64: defconfig: Enable ARM SBSA watchdog driver
    arm64: defconfig: Enable QorIQ cpufreq driver
    arm64: defconfig: Enable NXP/FSL SPI controller drivers
    arm64: defconfig: Enable ENETC Ethernet controller and FELIX switch
    arm64: defconfig: Enable QorIQ DPAA2 drivers
    arm64: defconfig: Enable QorIQ DPAA1 drivers
    ...

    Linus Torvalds
     
  • Pull ARM driver updates from Arnd Bergmann:
    "These are the usual updates for SoC specific device drivers and
    related subsystems that don't have their own top-level maintainers:

    - ARM SCMI/SCPI updates to allow pluggable transport layers

    - TEE subsystem cleanups

    - A new driver for the Amlogic secure power domain controller

    - Various driver updates for the NXP Layerscape DPAA2, NXP i.MX SCU
    and TI OMAP2+ sysc drivers.

    - Qualcomm SoC driver updates, including a new library module for
    "protection domain" notifications

    - Lots of smaller bugfixes and cleanups in other drivers"

    * tag 'arm-drivers-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (70 commits)
    soc: fsl: qe: fix sparse warnings for ucc_slow.c
    soc: fsl: qe: ucc_slow: remove 0 assignment for kzalloc'ed structure
    soc: fsl: qe: fix sparse warnings for ucc_fast.c
    soc: fsl: qe: fix sparse warnings for qe_ic.c
    soc: fsl: qe: fix sparse warnings for ucc.c
    soc: fsl: qe: fix sparse warning for qe_common.c
    soc: fsl: qe: fix sparse warnings for qe.c
    soc: qcom: Fix QCOM_APR dependencies
    soc: qcom: pdr: Avoid uninitialized use of found in pdr_indication_cb
    soc: imx: drop COMPILE_TEST for IMX_SCU_SOC
    firmware: imx: add COMPILE_TEST for IMX_SCU driver
    soc: imx: gpc: fix power up sequencing
    soc: imx: increase build coverage for imx8m soc driver
    soc: qcom: apr: Add avs/audio tracking functionality
    dt-bindings: soc: qcom: apr: Add protection domain bindings
    soc: qcom: Introduce Protection Domain Restart helpers
    devicetree: bindings: firmware: add ipq806x to qcom_scm
    memory: tegra: Correct debugfs clk rate-range on Tegra124
    memory: tegra: Correct debugfs clk rate-range on Tegra30
    memory: tegra: Correct debugfs clk rate-range on Tegra20
    ...

    Linus Torvalds
     
  • Pull ARM SoC updates from Arnd Bergmann:
    "The code changes are mostly for 32-bit platforms and include:

    - Lots of updates for the Nvidia Tegra platform, including cpuidle,
    pmc, and dt-binding changes

    - Microchip at91 power management updates for the recently added
    sam9x60 SoC

    - Treewide setup_irq deprecation by afzal mohammed

    - STMicroelectronics stm32 gains earlycon support

    - Renesas platforms with Cortex-A9 can now use the global timer

    - Some TI OMAP2+ platforms gain cpuidle support

    - Various cleanups for the i.MX6 and Orion platforms, as well as
    Kconfig files across all platforms"

    * tag 'arm-soc-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (75 commits)
    ARM: qcom: Add support for IPQ40xx
    ARM: mmp: replace setup_irq() by request_irq()
    ARM: cns3xxx: replace setup_irq() by request_irq()
    ARM: spear: replace setup_irq() by request_irq()
    ARM: ep93xx: Replace setup_irq() by request_irq()
    ARM: iop32x: replace setup_irq() by request_irq()
    arm: mach-dove: Mark dove_io_desc as __maybe_unused
    ARM: orion: replace setup_irq() by request_irq()
    ARM: debug: stm32: add UART early console support for STM32MP1
    ARM: debug: stm32: add UART early console support for STM32H7
    ARM: debug: stm32: add UART early console configuration for STM32F7
    ARM: debug: stm32: add UART early console configuration for STM32F4
    cpuidle: tegra: Disable CC6 state if LP2 unavailable
    cpuidle: tegra: Squash Tegra114 driver into the common driver
    cpuidle: tegra: Squash Tegra30 driver into the common driver
    cpuidle: Refactor and move out NVIDIA Tegra20 driver into drivers/cpuidle
    ARM: tegra: cpuidle: Remove unnecessary memory barrier
    ARM: tegra: cpuidle: Make abort_flag atomic
    ARM: tegra: cpuidle: Handle case where secondary CPU hangs on entering LP2
    ARM: tegra: Make outer_disable() open-coded
    ...

    Linus Torvalds