From patchwork Mon Nov 6 08:57:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 834605 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 3yVq6v50fnz9ryr for ; Mon, 6 Nov 2017 21:48:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZLpxesTJ"; 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 3yVq6v3tDCzDrK9 for ; Mon, 6 Nov 2017 21:48:55 +1100 (AEDT) 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="ZLpxesTJ"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c09::244; helo=mail-qk0-x244.google.com; envelope-from=ram.n.pai@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZLpxesTJ"; dkim-atps=neutral Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (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 3yVmjL5YW2zDq78 for ; Mon, 6 Nov 2017 20:00:06 +1100 (AEDT) Received: by mail-qk0-x244.google.com with SMTP id x195so4397271qkb.12 for ; Mon, 06 Nov 2017 01:00:06 -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=D1bW2Jji+c5cCyLY77a10WO2VGSNe/C5KRW6ZQ/QMtI=; b=ZLpxesTJseqNssMhrCHjmrFB5rslXMDY1YRB0KGI0tAVy4xfZiGS//20l2ldWbE7T0 IwrJs/1hDDGXsXriQIE1Wyt1SwSZuRnXrz8MOT9xF+rHeSX8LsFY+yLg+FotcvOQG97E jPjp9VsdtiVJ6I+1+HncCPlxhPx7raKNZNn+z0fPNSwl/+M+Hs9vj6l4+TMTGU9KNXmm O6pPUc9Dds/DxA273ORHPWbpgd5yB1dhV4KqyGGZTEEsIIQyF7QbCo9pseDCbZtSU0qt nNzg9Nb4FLDgHrQC0xCKZzh5zDcalpAuVbp6hkUiy88vMtg1DUVa5v2L13UH79F9aULb hV2Q== 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=D1bW2Jji+c5cCyLY77a10WO2VGSNe/C5KRW6ZQ/QMtI=; b=N3SsVgb4PQMSGc/QO6ck52HZqxP3jyzDyaZy0tAslR4VWZrVEoI6aU0RqNi78BMTZw K5uCovbdpt2Lgy3OMGbXtNMmKdy8/HQaMY8D6CM5YlilmZHkKMZFhB0uBgpRF30NGFmQ 3lxyD8TDBjaOGRr03EV3cLO0TNl6+aW9qjr3Qr/7/B2ZEiRGpqNqysIVsw6z8maYUK5J F0mCkd69tPkKIylDA5DQmCM0fuNCZsKvEM2E43ia6L9SnraLHm8AWYGX/QdQP9E9W079 Nhv1NsWHfINIvj1tKOlQ2Gx57jLfUYbJ7bz52sB+Id1cmeQHZjO5ThJacvm7fo9VYkqV f5hw== X-Gm-Message-State: AJaThX72KC0udrprwkm1dVuIf9dpYb0TTbmrS184siahFjEA//kbiJxa fcuLBddAag0KFs3JWctC+Dk= X-Google-Smtp-Source: ABhQp+TiefTk1gtrvNKp+elR5rNYdh7391L/sWRhoH7yDWwXYDFT86YG/JjzQeY1Z6YiQMq4kszfXA== X-Received: by 10.55.42.75 with SMTP id q72mr1346115qkh.57.1509958804665; Mon, 06 Nov 2017 01:00:04 -0800 (PST) Received: from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net. [50.39.103.96]) by smtp.gmail.com with ESMTPSA id r26sm8001094qki.42.2017.11.06.01.00.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 01:00:04 -0800 (PST) From: Ram Pai To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de Subject: [PATCH v9 38/51] selftest/vm: fixed bugs in pkey_disable_clear() Date: Mon, 6 Nov 2017 00:57:30 -0800 Message-Id: <1509958663-18737-39-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> References: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, ebiederm@xmission.com, linux-doc@vger.kernel.org, x86@kernel.org, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, linux-kselftest@vger.kernel.org, bauerman@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.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 5aba137..384cc9a 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)