Received: by 10.223.185.116 with SMTP id b49csp998873wrg; Fri, 16 Feb 2018 10:33:02 -0800 (PST) X-Google-Smtp-Source: AH8x225bQ8TNF8qIeAbGFIe67FpTKw+poNq4yxjiQ7P2IUlQCtk0SgDWke8kDBw2Mj9EORHjg63S X-Received: by 2002:a17:902:5902:: with SMTP id o2-v6mr6467745pli.79.1518805982509; Fri, 16 Feb 2018 10:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518805982; cv=none; d=google.com; s=arc-20160816; b=w879LswUivNXeMgkot138YGBuivGrvLCV3Wtc2/RFbUpYhDzQd0k7/Zo94H+gRwxBc e29BuITdmPNFgoWX49NWVvy/g7phcA5gxEj1zIi1FaA3W6+tWZ7T+jh1+PR4TzIKricb H26UtTT0wbGvdCfsye5sV6bMR5j1zkqzC0Vg/0tYlt4vWrYuuA+XnzKk7TkqhmUL40Ks 5hS5lgnRHkvrehbwZ3AYFFCw0QrmcNoDATx0JwM/JNXoMARi+87KJ046edl7mPwSLqhy 5UYFXYsto/Z1ajvJ2gj6R7uuuQnJx0sJYDQwYV5rLzAqqc5AWsOAWkmg9hxDwMpmrzu1 Vlyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=ldxQfEA8Zb/QPTUM9zc4XlLgU93cNOiBnMSoCapN7h4=; b=kJ1TULoi2d8TEYcXeXX6bpvXsYMHG5iT2VsN2EhjygB8b+WdQni1SbXEamb0qPAu8P Cc+lPutLWrrV3VAhrWWJa0zQklLiALtgp0jf1B+9+EdPYQa0nYPZalpPGRCFCCYOCpLw yVwknvM5PePEThq+/SSJCIZWwq7hQAiL8PgeARxtvteib5lUSWrLGcSppfy/v0rhTzSu BeaCJ+p8udIqVeLm07f1JOOJpxgknToVIf+kJvhVGfSoCjxd6zReIyttCq3th2nR0Dpc f6csn/Y9htaELhLGlmkxJ2BurDgnxEZwdwMG0F/q/VfGYQFv3jirc8ORkDFJ4qFgIdlD SK3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OZYKef7L; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3-v6si1539455plc.552.2018.02.16.10.32.46; Fri, 16 Feb 2018 10:33:02 -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=@gmail.com header.s=20161025 header.b=OZYKef7L; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756903AbeBPAvn (ORCPT + 99 others); Thu, 15 Feb 2018 19:51:43 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:42007 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756845AbeBPAvm (ORCPT ); Thu, 15 Feb 2018 19:51:42 -0500 Received: by mail-pl0-f68.google.com with SMTP id 31so815336ple.9 for ; Thu, 15 Feb 2018 16:51:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ldxQfEA8Zb/QPTUM9zc4XlLgU93cNOiBnMSoCapN7h4=; b=OZYKef7LT1GfKBywc9K9t3ayS+MbiiW48+wwjHeFL5y4FNygfNiTi7bdNMBs3ymFvi BYU+YqzdSzgKuIBwS7tOjN+h5S72r2GO01aO1k0m0c3aB/k5uikqdEfv5rudY4oKZ0qb 3oHhXfDzGYswop111auzzxXK9mAc6uxEPswuY0YpsgDG36PgnXTsUVV0MIcHA2H7y75Z J3nP6zjfjLou83ijNMshZ7DWACl7deJ06qwR/e9wbolNBP5ogaekJ4Zqiy38XBzRmILj Au1foGGYxjOPqalS4zkD37yVQm80VBA377rboFoVezmwFC0sB0oCoN3OUC5+xTJZshzr 8n6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ldxQfEA8Zb/QPTUM9zc4XlLgU93cNOiBnMSoCapN7h4=; b=Ie1MjSqakjzRHNqQkVvTP5NmoUwOh+wXlW8wXtFIlGrwCzYWgT9wZbTzOVdBR3VAtd B6SmGD/uDk3IDfgD474/xXpjNQdMkxixeoE0miLRGpljbzUEB5UrO59vMey8O680bijS 1mm0fkOzu6UlUJ2UmK9jOUZCGk+xw3zyGj+L0rkygpwITmLQp5RVjPIrnBGQuQdm4kPh 1+LzCIAcmqQyjTzsrYkaOGx2jgGK3IK/t6j6vn6Bv6iYAt1eqVNuF/28lONk7b5gdSE3 /gWsSzASUzAjjlt587rPZUE0llaUzPY7DQEkODiXMYWGEMp0nTrOgR/k7YvUA20fN8fm 4YRA== X-Gm-Message-State: APf1xPCO5iNLH70uzQe645drvUmkr2nWnuEzQfLDsqUMdCMDNhVYUSNw WJloNEWxhbFbZDFsdU4x4B4= X-Received: by 2002:a17:902:a5c5:: with SMTP id t5-v6mr4301237plq.160.1518742301340; Thu, 15 Feb 2018 16:51:41 -0800 (PST) Received: from [10.2.101.129] ([208.91.2.2]) by smtp.gmail.com with ESMTPSA id u9sm35672420pgv.4.2018.02.15.16.51.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2018 16:51:40 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH RFC v2 0/6] x86: Disabling PTI in compatibility mode From: Nadav Amit In-Reply-To: Date: Thu, 15 Feb 2018 16:51:38 -0800 Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Andy Lutomirski , Peter Zijlstra , Willy Tarreau , X86 ML , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180215163602.61162-1-namit@vmware.com> <27a0082c-fadb-792a-740e-70932d51f1b5@linux.intel.com> <91CEEFA7-86C8-4731-BC7E-6AF5CC3A1BA4@gmail.com> To: Andrew Cooper X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew Cooper wrote: > On 16/02/2018 00:25, Nadav Amit wrote: >> Dave Hansen wrote: >>=20 >>> On 02/15/2018 08:35 AM, Nadav Amit wrote: >>>> I removed the PTI disabling while SMEP is unsupported, although I >>>> must admit I did not fully understand why it is required. >>> Do you mean you don't fully understand how PTI gives SMEP-like = behavior >>> on non-SMEP hardware? >> No. I understand how it provide SMEP-like behavior, and I understand = the value >> of SMEP by itself. >>=20 >> However, I do not understand why SMEP-like protection is required to = protect >> processes that run in compatibility-mode from Meltdown/Spectre = attacks. As >> far as I understand, the process should not be able to manipulate the = kernel >> to execute code in the low 4GB. >=20 > Being 32bit is itself sufficient protection against Meltdown (as long = as > there nothing interesting of the kernels mapped below the 4G = boundary). >=20 > However, a 32bit compatibility process try to attack with Spectre/SP2 = to > redirect speculation back into userspace, at which point (if = successful) > the pipeline will be speculating in 64bit mode, and Meltdown is back = on > the table. SMEP will block this attack vector, irrespective of other > SP2 defences the kernel may employ, but a fully SP2-defended kernel > doesn't require SMEP to be safe in this case. Based on Jann Horn=E2=80=99s description of the branch predictor, it = basically only holds the lowest 31-bits of the target address. There might be a subtle problem if the prediction wrapsaround, but excluding this case, I do not = see how Spectre v2 can be used to jump into running user code.