Received: by 10.223.185.116 with SMTP id b49csp1382012wrg; Wed, 21 Feb 2018 18:01:46 -0800 (PST) X-Google-Smtp-Source: AH8x227ZDrfeix1ikLIOcFB1+jYMhyGrdvyQOMUQtXOAFAiX0D8venREUUx7cAqCGWPP+BrgI708 X-Received: by 2002:a17:902:aa43:: with SMTP id c3-v6mr4987629plr.357.1519264906601; Wed, 21 Feb 2018 18:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519264906; cv=none; d=google.com; s=arc-20160816; b=DiSnf8/KmJiuD+QpHD8zbypNLvHep7JqO6oLt1d+fqGG1k1ErdDkpYRPWLJjdWcqL3 PGbZkemC9mFhjnAxqNsQOCv1Fo6eZe/zSYMrWvHM4kRLsWglfiq7akC3VyyBbu6spQQV nqFFOaGqVaIh8uukyd+gEvtznAigygzU1P7fZx/VmGWKNFWNUsjz8FxPH95/Swerk54O CTLWp4zAcQo5Hs6zACAJrQvlwCDDYtq1c/fLL2HepQrwGBTfPUUJF8DMqA4ZRbaL0O1R PsuMoFR2IPKWLn+/IzF6U8Y6ZvcHOhZmkKqpcy1xM38RCz78t95vBJ3R+MhXc1zWOXCJ VzFw== 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=26JLPzSumX9JW1mcwDkQMQyDhS0smrhOJ3Ced5XKZAc=; b=mR4uROYMZ5NXgXaX7+oBOe4EO7G7gd4b3VvOJcAh4+SAnn6GcIi1F5Dz9lzfdwCG4y wE66IZroa73R6QTrEQIumv0XOi03Oc7A7gBbOdv01BNL8GHVDP9C4kZHjyrFur02qWTZ +ciHy2r0zZ+45qpPF6QsrGjxjnzk13EGNvkHbbhllcp9xgpmg7VTFbLJAsZ1hkbrcghc yZKlt99xSByTEkxOAW0xu2zcO6QuN/XXdz3LHl5Dlcwwq4+EW6o7oBPRTbgqAPq9hW2v 3VwAvzl6sCOKTBpP5wfTh5Yc2i+X4zBplFkhVdwqBFKOk7sYjjMsOU9s5PqmtXyi/Kr3 TOyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=aa/oSTTb; 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 99-v6si404288pla.603.2018.02.21.18.01.32; Wed, 21 Feb 2018 18:01:46 -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=aa/oSTTb; 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 S1752444AbeBVB77 (ORCPT + 99 others); Wed, 21 Feb 2018 20:59:59 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:40606 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752034AbeBVB4r (ORCPT ); Wed, 21 Feb 2018 20:56:47 -0500 Received: by mail-qt0-f193.google.com with SMTP id c19so4511939qtm.7; Wed, 21 Feb 2018 17:56:46 -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=26JLPzSumX9JW1mcwDkQMQyDhS0smrhOJ3Ced5XKZAc=; b=aa/oSTTb/Ry9Wg12HRbtKUz0bCNVVCQWB45v82LNpXW2gP3JcYvKNtsg92+BFbq0wG HCR+89YAFd81sWEGzbo+aj80OKxdshzmLsy3pno5hJuB5qgFGBdD7OyzNOGvB2hjigix aVSj3s3/Gi59xFCJLYYrReIDuIL15qeZXMF2loDe5di7V3mV2hkswDkh34GS+5aAhq/1 /mJXFu50Q3u+NjUnZgL9dhZt0TJ45Jfa8VhWMz2932mDlkZCJSX6oOy1rVS1gXJe2EzH J/4t0tp1pDPmDSdcfWBwRQnZEGQj31oQYtPfazYG6JzJFk+ragU3hXOm2elt6ueLUW4W Fg3g== 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=26JLPzSumX9JW1mcwDkQMQyDhS0smrhOJ3Ced5XKZAc=; b=N5Ef5eJdAqPoYlNm25gQHM54hsw3Cl3l00goL7IgVuHT/5x6OvQLj4rygTia+K4wtd cOiChGkV099pyRroi9COJWMX9jhBTMI+T9FdFbNOwCq/zc8zRvHbnSAyRk9RzqCJT3a1 AlwOVVQJtdj5orHg6Y4P9PNLsTSzrJqirtzT9i7fpWLsxQ98ZM9Ukj20AB2Qe9ewI/gs 7QA7bV7li6RLxeaNA22pNhRr7ssZEeu5ZVdwF99AGa7t/cCGk+D/AZMt7D0jBmU7zcpi Vh8xnxU+cNfl9LjqONWGyDEyXCQCF+ja+nzLDbP/fIgWgDicr/4FgoeeOTS6Qn0Fp4t0 2edw== X-Gm-Message-State: APf1xPApb7bwEEvLgbvb3TB5JRxIeVZ6nfcEXlixNGjeZFj/SM/CaiWd rmqgYFHmmaDCQdZAiLYvpEs= X-Received: by 10.200.24.123 with SMTP id n56mr8726171qtk.241.1519264606201; Wed, 21 Feb 2018 17:56:46 -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.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 17:56:45 -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 11/22] selftests/vm: pkey register should match shadow pkey Date: Wed, 21 Feb 2018 17:55:30 -0800 Message-Id: <1519264541-7621-12-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 expected_pkey_fault() is comparing the contents of pkey register with 0. This may not be true all the time. There could be bits set by default by the architecture which can never be changed. Hence compare the value against shadow pkey register, which is supposed to track the bits accurately all throughout 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 254b66d..6054093 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -926,10 +926,10 @@ void expected_pkey_fault(int pkey) pkey_assert(last_pkey_faults + 1 == pkey_faults); pkey_assert(last_si_pkey == pkey); /* - * The signal handler shold have cleared out PKEY register to let the + * The signal handler shold have cleared out pkey-register to let the * test program continue. We now have to restore it. */ - if (__rdpkey_reg() != 0) + if (__rdpkey_reg() != shadow_pkey_reg) pkey_assert(0); __wrpkey_reg(shadow_pkey_reg); -- 1.7.1