Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2445302yba; Mon, 15 Apr 2019 11:47:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9WUiiRq9Pm9igeRQsCHNwWOiDCMMRKCD6+GmXxPpOM3DMDJDbDtvbE6Le5Gd4btYkYuvb X-Received: by 2002:a63:c54a:: with SMTP id g10mr71421350pgd.71.1555354031919; Mon, 15 Apr 2019 11:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555354031; cv=none; d=google.com; s=arc-20160816; b=HTFi0d0UWAXHlQZoA98kx1Cr+lZMr+CR4i9XIKo/jneNNekFKngFWUa1Q+BJDxLVhv W/K9/WoD2C/JkO3NJkzLR46ncgDzF3Hjola3voWJWIy2utHmMDhKVQ3nqdoy/+RFVJJK InpXlyiRv/rVaWnahIs28mgiGZ0txEmzWZceitz/INv6wvAtHLyMTLhoaIKm3wA3mehA LgDFsEy1vHMv3FmlMjZ0QnSlK84aIeL+LqeL7cqJsbkYiyJOMXVBjM3/16aJZsj95nPx MfRJ4vcY+4azYuLf7JmC0eWQgVbFwnIEmJcL/yBLTo3qOKLTDoQbUbyP2XLOqaBp+6aC R/bg== 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=k76nrkj5yxzPnabD3ahsVARwuPI+zC2dL1K2GlQ58Z4=; b=LaX7WkI4Q+jJaFGa0T0xEnV0U7n2QDFeo/nD/2w4NdTPQsg0UxMfYvPbo5/g01LCjo AHPrbRkl7u/y8MAvP5oNlLkLCikX4/In/XagWGABJNKHsBjh76L3CncVMTzTILKQFcsi 2XWx1uv29KNzHbhJTtipUUC+jqfE5pKSWCE3ek/mUObvW12nGs0mVhZZl59fwdPUm+w8 MCy3ePsca24MulttYJu/NiGguGq8rMPH12xsN2gRRKDWG1YGt6G1MncaI6p1No4c6fVG rDYCzZcTwZef7y43JMbOkGqw8QD+VJJsqAz/7QIL6gDBSsRRti9R5qhXAJs1ZLVVSaPo oCHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xGa3V8N9; 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 j7si46226437pfb.75.2019.04.15.11.46.55; Mon, 15 Apr 2019 11:47:11 -0700 (PDT) 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=xGa3V8N9; 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 S1728480AbfDOSpz (ORCPT + 99 others); Mon, 15 Apr 2019 14:45:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:48382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728473AbfDOSpx (ORCPT ); Mon, 15 Apr 2019 14:45:53 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 A308B2073F; Mon, 15 Apr 2019 18:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555353953; bh=n4inz8fgTcSK7q+sPQjPtVdlfG1PqBQbmbjq/62cAfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGa3V8N9VghJvZtRGY6//0a/jqpyXHNL+5VK7u/CwiJPNNhAjEe2clY1nvaxabiwW 9gOzFi02VwGV8TbuRcJxjs6SxvDxiIJ28i+EzzlG+y/kwlciWD3DCFbwGWY+bUKNEo 4cPhlp59RKNGYrHnV4pfE0nMag+TaYV3f7CYC2KQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Suchanek , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 17/76] powerpc/64: Use barrier_nospec in syscall entry Date: Mon, 15 Apr 2019 20:43:41 +0200 Message-Id: <20190415183712.229837735@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183707.712011689@linuxfoundation.org> References: <20190415183707.712011689@linuxfoundation.org> User-Agent: quilt/0.66 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 commit 51973a815c6b46d7b23b68d6af371ad1c9d503ca upstream. Our syscall entry is done in assembly so patch in an explicit barrier_nospec. Based on a patch by Michal Suchanek. Signed-off-by: Michal Suchanek Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/kernel/entry_64.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index e24ae0fa80ed..11e390662384 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -38,6 +38,7 @@ #include #include #include +#include #include #ifdef CONFIG_PPC_BOOK3S #include @@ -180,6 +181,15 @@ system_call: /* label this so stack traces look sane */ clrldi r8,r8,32 15: slwi r0,r0,4 + + barrier_nospec_asm + /* + * Prevent the load of the handler below (based on the user-passed + * system call number) being speculatively executed until the test + * against NR_syscalls and branch to .Lsyscall_enosys above has + * committed. + */ + ldx r12,r11,r0 /* Fetch system call handler [ptr] */ mtctr r12 bctrl /* Call handler */ -- 2.19.1