History

lockdown: Lock down tracing and perf kprobes when in confidentiality mode

Disallow the creation of perf and ftrace kprobes when the kernel is locked down in confidentiality mode by preventing their registration. This prevents kprobes from being used to access kernel memory to steal crypto data, but continues to allow the use of kprobes from signed modules.

David Howells committed 7 years ago

Commit a94549d1 parent 02e935b3 files · +7 −0Browse files

Unified · Split

3 files
  1. include/linux/security.h +1 −0
  2. kernel/trace/trace_kprobe.c +5 −0
  3. security/lockdown/lockdown.c +1 −0
include/linux/security.h+1−0
@@ -117,6 +117,7 @@ enum lockdown_reason { · 116 unmodified lines
117117 LOCKDOWN_MMIOTRACE,
118118 LOCKDOWN_INTEGRITY_MAX,
119119 LOCKDOWN_KCORE,
120+ LOCKDOWN_KPROBES,
120121 LOCKDOWN_CONFIDENTIALITY_MAX,
121122 };
122123
kernel/trace/trace_kprobe.c+5−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/uaccess.h>
1212 #include <linux/rculist.h>
1313 #include <linux/error-injection.h>
14+#include <linux/security.h>
1415
1516 #include "trace_dynevent.h"
1617 #include "trace_kprobe_selftest.h"
@@ -415,6 +416,10 @@ static int __register_trace_kprobe(struct trace_kprobe *tk) · 398 unmodified lines
415416 {
416417 int i, ret;
417418
419+ ret = security_locked_down(LOCKDOWN_KPROBES);
420+ if (ret)
421+ return ret;
422+
418423 if (trace_probe_is_registered(&tk->tp))
419424 return -EINVAL;
420425
security/lockdown/lockdown.c+1−0
@@ -32,6 +32,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = { · 31 unmodified lines
3232 [LOCKDOWN_MMIOTRACE] = "unsafe mmio",
3333 [LOCKDOWN_INTEGRITY_MAX] = "integrity",
3434 [LOCKDOWN_KCORE] = "/proc/kcore access",
35+ [LOCKDOWN_KPROBES] = "use of kprobes",
3536 [LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality",
3637 };
3738

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t