Merge tag 'hardening-v5.18-rc1-fix1' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 31 Mar 2022 18:43:01 +0000 (11:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 31 Mar 2022 18:43:01 +0000 (11:43 -0700)
Pull hardening updates from Kees Cook:
 "This addresses an -Warray-bounds warning found under a few ARM
  defconfigs, and disables long-broken HARDENED_USERCOPY_PAGESPAN"

* tag 'hardening-v5.18-rc1-fix1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  ARM/dma-mapping: Remove CMA code when not built with CMA
  usercopy: Disable CONFIG_HARDENED_USERCOPY_PAGESPAN

arch/arm/mm/dma-mapping.c
arch/arm/mm/mm.h
include/linux/cma.h
security/Kconfig

index 4b61541853ea1c7ea6d996bf0332d7eb4f69ba2f..82ffac621854f863f8cb4b9b4f17621ffc83eb7a 100644 (file)
@@ -381,6 +381,7 @@ out:
  */
 postcore_initcall(atomic_pool_init);
 
+#ifdef CONFIG_CMA_AREAS
 struct dma_contig_early_reserve {
        phys_addr_t base;
        unsigned long size;
@@ -435,6 +436,7 @@ void __init dma_contiguous_remap(void)
                iotable_init(&map, 1);
        }
 }
+#endif
 
 static int __dma_update_pte(pte_t *pte, unsigned long addr, void *data)
 {
index 9ff683612f2a8cfc3e59f198e2b806415878bf63..d7ffccb7fea7d6f759104b62f9ab40a8d53cdeeb 100644 (file)
@@ -88,6 +88,10 @@ extern phys_addr_t arm_lowmem_limit;
 
 void __init bootmem_init(void);
 void arm_mm_memblock_reserve(void);
+#ifdef CONFIG_CMA_AREAS
 void dma_contiguous_remap(void);
+#else
+static inline void dma_contiguous_remap(void) { }
+#endif
 
 unsigned long __clear_cr(unsigned long mask);
index 90fd742fd1ef5436f100bea5d3bcbdafafcacf33..a6f637342740b921412eb183b4416fa72f128a9f 100644 (file)
  */
 #ifdef CONFIG_CMA_AREAS
 #define MAX_CMA_AREAS  (1 + CONFIG_CMA_AREAS)
-
-#else
-#define MAX_CMA_AREAS  (0)
-
 #endif
 
 #define CMA_MAX_NAME 64
index 1d2d71cc1f36ce4af728f7bbefc3deb9cb63399a..9b2c4925585a3a761019cd8b5358ecf09279a29c 100644 (file)
@@ -166,7 +166,7 @@ config HARDENED_USERCOPY
 config HARDENED_USERCOPY_PAGESPAN
        bool "Refuse to copy allocations that span multiple pages"
        depends on HARDENED_USERCOPY
-       depends on EXPERT
+       depends on BROKEN
        help
          When a multi-page allocation is done without __GFP_COMP,
          hardened usercopy will reject attempts to copy it. There are,