Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp599183pxb; Wed, 27 Jan 2021 16:18:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdCeALIwVWBBqCsu63X9/2Ce7WkfSInE5m+g4L+MD5Ujb2vBV4vIlspKH2OgdWcMuD0q/R X-Received: by 2002:aa7:df0c:: with SMTP id c12mr11530740edy.304.1611793105190; Wed, 27 Jan 2021 16:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611793105; cv=none; d=google.com; s=arc-20160816; b=1Iu8/AuUG+HbxIZSkuvO28NFxxSFv4PRrs8FE9JLAfUkgNq1J5BETH9GSks7JkZlQM VPBmBIFmsS8YHywbNsr2Kjk45wqUSu6xvg3PebTwZcIDgp1+9OucEhN8tfqagjSs4od0 e0TpqRjFfIqGfS4l/S4KgLUkjNoS+9v+VZkq0wr1Xa8sipGLsTJgHcjGnRCjW1KmEIZE N2eTeLtVtx7d+xQlYc31GyRsrhAFJzirTJ7L+m3x9FKl5S9ix8u2G+LEDJ8ijPyz4Pie 3EIYGPygK4P5pFHv9Cs1ARcSvzdVVO28tQhtNwZyXogh0L9YYV+fTRQaXD6hqRBv5Vhu fEQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=ZWd9zuAKnbFdypCI+AMFWb/xOlm+1GwlYKXpziv/GsE=; b=qoHznaDROALHRckadBlE4NSwBuKJRcSh0z80j3K6w5/LsldSQrFGuXFr3xd+DiQ1Oc f4eGc3e0m7KVbq79dcKLTnOl6r7GrI0wMKBGEOmvxzlrPBJ4LUh8R34Vdak+ZX/JVZxc 9/tP8hy6oeCd4vvWjXhyyM2NBrd8QoM95/A2aNgD11lpH/i8zSbX/kqAXs2I13kIGrO7 rVYV8HgQ/H0U7TKMLPzwqGwLZAMRIPkMqsEi8C3sbEb2L3suQK8/5+vtMXJGaI/bjo1y kHpEhkoxyraKDxQrNJzoBrqqolgOMOZYY1xw0SgEVEx3rmlcUREX6pSkZm78wHvKjaPi gmwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hAHhUcvT; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=cdZzZjK0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gg14si1534125ejb.367.2021.01.27.16.18.01; Wed, 27 Jan 2021 16:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hAHhUcvT; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=cdZzZjK0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344468AbhA0Tdv (ORCPT + 99 others); Wed, 27 Jan 2021 14:33:51 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:58444 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344241AbhA0TcR (ORCPT ); Wed, 27 Jan 2021 14:32:17 -0500 Date: Wed, 27 Jan 2021 19:31:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1611775895; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZWd9zuAKnbFdypCI+AMFWb/xOlm+1GwlYKXpziv/GsE=; b=hAHhUcvTB1/LQakNOuKdwbiV1e4occ20MEPp0ol+89XamcR0VMR0vaAk8Ixz75sCmmc0HG VvdjfOWKJtftobtCEWVsE2SgP+zZIUR1KrkFDzSua9o2SixLyEzKkPY5WaOxJ4CgEH6lMY zp4PRdAGKgG48Z6lEgZLXA7p1LrQyXNPCYB/6GFIP9a/4E/S+lwHIgoKpIXnTgQJHtvqu3 z9W+xKiSxw/mGpvqm1ZkFrpoDN0e6kp3ReQ1z2I1qCh78UtP52FnM4Rl+QIyE8107hfPUc kW3aOBpnJJJDkKVbdOrHuJ9rU62dclcrRJsqH+6uohFmsw3wAtltEcYraX1wMg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1611775895; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZWd9zuAKnbFdypCI+AMFWb/xOlm+1GwlYKXpziv/GsE=; b=cdZzZjK0+2kOfepF4lCvv17jAGIVXtZ1gYHPDnEZhpfy8qEo1AtW7vW5p7b79nVsv7aNWD 9RkGpEqqEomWHQAw== From: "tip-bot2 for Misono Tomohiro" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/misc] x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too Cc: Misono Tomohiro , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210127122456.13939-1-misono.tomohiro@jp.fujitsu.com> References: <20210127122456.13939-1-misono.tomohiro@jp.fujitsu.com> MIME-Version: 1.0 Message-ID: <161177589483.23325.9744949016620095034.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/misc branch of tip: Commit-ID: 02a16aa13574c8526beadfc9ae8cc9b66315fa2d Gitweb: https://git.kernel.org/tip/02a16aa13574c8526beadfc9ae8cc9b66315fa2d Author: Misono Tomohiro AuthorDate: Wed, 27 Jan 2021 21:24:56 +09:00 Committer: Borislav Petkov CommitterDate: Wed, 27 Jan 2021 19:06:47 +01:00 x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too Commit a7e1f67ed29f ("x86/msr: Filter MSR writes") introduced a module parameter to disable writing to the MSR device file and tainted the kernel upon writing. As MSR registers can be written by the X86_IOC_WRMSR_REGS ioctl too, the same filtering and tainting should be applied to the ioctl as well. [ bp: Massage commit message and space out statements. ] Fixes: a7e1f67ed29f ("x86/msr: Filter MSR writes") Signed-off-by: Misono Tomohiro Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20210127122456.13939-1-misono.tomohiro@jp.fujitsu.com --- arch/x86/kernel/msr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 8a67d1f..ed8ac6b 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c @@ -182,6 +182,13 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg) err = security_locked_down(LOCKDOWN_MSR); if (err) break; + + err = filter_write(regs[1]); + if (err) + return err; + + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); + err = wrmsr_safe_regs_on_cpu(cpu, regs); if (err) break;