From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225n/GC7IWKMNtR1qnpkL0Jb48i5rRu3dLxSkHBp43+pK4k1nWTFnLLJs9mqlUpxvIJydTJ0 ARC-Seal: i=1; a=rsa-sha256; t=1516881856; cv=none; d=google.com; s=arc-20160816; b=FYdgWCnl3yzVJBZdIIYszg13PdaYuDY8fm3s6cd61HTUibB2ZTwqZKxquPwVjChlZQ s5Tl2pSd4wIXbhIiBEoUymMWV3wgpxwAi1rJBFiPNee4/NVf3sGZHuQmd9a1h6JjYzCq wF+Qsx6nh2NGAmkipeiwLmYv8izP7whd7g7RRK+46zSXp5/2DOje+HWOpSpwfyILX6vd 3h1bMMi/U7IRo9rU9B76CNjRyM9ICjHN13kTfhwfzAfF0oDIor33I9t3OzQMqaOabe86 aAbF6F1CVJ3h1fxI9/rHaUr2NZn5lTbq7C56JS2uhzwYCRcsCsvGjkq5tD2DwCSD4Qy8 rjiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=pC/lMLETU7DwPbg1N8E2tVL+7C+jw/Ai/ejUZtHdkc0=; b=VpndGGZM6ccrD+KkoAj8Kb+S2hvAn8tK2yVdEURKXQQJTldJlRpxhGOM2TuZ76mLEV Nwjwc/mvDNBmNRND5KlGQuLXAjsgj5tG+MbHPzYfuoHD+TY2eyjRR0jOHgO4N/hWFafd 1xRRJVlgpoPH7/nnA53BcJYT+xHeyV/WcH9TNsAUFUy6jXfE0mgQ0wi+0eKP61FyRfLf L4wEIgS74UUGwfWsOvXqRvtbGamPglrBSoHJb3kF8Ilyw0UilAcufYkTQS2eJ93jAyTy 1o792ELlEFK6vPu8ZXy8cOIfy6pYzhclhJbYav9XMnEnrb8s6j1SG6QaNXbUKoGtMu83 iLuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=afPDfRNH; spf=pass (google.com: domain of jason@zx2c4.com designates 192.95.5.64 as permitted sender) smtp.mailfrom=Jason@zx2c4.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=afPDfRNH; spf=pass (google.com: domain of jason@zx2c4.com designates 192.95.5.64 as permitted sender) smtp.mailfrom=Jason@zx2c4.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com From: "Jason A. Donenfeld" To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Cc: "Jason A. Donenfeld" Subject: [PATCH] cpu: do not leak vulnerabilities to unprivileged users Date: Thu, 25 Jan 2018 13:04:01 +0100 Message-Id: <20180125120401.30596-1-Jason@zx2c4.com> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590565909898584039?= X-GMAIL-MSGID: =?utf-8?q?1590565909898584039?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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 --- 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