Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3627836imu; Mon, 28 Jan 2019 08:05:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN6hl2U0RcAXDuGr7rbc7o8SCm+/kVs+h4GSSGQ2rUepFuHn6PX6F77ktRwhw6IYKzcwLPg8 X-Received: by 2002:a62:8986:: with SMTP id n6mr13118039pfk.161.1548691524804; Mon, 28 Jan 2019 08:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691524; cv=none; d=google.com; s=arc-20160816; b=r1FljH0KwprIFdbgCJucMchosisfcj3CBSbErCg0O78fWaGqAmj4myN4jp1kqL/4EZ A/jhB1O5MjvA+JMAw+X5+nuugF2eLXLdOemTWFAjEfJxOAZIU2Ygg/Nbi2LcGxZfm/0m gsNAdVjWfYji+j+KWEIGzRkLI9KT6mRVcMZfrxGjAnx8NPFBn6D8IlxL7m1Q+h8r9O1J x2J4GIgv6AYY7+1QJ2vlh2j9iS0TnVl8J1pv/l/y4wixStqfqc+1HVNTLcqDHdWGvZyI bHM8lAmfQms4RcxL3u/4KXEUOcgamQNR1OcLndzMcuQae4V/xbmMqS9sxO5+dIViMoZI Pptg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1P1ElZPFA2IvJaQd/CAkJe+FTeA3nrt1KBb6ecFmxFA=; b=pqqgh6pfaC9sZkxO2ux/rwQ6MUGH6mdgMRi+L8MhOW9Uc+pHl10/Gk6XShdBJ9lZQK cDs9SJ/k0Yr0occSE4pNbss6i+4nkmTeY+SBt/HxhqJKnnA291jJPUotcEfs7x5O+HAj dfdN2JJHA3CLwSYOXJdQUH8638rCeTshL+QygaPY2iMz43PEWouiJK9gXpYdtfMMwuxh b0RSYnsMUX8fLOzqKk3tMX+wfrjlkLEHMGef+pCcdFJdnfec+951PeetiVQFWdngZp8V T+QBoOsxtXbszpvx6KaAgpRUgFmW9XT6n1OnxUcasj4dh69+J0OsiS/oaKYHyIFxzC3G TWzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZnUXKp1S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si10942779pgb.371.2019.01.28.08.05.08; Mon, 28 Jan 2019 08:05:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZnUXKp1S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730487AbfA1QER (ORCPT + 99 others); Mon, 28 Jan 2019 11:04:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:49572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731525AbfA1QEO (ORCPT ); Mon, 28 Jan 2019 11:04:14 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A21A920989; Mon, 28 Jan 2019 16:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691453; bh=bcLKVnO4RFI2dhwpNXslmzVthU5mituxKMAvmzBMi/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnUXKp1SDqn8AJPW1HJ0rDg/Nc3VZLfE2yQbuErA89nhu9Zzv5ft+mi/BjeUWh/Oy 5srjtaXnGiazJxg0PlBH/XYQSsIeLxERontWjVWv3MnbDkqVX3PmkYP86bpEIfavfF 7Q6ZtL+5QM7Tn2iFW5DV51WC3kFaCu/Ox3cwrkQA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sebastian Andrzej Siewior , Borislav Petkov , "H. Peter Anvin" , "Jason A. Donenfeld" , Andy Lutomirski , Dave Hansen , Ingo Molnar , Jann Horn , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , kvm ML , x86-ml , Sasha Levin Subject: [PATCH AUTOSEL 4.19 097/258] x86/fpu: Add might_fault() to user_insn() Date: Mon, 28 Jan 2019 10:56:43 -0500 Message-Id: <20190128155924.51521-97-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior [ Upstream commit 6637401c35b2f327a35d27f44bda05e327f2f017 ] Every user of user_insn() passes an user memory pointer to this macro. Add might_fault() to user_insn() so we can spot users which are using this macro in sections where page faulting is not allowed. [ bp: Space it out to make it more visible. ] Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Borislav Petkov Reviewed-by: Rik van Riel Cc: "H. Peter Anvin" Cc: "Jason A. Donenfeld" Cc: Andy Lutomirski Cc: Dave Hansen Cc: Ingo Molnar Cc: Jann Horn Cc: Paolo Bonzini Cc: Radim Krčmář Cc: Thomas Gleixner Cc: kvm ML Cc: x86-ml Link: https://lkml.kernel.org/r/20181128222035.2996-6-bigeasy@linutronix.de Signed-off-by: Sasha Levin --- arch/x86/include/asm/fpu/internal.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 69dcdf195b61..fa2c93cb42a2 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -106,6 +106,9 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu); #define user_insn(insn, output, input...) \ ({ \ int err; \ + \ + might_fault(); \ + \ asm volatile(ASM_STAC "\n" \ "1:" #insn "\n\t" \ "2: " ASM_CLAC "\n" \ -- 2.19.1