Skip to content
  1. Dec 25, 2020
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 14571d5f
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Correct the JSON pointer syntax in binding schemas
      
       - Drop unnecessary *-supply schema constraints
      
       - Drop redundant maxItems/items on array schemas
      
       - Fix various yamllint warnings
      
       - Fix various missing 'additionalProperties' properties
      
      * tag 'devicetree-fixes-for-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: Drop redundant maxItems/items
        dt-bindings: net: qcom,ipa: Drop unnecessary type ref on 'memory-region'
        dt-bindings: Drop unnecessary *-supply schemas properties
        dt-bindings/display: abt,y030xx067a: Fix binding
        dt-bindings: clock: imx8qxp-lpcg: eliminate yamllint warnings
        dt-bindings: display: eliminate yamllint warnings
        dt-bindings: media: nokia,smia: eliminate yamllint warnings
        dt-bindings: devapc: add the required property 'additionalProperties'
        dt-bindings: soc: add the required property 'additionalProperties'
        dt-bindings: serial: add the required property 'additionalProperties'
        dt-bindings: xlnx,vcu-settings: fix dt_binding_check warnings
        media: dt-bindings: coda: Add missing 'additionalProperties'
        dt-bindings: Fix JSON pointers
      14571d5f
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 64145482
      Linus Torvalds authored
      Pull virtio updates from Michael Tsirkin:
      
       - vdpa sim refactoring
      
       - virtio mem: Big Block Mode support
      
       - misc cleanus, fixes
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (61 commits)
        vdpa: Use simpler version of ida allocation
        vdpa: Add missing comment for virtqueue count
        uapi: virtio_ids: add missing device type IDs from OASIS spec
        uapi: virtio_ids.h: consistent indentions
        vhost scsi: fix error return code in vhost_scsi_set_endpoint()
        virtio_ring: Fix two use after free bugs
        virtio_net: Fix error code in probe()
        virtio_ring: Cut and paste bugs in vring_create_virtqueue_packed()
        tools/virtio: add barrier for aarch64
        tools/virtio: add krealloc_array
        tools/virtio: include asm/bug.h
        vdpa/mlx5: Use write memory barrier after updating CQ index
        vdpa: split vdpasim to core and net modules
        vdpa_sim: split vdpasim_virtqueue's iov field in out_iov and in_iov
        vdpa_sim: make vdpasim->buffer size configurable
        vdpa_sim: use kvmalloc to allocate vdpasim->buffer
        vdpa_sim: set vringh notify callback
        vdpa_sim: add set_config callback in vdpasim_dev_attr
        vdpa_sim: add get_config callback in vdpasim_dev_attr
        vdpa_sim: make 'config' generic and usable for any device type
        ...
      64145482
  2. Dec 24, 2020
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 58cf05f5
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A collection of small fixes that came up recently for 5.11.
      
        The majority of fixes are usual HD-audio and USB-audio quirks, with a
        few PCM core fixes for addressing the information leak and yet more
        UBSAN fixes in the core side"
      
      * tag 'sound-fix-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA/hda: apply jack fixup for the Acer Veriton N4640G/N6640G/N2510G
        ALSA: hda/realtek: Apply jack fixup for Quanta NL3
        ALSA: usb-audio: Add implicit feeback support for the BOSS GT-1
        ALSA: usb-audio: Add alias entry for ASUS PRIME TRX40 PRO-S
        ALSA: core: Remove redundant comments
        ALSA: hda/realtek: Add quirk for MSI-GP73
        ALSA: pcm: oss: Fix a few more UBSAN fixes
        ALSA: pcm: Clear the full allocated memory at hw_params
        ALSA: memalloc: Align buffer allocations in page size
        ALSA: usb-audio: Disable sample read check if firmware doesn't give back
        ALSA: pcm: Remove snd_pcm_lib_preallocate_dma_free()
        ALSA: usb-audio: Add VID to support native DSD reproduction on FiiO devices
        ALSA: core: memalloc: add page alignment for iram
        ALSA: hda/realtek - Supported Dell fixed type headset
        ALSA: hda/realtek: Remove dummy lineout on Acer TravelMate P648/P658
      58cf05f5
    • Linus Torvalds's avatar
      Merge tag 'tag-chrome-platform-for-v5.11' of... · a0881596
      Linus Torvalds authored
      Merge tag 'tag-chrome-platform-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
      
      Pull chrome platform updates from Benson Leung:
       "cros_ec_typec:
      
         - A series from Prashant for Type-C to implement TYPEC_STATUS,
           parsing USB PD Partner ID VDOs, and registering partner altmodes.
      
        cros_ec misc:
      
         - Don't treat RTC events as wakeup sources in cros_ec_proto"
      
      * tag 'tag-chrome-platform-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
        platform/chrome: cros_ec_typec: Tolerate unrecognized mux flags
        platform/chrome: cros_ec_typec: Register partner altmodes
        platform/chrome: cros_ec_typec: Parse partner PD ID VDOs
        platform/chrome: cros_ec_typec: Introduce TYPEC_STATUS
        platform/chrome: cros_ec: Import Type C host commands
        platform/chrome: cros_ec_typec: Clear partner identity on device removal
        platform/chrome: cros_ec_typec: Fix remove partner logic
        platform/chrome: cros_ec_typec: Relocate set_port_params_v*() functions
        platform/chrome: Don't treat RTC events as wakeup sources
      a0881596
    • Linus Torvalds's avatar
      Merge tag 'linux-watchdog-5.11-rc1' of git://www.linux-watchdog.org/linux-watchdog · 6755f456
      Linus Torvalds authored
      Pull watchdog updates from Wim Van Sebroeck:
      
       - Removal of the pnx83xx driver
      
       - Add a binding for A100's watchdog controller
      
       - Add Rockchip compatibles to snps,dw-wdt.yaml
      
       - hpwdt: Disable NMI in Crash Kernel
      
       - Fix potential dereferencing of null pointer in watchdog_core
      
       - Several other small fixes and improvements
      
      * tag 'linux-watchdog-5.11-rc1' of git://www.linux-watchdog.org/linux-watchdog: (23 commits)
        watchdog: convert comma to semicolon
        watchdog: iTCO_wdt: use dev_*() instead of pr_*() for logging
        dt-binding: watchdog: add Rockchip compatibles to snps,dw-wdt.yaml
        watchdog: coh901327: add COMMON_CLK dependency
        dt-bindings: watchdog: sun4i: Add A100 compatible
        watchdog: qcom: Avoid context switch in restart handler
        watchdog: iTCO_wdt: use module_platform_device() macro
        watchdog: Fix potential dereferencing of null pointer
        watchdog: wdat_wdt: Fix missing kerneldoc reported by W=1
        watchdog/hpwdt: Reflect changes
        watchdog/hpwdt: Disable NMI in Crash Kernel
        wdt: sp805: add watchdog_stop on reboot
        watchdog: sbc_fitpc2_wdt: add __user annotations
        watchdog: geodewdt: remove unneeded break
        watchdog: rti-wdt: fix reference leak in rti_wdt_probe
        watchdog: qcom_wdt: set WDOG_HW_RUNNING bit when appropriate
        watchdog: remove pnx83xx driver
        watchdog: stm32_iwdg: don't print an error on probe deferral
        watchdog: sprd: change to use usleep_range() instead of busy loop
        watchdog: sprd: check busy bit before new loading rather than after that
        ...
      6755f456
  3. Dec 23, 2020
    • Rob Herring's avatar
      dt-bindings: Drop redundant maxItems/items · 2b8f061a
      Rob Herring authored
      
      
      'maxItems' equal to the 'items' list length is redundant. 'maxItems' is
      preferred for a single entry while greater than 1 should have an 'items'
      list.
      
      A meta-schema check for this is pending once these existing cases are
      fixed.
      
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: dri-devel@lists.freedesktop.org
      Cc: dmaengine@vger.kernel.org
      Cc: alsa-devel@alsa-project.org
      Cc: linux-usb@vger.kernel.org
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Acked-by: default avatarVinod Koul <vkoul@kernel.org>
      Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20201222040645.1323611-1-robh@kernel.org
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      2b8f061a
    • Rob Herring's avatar
      dt-bindings: net: qcom,ipa: Drop unnecessary type ref on 'memory-region' · 246eedd7
      Rob Herring authored
      
      
      'memory-region' is a common property, so it doesn't need a type ref here.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Alex Elder <elder@kernel.org>
      Cc: netdev@vger.kernel.org
      Acked-by: default avatarAlex Elder <elder@linaro.org>
      Link: https://lore.kernel.org/r/20201222040121.1314370-1-robh@kernel.org
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      246eedd7
    • Rob Herring's avatar
      dt-bindings: Drop unnecessary *-supply schemas properties · 9bfaf9c7
      Rob Herring authored
      
      
      *-supply properties are always a single phandle, so binding schemas
      don't need a type $ref nor 'maxItems'.
      
      A meta-schema check for this is pending once these existing cases are
      fixed.
      
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: dri-devel@lists.freedesktop.org
      Cc: linux-iio@vger.kernel.org
      Cc: linux-input@vger.kernel.org
      Cc: linux-media@vger.kernel.org
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/20201221234659.824881-1-robh@kernel.org
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      9bfaf9c7
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 614cb589
      Linus Torvalds authored
      Pull more ACPI updates from Rafael Wysocki:
       "These make the ACPI enumeration of devices take _DEP information into
        account more aggressively, fix device IDs matching in the ACPI part of
        the PNP devices framework and update the ACPI code related to
        suspend-to-idle to take systems based on AMD hardware into account
        properly.
      
        Specifics:
      
         - Modify the ACPI device enumeration code to defer the enumeration of
           devices with an _HID whose lists of operation region dependencies
           returned by _DEP are not empty after eliminating the entries
           representing known-benign dependencies from them (Rafael Wysocki,
           Hans de Goede).
      
         - Make the ACPI PNP code mathing device IDs also take the length of
           the given ID string into account (Hui Wang).
      
         - Add AMD systems support to the ACPI code handling suspend-to-idle
           via the PNP0D80 (System Power Management Controller) device _DSM
           interface (Shyam Sundar).
      
         - Move the suspend-to-idle handling code related to the PNP0D80
           device _DSM interface, which is x86-specific, to a separate file in
           the x86/ subdirectory (Rafael Wysocki)"
      
      * tag 'acpi-5.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: PM: s2idle: Move x86-specific code to the x86 directory
        ACPI: scan: Add Intel Baytrail Mailbox Device to acpi_ignore_dep_ids
        ACPI: scan: Avoid unnecessary second pass in acpi_bus_scan()
        ACPI: scan: Defer enumeration of devices with _DEP lists
        ACPI: scan: Evaluate _DEP before adding the device
        ACPI: PM: s2idle: Add AMD support to handle _DSM
        ACPI: PNP: compare the string length in the matching_id()
      614cb589
    • Linus Torvalds's avatar
      Merge tag 'pm-5.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 4960821a
      Linus Torvalds authored
      Pull more power management updates from Rafael Wysocki:
       "These update the CPPC cpufreq driver and intel_pstate (which involves
        updating the cpufreq core and the schedutil governor) and make
        janitorial changes in the ACPI code handling processor objects.
      
        Specifics:
      
         - Rework the passive-mode "fast switch" path in the intel_pstate
           driver to allow it receive the minimum (required) and target
           (desired) performance information from the schedutil governor so as
           to avoid running some workloads too fast (Rafael Wysocki).
      
         - Make the intel_pstate driver allow the policy max limit to be
           increased after the guaranteed performance value for the given CPU
           has increased (Rafael Wysocki).
      
         - Clean up the handling of CPU coordination types in the CPPC cpufreq
           driver and make it export frequency domains information to user
           space via sysfs (Ionela Voinescu).
      
         - Fix the ACPI code handling processor objects to use a correct
           coordination type when it fails to map frequency domains and drop a
           redundant CPU map initialization from it (Ionela Voinescu, Punit
           Agrawal)"
      
      * tag 'pm-5.11-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: intel_pstate: Use most recent guaranteed performance values
        cpufreq: intel_pstate: Implement the ->adjust_perf() callback
        cpufreq: Add special-purpose fast-switching callback for drivers
        cpufreq: schedutil: Add util to struct sg_cpu
        cppc_cpufreq: replace per-cpu data array with a list
        cppc_cpufreq: expose information on frequency domains
        cppc_cpufreq: clarify support for coordination types
        cppc_cpufreq: use policy->cpu as driver of frequency setting
        ACPI: processor: fix NONE coordination for domain mapping failure
      4960821a
    • Linus Torvalds's avatar
      Merge tag 'kconfig-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · 2762db75
      Linus Torvalds authored
      Pull Kconfig updates from Masahiro Yamada:
      
       - Support only Qt5 for qconf
      
       - Validate signal/slot connection at compile time of qconf
      
       - Sanitize header includes
      
      * tag 'kconfig-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kconfig: doc: fix $(fileno) to $(filename)
        kconfig: fix return value of do_error_if()
        kconfig: clean up header inclusion
        kconfig: qconf: show Qt version in the About dialog
        kconfig: make lkc.h self-sufficient #include-wise
        kconfig: qconf: convert to Qt5 new signal/slot connection syntax
        kconfig: qconf: use a variable to pass packages to pkg-config
        kconfig: qconf: drop Qt4 support
      2762db75
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · 7b95f056
      Linus Torvalds authored
      Pull Kbuild updates from Masahiro Yamada:
      
       - Use /usr/bin/env for shebang lines in scripts
      
       - Remove useless -Wnested-externs warning flag
      
       - Update documents
      
       - Refactor log handling in modpost
      
       - Stop building modules without MODULE_LICENSE() tag
      
       - Make the insane combination of 'static' and EXPORT_SYMBOL an error
      
       - Improve genksyms to handle _Static_assert()
      
      * tag 'kbuild-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        Documentation/kbuild: Document platform dependency practises
        Documentation/kbuild: Document COMPILE_TEST dependencies
        genksyms: Ignore module scoped _Static_assert()
        modpost: turn static exports into error
        modpost: turn section mismatches to error from fatal()
        modpost: change license incompatibility to error() from fatal()
        modpost: turn missing MODULE_LICENSE() into error
        modpost: refactor error handling and clarify error/fatal differe...
      7b95f056
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 1375b980
      Linus Torvalds authored
      Merge KASAN updates from Andrew Morton.
      
      This adds a new hardware tag-based mode to KASAN.  The new mode is
      similar to the existing software tag-based KASAN, but relies on arm64
      Memory Tagging Extension (MTE) to perform memory and pointer tagging
      (instead of shadow memory and compiler instrumentation).
      
      By Andrey Konovalov and Vincenzo Frascino.
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (60 commits)
        kasan: update documentation
        kasan, mm: allow cache merging with no metadata
        kasan: sanitize objects when metadata doesn't fit
        kasan: clarify comment in __kasan_kfree_large
        kasan: simplify assign_tag and set_tag calls
        kasan: don't round_up too much
        kasan, mm: rename kasan_poison_kfree
        kasan, mm: check kasan_enabled in annotations
        kasan: add and integrate kasan boot parameters
        kasan: inline (un)poison_range and check_invalid_free
        kasan: open-code kasan_unpoison_slab
        kasan: inline random_tag for HW_TAGS
        kasan: inline kasan_reset_tag for tag-based modes
        kasan: remove __kasan_unpoison_stack
        kasan: allow VMAP_STACK for HW_TAGS mode
        kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK
        kasan: introduce set_alloc_info
        kasan: rename get_alloc/free_info
        kasan: simplify quarantine_put call site
        kselftest/arm64: check GCR_EL1 after context switch
        ...
      1375b980
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux · c45647f9
      Linus Torvalds authored
      Pull ARM updates from Russell King:
      
       - Rework phys/virt translation
      
       - Add KASan support
      
       - Move DT out of linear map region
      
       - Use more PC-relative addressing in assembly
      
       - Remove FP emulation handling while in kernel mode
      
       - Link with '-z norelro'
      
       - remove old check for GCC <= 4.2 in ARM unwinder code
      
       - disable big endian if using clang's linker
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: (46 commits)
        ARM: 9027/1: head.S: explicitly map DT even if it lives in the first physical section
        ARM: 9038/1: Link with '-z norelro'
        ARM: 9037/1: uncompress: Add OF_DT_MAGIC macro
        ARM: 9036/1: uncompress: Fix dbgadtb size parameter name
        ARM: 9035/1: uncompress: Add be32tocpu macro
        ARM: 9033/1: arm/smp: Drop the macro S(x,s)
        ARM: 9032/1: arm/mm: Convert PUD level pgtable helper macros into functions
        ARM: 9031/1: hyp-stub: remove unused .L__boot_cpu_mode_offset symbol
        ARM: 9044/1: vfp: use undef hook for VFP support detection
        ARM: 9034/1: __div64_32(): straighten up inline asm constraints
        ARM: 9030/1: entry: omit FP emulation for UND exceptions taken in kernel mode
        ARM: 9029/1: Make iwmmxt.S support Clang's integrated assembler
        ARM: 9028/1: disable KASAN in call stack capturing routines
        ARM: 9026/1: unwind: remove old check for GCC <= 4.2
        ARM: 9025/1: Kconfig: CPU_BIG_ENDIAN depends on !LD_IS_LLD
        ARM: 9024/1: Drop useless cast of "u64" to "long long"
        ARM: 9023/1: Spelling s/mmeory/memory/
        ARM: 9022/1: Change arch/arm/lib/mem*.S to use WEAK instead of .weak
        ARM: kvm: replace open coded VA->PA calculations with adr_l call
        ARM: head.S: use PC relative insn sequence to calculate PHYS_OFFSET
        ...
      c45647f9
    • Linus Torvalds's avatar
      Merge tag 'for-5.11/dm-changes' of... · d8355e74
      Linus Torvalds authored
      Merge tag 'for-5.11/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
      
      Pull device mapper updates from Mike Snitzer:
      
       - Add DM verity support for signature verification with 2nd keyring
      
       - Fix DM verity to skip verity work if IO completes with error while
         system is shutting down
      
       - Add new DM multipath "IO affinity" path selector that maps IO
         destined to a given path to a specific CPU based on user provided
         mapping
      
       - Rename DM multipath path selector source files to have "dm-ps" prefix
      
       - Add REQ_NOWAIT support to some other simple DM targets that don't
         block in more elaborate ways waiting for IO
      
       - Export DM crypt's kcryptd workqueue via sysfs (WQ_SYSFS)
      
       - Fix error return code in DM's target_message() if empty message is
         received
      
       - A handful of other small cleanups
      
      * tag 'for-5.11/dm-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm cache: simplify the return expression of load_mapping()
        dm ebs: avoid double unlikely() notation when using IS_ERR()
        dm verity: skip verity work if I/O error when system is shutting down
        dm crypt: export sysfs of kcryptd workqueue
        dm ioctl: fix error return code in target_message
        dm crypt: Constify static crypt_iv_operations
        dm: add support for REQ_NOWAIT to various targets
        dm: rename multipath path selector source files to have "dm-ps" prefix
        dm mpath: add IO affinity path selector
        dm verity: Add support for signature verification with 2nd keyring
        dm: remove unnecessary current->bio_list check when submitting split bio
      d8355e74
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v5.11-take2' of... · 4e31dcc0
      Linus Torvalds authored
      Merge tag 'hwmon-for-v5.11-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull another hwmon update from Guenter Roeck:
       "The only patch in this series is removal of voltage and current
        reporting for AMD Zen CPUs.
      
        Turns out that was not worth the trouble, because it's all
        undocumented and not maintainable"
      
      * tag 'hwmon-for-v5.11-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (k10temp) Remove support for displaying voltage and current on Zen CPUs
      4e31dcc0
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.11' of git://git.infradead.org/users/hch/dma-mapping · 347d81b6
      Linus Torvalds authored
      Pull dma-mapping updates from Christoph Hellwig:
      
       - support for a partial IOMMU bypass (Alexey Kardashevskiy)
      
       - add a DMA API benchmark (Barry Song)
      
       - misc fixes (Tiezhu Yang, tangjianqiang)
      
      * tag 'dma-mapping-5.11' of git://git.infradead.org/users/hch/dma-mapping:
        selftests/dma: add test application for DMA_MAP_BENCHMARK
        dma-mapping: add benchmark support for streaming DMA APIs
        dma-contiguous: fix a typo error in a comment
        dma-pool: no need to check return value of debugfs_create functions
        powerpc/dma: Fallback to dma_ops when persistent memory present
        dma-mapping: Allow mixing bypass and mapped DMA operation
      347d81b6
    • Linus Torvalds's avatar
      Merge tag 'configfs-5.11' of git://git.infradead.org/users/hch/configfs · 4f06f210
      Linus Torvalds authored
      Pull configfs update from Christoph Hellwig:
       "Fix a kerneldoc comment (Alex Shi)"
      
      * tag 'configfs-5.11' of git://git.infradead.org/users/hch/configfs:
        configfs: fix kernel-doc markup issue
      4f06f210
    • Linus Torvalds's avatar
      Merge tag 'exfat-for-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat · e9e541ec
      Linus Torvalds authored
      Pull exfat update from Namjae Jeon:
       "Avoid page allocation failure from upcase table allocation"
      
      * tag 'exfat-for-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
        exfat: Avoid allocating upcase table using kcalloc()
      e9e541ec
    • Andi Kleen's avatar
      x86/split-lock: Avoid returning with interrupts enabled · e14fd4ba
      Andi Kleen authored
      When a split lock is detected always make sure to disable interrupts
      before returning from the trap handler.
      
      The kernel exit code assumes that all exits run with interrupts
      disabled, otherwise the SWAPGS sequence can race against interrupts and
      cause recursing page faults and later panics.
      
      The problem will only happen on CPUs with split lock disable
      functionality, so Icelake Server, Tiger Lake, Snow Ridge, Jacobsville.
      
      Fixes: ca4c6a98 ("x86/traps: Make interrupt enable/disable symmetric in C code")
      Fixes: bce9b042
      
       ("x86/traps: Disable interrupts in exc_aligment_check()") # v5.8+
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e14fd4ba
    • Andrey Konovalov's avatar
      kasan: update documentation · 625d8673
      Andrey Konovalov authored
      
      
      This change updates KASAN documentation to reflect the addition of boot
      parameters and also reworks and clarifies some of the existing sections,
      in particular: defines what a memory granule is, mentions quarantine,
      makes Kunit section more readable.
      
      Link: https://lkml.kernel.org/r/748daf013e17d925b0fe00c1c3b5dce726dd2430.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ib1f83e91be273264b25f42b04448ac96b858849f
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      625d8673
    • Andrey Konovalov's avatar
      kasan, mm: allow cache merging with no metadata · e86f8b09
      Andrey Konovalov authored
      
      
      The reason cache merging is disabled with KASAN is because KASAN puts its
      metadata right after the allocated object. When the merged caches have
      slightly different sizes, the metadata ends up in different places, which
      KASAN doesn't support.
      
      It might be possible to adjust the metadata allocation algorithm and make
      it friendly to the cache merging code. Instead this change takes a simpler
      approach and allows merging caches when no metadata is present. Which is
      the case for hardware tag-based KASAN with kasan.mode=prod.
      
      Link: https://lkml.kernel.org/r/37497e940bfd4b32c0a93a702a9ae4cf061d5392.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ia114847dfb2244f297d2cb82d592bf6a07455dba
      Co-developed-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Signed-off-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e86f8b09
    • Andrey Konovalov's avatar
      kasan: sanitize objects when metadata doesn't fit · 97593cad
      Andrey Konovalov authored
      
      
      KASAN marks caches that are sanitized with the SLAB_KASAN cache flag.
      Currently if the metadata that is appended after the object (stores e.g.
      stack trace ids) doesn't fit into KMALLOC_MAX_SIZE (can only happen with
      SLAB, see the comment in the patch), KASAN turns off sanitization
      completely.
      
      With this change sanitization of the object data is always enabled.
      However the metadata is only stored when it fits.  Instead of checking for
      SLAB_KASAN flag accross the code to find out whether the metadata is
      there, use cache->kasan_info.alloc/free_meta_offset.  As 0 can be a valid
      value for free_meta_offset, introduce KASAN_NO_FREE_META as an indicator
      that the free metadata is missing.
      
      Without this change all sanitized KASAN objects would be put into
      quarantine with generic KASAN.  With this change, only the objects that
      have metadata (i.e.  when it fits) are put into quarantine, the rest is
      freed right away.
      
      Along the way rework __kasan_cache_create() and add claryfying comments.
      
      Link: https://lkml.kernel.org/r/aee34b87a5e4afe586c2ac6a0b32db8dc4dcc2dc.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Icd947e2bea054cb5cfbdc6cf6652227d97032dcb
      Co-developed-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Signed-off-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      97593cad
    • Andrey Konovalov's avatar
      kasan: clarify comment in __kasan_kfree_large · 3933c175
      Andrey Konovalov authored
      
      
      Currently it says that the memory gets poisoned by page_alloc code.
      Clarify this by mentioning the specific callback that poisons the memory.
      
      Link: https://lkml.kernel.org/r/1c8380fe0332a3bcc720fe29f1e0bef2e2974416.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I1334dffb69b87d7986fab88a1a039cc3ea764725
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3933c175
    • Andrey Konovalov's avatar
      kasan: simplify assign_tag and set_tag calls · 1ef3133b
      Andrey Konovalov authored
      
      
      set_tag() already ignores the tag for the generic mode, so just call it
      as is. Add a check for the generic mode to assign_tag(), and simplify its
      call in ____kasan_kmalloc().
      
      Link: https://lkml.kernel.org/r/121eeab245f98555862b289d2ba9269c868fbbcf.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I18905ca78fb4a3d60e1a34a4ca00247272480438
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1ef3133b
    • Andrey Konovalov's avatar
      kasan: don't round_up too much · d99f6a10
      Andrey Konovalov authored
      
      
      For hardware tag-based mode kasan_poison_memory() already rounds up the
      size. Do the same for software modes and remove round_up() from the common
      code.
      
      Link: https://lkml.kernel.org/r/47b232474f1f89dc072aeda0fa58daa6efade377.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ib397128fac6eba874008662b4964d65352db4aa4
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d99f6a10
    • Andrey Konovalov's avatar
      kasan, mm: rename kasan_poison_kfree · eeb3160c
      Andrey Konovalov authored
      
      
      Rename kasan_poison_kfree() to kasan_slab_free_mempool() as it better
      reflects what this annotation does. Also add a comment that explains the
      PageSlab() check.
      
      No functional changes.
      
      Link: https://lkml.kernel.org/r/141675fb493555e984c5dca555e9d9f768c7bbaa.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I5026f87364e556b506ef1baee725144bb04b8810
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eeb3160c
    • Andrey Konovalov's avatar
      kasan, mm: check kasan_enabled in annotations · 34303244
      Andrey Konovalov authored
      
      
      Declare the kasan_enabled static key in include/linux/kasan.h and in
      include/linux/mm.h and check it in all kasan annotations. This allows to
      avoid any slowdown caused by function calls when kasan_enabled is
      disabled.
      
      Link: https://lkml.kernel.org/r/9f90e3c0aa840dbb4833367c2335193299f69023.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I2589451d3c96c97abbcbf714baabe6161c6f153e
      Co-developed-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Signed-off-by: default avatarVincenzo Frascino <Vincenzo.Frascino@arm.com>
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      34303244
    • Andrey Konovalov's avatar
      kasan: add and integrate kasan boot parameters · 8028caac
      Andrey Konovalov authored
      
      
      Hardware tag-based KASAN mode is intended to eventually be used in
      production as a security mitigation. Therefore there's a need for finer
      control over KASAN features and for an existence of a kill switch.
      
      This change adds a few boot parameters for hardware tag-based KASAN that
      allow to disable or otherwise control particular KASAN features.
      
      The features that can be controlled are:
      
      1. Whether KASAN is enabled at all.
      2. Whether KASAN collects and saves alloc/free stacks.
      3. Whether KASAN panics on a detected bug or not.
      
      With this change a new boot parameter kasan.mode allows to choose one of
      three main modes:
      
      - kasan.mode=off - KASAN is disabled, no tag checks are performed
      - kasan.mode=prod - only essential production features are enabled
      - kasan.mode=full - all KASAN features are enabled
      
      The chosen mode provides default control values for the features mentioned
      above. However it's also possible to override the default values by
      providing:
      
      - kasan.stacktrace=off/on - enable alloc/free stack collection
                                  (default: on for mode=full, otherwise off)
      - kasan.fault=report/panic - only report tag fault or also panic
                                   (default: report)
      
      If kasan.mode parameter is not provided, it defaults to full when
      CONFIG_DEBUG_KERNEL is enabled, and to prod otherwise.
      
      It is essential that switching between these modes doesn't require
      rebuilding the kernel with different configs, as this is required by
      the Android GKI (Generic Kernel Image) initiative [1].
      
      [1] https://source.android.com/devices/architecture/kernel/generic-kernel-image
      
      [andreyknvl@google.com: don't use read-only static keys]
        Link: https://lkml.kernel.org/r/f2ded589eba1597f7360a972226083de9afd86e2.1607537948.git.andreyknvl@google.com
      
      Link: https://lkml.kernel.org/r/cb093613879d8d8841173f090133eddeb4c35f1f.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8028caac
    • Andrey Konovalov's avatar
      kasan: inline (un)poison_range and check_invalid_free · 57345fa6
      Andrey Konovalov authored
      
      
      Using (un)poison_range() or check_invalid_free() currently results in
      function calls. Move their definitions to mm/kasan/kasan.h and turn them
      into static inline functions for hardware tag-based mode to avoid
      unneeded function calls.
      
      Link: https://lkml.kernel.org/r/7007955b69eb31b5376a7dc1e0f4ac49138504f2.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ia9d8191024a12d1374675b3d27197f10193f50bb
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      57345fa6
    • Andrey Konovalov's avatar
      kasan: open-code kasan_unpoison_slab · bffe6907
      Andrey Konovalov authored
      
      
      There's the external annotation kasan_unpoison_slab() that is currently
      defined as static inline and uses kasan_unpoison_range(). Open-code this
      function in mempool.c. Otherwise with an upcoming change this function
      will result in an unnecessary function call.
      
      Link: https://lkml.kernel.org/r/131a6694a978a9a8b150187e539eecc8bcbf759b.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ia7c8b659f79209935cbaab3913bf7f082cc43a0e
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bffe6907
    • Andrey Konovalov's avatar
      kasan: inline random_tag for HW_TAGS · d8dd3971
      Andrey Konovalov authored
      
      
      Using random_tag() currently results in a function call. Move its
      definition to mm/kasan/kasan.h and turn it into a static inline function
      for hardware tag-based mode to avoid uneeded function calls.
      
      Link: https://lkml.kernel.org/r/be438471690e351e1d792e6bb432e8c03ccb15d3.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Iac5b2faf9a912900e16cca6834d621f5d4abf427
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8dd3971
    • Andrey Konovalov's avatar
      kasan: inline kasan_reset_tag for tag-based modes · c0054c56
      Andrey Konovalov authored
      
      
      Using kasan_reset_tag() currently results in a function call. As it's
      called quite often from the allocator code, this leads to a noticeable
      slowdown. Move it to include/linux/kasan.h and turn it into a static
      inline function. Also remove the now unneeded reset_tag() internal KASAN
      macro and use kasan_reset_tag() instead.
      
      Link: https://lkml.kernel.org/r/6940383a3a9dfb416134d338d8fac97a9ebb8686.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I4d2061acfe91d480a75df00b07c22d8494ef14b5
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c0054c56
    • Andrey Konovalov's avatar
      kasan: remove __kasan_unpoison_stack · 77f57c98
      Andrey Konovalov authored
      
      
      There's no need for __kasan_unpoison_stack() helper, as it's only
      currently used in a single place. Removing it also removes unneeded
      arithmetic.
      
      No functional changes.
      
      Link: https://lkml.kernel.org/r/93e78948704a42ea92f6248ff8a725613d721161.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ie5ba549d445292fe629b4a96735e4034957bcc50
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      77f57c98
    • Andrey Konovalov's avatar
      kasan: allow VMAP_STACK for HW_TAGS mode · 38dd767d
      Andrey Konovalov authored
      
      
      Even though hardware tag-based mode currently doesn't support checking
      vmalloc allocations, it doesn't use shadow memory and works with
      VMAP_STACK as is. Change VMAP_STACK definition accordingly.
      
      Link: https://lkml.kernel.org/r/ecdb2a1658ebd88eb276dee2493518ac0e82de41.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I3552cbc12321dec82cd7372676e9372a2eb452ac
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: Andrew Morton...
      38dd767d
    • Andrey Konovalov's avatar
      kasan, arm64: unpoison stack only with CONFIG_KASAN_STACK · d56a9ef8
      Andrey Konovalov authored
      
      
      There's a config option CONFIG_KASAN_STACK that has to be enabled for
      KASAN to use stack instrumentation and perform validity checks for
      stack variables.
      
      There's no need to unpoison stack when CONFIG_KASAN_STACK is not enabled.
      Only call kasan_unpoison_task_stack[_below]() when CONFIG_KASAN_STACK is
      enabled.
      
      Note, that CONFIG_KASAN_STACK is an option that is currently always
      defined when CONFIG_KASAN is enabled, and therefore has to be tested
      with #if instead of #ifdef.
      
      Link: https://lkml.kernel.org/r/d09dd3f8abb388da397fd11598c5edeaa83fe559.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/If8a891e9fe01ea543e00b576852685afec0887e3
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d56a9ef8
    • Andrey Konovalov's avatar
      kasan: introduce set_alloc_info · 8bb0009b
      Andrey Konovalov authored
      
      
      Add set_alloc_info() helper and move kasan_set_track() into it. This will
      simplify the code for one of the upcoming changes.
      
      No functional changes.
      
      Link: https://lkml.kernel.org/r/b2393e8f1e311a70fc3aaa2196461b6acdee7d21.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/I0316193cbb4ecc9b87b7c2eee0dd79f8ec908c1a
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8bb0009b
    • Andrey Konovalov's avatar
      kasan: rename get_alloc/free_info · 6476792f
      Andrey Konovalov authored
      
      
      Rename get_alloc_info() and get_free_info() to kasan_get_alloc_meta() and
      kasan_get_free_meta() to better reflect what those do and avoid confusion
      with kasan_set_free_info().
      
      No functional changes.
      
      Link: https://lkml.kernel.org/r/27b7c036b754af15a2839e945f6d8bfce32b4c2f.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Ib6e4ba61c8b12112b403d3479a9799ac8fff8de1
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6476792f
    • Andrey Konovalov's avatar
      kasan: simplify quarantine_put call site · c696de9f
      Andrey Konovalov authored
      
      
      Patch series "kasan: boot parameters for hardware tag-based mode", v4.
      
      === Overview
      
      Hardware tag-based KASAN mode [1] is intended to eventually be used in
      production as a security mitigation. Therefore there's a need for finer
      control over KASAN features and for an existence of a kill switch.
      
      This patchset adds a few boot parameters for hardware tag-based KASAN that
      allow to disable or otherwise control particular KASAN features, as well
      as provides some initial optimizations for running KASAN in production.
      
      There's another planned patchset what will further optimize hardware
      tag-based KASAN, provide proper benchmarking and tests, and will fully
      enable tag-based KASAN for production use.
      
      Hardware tag-based KASAN relies on arm64 Memory Tagging Extension (MTE)
      [2] to perform memory and pointer tagging. Please see [3] and [4] for
      detailed analysis of how MTE helps to fight memory safety problems.
      
      The features that can be controlled are:
      
      1. Whether KASAN is enabled at all.
      2. Whether KASAN collects and saves alloc/free stacks.
      3. Whether KASAN panics on a detected bug or not.
      
      The patch titled "kasan: add and integrate kasan boot parameters" of this
      series adds a few new boot parameters.
      
      kasan.mode allows to choose one of three main modes:
      
      - kasan.mode=off - KASAN is disabled, no tag checks are performed
      - kasan.mode=prod - only essential production features are enabled
      - kasan.mode=full - all KASAN features are enabled
      
      The chosen mode provides default control values for the features mentioned
      above. However it's also possible to override the default values by
      providing:
      
      - kasan.stacktrace=off/on - enable stacks collection
                                  (default: on for mode=full, otherwise off)
      - kasan.fault=report/panic - only report tag fault or also panic
                                   (default: report)
      
      If kasan.mode parameter is not provided, it defaults to full when
      CONFIG_DEBUG_KERNEL is enabled, and to prod otherwise.
      
      It is essential that switching between these modes doesn't require
      rebuilding the kernel with different configs, as this is required by
      the Android GKI (Generic Kernel Image) initiative.
      
      === Benchmarks
      
      For now I've only performed a few simple benchmarks such as measuring
      kernel boot time and slab memory usage after boot. There's an upcoming
      patchset which will optimize KASAN further and include more detailed
      benchmarking results.
      
      The benchmarks were performed in QEMU and the results below exclude the
      slowdown caused by QEMU memory tagging emulation (as it's different from
      the slowdown that will be introduced by hardware and is therefore
      irrelevant).
      
      KASAN_HW_TAGS=y + kasan.mode=off introduces no performance or memory
      impact compared to KASAN_HW_TAGS=n.
      
      kasan.mode=prod (manually excluding tagging) introduces 3% of performance
      and no memory impact (except memory used by hardware to store tags)
      compared to kasan.mode=off.
      
      kasan.mode=full has about 40% performance and 30% memory impact over
      kasan.mode=prod. Both come from alloc/free stack collection.
      
      === Notes
      
      This patchset is available here:
      
      https://github.com/xairy/linux/tree/up-boot-mte-v4
      
      This patchset is based on v11 of "kasan: add hardware tag-based mode for
      arm64" patchset [1].
      
      For testing in QEMU hardware tag-based KASAN requires:
      
      1. QEMU built from master [6] (use "-machine virt,mte=on -cpu max" arguments
         to run).
      2. GCC version 10.
      
      [1] https://lore.kernel.org/linux-arm-kernel/cover.1606161801.git.andreyknvl@google.com/T/#t
      [2] https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/enhancing-memory-safety
      [3] https://arxiv.org/pdf/1802.09517.pdf
      [4] https://github.com/microsoft/MSRC-Security-Research/blob/master/papers/2020/Security%20analysis%20of%20memory%20tagging.pdf
      [5] https://source.android.com/devices/architecture/kernel/generic-kernel-image
      [6] https://github.com/qemu/qemu
      
      === Tags
      
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      
      This patch (of 19):
      
      Move get_free_info() call into quarantine_put() to simplify the call site.
      
      No functional changes.
      
      Link: https://lkml.kernel.org/r/cover.1606162397.git.andreyknvl@google.com
      Link: https://lkml.kernel.org/r/312d0a3ef92cc6dc4fa5452cbc1714f9393ca239.1606162397.git.andreyknvl@google.com
      Link: https://linux-review.googlesource.com/id/Iab0f04e7ebf8d83247024b7190c67c3c34c7940f
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c696de9f
    • Vincenzo Frascino's avatar
      kselftest/arm64: check GCR_EL1 after context switch · 29f08088
      Vincenzo Frascino authored
      
      
      This test is specific to MTE and verifies that the GCR_EL1 register is
      context switched correctly.
      
      It spawns 1024 processes and each process spawns 5 threads.  Each thread
      writes a random setting of GCR_EL1 through the prctl() system call and
      reads it back verifying that it is the same.  If the values are not the
      same it reports a failure.
      
      Note: The test has been extended to verify that even SYNC and ASYNC mode
      setting is preserved correctly over context switching.
      
      Link: https://lkml.kernel.org/r/b51a165426e906e7ec8a68d806ef3f8cd92581a6.1606161801.git.andreyknvl@google.com
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Tested-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Branislav Rankov <Branislav.Rankov@arm.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Evgenii Stepanov <eugenis@google.com>
      Cc: Kevin Brodsky <kevin.brodsky@arm.com>
      Cc: Marco Elver <elver@google.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      29f08088