From patchwork Sun Jul 16 03:56:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 789042 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x9FJL3N2dz9s5L for ; Sun, 16 Jul 2017 15:25:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YyOm+BZ8"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3x9FJL1x6PzDqny for ; Sun, 16 Jul 2017 15:25:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YyOm+BZ8"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3x9CPC46rczDqmw for ; Sun, 16 Jul 2017 13:59:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YyOm+BZ8"; dkim-atps=neutral Received: by mail-qt0-x243.google.com with SMTP id w12so14717232qta.2 for ; Sat, 15 Jul 2017 20:59:59 -0700 (PDT) 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=jqAbSap/TYGBWsX7G44S6i7izsNyZlez4P1OV9M1q44=; b=YyOm+BZ8gNGM7kSTIX3h9SdSEvdFqlAM8m7IHUfDUHHVzgMb1FsEe5OGifUpqvtlo9 VQk9SOLNA8OVIg7ljoXLIcAstM4k99VaKeUiyJGQMjT5bF45uNyiWT19hSVUfAu6EMe5 umIzD/TvNpZb7PnKgBoJ6h1Lyy4WQFHp5u/LGsxJbtuJFc5S8sbV8ctV/f1+8SX7Ggfm VYBEl3zL0T8l43YpL1UFQM8XgCoKXmyfsJcRayJUfnQVQT3xqlcm+4w9h05LPKdX+3Gm 6w6plu/ZjsFtujehx2Q61XBMtHeKw79oIu7r2yXvkyrlnnoxRHyV8VKz03rxnUJHJnBb mAaw== 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=jqAbSap/TYGBWsX7G44S6i7izsNyZlez4P1OV9M1q44=; b=fZSJ9LIOr8j/v2cYs7RTOeqgLNnClGztEPSWH1z0zyhP8flDeqfgdfcYwHxvtPBFNp 24m5/sQvmlbaAchdVZQOiGtbo3p9yBiSVFMADyRjTjm5ErUunhH3xzzUg7cNT4iB3TaZ P6xPm5MAVo9LHda+s+lWylrapOfLgylr5dLjaWENGXusOBZs7VFB9htFj+TlYCAjb74w c8mkAl/RUkoGPpwoE03hesUDFL60Bc2XONr5tih3nQa5PJ35lZrcusTa4TleoE6dg5sO yiq+ZbQC5OmsZThXfJYtAUhCy18JvjVerioLUsvG7wrbUo+LJRAK59NXpWqJMjuzdrv9 mb5w== X-Gm-Message-State: AIVw111MWzJSEXMPAnRWMHNUToBPAwWEVmWXd+kFQkyCrpTxumxsu1Ny R1z5uVzKVM3jjP+uwEw= X-Received: by 10.237.52.161 with SMTP id x30mr21157530qtd.55.1500177597619; Sat, 15 Jul 2017 20:59:57 -0700 (PDT) Received: from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net. [50.39.103.96]) by smtp.gmail.com with ESMTPSA id q46sm2290345qtc.54.2017.07.15.20.59.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Jul 2017 20:59:57 -0700 (PDT) From: Ram Pai To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [RFC v6 47/62] selftest/vm: fixed bugs in pkey_disable_clear() Date: Sat, 15 Jul 2017 20:56:49 -0700 Message-Id: <1500177424-13695-48-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1500177424-13695-1-git-send-email-linuxram@us.ibm.com> References: <1500177424-13695-1-git-send-email-linuxram@us.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, corbet@lwn.net, linuxram@us.ibm.com, mhocko@kernel.org, dave.hansen@intel.com, mingo@redhat.com, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, akpm@linux-foundation.org, khandual@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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. 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 b2d7879..0f2d1ce 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)