Received: by 10.223.185.116 with SMTP id b49csp1381164wrg; Wed, 21 Feb 2018 18:00:57 -0800 (PST) X-Google-Smtp-Source: AH8x227m/iRrkiFTq3OOONQVZOuOKETI4t9s5jPBFZKj92fYzzi7OnQHrRquvcjDys9I8ZXTe+m+ X-Received: by 2002:a17:902:a588:: with SMTP id az8-v6mr5077929plb.10.1519264857366; Wed, 21 Feb 2018 18:00:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519264857; cv=none; d=google.com; s=arc-20160816; b=LvYnIA15Dpd7al35PYjPB4TTSfOHDo43Zt2+R1FVnH1cHBhPg8mt7LsC87DJoBSFJm 1V/mSldntBBllHUZ9VnenOcH6+1WYkl0qX+zVmOwwnQ7pkgquQ9PNGcn/1DFH6jsAeeH DhxoRkfVoKgdiqMkVOnbSNyoxf1QfPBwFMOre/DcvdJ8tf0d01bKEFkL/dgusH6NzDKb g31vTp8i7Am6sYpYsW0QgTdK4YJkIt1fg1HE6fr/2MZ4MtGWmLgF3sWXhz6QHu7w+mYL bYZOaAPyJmOUd/sHyZo97+aS7O7dSGFSK9lST+PA+5D7cJnmEFuV0TI7ULfH5A3HcFIn 88Qw== 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=pVXof952unrEX5OZWG7EovzxlbRLAhTrnbYTLlTuZ2A=; b=OQIDcmZUft1h2y+d6ihlSRQICsE9k6zuGX8Yh06C3HnMPnikBhtO5l8Tuqcg/iSqXW tTiozd62D2vtCkcXsJPvSLLCv3zW6ZvDsPfA9waOOwaf5i2KCJA05r4NDtJR3UntL7Dy Ig1yjbpw2SUxVeEPCOMADx9xXvBLJobcT2LeeSDzqZgGk3340GSJ9Ri9AWsm2HsCJ759 lSdMDZkfQY4MI8DHStlhhDspI/dlv+c45pVbg32hoD5WCLliafgtyOOEsO7Ltz/JxLY9 yv+cUFy8ed5srqab+h+jb/ClCSvAL8J4KIBuKjtzuGnrbMshRdRUu0yVDHoQD+sI2hMx 863g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=SzDM2T8V; 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 u69si6677830pgd.619.2018.02.21.18.00.43; Wed, 21 Feb 2018 18:00:57 -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=SzDM2T8V; 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 S1752283AbeBVB7f (ORCPT + 99 others); Wed, 21 Feb 2018 20:59:35 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:34630 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752099AbeBVB5J (ORCPT ); Wed, 21 Feb 2018 20:57:09 -0500 Received: by mail-qk0-f193.google.com with SMTP id l206so4652058qke.1; Wed, 21 Feb 2018 17:57:08 -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=pVXof952unrEX5OZWG7EovzxlbRLAhTrnbYTLlTuZ2A=; b=SzDM2T8VwFUNsFrOln2tZmCkvJ1CB8nVH+BucHLTsDLc82xUR9ehAN+f8ZzpvtRo2x 4c7fBAlgb8wK3fDHMFWJlmFHLJgSD+BKQF1yeWdAKjESoD55cRDilcXOhjfB/rWIIv2L Xhmn9i0+X+1WF6yEqs/XK3kUn/50dPRZiroe7/n6H+hjozOIpa4tJdEp2LS/QOzmI1sH SZDST5E/sj5caO89OTk/sF1gq1A/RjR+58kUYNxEjdH7eTDxm+rEdEPjsQ2zgxS6Qf2A LpVdtaqUqZTvOuy/WZJAlkJpDFGrxKZElbPf5Ki8oWA4sTplB6pR9z4xN3R1ibJImWGW DeIg== 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=pVXof952unrEX5OZWG7EovzxlbRLAhTrnbYTLlTuZ2A=; b=LM/dBxXA3G/JiIgRGaz0/hQSfp+22sEw036e6txu6qlxncRfUaZVZl7TxU7zzps/fh +rkDjMZzl3eT14wUpYBPIF+hyyEcAcYTdPVR3pvKrkPFnxqG4ZDqiyrXfy0tGwINwBX7 XQtPMcXGqPUD/PtGkm9lwO11AOTUA/E/TS/GETxu54lhPKXMgYX22CsTX6/TW0cGADX1 Tdh95pjQxxArSLxTHCSWoO0R+F+AScoSt2tB60plYkD3wmUXCnbjUBLdCExqK/ZijBUB dvVu9FYa4zAyiHL5oz3KWwjrGaklNR6S0TfWijXH1Kxygv6DLeA1RibCSyKDhJPbamta fQtA== X-Gm-Message-State: APf1xPC7yUeLN3rxgWYOPwKIkNQR28OGqEwp7MRd1lZBa9Dxdwmdc+IA 71v6XF2VgmbdSSGSZ6EHVn4= X-Received: by 10.55.3.66 with SMTP id 63mr8007198qkd.283.1519264628604; Wed, 21 Feb 2018 17:57:08 -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.57.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 17:57:08 -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 14/22] selftests/vm: clear the bits in shadow reg when a pkey is freed. Date: Wed, 21 Feb 2018 17:55:33 -0800 Message-Id: <1519264541-7621-15-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, 2 insertions(+), 1 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index c4c73e6..e82bd88 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -586,7 +586,8 @@ 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); + shadow_pkey_reg &= reset_bits(pkey, + PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE); dprintf1("%s(pkey=%ld) syscall ret: %d\n", __func__, pkey, ret); return ret; } -- 1.7.1