Received: by 10.223.176.46 with SMTP id f43csp834886wra; Wed, 24 Jan 2018 06:41:24 -0800 (PST) X-Google-Smtp-Source: AH8x2279IUOdd31urheml64KyDwSn32AM/h83Nhko4RpTwUQSsvnk3LOZP0faJOlM0/OPj7Fgwr/ X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr8312546plg.448.1516804883976; Wed, 24 Jan 2018 06:41:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516804883; cv=none; d=google.com; s=arc-20160816; b=aV2KjkQqqrOusRJAKmdX+xdf/uDUbD5gwofvGyDyguuxK4H0Zv0njdrGazg4Hm9eWR 614QLn2hexVNDpNOUMxdBv1K1F3gLp1dz1Djbqr6ZZhopuYZ+pdAuCzbdRppuPEaKOvn BHHDxbNTbf4TqCQxrdWVKK6m474MNeuKYvzkU62jUz+a5Btn0kq+2FZLDQ59klTD6Quo LhOpFvc8Whdy5ols9FkoJOY2s0nbYQPizDg3Ta7qqsv+gLHz/9v7Ct3jgDO33rfSu4Df M0ektRa4g+40Q3rAnvCGHSP0AAoreIoiN81xzEkMRn1xkCkfWCwTPc7IKZ2IvEG7uksO I2xg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=LqI0rr8xDsuzkz6b8WjbhgSAsrHLHJ2Bnx9EWqbtuWg=; b=HH6W/bemMEl3MxnJBAHF+QBC9vKn0QAH62ZnFfyMm1Qu9F/Vqc1thzwOJppSyLFVON Rgtmaijoy0tURdcOmp94k8y1plwrtYNxoEOuhG57q5aNFjfNe23FiVLV7bODkYUgbYRu gtCsihUtxzZc7i+Mtr+Wkio1NnMlV+asueKMnciY+iATqPwKsIUPb+dDqHBb9xdkyRkm 7f2ppv+ctIo+OxGiVd1/a7p1rokjuazmoHSMrseUa2tz6kOPlMals1eKJ5FXXkyzAnxB stjfNx/BFijvE3P4rnnY7zyJ34UcBnsBQA9BQpjkOwbSkZSyh4Bdch6SRBwEXTBZjrwP y01Q== ARC-Authentication-Results: i=1; mx.google.com; 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 t18-v6si290331plo.493.2018.01.24.06.41.09; Wed, 24 Jan 2018 06:41:23 -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; 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 S933923AbeAXOko (ORCPT + 99 others); Wed, 24 Jan 2018 09:40:44 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33571 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933688AbeAXOkn (ORCPT ); Wed, 24 Jan 2018 09:40:43 -0500 Received: by mail-wm0-f66.google.com with SMTP id x4so26895145wmc.0; Wed, 24 Jan 2018 06:40:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LqI0rr8xDsuzkz6b8WjbhgSAsrHLHJ2Bnx9EWqbtuWg=; b=WcmB5JAXkSvu3EauwQMKwWE7/yTHP1LTefDcOnDJNMFjnTgeGJgZEyQYiODPPvY4km kIcBG4fj/MBOZwK1AZ+pJuD6nfczRc+0vxjdDoGqrAceZj5CQ+KI4cdxoL6BUvAKjH7o tpd6IRur2l2p1lLRtl38hhyxKNNeqoNbm3q3Y9YRJK5HU2s0lXXXEh4b1GdwWlmmaRJ3 S8Djgt3FK0njcHQHbjAXm2eeYREcNkve9MCRBY+wA8WoQlTdM4fMgaynNGtgh3WgnKNT 0FHM38ssHqs6CVIrYLd8lFddLaT6S01a/dKxpwpCz4540ZgD2DhuJZ+IeMYvUwTXrN7z 0k/g== X-Gm-Message-State: AKwxytfy/kYKPBx6Y1FM6Y+z5Ydnt3cObvwV69jybjqZhzQQJMS684hU BSWexhqY9gSVwFnJI1KiT+w= X-Received: by 10.28.167.215 with SMTP id q206mr4924106wme.48.1516804842170; Wed, 24 Jan 2018 06:40:42 -0800 (PST) Received: from ?IPv6:2a01:4240:2e27:ad85:aaaa::19f? (f.9.1.0.0.0.0.0.0.0.0.0.a.a.a.a.5.8.d.a.7.2.e.2.0.4.2.4.1.0.a.2.v6.cust.nbox.cz. [2a01:4240:2e27:ad85:aaaa::19f]) by smtp.gmail.com with ESMTPSA id w73sm6931305wrb.34.2018.01.24.06.40.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 06:40:41 -0800 (PST) Subject: Re: [PATCH v4 07/10] x86: narrow out of bounds syscalls to sys_read under speculation To: Dan Williams , linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, kernel-hardening@lists.openwall.com, gregkh@linuxfoundation.org, x86@kernel.org, Ingo Molnar , Andy Lutomirski , "H. Peter Anvin" , tglx@linutronix.de, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@linux.intel.com References: <151632009605.21271.11304291057104672116.stgit@dwillia2-desk3.amr.corp.intel.com> <151632014097.21271.16980532033566583357.stgit@dwillia2-desk3.amr.corp.intel.com> From: Jiri Slaby Message-ID: Date: Wed, 24 Jan 2018 15:40:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <151632014097.21271.16980532033566583357.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/19/2018, 01:02 AM, Dan Williams wrote: > The syscall table base is a user controlled function pointer in kernel > space. Like, 'get_user, use 'MASK_NOSPEC' to prevent any out of bounds > speculation. While retpoline prevents speculating into the user > controlled target it does not stop the pointer de-reference, the concern > is leaking memory relative to the syscall table base. > > Reported-by: Linus Torvalds > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: x86@kernel.org > Cc: Andy Lutomirski > Signed-off-by: Dan Williams > --- > arch/x86/entry/entry_64.S | 2 ++ > arch/x86/include/asm/smap.h | 9 ++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > index 4f8e1d35a97c..2320017077d4 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include This is already included 2 lines above thanks, -- js suse labs