From patchwork Thu Jun 14 00:45:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 10463045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86986600D0 for ; Thu, 14 Jun 2018 00:47:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79E9F28BA7 for ; Thu, 14 Jun 2018 00:47:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EC7D28BBE; Thu, 14 Jun 2018 00:47:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A0FA28BA7 for ; Thu, 14 Jun 2018 00:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936027AbeFNArF (ORCPT ); Wed, 13 Jun 2018 20:47:05 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:42991 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936014AbeFNArD (ORCPT ); Wed, 13 Jun 2018 20:47:03 -0400 Received: by mail-qt0-f195.google.com with SMTP id y31-v6so4265968qty.9; Wed, 13 Jun 2018 17:47:03 -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=1F1c8MwqE4ydAwBXz/KrkKyy0nq0RWNRyOBZbicYdfg=; b=jlmGrYbqx5bOPc96bGGB82mykhJw7IsD+8UYE1CUAyhE6fCAeTmWBMeFDXgGtW6muV YoFutY/eoXd2IJjoXvt7LbPuJ2Qc3gjK9IlB3LCz2hIMvLEKSuG+KEOyB9ZLfxgOywrK V7/xnTgshOW6D9Cy18BPoniS27PBsh41PthJ3hBds2xc40FVlt8uxrsuxIX6wAOeHlY+ nhMtq13tyBwrS+GcgEN+mjGjNicfqDyQ7njncm/ZCYja9yRcJrhU+n1WP/9IocAa97NA I1eo8CbPcUrCmLIoN00Q0K3XuJzyztxPevzJWozyFC641TWQrpw5lHA+QDNfPuH1mKT/ iK9g== 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=1F1c8MwqE4ydAwBXz/KrkKyy0nq0RWNRyOBZbicYdfg=; b=Dgp7GxbdzhxYkgBOYn65p/+Xl0o6Fj9lqZHuDVdyqx9QhUZiHZNSiiZyDA6cSAvdAm wyW4evo7pXeYYpg27dUK8IuROgEFEMb0guxVLgSkoQ86I9HHDH70MPRXgEPo5X+BPQ34 n6/9BADTGYVdhss3A6o0xlchnNYJOD8a7uXlto6J75PQLkol77JA4LJpTjP3ROD5pdNo iCb2Ozm1fT6Jne22Irf8pLJ1WW0Wu3Hc3df961YZ6OstS2XUQ0aDkmQy+WB50XM4VHSb drqTuJIRiGzcv7v1XOo91hXXzE8QJSvNWreXUhNWUx7jwP8GlPAL+lFQeucCb8byNBw0 aDZA== X-Gm-Message-State: APt69E0A1dQeOmRBPwl6hY8vwV+zEm44ybHt8oMw8C/kIV3C/m3erFsr 6208Vlbs49/cNdjjZF4hDhk= X-Google-Smtp-Source: ADUXVKI/bR5M7FelMVO0pjYptzxAmDzDgDj0WX6mjH5tXqM58D5Z3IOrNCOPZE1wpBQh3X+LEF0O4Q== X-Received: by 2002:aed:3966:: with SMTP id l93-v6mr386596qte.220.1528937222661; Wed, 13 Jun 2018 17:47:02 -0700 (PDT) Received: from localhost.localdomain (50-39-100-161.bvtn.or.frontiernet.net. [50.39.100.161]) by smtp.gmail.com with ESMTPSA id u31-v6sm3225898qtc.28.2018.06.13.17.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 17:47:02 -0700 (PDT) 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, mingo@redhat.com, dave.hansen@intel.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, linuxram@us.ibm.com, fweimer@redhat.com, msuchanek@suse.de, aneesh.kumar@linux.vnet.ibm.com Subject: [PATCH v13 09/24] selftests/vm: fixed bugs in pkey_disable_clear() Date: Wed, 13 Jun 2018 17:45:00 -0700 Message-Id: <1528937115-10132-10-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1528937115-10132-1-git-send-email-linuxram@us.ibm.com> References: <1528937115-10132-1-git-send-email-linuxram@us.ibm.com> Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. This hasn't been a problem so far because this code isn't currently used. 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 5fcccdb..da4f5d5 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -433,7 +433,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 = hw_pkey_set(pkey, pkey_rights, 0); shadow_pkey_reg &= clear_pkey_flags(pkey, flags); @@ -446,7 +446,7 @@ void pkey_disable_clear(int pkey, int flags) dprintf1("%s(%d) pkey_reg: 0x"PKEY_REG_FMT"\n", __func__, pkey, read_pkey_reg()); if (flags) - assert(read_pkey_reg() > orig_pkey_reg); + assert(read_pkey_reg() < orig_pkey_reg); } void pkey_write_allow(int pkey)