2010-07-07 11:12:45 +00:00
|
|
|
From: Andrea Arcangeli <andrea@cpushare.com>
|
|
|
|
Subject: [PATCH seccomp: make tsc disabling optional
|
|
|
|
Patch-mainline: unknown
|
|
|
|
References: 191123
|
|
|
|
|
|
|
|
Make the TSC disable purely paranoid feature optional, so by default seccomp
|
|
|
|
returns absolutely zerocost.
|
|
|
|
|
|
|
|
Ported from 2.6.19 to 2.6.24-rc7 by Jeff Mahoney.
|
|
|
|
Addition of x86-64 by Jan Beulich.
|
|
|
|
|
|
|
|
Signed-off-by: Andrea Arcangeli <andrea@cpushare.com>
|
|
|
|
Acked-by: Jeff Mahoney <jeffm@suse.com>
|
|
|
|
---
|
2011-04-19 20:09:59 +00:00
|
|
|
arch/x86/Kconfig | 11 +++++++++++
|
2010-07-07 11:12:45 +00:00
|
|
|
arch/x86/kernel/process.c | 2 ++
|
2011-04-19 20:09:59 +00:00
|
|
|
2 files changed, 13 insertions(+)
|
2010-07-07 11:12:45 +00:00
|
|
|
|
|
|
|
--- a/arch/x86/Kconfig
|
|
|
|
+++ b/arch/x86/Kconfig
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -1482,6 +1482,17 @@ config SECCOMP
|
2010-07-07 11:12:45 +00:00
|
|
|
|
|
|
|
If unsure, say Y. Only embedded should say N here.
|
|
|
|
|
|
|
|
+config SECCOMP_DISABLE_TSC
|
|
|
|
+ bool "Disable the TSC for seccomp tasks"
|
|
|
|
+ depends on SECCOMP
|
|
|
|
+ help
|
|
|
|
+ This feature mathematically prevents covert channels
|
|
|
|
+ for tasks running under SECCOMP. This can generate
|
|
|
|
+ a minuscule overhead in the scheduler.
|
|
|
|
+
|
|
|
|
+ If you care most about performance say N. Say Y only if you're
|
|
|
|
+ paranoid about covert channels.
|
|
|
|
+
|
|
|
|
config CC_STACKPROTECTOR
|
|
|
|
bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
|
|
|
|
---help---
|
|
|
|
--- a/arch/x86/kernel/process.c
|
|
|
|
+++ b/arch/x86/kernel/process.c
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -135,6 +135,7 @@ static void hard_disable_TSC(void)
|
2010-07-07 11:12:45 +00:00
|
|
|
|
|
|
|
void disable_TSC(void)
|
|
|
|
{
|
|
|
|
+#ifdef CONFIG_SECCOMP_DISABLE_TSC
|
|
|
|
preempt_disable();
|
|
|
|
if (!test_and_set_thread_flag(TIF_NOTSC))
|
|
|
|
/*
|
2011-04-19 20:09:59 +00:00
|
|
|
@@ -143,6 +144,7 @@ void disable_TSC(void)
|
2010-07-07 11:12:45 +00:00
|
|
|
*/
|
|
|
|
hard_disable_TSC();
|
|
|
|
preempt_enable();
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void hard_enable_TSC(void)
|