Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2724938imj; Mon, 11 Feb 2019 07:33:13 -0800 (PST) X-Google-Smtp-Source: AHgI3IZOx5urD0aRqA111Az0pyTqZPydjg4HTorKHDVYjI1e2fSihiyRDJXkir6larg1/YJmYYSp X-Received: by 2002:a17:902:7e0d:: with SMTP id b13mr38338002plm.154.1549899193674; Mon, 11 Feb 2019 07:33:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899193; cv=none; d=google.com; s=arc-20160816; b=zHczMY6Tg4skUi6jm0ubxmQ2c/Tr3s9sY50LsQoS+hDwbSKO9bLROtqUIF0vQkZeJi HAlqD9bXxw5vL/Osofs3CXN1OXZgs85QHnpLdHp0Ul/OYto4l043oLbXC7jkUGbn8TXa xh+OA5L7QfpmSQXrY4mSHLkUAUhJzNvze6SCg/VM12V0dUZZjI0cDWLeuZ5692LjRlii mCjKqI0UvRY+SG86NUgO10JEGyobX1y+5DZS2+kKg8m1a3daI/BrxOpQFeex9ncF0s2Z YPeZjvWp+xqTjKZGfyPoueoscUEXMC8ZOAnOg4LYTmIzdhrqpHlxH6K0I3XFppn9KBUa mcmw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zq6t/JQbWoG56l3Zs3qo4/y9lDsDe3D289FaFPpXRmY=; b=QimjhX8ocSkNBDNEJWZ76SQ056bbcv6kouLluTFkuZXn1C9Lsy76JXAmRkEMZXcQ3b nd1iDq8f1kRshfah6N5CYOziVGJafilnL7g2zhj2p0EF/bPIMUkWHkFf44PhJ2XxvNVC +5zHycYen11zI6HVk9OEF2EXb7n7zczQ0qsAlUIBuliHEtaB6TUQZ+WaFRntdPOnIOxE FnhAWBajfEvIt3XcAJZF4wcWT3JyPqDKpLdHXqXJQUdC8NNL0tcHZIGzg+rnfrRKyjmU JNKpO9PGGYItS3tDdcgTOtQlKWOMmjMymfBUw90+njB4GKww8UBe4om/CcDOn816PAgn TJzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gZDN1b2I; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si1664291pfa.34.2019.02.11.07.32.57; Mon, 11 Feb 2019 07:33:13 -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=gZDN1b2I; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389511AbfBKO6T (ORCPT + 99 others); Mon, 11 Feb 2019 09:58:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:45842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389489AbfBKO6Q (ORCPT ); Mon, 11 Feb 2019 09:58:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5458520700; Mon, 11 Feb 2019 14:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897095; bh=sThCRVdTB8e5XIo/1yb5b+c0Nftm7NdeapiMVBHasIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZDN1b2INFcdAZDKDGJ5Mib9NLvk+ujSmHGFTRAFZfiBGCyf2anH4aaY9c2b3G3mm Ra4kJH6zd/rStCVNZxAe+iZ5M6Ekpmnzpj/FYoeklVVoUkK5T2l0c+ptRFo52Ke0WF OxGJVIkG5QGa/bqLTJuKO9U7c0qyVdctmKNoMsyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , Borislav Petkov , Rik van Riel , "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 4.14 059/205] x86/fpu: Add might_fault() to user_insn() Date: Mon, 11 Feb 2019 15:17:37 +0100 Message-Id: <20190211141832.659373595@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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