Skip to contentSkip to conversation

security/Kconfig: further restrict HARDENED_USERCOPY

PATCH In review Tycho Andersen 2 participants 2 messages Mar 9, 2017 Security (LSM)

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 security/Kconfig: further restrict HARDENED_USERCOPY

It doesn't make sense to have HARDENED_USERCOPY when either /dev/kmem is enabled or /dev/mem can be used to read kernel memory (i.e. !STRICT_DEVMEM).

v2: add !MMU depend as well
v3: drop !MMU, s/ARCH_HAS_DEVMEM_IS_ALLOWED/DEVMEM, which makes the above
commit message actually match the logic again

CC Kees Cook <[email protected]>
CC "Serge E. Hallyn" <[email protected]>
CC James Morris <[email protected]>
---
 security/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
security/Kconfig +2 -0
index 3ff1bf9..4619cee 100644
@@ -142,6 +142,8 @@ config HARDENED_USERCOPY
 	bool "Harden memory copies between kernel and userspace"
 	depends on HAVE_ARCH_HARDENED_USERCOPY
 	depends on HAVE_HARDENED_USERCOPY_ALLOCATOR
+	depends on !DEVKMEM
+	depends on !DEVMEM || STRICT_DEVMEM
 	select BUG
 	help
 	  This option checks for obviously wrong memory regions when
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 4 lines · Tycho Andersen

It doesn't make sense to have HARDENED_USERCOPY when either /dev/kmem is enabled or /dev/mem can be used to read kernel memory (i.e. !STRICT_DEVMEM).

Quoted 8 lines

v2: add !MMU depend as well
v3: drop !MMU, s/ARCH_HAS_DEVMEM_IS_ALLOWED/DEVMEM, which makes the above
commit message actually match the logic again

CC Kees Cook <[email protected]>
CC "Serge E. Hallyn" <[email protected]>
CC James Morris <[email protected]>

Awesome, thanks! I'll add this to the usercopy tree.

-Kees

Quoted 20 lines
---
 security/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
security/Kconfig +2 -1
index 3ff1bf9..4619cee 100644
@@ -142,6 +142,8 @@ config HARDENED_USERCOPY
        bool "Harden memory copies between kernel and userspace"
        depends on HAVE_ARCH_HARDENED_USERCOPY
        depends on HAVE_HARDENED_USERCOPY_ALLOCATOR
+       depends on !DEVKMEM
+       depends on !DEVMEM || STRICT_DEVMEM
        select BUG
        help
          This option checks for obviously wrong memory regions when
--

2.7.4

Signature · 6 lines
Kees Cook
Pixel Security
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html