Received: by 10.223.176.46 with SMTP id f43csp3260588wra; Mon, 22 Jan 2018 11:00:19 -0800 (PST) X-Google-Smtp-Source: AH8x2250BOPKKDZHpKLfmo/6x4l2nIYQcQPsvY7XFlqCLHJiOz7WLqkKYg1A1o3nMSqeN8T5n5jY X-Received: by 10.36.179.67 with SMTP id z3mr10093427iti.67.1516647619472; Mon, 22 Jan 2018 11:00:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516647619; cv=none; d=google.com; s=arc-20160816; b=kmn3TNaET0xNvjTi74Y0WfPBL7P2O1ihE/eJwNflEffP6A8w3Xd816Tij1d+7aYhgd /gdx09fwY9z3yOV5RE7izgM326DejtAsU8sHY05nuiHL7zVG4c1Qf5AXSCiKH2TFH2vB sk57GAsm6DmITuwgkZfhk2ioXOGMUwMbwZHhzDDz2Lsk67zfyvj0ZKWsjqLYrVoW7w6i tGizU1DLc6uubKARuhh+w25BnDGf8yjRf6r+2D/5x0TBvrmV34GgQfufz88zdFxfQ7yC 6h5SJ7sawnfO5Zq5PUoiuZHdXrqWhjnIoYZKvFzxZn4tyIzWnnWZ7PY8mQktiM5gqPit UI+w== 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=RmAxQc6qgJFMG9zx+ucCq/VxCdY2teR3zKOd74p92fY=; b=Zey4lvHjLZawpDhYA81qu3CltQ+isws+/kShwiKQXusInu2glnPBy7N41+/r/M9A8s iBjoSj7NiGp8McEo1nBBEM8BdEx9JsPUfdkjSJKl1YbZarXKDcw+21iQTD7bh7fLyr8G h9rWSCXMBAvmPsU9r3m8gpcNxSJst/YOhaV/S3mjRSaIiQe3hSIJREOONPEIgNS7XfTG lRw3HgCHopQXGFoZbcWn7swgSrwWiSWPA/HpVTs/Jeram9tQIjFpn+fuwFNOTc2btqNj PVa+BHmsnV1Y7ed159HLitz8ZqK0PZgrdt9Or5v23Cmn2m6b4yJzNd+qqbabCuZFEcCE tMQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=emqYjWUK; 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 y136si13978479ioy.124.2018.01.22.11.00.05; Mon, 22 Jan 2018 11:00:19 -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=emqYjWUK; 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 S1751493AbeAVS7F (ORCPT + 99 others); Mon, 22 Jan 2018 13:59:05 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:36885 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751341AbeAVSxL (ORCPT ); Mon, 22 Jan 2018 13:53:11 -0500 Received: by mail-qt0-f194.google.com with SMTP id d54so23487411qtd.4; Mon, 22 Jan 2018 10:53:11 -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=RmAxQc6qgJFMG9zx+ucCq/VxCdY2teR3zKOd74p92fY=; b=emqYjWUKnhZxMBwglCvMpk8X21RiIHVgR2eE6cbtTew662p9IXM/GPdn5gxp2spqGQ IcTjESODucGQNGJa5IWmYErVOI7GXRxxHGYyiOxurWYfABmawiKBt1yxPikmr6TpVxzR 9/tbbfHOLRwGkCx+N3eZzOYU6GClG3sgA69XaNb4sh0O4mE5q/HWAXCUTOawW9bY2FdO NSWA3dkpo802c0SylH4CWCBCASBgyWiU5XIzFBUZiHF0ADnCyOJAUzqzVUpKb2vJrWY2 f3Nl/FY/vQ5rr/eg3bA2AXmz1R03hkWfUsKrVt1LGrBSd8XWNybcnkak43ENBTQrvPEJ ABww== 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=RmAxQc6qgJFMG9zx+ucCq/VxCdY2teR3zKOd74p92fY=; b=oo87pRMkYBhsUrN2t/xfx7bqUsZf2BbgKhlFr3nw/7Zl82H5bn+TxFDoZ3rgP4v85o UXrOwk80g4mFqAfpWura0HWt7nzOAUrIUMcpmFoIWKFFNVLHmxCTDlyMgQMjGztwNiey tUFNgPPwp0QwMiy43sxpH6QobEigLRvQPJX7C9i69DUdgrLpUHq/BYvHKDzx/Ni8T9Xb ZAPIcwVe6O0JNIQ2IkbKmPABMP5lTgAixJufsPWmSxV7O2KQHXV8R0TtGWWGtyPY8gEy Jpt0DJjfzklOfJu+56xIb6YVSQvZbUiYxJw5tGJpbsM6/9jbihsTclyfEZkH9oUitK54 y17w== X-Gm-Message-State: AKwxytf9lwfDrCFQVfbJClKJhcBAch9uMf7kJu+pAI6j4t/M7TwveHNy Hg5OTRHUQGmzPkVEH0k3GtY5UbR8 X-Received: by 10.200.58.129 with SMTP id x1mr11398467qte.146.1516647190795; Mon, 22 Jan 2018 10:53:10 -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 o20sm10790061qkl.14.2018.01.22.10.53.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:53:10 -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 v10 08/24] selftests/vm: clear the bits in shadow reg when a pkey is freed. Date: Mon, 22 Jan 2018 10:52:01 -0800 Message-Id: <1516647137-11174-9-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1516647137-11174-1-git-send-email-linuxram@us.ibm.com> References: <1516647137-11174-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. 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