mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
proc: add config & param to block forcing mem writes
[ Upstream commit 41e8149c8892ed1962bd15350b3c3e6e90cba7f4 ] This adds a Kconfig option and boot param to allow removing the FOLL_FORCE flag from /proc/pid/mem write calls because it can be abused. The traditional forcing behavior is kept as default because it can break GDB and some other use cases. Previously we tried a more sophisticated approach allowing distributions to fine-tune /proc/pid/mem behavior, however that got NAK-ed by Linus [1], who prefers this simpler approach with semantics also easier to understand for users. Link: https://lore.kernel.org/lkml/CAHk-=wiGWLChxYmUA5HrT5aopZrB7_2VTa0NLZcxORgkUe5tEQ@mail.gmail.com/ [1] Cc: Doug Anderson <[email protected]> Cc: Jeff Xu <[email protected]> Cc: Jann Horn <[email protected]> Cc: Kees Cook <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Christian Brauner <[email protected]> Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Adrian Ratiu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
f3b2acb1b6
commit
299b917594
3 changed files with 102 additions and 1 deletions
|
|
@ -19,6 +19,38 @@ config SECURITY_DMESG_RESTRICT
|
|||
|
||||
If you are unsure how to answer this question, answer N.
|
||||
|
||||
choice
|
||||
prompt "Allow /proc/pid/mem access override"
|
||||
default PROC_MEM_ALWAYS_FORCE
|
||||
help
|
||||
Traditionally /proc/pid/mem allows users to override memory
|
||||
permissions for users like ptrace, assuming they have ptrace
|
||||
capability.
|
||||
|
||||
This allows people to limit that - either never override, or
|
||||
require actual active ptrace attachment.
|
||||
|
||||
Defaults to the traditional behavior (for now)
|
||||
|
||||
config PROC_MEM_ALWAYS_FORCE
|
||||
bool "Traditional /proc/pid/mem behavior"
|
||||
help
|
||||
This allows /proc/pid/mem accesses to override memory mapping
|
||||
permissions if you have ptrace access rights.
|
||||
|
||||
config PROC_MEM_FORCE_PTRACE
|
||||
bool "Require active ptrace() use for access override"
|
||||
help
|
||||
This allows /proc/pid/mem accesses to override memory mapping
|
||||
permissions for active ptracers like gdb.
|
||||
|
||||
config PROC_MEM_NO_FORCE
|
||||
bool "Never"
|
||||
help
|
||||
Never override memory mapping permissions
|
||||
|
||||
endchoice
|
||||
|
||||
config SECURITY
|
||||
bool "Enable different security models"
|
||||
depends on SYSFS
|
||||
|
|
|
|||
Loading…
Reference in a new issue