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: 10463075 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 CF82F600D0 for ; Thu, 14 Jun 2018 00:47:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2E6528988 for ; Thu, 14 Jun 2018 00:47:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6FD428BAC; Thu, 14 Jun 2018 00:47:20 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6071128988 for ; Thu, 14 Jun 2018 00:47:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF0B86B026D; Wed, 13 Jun 2018 20:47:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D9F746B026E; Wed, 13 Jun 2018 20:47:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6D8B6B026F; Wed, 13 Jun 2018 20:47:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id 97EB16B026D for ; Wed, 13 Jun 2018 20:47:03 -0400 (EDT) Received: by mail-qk0-f198.google.com with SMTP id w203-v6so3536475qkb.16 for ; Wed, 13 Jun 2018 17:47:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id:in-reply-to:references; bh=1F1c8MwqE4ydAwBXz/KrkKyy0nq0RWNRyOBZbicYdfg=; b=JEYlzebYmYo/TqB6eJNmHJUtBHc3FHYWyYe+3WyLIs45ONSKZFM+AxrTbvjN/dybb5 0EySdgtW+vSaPRo/uoGgcP4vOE9TOffMA1RuAX1uIk1ZEQyEBkvMxHB09+DJ+jue9BCd daHDQ156qgAjLw5d2TLMZ6qP0cvY5fh/aQFJ5p5FdGZLHSa2P3MExGncwb2t9lgiSZYQ saIFFGR52jvXvD6YdMOkhNRvJvnuRl37ibLmgAp6pqCLCfefYMo9QMJxgWNSFmvRY2Vr u4t+1gfp3e57ygehsqEoVmSeQq+NRnhUUVFnFE8s101yHE5uwxR02qZAUTFZ2Nt4qqcq 0tVA== X-Gm-Message-State: APt69E2tWGxpMO9FnqBhzny6ITdQuVEM1NbuNgnuEni3HAgbHE9E4MJr bock3hH9mYKBXrS+XYoQgIcCzgmtMeXWJs9iVLNHf0WT5zy9Ci8Z7FyEuxjJyq96kkwKrEneTZv clUkVQMh5/tPHUg2Q0Mf/LS5cQmC77iC+OJMT31PURvr1rxCOZ7ngzkBPr3844bI8kHFLO8tMSN huJBacUjpuobmZ9drmUo8jVd4JfFJ+MjpD1NJPqAq0SP1v1KAmFUpE8qJomNR1AkdhD1IwX2Z97 dX8TTu9qTUHE1SZudTPtNZyzfnurF6Jd4lULFvjOdtGFOpphsP4mIlzzVJYCpxZcV13V3P8gEug NQriQHp55KfqjYXB7MVnPatUQUKuHY0Ipzy8+CHRWDk4xF+lcxwFufivWh4ewCbLZK5rcCVZQQ= = X-Received: by 2002:ac8:2238:: with SMTP id o53-v6mr359066qto.355.1528937223429; Wed, 13 Jun 2018 17:47:03 -0700 (PDT) X-Received: by 2002:ac8:2238:: with SMTP id o53-v6mr359039qto.355.1528937222834; Wed, 13 Jun 2018 17:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528937222; cv=none; d=google.com; s=arc-20160816; b=y7qe9EOmC/HiRN0a6/VlidYSfoY55rB6LWX3k/ZbWai757jtMoaZ4BsZ+WkhZI/IrW l5IxD/UR36+Cv1C7GqC3eqOk+QJT7GFldg0Md1NL4LLHkjbsDt6urTljHLzN9nGsfG0K G06OqmZ73imcCNz5enPbZk6Ox+Cz9fQ7slcf+0XeFckzGCgUZa/eRngBIvPee/kWNce2 UbVY+nNSFN6A90+DVJU8xS6QkaWFE99cGE1ijec/Z6BPtpVl9SXfEPr8xtqGGOx0qECH gWvHkLfGtcty9NTLpNVZcBn0/T0S94Yc/kIR3sLrMc4yZD5DWpvd14PGs7anwBRfPv02 Y46w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature:arc-authentication-results; bh=1F1c8MwqE4ydAwBXz/KrkKyy0nq0RWNRyOBZbicYdfg=; b=HVOLh+jD4/87OWrSYz5P7Mlo3t8IrnlKttHevpcsQM8G3BmyMlk4h0dF+yZ1fX6V7u rw5tMezcxfA/MmQtB0ekCAsiUjZnf8bSwhpzePnJhBk3M5et0ubvlDGFrsBJVuDb7Su5 9NShUpPnXCkmkm3roNNIjhimQzAUvvUBHWo3sP9yR1z3rNhk6UoZJrRBzus5IjeihhRO 5NtvoOpNRFhhazkfuQIFCnRpNw8Mrrxd3+nADUofyvDTfIZITvMzgbDyFaKCcIQ3noQz Dgm3O24ceOYEsXMj9+HP0Y/UXBIe/rxxGWu1HD8sg4CshudejxliMC3FIldf7t5ga1Kb FQKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jlmGrYbq; spf=pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ram.n.pai@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 6-v6sor2266707qtn.115.2018.06.13.17.47.02 for (Google Transport Security); Wed, 13 Jun 2018 17:47:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jlmGrYbq; spf=pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ram.n.pai@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com 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-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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)