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 Kroah-Hartman X-Patchwork-Id: 10468809 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 8F34A6029B for ; Sun, 17 Jun 2018 11:36:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8006028874 for ; Sun, 17 Jun 2018 11:36:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74BB328A1B; Sun, 17 Jun 2018 11:36:33 +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 CBA5B28874 for ; Sun, 17 Jun 2018 11:36:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AB0E6B026A; Sun, 17 Jun 2018 07:36:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 65F0D6B026B; Sun, 17 Jun 2018 07:36:26 -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 4D86A6B026C; Sun, 17 Jun 2018 07:36:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id F3F1F6B026A for ; Sun, 17 Jun 2018 07:36:25 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id t19-v6so8283858plo.9 for ; Sun, 17 Jun 2018 04:36:25 -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=fOH39trgFZud1VQEHKwD7oq2roAzA+h93iUD1zq8vmI=; b=qeTRGmPAAYi/SmQkt1QJy2osZepZeTAtDvyphodSI6587j4QA5OJRoRtZT28OMtz0K 8xGdX82qPlm0O+dWrm8s1iUqMpClfbdRypvFPQXntOHVq27cnmV/8KL4hsKih3rl1pOk FaPCSZBH9RqtdMe9TNWTvUWQ3n626wWsMeNFPRMj2UL7CW92FSaiTEerW/aYoDnTBCXm x5oCKi3tgTDKssY++G/hKfzTUlJeEJjRbAbkmUyp5yPxaWnwYo0zTN1VtBhQRxu2h05G KQC/midXCB7uao8jfdbJpwxXFUeTPd9R3w8ba/oEESAfP72SWPftQD1wv4ZrxvSZjZZ4 VBEg== X-Gm-Message-State: APt69E2ifh31Kb/sCWSI61ENm8h5TTbxQ4BD2bLddpCyGeXtqIg/QIOx ln4AbKk7mcuX8+nNU/ixJKGTKHW+juKubIruc4yyIqZKpSycOAl9AJWakcqRytIJMHy7WJxbX/F N/je7BDvbeJAOPqUhP02z9JU8IVXuziV0i2zUV6KL922rHGx2tcAk6o/RvrO8c28= X-Received: by 2002:a63:9902:: with SMTP id d2-v6mr7810996pge.166.1529235385653; Sun, 17 Jun 2018 04:36:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIAaqUqd4hN1Iu/Hfqrlk9zTmPIfPq6EnhTIDBGVEGKS8a8/mitlfLmaR0aSs+mZpBy4CoS X-Received: by 2002:a63:9902:: with SMTP id d2-v6mr7810957pge.166.1529235384883; Sun, 17 Jun 2018 04:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529235384; cv=none; d=google.com; s=arc-20160816; b=Bz8oyIQCrBVWtaJq6pjxJqFOKmvfZu1zYSXnvtG37YfrXtXxNtYSB1oBG52aimxg9G bhhOMgZmaT3wwSBImCURAxSiyjuK5zLC1DsRqJX0OTW+K4AKedvJs+hYVteeKDeZwqlF 4CPvz+fEYsucQsnFbM2DrASUk7gS6UirluwMSskYANkO0Sy0fd/BlBUaGItdElj/v6+J 2umHi0MDLxZPcXzwWqAMYRavxracvoY2rlxTZjZhlDg7YQbjhbRqeKGS71RUM7KgetwE o8PUbXjSnLDI//Uo9Eyw5ZxkIul3ZGNZ88oSVl2XTgqn5gPuNFUo3rAElwLSR+nTr5Qh gQxg== 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=fOH39trgFZud1VQEHKwD7oq2roAzA+h93iUD1zq8vmI=; b=ymhpG+iChY2vy5mg7eMkUgXQCmigRi9mWSZDYMKKqb6OrwjKGWMDC/md+6eyjHmqyP ZEeH1wyyhbJIOyC3+5KJlUZ91SYfaAKzJBleR+xTrTB8u/a7I6h+CgxGikgNANHE7TC7 u3EnaEOaGVffv0yOR6Pe6oJY7vFYBGIbdi4/OpYsr6VgFn6TPvwRc6tqaZOaPvwwn0Cu RufKoCZj0w5qmadvmJ5bRxzCOwhOkQlmX/ICfd0pkEw2f1rlKmBXsope/ca0BmC/0Ye8 xaCx8IP/w0FBR81lRsKEJ2j9smNwsSNWGL8SdxkCACcKlp1In3WZAemwxvrss96dn7Vl 47Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L6ulOTNS; 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 g61-v6si12583110plb.169.2018.06.17.04.36.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 04:36:24 -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=L6ulOTNS; 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 0C56C208E6; Sun, 17 Jun 2018 11:36:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529235384; bh=oCNEJKY4S3r5VZdg6eaWj9L3DSMU5xaaOZnS47rGVIE=; h=Subject:To:Cc:From:Date:From; b=L6ulOTNSq4ufOOUlHvBrf/WUv1WPDAdFBe90BrdUVVtyFMxHCon6NRO2Ejd3Bgf85 0DVqcuVGki8qUfGO2l3KgnmrLeB3YG68KxjSFPK2+ECgrRVwlf+fJUtG82XfyQi2hd fMVfufgZF6uBhcAAT/3zRTnLNEcOdgf4GI8iu4JY= Subject: Patch "x86/pkeys/selftests: Fix pkey exhaustion test off-by-one" has been added to the 4.14-stable tree To: 20180509171350.E1656B95@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: <1529234611245241@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: Fix pkey exhaustion test off-by-one 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-fix-pkey-exhaustion-test-off-by-one.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:50 -0700 Subject: x86/pkeys/selftests: Fix pkey exhaustion test off-by-one From: Dave Hansen [ Upstream commit f50b4878329ab61d8e05796f655adeb6f5fb57c6 ] In our "exhaust all pkeys" test, we make sure that there is the expected number available. Turns out that the test did not cover the execute-only key, but discussed it anyway. It did *not* discuss the test-allocated key. Now that we have a test for the mprotect(PROT_EXEC) case, this off-by-one issue showed itself. Correct the off-by- one and add the explanation for the case we missed. 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/20180509171350.E1656B95@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 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 @@ -1163,12 +1163,15 @@ void test_pkey_alloc_exhaust(int *ptr, u pkey_assert(i < NR_PKEYS*2); /* - * There are 16 pkeys supported in hardware. One is taken - * up for the default (0) and another can be taken up by - * an execute-only mapping. Ensure that we can allocate - * at least 14 (16-2). + * There are 16 pkeys supported in hardware. Three are + * allocated by the time we get here: + * 1. The default key (0) + * 2. One possibly consumed by an execute-only mapping. + * 3. One allocated by the test code and passed in via + * 'pkey' to this function. + * Ensure that we can allocate at least another 13 (16-3). */ - pkey_assert(i >= NR_PKEYS-2); + pkey_assert(i >= NR_PKEYS-3); for (i = 0; i < nr_allocated_pkeys; i++) { err = sys_pkey_free(allocated_pkeys[i]);