system: activate-ptrace-attach: Handle kernels without YAMA support.

* gnu/build/activation.scm (activate-ptrace-attach): Check for the existence
  of /proc/sys/kernel/yama/ptrace_scope before trying to write to it.
This commit is contained in:
Mark H Weaver 2015-05-09 12:57:36 -04:00
parent 57e95b261b
commit 15f0de0581

View file

@ -369,9 +369,11 @@ (define (activate-ptrace-attach)
processes--see Yama.txt in the Linux source tree for the rationale. This processes--see Yama.txt in the Linux source tree for the rationale. This
sounds like an unacceptable restriction for little or no security sounds like an unacceptable restriction for little or no security
improvement." improvement."
(call-with-output-file "/proc/sys/kernel/yama/ptrace_scope" (let ((file "/proc/sys/kernel/yama/ptrace_scope"))
(lambda (port) (when (file-exists? file)
(display 0 port)))) (call-with-output-file file
(lambda (port)
(display 0 port))))))
(define %current-system (define %current-system