Received: by 10.223.185.116 with SMTP id b49csp1382641wrg; Wed, 21 Feb 2018 18:02:29 -0800 (PST) X-Google-Smtp-Source: AH8x226NfmNnp9wmNa0qgOKprw5OlFvfsKMIKd3FT07UCLnUSWnFfVh/XPRnUtMmZ8YJ0xYmbxQC X-Received: by 10.99.99.66 with SMTP id x63mr4354078pgb.421.1519264949225; Wed, 21 Feb 2018 18:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519264949; cv=none; d=google.com; s=arc-20160816; b=hL+qQSnMgELdhk1tPJlBHjgAf1zty1c+4q4sU1wBTR39bDaaP37rBSKREIHDt376c8 t2XzAhPBZfrPXRYdbaBtzq1zmmDlydzQ+ZmfDreYFZkoXU3/fQ+n5gp+CvZgnyf5vCLU FOpeqvFZwy5v4l4OLnDDutRMFgazlaky9fO4L306zstH7CA4MgJDxEGH8z4GEQJ4mBQu ZLt37uscitxnWqwWGOsTxbmwg1a/sSaJqPvu72yWr+bcLCipUug9W4R6vMLP+4pmU65b lww6vkTrpNjw3agFL8VBn/+YrfTVYaO64jfLTphkHAYZJBuoTT9bXFCI6pf2LXl/RXOQ LMAw== 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=Z9x08ke5AC15mmgCuLnzCj7O+Z8bftzisBlAAitmSGs=; b=KJhAKO8SaTeu/f+sZs4yLuWDNpAs+viB5BHvjtdkRQ6DY0Uq6htQ8zrb/4krjSRP8a Mq5AgVJWF+E2r5F00S41kIUZjSj/KEZOTcmUI8R+lN3jPt7GGlwVVLCaei3xWDYecdUO 8ReCTyQ8rOGAzhwDp3fS/T3BZYn/iaOCCRlRCxL6jb9HnymTtcxKjUvC+WgNqu0HYqgF 8TSuMsjbHS8kpr4NS7w7FDtOEmpV1KYpTmCHqO1p+RQsT0F7xiRgtGlqY9OFWI9wGNCt 47iv4HK5omGWZign1yCJGECMftsE9mE3v75NttrZFPgzXEx11ERGL+cAuJlVZbk3XSRv ObHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=D+MBVQQL; 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 u36si1936178pgn.702.2018.02.21.18.02.14; Wed, 21 Feb 2018 18:02:29 -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=D+MBVQQL; 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 S1752328AbeBVCA4 (ORCPT + 99 others); Wed, 21 Feb 2018 21:00:56 -0500 Received: from mail-qk0-f195.google.com ([209.85.220.195]:44184 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751798AbeBVB4g (ORCPT ); Wed, 21 Feb 2018 20:56:36 -0500 Received: by mail-qk0-f195.google.com with SMTP id v124so4610909qkh.11; Wed, 21 Feb 2018 17:56:35 -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=Z9x08ke5AC15mmgCuLnzCj7O+Z8bftzisBlAAitmSGs=; b=D+MBVQQLgOnU7NTDYSMTm9DD3CmXlwB0KDDupxrsJjLomeplo5KunZQVh9lVWcmt3V FCzNIs5G1vipY1y6HDierWT++YOQF1xmcYwADIRXiBDtI9wC0BW0sNnLVp2/ttkXd1I7 pmDfXR00QY0IzopodBWrwBlQKyZtP77P0kPfw4Qu1xOyncu2k33kqro3novMaaoBqdn0 i9oMAu737Zth4Q4haUdy/KmWZ9hm7HbkgQvsVNI19+Hl9nUh0877bHVAFlMMrwU0jxtc k1100tUdKwF4YXvcgaLHQvCCRdY82Bdbyl4WbDKETgDPTvc0OcN+idArATdt9Z0Ze/uG BZMw== 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=Z9x08ke5AC15mmgCuLnzCj7O+Z8bftzisBlAAitmSGs=; b=qUTrYjCpbg23vnVIJKYYX7USyiXMaGV8JKRoh/uhdTxOe6Q7NvfiZUMdc0f7BR3CM6 VFD3VAaqXBsxaQhDmyWxhd/PSWgAuU79x5vmK32I1p2whWFAiJGsaT04XD2ufBEq6UKL XKy5GlpBXtOu4HBgce/+4yIpi15e29qcDIKf0JYdb/qrL+DWkBXWV6rUuQ2BTCMG6PHL RlwJXg8lQQipWNlToaFGGQzFX4nS7AKiJ26mEQD25ufsgx783+xvGy6UV9eiRmOLeEml tEBk8Dt8jYKKEfb3rlZDxiz1aa2SiNM58j0N4Oyn6LN24x3j5yTHI5fGRScktv7OLLTC QFsQ== X-Gm-Message-State: APf1xPDaqVsPeywV+Ezri1XQVPb26t0VMSply5kgSNfO8VhwiFtIhcla K1xK96Zu/y2t8x/OyZwqvUY= X-Received: by 10.55.138.2 with SMTP id m2mr8233789qkd.59.1519264594842; Wed, 21 Feb 2018 17:56:34 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 17:56:34 -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 07/22] selftests/vm: fixed bugs in pkey_disable_clear() Date: Wed, 21 Feb 2018 17:55:26 -0800 Message-Id: <1519264541-7621-8-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 instead of clearing the bits, pkey_disable_clear() was setting the bits. Fixed it. Also fixed a wrong assertion in that function. When bits are cleared, the resulting bit value will be less than the original. cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 0109388..ca54a95 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -461,7 +461,7 @@ void pkey_disable_clear(int pkey, int flags) pkey, pkey, pkey_rights); pkey_assert(pkey_rights >= 0); - pkey_rights |= flags; + pkey_rights &= ~flags; ret = pkey_set(pkey, pkey_rights, 0); /* pkey_reg and flags have the same format */ @@ -475,7 +475,7 @@ void pkey_disable_clear(int pkey, int flags) dprintf1("%s(%d) pkey_reg: 0x%016lx\n", __func__, pkey, rdpkey_reg()); if (flags) - assert(rdpkey_reg() > orig_pkey_reg); + assert(rdpkey_reg() < orig_pkey_reg); } void pkey_write_allow(int pkey) -- 1.7.1