Received: by 10.223.176.46 with SMTP id f43csp3259496wra; Mon, 22 Jan 2018 10:59:12 -0800 (PST) X-Google-Smtp-Source: AH8x224Cc10uiL0qDwxeiTYHL3knRJUSG+dRfi3k/Be3utthA66i6McTJxUwBzHvfjvdzPnp3nMA X-Received: by 10.36.175.79 with SMTP id l15mr10106770iti.8.1516647551980; Mon, 22 Jan 2018 10:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516647551; cv=none; d=google.com; s=arc-20160816; b=DfV9Hq3Bl9GzcD83N0GOXDAETc/naPU1n175KmMeaTvL0QrDh2xd1XYH4XRDHxwwaD jEMqwCtWwg2z7Tq2Fp9Nq5/AZe94R0sZYrpS0RF2IIeMe42yeo2I0ii86RwUqigo14J7 R8VHH7f/UPPSb5XcWHGyBXezbg2tYyCXDAd4BQZ9JpB4bgX5wGULStuDgLd9bC6N4FVa n8LdJnz0y59naPCyXElB5h7696uI3hEMfWtrgNm9DqMFC75VAhFRUvB9cmNfM0plV1w7 Ah3IJTa1Km0L88/rZgKhvw2K1+cehOVixt4cQq7IKyXkS3yVw96zpATtIx+Z1FvRKXOD 7KqQ== 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=/fQ8YvZUz/rzjD6Jd4exWFMmioMtz/ybDgAlTb3OwFY=; b=yPABpGOSnfCdJOMJZFEXKyPSRCon64/MSf28wo2xnQMk+NrMJexicl0qR/NVvabh9b WBfyKmTHtCPlLCDIn1iJUz4X+MtqfS0QQGgddV+GL0UvGMfHSpqkovz8wEG6LjDAbwGG NNSKF6IBPUuPNe2tPjsWsJb2C2qRmYNcSI6K0Be4PiV2KnTpFPO3Wy8qG5odzHCb9+Q1 O4t1tc/zG5FWbsifADUuclrWtbGMhxiwTH7AszjJ8mO4AygjpBIh75WyR+MkyZxxOQ2S HE1Cq3OfDf25qnUeMhGi5yLkeuoq75RuHyCt32YnWtyfMjU9AYGK+mApwSmL9xilRoAg KrfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=a6IgMnee; 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 s71si13606082ioe.79.2018.01.22.10.58.59; Mon, 22 Jan 2018 10:59:11 -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=a6IgMnee; 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 S1751650AbeAVS5q (ORCPT + 99 others); Mon, 22 Jan 2018 13:57:46 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:34744 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751207AbeAVSxU (ORCPT ); Mon, 22 Jan 2018 13:53:20 -0500 Received: by mail-qt0-f193.google.com with SMTP id a27so10306212qtd.1; Mon, 22 Jan 2018 10:53:19 -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=/fQ8YvZUz/rzjD6Jd4exWFMmioMtz/ybDgAlTb3OwFY=; b=a6IgMneeI4pQAwD9jBXvqcYkC9zvrZZ3gmF9hMYu3/9oClAq75v8H7lAUBK4k3vsJb 63h0Ebk0Fl5BRGPDQmqb2MfYf7Q7nYgduBesQO0jdNSdtqULhZUNrnwxhVuVU+2+A1Ih KH36dDnxPZWxkv5t91P0NsQnqZKanI9iyjuV//EP2bYjjYispaHF1rXHkBvY3CF6avao vMt1uHHuXf/XdPBhAaR30TRcbw6YXCRP/U0ydrTABLUUJxpoGPz8z7PaAsrLC75AQ48J 7TpKKWvrUirQ6lwz6ApVckdHdhih3cEbSC/44Y12b3p8fDTUCzKvZWEnDBuCSENnUppZ QH7A== 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=/fQ8YvZUz/rzjD6Jd4exWFMmioMtz/ybDgAlTb3OwFY=; b=pqpC0BOqebeEWX1vbQXhcbufRUChnvVm14ZIqBI8biaK+LoAlDuOIGXZnvJyK1Kalo UEUvJ8k05NbUwkAniZLO3k4XsAbu7mR5vegffitLS9jdd47+jqTjEYsOkWhYPzbDGCkk qedIEy18ejgvtEvovNVAE/iCfxpSZsklagRL9Lu8cKZ5mBcVGgyK4mCLe/kRs72AEsZR kuRZPoRMKU+NH8h8hheON0ALOc0j73T5f1uxNkdfasIRBGNrUwAtJV2an59KJcLMT3JA lN0Jz3aSzdUcdhtQtsQREaQNaS2YoB+Uew/ypT3YBDJs4uhX2/3P/hYnltG7a/bKU1zD /ZGw== X-Gm-Message-State: AKwxyte4r4OeINIRt76qtn+YEiBOf3+ltVzDuEBJhyQel9aYq+JC7Qy8 y0Pfn8VRcs3BFIzIxcOvVYk= X-Received: by 10.55.40.204 with SMTP id o73mr12128163qko.173.1516647199350; Mon, 22 Jan 2018 10:53:19 -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 o20sm10790061qkl.14.2018.01.22.10.53.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:53:18 -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 v10 11/24] selftests/vm: pkey register should match shadow pkey Date: Mon, 22 Jan 2018 10:52:04 -0800 Message-Id: <1516647137-11174-12-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1516647137-11174-1-git-send-email-linuxram@us.ibm.com> References: <1516647137-11174-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 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