Received: by 10.213.65.68 with SMTP id h4csp5732imn; Fri, 16 Mar 2018 15:21:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELtopPtGRSFmlGRXPlUYTABWADuNEjuWMQ5cSJp716dMeBlvXncpgxdGUsiKr1TYdCzAIHvf X-Received: by 10.99.165.66 with SMTP id r2mr2740293pgu.452.1521238866344; Fri, 16 Mar 2018 15:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521238866; cv=none; d=google.com; s=arc-20160816; b=fvqab1fItgeKNvvAFD6lYM7NcBGxwmCNtaYOhuiVDwi+MSaiUJwTd2iBwf0/7o7H95 wniEdAvTBQjASayV9w6FE96yhLeOUJIFRaaJYPk6b5AgSLNT58TfTLQKRPT4OaKAOTw8 5+vPp1ZYsM/rIAXyl12lRZQYeMV8B0xNl50HUizLoppxJpTdPTu9L2K2DU92b825/uuX KZLrwZ6EstVnKIKQKzM2F1g+416PgFGXs3eE9R6PW1bhn5QdD9fhQeugWvl9uDzpyOD6 ysmFu+zHNfr6PeDGtT5skEWSLMht7qhWb8BLyJznpr3+BQnFF9miAH+CTMnfLxuZ2nm/ 0wLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:cc:references:to:subject:arc-authentication-results; bh=8sRtMgvQoDMkcWXsUTJq72v44b2EcJ+1uaPKjcKA7rg=; b=DW7ya2rDuRMG/9yNyty/alw2LZhxCqcRs57pVgz2M7F+e8E3OnHKCRAbbVdSMkK846 rfrvpMWU7ASb5XeZcnhG4DMMuQ9UNgH3xtxkSu3/GZj0SN86vXeOgyD96cstHzSuZcjM wJ0gDcwM++HMNI0GlwgYpoPn/tbgIeDGbyWDP68QNlAwZ5j2Obxh5ng0TNx3ATCW0HQf 9La44uILQ1D7deYtdCGyKRwDGSyJMzxNqnqGFME3cigvgyKwyVPUsgt7Uko6EtqoYOYB fedENvvR/mu3E29vbsFPsdNWuiRii/9rgxTqKAVZqVu3BBEDFqiB+alNBQ8NZgnJ5sRw eF+A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13-v6si2619261pln.421.2018.03.16.15.20.51; Fri, 16 Mar 2018 15:21:06 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbeCPWTW (ORCPT + 99 others); Fri, 16 Mar 2018 18:19:22 -0400 Received: from mga12.intel.com ([192.55.52.136]:54176 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750915AbeCPWTV (ORCPT ); Fri, 16 Mar 2018 18:19:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 15:19:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,317,1517904000"; d="scan'208";a="25371125" Received: from ray.jf.intel.com (HELO [10.7.201.16]) ([10.7.201.16]) by orsmga007.jf.intel.com with ESMTP; 16 Mar 2018 15:19:20 -0700 Subject: Re: [PATCH v12 11/22] selftests/vm: pkey register should match shadow pkey To: Ram Pai , shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-12-git-send-email-linuxram@us.ibm.com> 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, 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, arnd@arndb.de From: Dave Hansen Message-ID: Date: Fri, 16 Mar 2018 15:19:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519264541-7621-12-git-send-email-linuxram@us.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/21/2018 05:55 PM, Ram Pai wrote: > 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 Heh, you randomly changed the formatting and didn't bother with my awful typo. :) > * 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); > I don't think this should be "shadow_pkey_reg". This was just trying to double-check that the signal handler messed around with PKRU the way we expected. We could also just check that the disable bits for 'pkey' are clear at this point. That would be almost as good.