Received: by 10.223.185.116 with SMTP id b49csp1378664wrg; Wed, 21 Feb 2018 17:57:47 -0800 (PST) X-Google-Smtp-Source: AH8x226paharNNWfUYzvp1bMTCH7cLtDc0UYhYr/P+DgX3OMlFwJ9+/mkN7HPoGqxubcJSXkH2TE X-Received: by 2002:a17:902:34a:: with SMTP id 68-v6mr5067501pld.276.1519264667584; Wed, 21 Feb 2018 17:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519264667; cv=none; d=google.com; s=arc-20160816; b=gk0pr0vuH2ttqZdEwDFOroS1MNVCZNy5IcVejITCeZI3x35LzFRtLky+kBYHjt7/Il XIaYsYXpMDFyidNVpB+bI1aWEdeOyEixKW8gDvwcJfgwObNg8ddDAssIY8igkdeNsU+x PfScj4SsOEFC1kmkGIqFsqfG0OMH+kGnsU3BvHWfG0GOrynbdmOCw/r4uLCBZIrvkXsM V1bARTLuvaMrLyPnkSjg+uuOxGcq4zqYWc9b9qNHdoryfvg0crxwBEVTfgDqhQwIGDRW o0QlcYypWgU7feKkXLE+QDD6KYAwaMUfvkKraa4P9t4nDGcyfbvvYPpkoEOuYSKTuy/W mDQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Hnp4iH9HQYBbILP4S/gbtnfjR/HzlOVJS4AZFWP31UA=; b=FVrk61QnQojqJQ9mqrKvhj7jum/UUg9v5k1I2PgHSuirK72+Nx7Ii1hLHs3cNdgRf7 LCBWaJ49un8cd0J9wcVlxHaoqYxRJdcCSvU8VrPZ87xoV7nES2MCg+bZcKoX/+gk99j+ tH1NnTV8CPVZ83+s7Fb+uRwCqJkFR3SeChQMn1PIf5H+R3xCD3H8MFvA5FPGUxi5coYj hrj7t+JQISlF3Gqf5qkY71JT8CP9GeBDib4P6eFPjCwsUXOdIHYlHovNU3g9Qrt+vcfS wdl4L/JdUyfWTgbyjUB/ZAMdu3u5bazcZumnaRHMQT3j0kL1+C6O1YD5mxjXThEGrfI/ PP3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hgeF4R2f; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si716976pgp.701.2018.02.21.17.57.33; Wed, 21 Feb 2018 17:57:47 -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=fail header.i=@gmail.com header.s=20161025 header.b=hgeF4R2f; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752018AbeBVB4n (ORCPT + 99 others); Wed, 21 Feb 2018 20:56:43 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:44187 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbeBVB4i (ORCPT ); Wed, 21 Feb 2018 20:56:38 -0500 Received: by mail-qk0-f193.google.com with SMTP id v124so4611022qkh.11; Wed, 21 Feb 2018 17:56:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hnp4iH9HQYBbILP4S/gbtnfjR/HzlOVJS4AZFWP31UA=; b=hgeF4R2f1CgUe7281z4JqJv0oZcKomJhsk2dvmGqv3kq5ohFig48KMymYSKMnxBbmr n921/awI3ffKlVcfvwxqbhTMFcNRvODkvkGjsF+3U2vJpvb/atuJ8FQnEql/a5E1UH4L ZJmu9hxLE4GBn93OBKV7JoteGG8GBp+RWNJOirJsGwjcrraXFoUoeQHfvtEuypJ7mf3d 7Y+3bQbkD0d1Ez3HBudrEbcbupuLs2boJQqEXuhRkiHNNBV2WWXu0up7rewUPBRF6C8g xxIfGuXBFbaxrfaNc2MzzmqRhBE3g/quGnSuEqsvEs9RtSSy8WAhRo4KrgQkwBClKk2r 8FGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Hnp4iH9HQYBbILP4S/gbtnfjR/HzlOVJS4AZFWP31UA=; b=n8Kwet0bP0RxY8A9ncxiPHsG5b88pLu5tLsDvgrt9GMzRZs+W1lUAgDqRpLOgmzejU OWUG4sJhNDgYP/eHkLHDyfLna2kUnPSBaWOXaNc3zrE9+Ri+qNdoXSLIZAnIdi7MT8bc hjuqgSrwBKjUacfpGCYCe+r1JA+8L0SSkgF84YNYJiin3uEppTYc55Uvo2DB69nFWhhs 68Flt7AlH1mSlYgQ8kRsC21VRCGO3ecn1LSfz4+g83EPnTq/DtKkiLBuzIexkTF/UX9Y RNVryE3avnGhAr32bKPIsTpahVoBgQVK0SELs34x6eggKL4zspGloBkYAwA9iK/74s6d 68FA== X-Gm-Message-State: APf1xPAzXYj+1SU4pVTaCQY1DrRsr+AbpcT9koLgAzo3nlhNYeIxNUQr LPShRNqDYPIdLZwP5ItULgQ= X-Received: by 10.55.113.69 with SMTP id m66mr4095396qkc.84.1519264597444; Wed, 21 Feb 2018 17:56:37 -0800 (PST) Received: from localhost.localdomain (50-39-100-161.bvtn.or.frontiernet.net. [50.39.100.161]) by smtp.gmail.com with ESMTPSA id n29sm14182630qtf.18.2018.02.21.17.56.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 17:56:37 -0800 (PST) From: Ram Pai To: shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, akpm@linux-foundation.org, dave.hansen@intel.com, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, linuxram@us.ibm.com, arnd@arndb.de Subject: [PATCH v12 08/22] selftests/vm: clear the bits in shadow reg when a pkey is freed. Date: Wed, 21 Feb 2018 17:55:27 -0800 Message-Id: <1519264541-7621-9-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a key is freed, the key is no more effective. Clear the bits corresponding to the pkey in the shadow register. Otherwise it will carry some spurious bits which can trigger false-positive asserts. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index ca54a95..aaf9f09 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -582,6 +582,9 @@ int alloc_pkey(void) int sys_pkey_free(unsigned long pkey) { int ret = syscall(SYS_pkey_free, pkey); + + if (!ret) + shadow_pkey_reg &= reset_bits(pkey, PKEY_DISABLE_ACCESS); dprintf1("%s(pkey=%ld) syscall ret: %d\n", __func__, pkey, ret); return ret; } -- 1.7.1