1. Sep 23, 2022
    • Mark Rutland's avatar
      arm64: uaccess: simplify uaccess_mask_ptr() · 2305b809
      Mark Rutland authored
      We introduced uaccess pointer masking for arm64 in commit:
      
        4d8efc2d ("arm64: Use pointer masking to limit uaccess speculation")
      
      Which was intended to prevent speculative uaccesses to kernel memory on
      CPUs where access permissions were not respected under speculation.
      
      At the time, the uaccess primitives were occasionally used to access
      kernel memory, with the maximum permitted address held in
      thread_info::addr_limit. Consequently, the address masking needed to
      take this dynamic limit into account.
      
      Subsequently the uaccess primitives were reworked such that they are
      only used for user memory, and as of commit:
      
        3d2403fd
      
       ("arm64: uaccess: remove set_fs()")
      
      ... the address limit was made a compile-time constant, but the logic
      was otherwise unchanged.
      
      Regardless of the configured VA size or whether TBI is in use, the
      address space can be divided into three ranges:
      
      * The TTBR0 VA range, for which any valid pointer has bit 55 *clear*,
        and any non-tag bits [63-56] must match bit 55 (i.e. must be clear).
      
      * The TTBR1 VA range, for which any valid pointer has bit 55 *set*, and
        any non-tag bits [63-56] must match bit 55 (i.e. must be set).
      
      * The gap between the TTBR0 and TTBR1 ranges, where bit 55 may be set or
        clear, but any access will result in a fault.
      
      As the uaccess primitives are now only used for user memory in the TTBR0
      VA range, we can prevent generation of TTBR1 addresses by clearing bit
      55, which will either result in a TTBR0 address or a faulting address
      between the TTBR VA ranges.
      
      This is beneficial for code generation as:
      
      * We no longer clobber the condition codes.
      
      * We no longer burn a register on (TASK_SIZE_MAX - 1).
      
      * We no longer need to consume the untagged pointer.
      
      When building a defconfig v6.0-rc3 with GCC 12.1.0, this change makes
      the resulting Image 64KiB smaller.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Link: https://lore.kernel.org/r/20220922151053.3520750-1-mark.rutland@arm.com
      
      
      [catalin.marinas@arm.com: remove csdb() as the bit clearing is unconditional]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      2305b809
    • Peter Collingbourne's avatar
      arm64: mte: move register initialization to C · 973b9e37
      Peter Collingbourne authored
      
      
      If FEAT_MTE2 is disabled via the arm64.nomte command line argument on a
      CPU that claims to support FEAT_MTE2, the kernel will use Tagged Normal
      in the MAIR. If we interpret arm64.nomte to mean that the CPU does not
      in fact implement FEAT_MTE2, setting the system register like this may
      lead to UNSPECIFIED behavior. Fix it by arranging for MAIR to be set
      in the C function cpu_enable_mte which is called based on the sanitized
      version of the system register.
      
      There is no need for the rest of the MTE-related system register
      initialization to happen from assembly, with the exception of TCR_EL1,
      which must be set to include at least TBI1 because the secondary CPUs
      access KASan-allocated data structures early. Therefore, make the TCR_EL1
      initialization unconditional and move the rest of the initialization to
      cpu_enable_mte so that we no longer have a dependency on the unsanitized
      ID register value.
      
      Co-developed-by: default avatarEvgenii Stepanov <eugenis@google.com>
      Signed-off-by: default avatarPeter Collingbourne <pcc@google.com>
      Signed-off-by: default avatarEvgenii Stepanov <eugenis@google.com>
      Suggested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 3b714d24 ("arm64: mte: CPU feature detection and initial sysreg configuration")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Link: https://lore.kernel.org/r/20220915222053.3484231-1-eugenis@google.com
      
      
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      973b9e37
  2. Sep 22, 2022
  3. Sep 16, 2022
  4. Sep 10, 2022
  5. Sep 06, 2022
    • Ard Biesheuvel's avatar
      arm64: compat: Implement misalignment fixups for multiword loads · 3fc24ef3
      Ard Biesheuvel authored
      
      
      The 32-bit ARM kernel implements fixups on behalf of user space when
      using LDM/STM or LDRD/STRD instructions on addresses that are not 32-bit
      aligned. This is not something that is supported by the architecture,
      but was done anyway to increase compatibility with user space software,
      which mostly targeted x86 at the time and did not care about aligned
      accesses.
      
      This feature is one of the remaining impediments to being able to switch
      to 64-bit kernels on 64-bit capable hardware running 32-bit user space,
      so let's implement it for the arm64 compat layer as well.
      
      Note that the intent is to implement the exact same handling of
      misaligned multi-word loads and stores as the 32-bit kernel does,
      including what appears to be missing support for user space programs
      that rely on SETEND to switch to a different byte order and back. Also,
      like the 32-bit ARM version, we rely on the faulting address reported by
      the CPU to infer the memory address, instead of decoding the instruction
      fully to obtain this information.
      
      This implementation is taken from the 32-bit ARM tree, with all pieces
      removed that deal with instructions other than LDRD/STRD and LDM/STM, or
      that deal with alignment exceptions taken in kernel mode.
      
      Cc: debian-arm@lists.debian.org
      Cc: Vagrant Cascadian <vagrant@debian.org>
      Cc: Riku Voipio <riku.voipio@iki.fi>
      Cc: Steve McIntyre <steve@einval.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20220701135322.3025321-1-ardb@kernel.org
      
      
      [catalin.marinas@arm.com: change the option to 'default n']
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      3fc24ef3
  6. Aug 29, 2022
  7. Aug 28, 2022
    • Linus Torvalds's avatar
      Merge tag 'thermal-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 10d4879f
      Linus Torvalds authored
      Pull thermal control fixes from Rafael Wysocki:
       "Fix two issues introduced recently and one driver problem leading to a
        NULL pointer dereference in some cases.
      
        Specifics:
      
         - Add missing EXPORT_SYMBOL_GPL in the thermal core and add back the
           required 'trips' property to the thermal zone DT bindings (Daniel
           Lezcano)
      
         - Prevent the int340x_thermal driver from crashing when a package
           with a buffer of 0 length is returned by an ACPI control method
           evaluated by it (Lee, Chun-Yi)"
      
      * tag 'thermal-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        thermal/int340x_thermal: handle data_vault when the value is ZERO_SIZE_PTR
        dt-bindings: thermal: Fix missing required property
        thermal/core: Add missing EXPORT_SYMBOL_GPL
      10d4879f
    • Linus Torvalds's avatar
      Merge tag 'pm-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · b98f602d
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "Make __resolve_freq() check the presence of the frequency table
        instead of checking whether or not the ->target_index() callback is
        implemented by the driver, because that need not be the case when
        __resolve_freq() is used (Lukasz Luba)"
      
      * tag 'pm-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: check only freq_table in __resolve_freq()
      b98f602d
    • Linus Torvalds's avatar
      Merge tag 'acpi-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2b1ddb59
      Linus Torvalds authored
      Pull ACPI fixes from Rafael Wysocki:
       "These fix issues introduced by recent changes related to the handling
        of ACPI device properties and a coding mistake in the exit path of the
        ACPI processor driver.
      
        Specifics:
      
         - Prevent acpi_thermal_cpufreq_exit() from attempting to remove
           the same frequency QoS request multiple times (Riwen Lu)
      
         - Fix type detection for integer ACPI device properties (Stefan
           Binding)
      
         - Avoid emitting false-positive warnings when processing ACPI
           device properties and drop the useless default case from the
           acpi_copy_property_array_uint() macro (Sakari Ailus)"
      
      * tag 'acpi-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: property: Remove default association from integer maximum values
        ACPI: property: Ignore already existing data node tags
        ACPI: property: Fix type detection of unified integer reading functions
        ACPI: processor: Remove freq Qos request for all CPUs
      2b1ddb59
    • Linus Torvalds's avatar
      Merge tag 's390-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · dee18737
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - Fix double free of guarded storage and runtime instrumentation
         control blocks on fork() failure
      
       - Fix triggering write fault when VMA does not allow VM_WRITE
      
      * tag 's390-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/mm: do not trigger write fault when vma does not allow VM_WRITE
        s390: fix double free of GS and RI CBs on fork() failure
      dee18737
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.0-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 05519f24
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - two minor cleanups
      
       - a fix of the xen/privcmd driver avoiding a possible NULL dereference
         in an error case
      
      * tag 'for-linus-6.0-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/privcmd: fix error exit of privcmd_ioctl_dm_op()
        xen: move from strlcpy with unused retval to strscpy
        xen: x86: remove setting the obsolete config XEN_MAX_DOMAIN_MEMORY
      05519f24
    • Linus Torvalds's avatar
      Merge tag 'audit-pr-20220826' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit · 17b28d42
      Linus Torvalds authored
      Pull audit fix from Paul Moore:
       "Another small audit patch, this time to fix a bug where the return
        codes were not properly set before the audit filters were run,
        potentially resulting in missed audit records"
      
      * tag 'audit-pr-20220826' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit:
        audit: move audit_return_fixup before the filters
      17b28d42
    • Linus Torvalds's avatar
      Merge tag 'fbdev-for-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev · 89b749d8
      Linus Torvalds authored
      Pull fbdev fixes and updates from Helge Deller:
       "Mostly just small patches, with the exception of the bigger indenting
        cleanups in the sisfb and radeonfb drivers.
      
        Two patches should be mentioned though: A fix-up for fbdev if the
        screen resize fails (by Shigeru Yoshida), and a potential divide by
        zero fix in fb_pm2fb (by Letu Ren).
      
        Summary:
      
        Major fixes:
         - Revert the changes for fbcon console when vc_resize() fails
           [Shigeru Yoshida]
         - Avoid a potential divide by zero error in fb_pm2fb [Letu Ren]
      
        Minor fixes:
         - Add missing pci_disable_device() in chipsfb_pci_init() [Yang
           Yingliang]
         - Fix tests for platform_get_irq() failure in omapfb [Yu Zhe]
         - Destroy mutex on freeing struct fb_info in fbsysfs [Shigeru
           Yoshida]
      
        Cleanups:
         - Move fbdev drivers from strlcpy to strscpy [Wolfram Sang]
         - Indenting fixes, comment fixes, ... [Jiapeng Chong & Jilin Yuan]"
      
      * tag 'fbdev-for-6.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
        fbdev: fbcon: Properly revert changes when vc_resize() failed
        fbdev: Move fbdev drivers from strlcpy to strscpy
        fbdev: omap: Remove unnecessary print function dev_err()
        fbdev: chipsfb: Add missing pci_disable_device() in chipsfb_pci_init()
        fbdev: fbcon: Destroy mutex on freeing struct fb_info
        fbdev: radeon: Clean up some inconsistent indenting
        fbdev: sisfb: Clean up some inconsistent indenting
        fbdev: fb_pm2fb: Avoid potential divide by zero error
        fbdev: ssd1307fb: Fix repeated words in comments
        fbdev: omapfb: Fix tests for platform_get_irq() failure
      89b749d8