From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id B1A796B0006 for ; Wed, 20 Jun 2018 11:20:25 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id d64-v6so1719166pfd.13 for ; Wed, 20 Jun 2018 08:20:25 -0700 (PDT) Received: from mga04.intel.com (mga04.intel.com. [192.55.52.120]) by mx.google.com with ESMTPS id h16-v6si2371897pfi.84.2018.06.20.08.20.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 08:20:24 -0700 (PDT) Subject: Re: [PATCH v13 22/24] selftests/vm: testcases must restore pkey-permissions References: <1528937115-10132-1-git-send-email-linuxram@us.ibm.com> <1528937115-10132-23-git-send-email-linuxram@us.ibm.com> From: Dave Hansen Message-ID: Date: Wed, 20 Jun 2018 08:20:22 -0700 MIME-Version: 1.0 In-Reply-To: <1528937115-10132-23-git-send-email-linuxram@us.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: owner-linux-mm@kvack.org List-ID: To: Ram Pai , 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, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, fweimer@redhat.com, msuchanek@suse.de, aneesh.kumar@linux.vnet.ibm.com On 06/13/2018 05:45 PM, Ram Pai wrote: > Generally the signal handler restores the state of the pkey register > before returning. However there are times when the read/write operation > can legitamely fail without invoking the signal handler. Eg: A > sys_read() operaton to a write-protected page should be disallowed. In > such a case the state of the pkey register is not restored to its > original state. The test case is responsible for restoring the key > register state to its original value. Seems fragile. Can't we just do this in common code? We could just loop through and restore the default permissions. That seems much more resistant to a bad test case.