Android s preview 2 release 0.3
FROMLIST: mm/madvise: replace ptrace attach requirement for process_madvise

process_madvise currently requires ptrace attach capability.
PTRACE_MODE_ATTACH gives one process complete control over another
process. It effectively removes the security boundary between the
two processes (in one direction). Granting ptrace attach capability
even to a system process is considered dangerous since it creates an
attack surface. This severely limits the usage of this API.
The operations process_madvise can perform do not affect the correctness
of the operation of the target process; they only affect where the data
is physically located (and therefore, how fast it can be accessed).
What we want is the ability for one process to influence another process
in order to optimize performance across the entire system while leaving
the security boundary intact.
Replace PTRACE_MODE_ATTACH with a combination of PTRACE_MODE_READ
and CAP_SYS_NICE. PTRACE_MODE_READ to prevent leaking ASLR metadata
and CAP_SYS_NICE for influencing process performance.

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Link: https://lore.kernel.org/lkml/202101111033.2D03EA97@keescook/T/#u

Test: built and flashed kernel
Bug: 153444106
Signed-off-by: Edgar Arriaga Garcia <edgararriaga@google.com>
Change-Id: I3624a8b0697d70f23587c1dcb746ba753c301f45
1 file changed
tree: 971757f2fe3c35eea754baf518b74281000d3f4e
  1. arch/
  2. block/
  3. certs/
  4. crypto/
  5. Documentation/
  6. drivers/
  7. firmware/
  8. fs/
  9. include/
  10. init/
  11. ipc/
  12. kernel/
  13. lib/
  14. mm/
  15. net/
  16. samples/
  17. scripts/
  18. security/
  19. sound/
  20. techpack/
  21. test/
  22. tools/
  23. usr/
  24. virt/
  25. .clang-format
  26. .cocciconfig
  27. .get_maintainer.ignore
  28. .gitattributes
  29. .gitignore
  30. .mailmap
  31. Androidbp
  32. AndroidKernel.mk
  33. build.config
  34. build.config.aarch64
  35. build.config.boundsan
  36. build.config.common
  37. build.config.common.clang
  38. build.config.cuttlefish.aarch64
  39. build.config.cuttlefish.x86_64
  40. build.config.debug_api
  41. build.config.debug_hang
  42. build.config.debug_locking
  43. build.config.debug_memory
  44. build.config.floral
  45. build.config.floral.common
  46. build.config.floral.common.clang
  47. build.config.floral_debug_api
  48. build.config.floral_debug_hang
  49. build.config.floral_debug_locking
  50. build.config.floral_debug_memory
  51. build.config.floral_debug_memory_accounting
  52. build.config.floral_kasan
  53. build.config.floral_khwasan
  54. build.config.floral_no-cfi
  55. build.config.floral_performance
  56. build.config.gcc
  57. build.config.goldfish.arm
  58. build.config.goldfish.arm64
  59. build.config.goldfish.mips
  60. build.config.goldfish.mips64
  61. build.config.goldfish.x86
  62. build.config.goldfish.x86_64
  63. build.config.kasan
  64. build.config.khwasan
  65. build.config.no-cfi
  66. build.config.performance
  67. build.config.sunfish
  68. build.config.sunfish.common
  69. build.config.sunfish.common.clang
  70. build.config.sunfish_debug_api
  71. build.config.sunfish_debug_hang
  72. build.config.sunfish_debug_locking
  73. build.config.sunfish_debug_memory
  74. build.config.sunfish_debug_memory_accounting
  75. build.config.sunfish_kasan
  76. build.config.sunfish_khwasan
  77. build.config.sunfish_no-cfi
  78. build.config.sunfish_performance
  79. build_floral.sh
  80. build_sunfish.sh
  81. COPYING
  82. CREDITS
  83. gen_headers_arm.bp
  84. gen_headers_arm64.bp
  85. Kbuild
  86. Kconfig
  87. kernel_headers.py
  88. MAINTAINERS
  89. Makefile
  90. OWNERS
  91. PREUPLOAD.cfg
  92. README
  93. verity_dev_keys.x509