From patchwork Sun Jun 17 11:23:53 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: 10468851 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 880946028E for ; Sun, 17 Jun 2018 11:49:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77BE0287AD for ; Sun, 17 Jun 2018 11:49:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C59F287BD; Sun, 17 Jun 2018 11:49:41 +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 CD450287AD for ; Sun, 17 Jun 2018 11:49:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C21EC6B0284; Sun, 17 Jun 2018 07:49:38 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BAD396B0286; Sun, 17 Jun 2018 07:49:38 -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 A6FE86B0287; Sun, 17 Jun 2018 07:49:38 -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 647476B0284 for ; Sun, 17 Jun 2018 07:49:38 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id 70-v6so507942plc.1 for ; Sun, 17 Jun 2018 04:49:38 -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=lRpvbet6lSL/lCsyXybuRVGOUAJrM0vZNCcu7H5WCYA=; b=s+oXruV05Yu5IQ3lu6K4QhNxRsOM2e2JVafqvHb0B71JVwFshtfPJpnBlG2WdxZc2k w0s2dVEGadSaF1ihHWDS/TQvzGhaIIji2WAQIBclg94sqEqcOKgDZD2QBTjl2dZXMaSG NJhtDf9ybswKzbi483s8dr57YPtFLCPNIsiJBEXPQpaFwilPTysP1HmTbhEDiaRZ9Rn0 oC668orP/oO5voPFoPtNdm76ajaH7gnqcdxJqZk2P23Iug/MvFpJto+0vQ6yh4Dnz1oo 0TRivDF+qFhQj5W3zNHSL0V20y6yB/5pux8Y2kd3PeekoRcd1NJWD3UEHpDjBlHr2+Dj 2f0A== X-Gm-Message-State: APt69E2/ayUObBhxVm6YYvOmfIBtv0Ju9WKZUsz74TryEl3FgoRh44MW 5SwWSU9vNv8NgAmmZJqf+VLgkLu+OlKZ0EGso4x1l01ngalPDpNxJgl2KKR88kUdvO7vQRBQngk 5fRkK+01LQVkgH4BNntiLshOOcdXspYr6DCtUQC/dxDtoiU2Gpl3qB5eW7QvTD18= X-Received: by 2002:a63:4701:: with SMTP id u1-v6mr7752010pga.34.1529236178053; Sun, 17 Jun 2018 04:49:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLkvLaEliZuozxBj/ipmh9fUTDVTUPCOgL/BMYXv/KOjk6yWgC6nmpD77RCyOO6OcRQ7MSr X-Received: by 2002:a63:4701:: with SMTP id u1-v6mr7751981pga.34.1529236177297; Sun, 17 Jun 2018 04:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529236177; cv=none; d=google.com; s=arc-20160816; b=joHUdLqX0l210yTrk2RtkGMqb4f1to4VhvjSCBFsf6x01u88psEx8mbWm0yGjCd3/X 8Lv82e40AhSHLvz4Gy9OxMSDEUb5Ivz/RdaHhEMU5tbDPZ+X2hT3kCjBNEj81H9odV1M 2k+cFzzdn3uYF/VkM1mooG+MU3CR2+nu7cInc32apL7+vGQ3AsJfHMUZrzMfJHLP6yKD ENX+/jNJ3MAZQtpxFW7n2w6mJFApf64FMlIbX2rmCfg9TYNmpxVfsN+spMLLXreQecDX 954NnZDCCXUlA6ja5nD9Y9BmJdvm0KUaTW3qOKRiBBdA4Gio/uPlNoUWDKIfk6BZ/lWO Nl5Q== 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=lRpvbet6lSL/lCsyXybuRVGOUAJrM0vZNCcu7H5WCYA=; b=zfDnRDO/7IVyMGPFC4ACGAlgn9WLfuupN61kanyDhamfEP/XvkxosBrOtGMTEHjFyL HtCRmrQ2I8/dACKueWT5BG5dDHtN3YUYYJivmkBso4sJTZhQnMA9phLaqtLO3mZ9nU82 usGkTEm7fvG8JfM4qC1Tx1A61pPPkrWzi5GsxAxmpvoyGm6FpIvaBk5/fTPqESnxMneX mDf+klIfC6SRXYXWSjdFtVYPNNgcpc56IqCW/lzMEuW0FsUmMmSxZc1KqYAhQoxbYTzW zQUzs+pPjZs7iWUVR/pbvaMkZYHfmZBX5jjD8VvB+QA9yneVtty68eL7yCP0bC3KNXH7 hflg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J3uLSf7F; 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 k18-v6si12217913pll.404.2018.06.17.04.49.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Jun 2018 04:49:37 -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=J3uLSf7F; 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 6BFC9208E0; Sun, 17 Jun 2018 11:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1529236177; bh=4wqy7P5A45Q8ysdWXMC3l1+xRHHZ7OsiF9X7493Eq0E=; h=Subject:To:Cc:From:Date:From; b=J3uLSf7FyIgAdS9+4inWg0rJT/JrivVKgV7a9BUcJw9fXuh7wQJECPQ/dHS8IAeM6 hKfElymHXNtNUp5OmylXl/FAaFG15NYh3RZIlnHzdwRhj1ZfgJygUqdw8GqX7azskK 18eI2Vb+yZYlxiN1+o9Ux6vl6KcKuVypKAcuNPi4= Subject: Patch "x86/pkeys/selftests: Fix pkey exhaustion test off-by-one" has been added to the 4.16-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:53 +0200 Message-ID: <1529234633116241@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.16-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.16 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:07:34 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.16/x86-pkeys-selftests-factor-out-instruction-page.patch queue-4.16/x86-pkeys-selftests-fix-pointer-math.patch queue-4.16/x86-pkeys-selftests-adjust-the-self-test-to-fresh-distros-that-export-the-pkeys-abi.patch queue-4.16/x86-pkeys-selftests-add-a-test-for-pkey-0.patch queue-4.16/x86-pkeys-selftests-stop-using-assert.patch queue-4.16/x86-pkeys-selftests-save-off-prot-for-allocations.patch queue-4.16/x86-pkeys-selftests-remove-dead-debugging-code-fix-dprint_in_signal.patch queue-4.16/x86-mpx-selftests-adjust-the-self-test-to-fresh-distros-that-export-the-mpx-abi.patch queue-4.16/x86-pkeys-selftests-add-prot_exec-test.patch queue-4.16/x86-pkeys-selftests-allow-faults-on-unknown-keys.patch queue-4.16/x86-pkeys-selftests-give-better-unexpected-fault-error-messages.patch queue-4.16/x86-pkeys-selftests-avoid-printf-in-signal-deadlocks.patch queue-4.16/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]);