From patchwork Sun Jun 17 11:23:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10468805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 701BD6028E for ; Sun, 17 Jun 2018 11:36:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6106928874 for ; Sun, 17 Jun 2018 11:36:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55B4A28A1B; Sun, 17 Jun 2018 11:36:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA95A28874 for ; Sun, 17 Jun 2018 11:36:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9433A6B0010; Sun, 17 Jun 2018 07:36:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8F42B6B0266; Sun, 17 Jun 2018 07:36:20 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BBAF6B0269; Sun, 17 Jun 2018 07:36:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 3DD376B0010 for ; Sun, 17 Jun 2018 07:36:20 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id g20-v6so7136971pfi.2 for ; Sun, 17 Jun 2018 04:36:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:subject:to:cc:from:date :message-id:mime-version:content-transfer-encoding; bh=OXxaRZ9x2E7w24C1h9xPBoAz443EcpRzu7/+qAIOAnA=; b=fe/E5R59iHrIO2juE3xsOrc3Iuz7kfPEMDH4apcwSGlbJNYQFH2/lYOtv/Z2QSFtRe NVWuMX3gJQ+Vz/lNrPrIYXlH9KOnmqZ+v7qNU++WzrXMTm7cb+3lkYklGLFan1Zh7nc9 CicF3c6/ndORF4YmZcilaY8MQk57tQMou42cwuX3EAcMBa0/G9+w8lVzzY7q80jwQ9dU zlqOBDNrdQ2GZO/wxhBRvVBcXwvbdM7Y2FxC2ZasJtlSVp5TgVWYbfM7Y+Ufe67zd80H q4JgzI2HxrkIp/14iEFsuF0O+qYv1m6HBUHs5OWGQFVuL0naMXtbo9bfUFd04n9q8tYN 9kLw== X-Gm-Message-State: APt69E3HdMwc72klXjAy4TZj3H+BhIHJq/veAyoGGyDxuyImZMEurFzo ZnRuyLXFaBqoevWzs7iXjGF0TFpdggL6NsZSdJRyQ8fjN/4WbULz43YLQzz37BcMW3D90Se4HwI KhO0zhwJVhvnc8xse6DxfH4VV4T4kZ2MgJXmdMt+HwUXSFtY4CaqW+I9V+mZ/K8A= X-Received: by 2002:a17:902:8c95:: with SMTP id t21-v6mr9943798plo.306.1529235379920; Sun, 17 Jun 2018 04:36:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLuaF80XAPZpugkWNigt3Mn4/OJ7RHEQNcc8klszk+YP3EPM1UAP94EvtBJeNN8Jbc7eTGf X-Received: by 2002:a17:902:8c95:: with SMTP id t21-v6mr9943748plo.306.1529235379135; Sun, 17 Jun 2018 04:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529235379; cv=none; d=google.com; s=arc-20160816; b=KKC6UvFbld1Ck88nnEyn5/YY1juVx/E2r//meO4JxhrqKLNMaIVuDHLRuBcpZr1J0o zZ49ggu9xC11AZ4Uj18dYeu2lDgwxIK70KilFIW8Cx1RFx5Uai8KAlrTqd+K2zcw4HVt eRAxXIVf9qNIDuaq+74FUzIoC6Q+sS0URP4oS62gtVXg/T2hKMkU+N9veYpTFHv8ZMv0 0KgEZwRrY911lPNb9KDz6xl/BlonTAN8zrnsmAe+qUudf3JeQuzR98aUZ2l/ICfQ6EqD l3GzxOl3CFO0wozp440CDYG4P/CXmJsRbXhqbloavT35gJdcmOlrpHmZ7G/ysHf7IOTz Aqjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:from:cc:to :subject:dkim-signature:arc-authentication-results; bh=OXxaRZ9x2E7w24C1h9xPBoAz443EcpRzu7/+qAIOAnA=; b=QNWVbmpG9ODz6BnUbXMbzF3iFGWZzN0oTK0bPOxiqRIq3pzwL+i8uJHNmBdj3O7gXQ 5K/JkAJaBj6PYRqHYq6hDTjxlcDqHFnvqUyHNUG6+zmvZ4WWDZ+VgJxkKVfpSnkCjix1 xCxdh0EA6ZEHfgxL813LLS8FnHp66TTRuP0aU59sLxHMI4iMMFcbWFmuEepY4rrVCYLz j6ptOyr4YP9XPfuz75SIgPPtkPvCoqNGOMHKU+lesp3UKI1LeH2cJEn5HPdWs8h3PlEg MenkH/BjKvQ2yuTPYlslpAhLuh7EUvgOF0Uzlms1CwwAuTHix6Mct36Ts9T1jSyhr1y6 a3uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VCah+qFb; spf=pass (google.com: domain of srs0=nxds=jd=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom="SRS0=nXdS=JD=linuxfoundation.org=gregkh@kernel.org" Received: from mail.kernel.org (mail.kernel.org. [198.145.29.99]) by mx.google.com with ESMTPS id n2-v6si5125946pfe.23.2018.06.17.04.36.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 04:36:19 -0700 (PDT) Received-SPF: pass (google.com: domain of srs0=nxds=jd=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) client-ip=198.145.29.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VCah+qFb; spf=pass (google.com: domain of srs0=nxds=jd=linuxfoundation.org=gregkh@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom="SRS0=nXdS=JD=linuxfoundation.org=gregkh@kernel.org" Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 45D86208F7; Sun, 17 Jun 2018 11:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529235378; bh=jBCeL36GloeMdSmJI6azJJAXNC4nG2vR96PkxLBoFNc=; h=Subject:To:Cc:From:Date:From; b=VCah+qFb+OX8WQrHXK8R843K8IKBDoWUp2AM/RmSMRQ3LC5/tWA5GLqpLp0xwiR/n XK9EmjN6RGt2ye1DenGSiz5jZVjT15t3JcC0yTVbEE6ikHGjSRAzZU4elD0rgFnt6O QdXauamyz5yBOu2k3+S+kwH7yz61SVolKljuz3Ts= Subject: Patch "x86/pkeys/selftests: Allow faults on unknown keys" has been added to the 4.14-stable tree To: 20180509171345.7FC7DA00@viggo.jf.intel.com, akpm@linux-foundation.org, alexander.levin@microsoft.com, dave.hansen@intel.com, dave.hansen@linux.intel.com, gregkh@linuxfoundation.org, linux-mm@kvack.org, linuxram@us.ibm.com, mingo@kernel.org, mpe@ellerman.id.au, peterz@infradead.org, shuah@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org Cc: From: Date: Sun, 17 Jun 2018 13:23:31 +0200 Message-ID: <1529234611605@kroah.com> MIME-Version: 1.0 X-stable: commit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This is a note to let you know that I've just added the patch titled x86/pkeys/selftests: Allow faults on unknown keys to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-pkeys-selftests-allow-faults-on-unknown-keys.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From foo@baz Sun Jun 17 12:13:49 CEST 2018 From: Dave Hansen Date: Wed, 9 May 2018 10:13:46 -0700 Subject: x86/pkeys/selftests: Allow faults on unknown keys From: Dave Hansen [ Upstream commit 7e7fd67ca39335a49619729821efb7cbdd674eb0 ] The exec-only pkey is allocated inside the kernel and userspace is not told what it is. So, allow PK faults to occur that have an unknown key. Signed-off-by: Dave Hansen Cc: Andrew Morton Cc: Dave Hansen Cc: Linus Torvalds Cc: Michael Ellermen Cc: Peter Zijlstra Cc: Ram Pai Cc: Shuah Khan Cc: Thomas Gleixner Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20180509171345.7FC7DA00@viggo.jf.intel.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/x86/protection_keys.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Patches currently in stable-queue which might be from dave.hansen@linux.intel.com are queue-4.14/x86-pkeys-selftests-factor-out-instruction-page.patch queue-4.14/x86-pkeys-selftests-fix-pointer-math.patch queue-4.14/x86-pkeys-selftests-adjust-the-self-test-to-fresh-distros-that-export-the-pkeys-abi.patch queue-4.14/x86-pkeys-selftests-add-a-test-for-pkey-0.patch queue-4.14/x86-pkeys-selftests-stop-using-assert.patch queue-4.14/x86-pkeys-selftests-save-off-prot-for-allocations.patch queue-4.14/x86-pkeys-selftests-remove-dead-debugging-code-fix-dprint_in_signal.patch queue-4.14/x86-mpx-selftests-adjust-the-self-test-to-fresh-distros-that-export-the-mpx-abi.patch queue-4.14/x86-pkeys-selftests-add-prot_exec-test.patch queue-4.14/x86-pkeys-selftests-allow-faults-on-unknown-keys.patch queue-4.14/x86-pkeys-selftests-give-better-unexpected-fault-error-messages.patch queue-4.14/x86-pkeys-selftests-fix-pkey-exhaustion-test-off-by-one.patch --- a/tools/testing/selftests/x86/protection_keys.c +++ b/tools/testing/selftests/x86/protection_keys.c @@ -921,13 +921,21 @@ void *malloc_pkey(long size, int prot, u } int last_pkru_faults; +#define UNKNOWN_PKEY -2 void expected_pk_fault(int pkey) { dprintf2("%s(): last_pkru_faults: %d pkru_faults: %d\n", __func__, last_pkru_faults, pkru_faults); dprintf2("%s(%d): last_si_pkey: %d\n", __func__, pkey, last_si_pkey); pkey_assert(last_pkru_faults + 1 == pkru_faults); - pkey_assert(last_si_pkey == pkey); + + /* + * For exec-only memory, we do not know the pkey in + * advance, so skip this check. + */ + if (pkey != UNKNOWN_PKEY) + pkey_assert(last_si_pkey == pkey); + /* * The signal handler shold have cleared out PKRU to let the * test program continue. We now have to restore it.