mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cpu: do not leak vulnerabilities to unprivileged users
@ 2018-01-25 12:04 Jason A. Donenfeld
  2018-01-25 13:34 ` Alan Cox
  0 siblings, 1 reply; 9+ messages in thread
From: Jason A. Donenfeld @ 2018-01-25 12:04 UTC (permalink / raw)
  To: gregkh, linux-kernel, kernel-hardening; +Cc: Jason A. Donenfeld

While it's public information if the CPU in general has spectre/meltdown
bugs, it probably shouldn't be as globally obvious to all unprivileged
users whether or not the kernel is doing something to mitigate those
bugs. While an attacker can obviously probe and try, there frequently is
a trade-off attackers make of how much probing around they're willing to
do versus the certainty of an attack working, in order to reduce
detection. By making it loud and clear that the kernel _is_ vulnerable,
we're simply aiding the trade-off calculations attackers have to make
when choosing which vectors to target.

So, this patch changes the permissions to 0400 to make the attacker's
job slightly less easy.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/base/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index d99038487a0d..a3a8e008f957 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -531,9 +531,9 @@ ssize_t __weak cpu_show_spectre_v2(struct device *dev,
 	return sprintf(buf, "Not affected\n");
 }
 
-static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL);
-static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL);
-static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
+static DEVICE_ATTR(meltdown, 0400, cpu_show_meltdown, NULL);
+static DEVICE_ATTR(spectre_v1, 0400, cpu_show_spectre_v1, NULL);
+static DEVICE_ATTR(spectre_v2, 0400, cpu_show_spectre_v2, NULL);
 
 static struct attribute *cpu_root_vulnerabilities_attrs[] = {
 	&dev_attr_meltdown.attr,
-- 
2.16.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-26 19:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-25 12:04 [PATCH] cpu: do not leak vulnerabilities to unprivileged users Jason A. Donenfeld
2018-01-25 13:34 ` Alan Cox
2018-01-25 13:40   ` [kernel-hardening] " Jason A. Donenfeld
2018-01-26 12:31     ` [PATCH v2] " Jason A. Donenfeld
2018-01-26 16:43       ` Alan Cox
2018-01-26 17:23         ` [kernel-hardening] " Boris Lukashev
2018-01-26 17:47         ` Jason A. Donenfeld
2018-01-26 18:45           ` Boris Lukashev
2018-01-26 19:07           ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®