From patchwork Mon Nov 6 08:57:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 834606 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVq993fzYz9ryr for ; Mon, 6 Nov 2017 21:50:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ciAZbw4U"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yVq992VKvzDrJw for ; Mon, 6 Nov 2017 21:50:53 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ciAZbw4U"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c09::243; helo=mail-qk0-x243.google.com; envelope-from=ram.n.pai@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ciAZbw4U"; dkim-atps=neutral Received: from mail-qk0-x243.google.com (mail-qk0-x243.google.com [IPv6:2607:f8b0:400d:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yVmjP24B6zDr5S for ; Mon, 6 Nov 2017 20:00:09 +1100 (AEDT) Received: by mail-qk0-x243.google.com with SMTP id n5so9991896qke.11 for ; Mon, 06 Nov 2017 01:00:09 -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=9UEhhxawN/UOH+Cxn1KF1BSCtRkN1bH+haWbwPEuMZk=; b=ciAZbw4UtYA2q3WCvTMNjM0wtncdY+VdsMLDqbkrHYdG51FbZOWgkwzIWmG9dAj1Ja LyteNQk1JeetpkG+y3PDsTOAzwFl8NLIdlLilFwPinl89D1gsVp4ol4FvA9oxGeor7fu eMKLSfi+XTTr+qdmhGYOIIRLuSGw+6KjCEuT5rsCS8pV+cjeck4LoyEeEAVr9X0Am2dJ GzfwjEX8b68gJaGaFcI4x77Yu9Z7DE5aX+X5oSwdbMLWgBvkKZxBoSoaVHZQo1Ayzcja o3pYaiPySiXOYLNkdfZid29mCTgAWIlrDDLZa/w6LTBeIRhlclLYN6/Cc5TXZtg//Nio BrEg== 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=9UEhhxawN/UOH+Cxn1KF1BSCtRkN1bH+haWbwPEuMZk=; b=scU8Nb+XUojIgK+0cHUE6dSOgEAe6oVT75o1Yuxq7Eer0gJ9ynMHs4PObZGKOlY5dH fdncrCm3KhWEbdJNG/OmcauwGJu5L5+xoQw6DbYrEdlSLsMUgZgjh0SIi/T+HUKst50z EXH86cZHl3dvqq99hb7j5EcsXfnZz1oVf+NEjadtEdmLiarodVxupnAGF1v1hTEwZYvB zIrjommEewr+zw2mBTLkSEZWHViH2eqbh0Sjmn88+Z1fF3eeki6cnNP8IpgGp2z3bTDD hu19YWBgSkYsYVu/aRFUE+LMBgydWn7whQSwnzbJ+jM7SSqXTKavUR/RHuIHwsjm2Td1 vVfQ== X-Gm-Message-State: AMCzsaV3c3TQCsWxwPGpAhFlIwXl2AhOTbAUL8VKpW9jdDWvaP0lDKQy pCZKY1eYcqaFrIJ+rFCRsXQ= X-Google-Smtp-Source: ABhQp+T1O9BdaWwENGnt2wkOPZYz0xuJohQt+Tksi9THwiWa4MeVT4VyR8E8hFiZmfxAe215HgNkUw== X-Received: by 10.55.154.146 with SMTP id c140mr20515307qke.131.1509958807423; Mon, 06 Nov 2017 01:00:07 -0800 (PST) Received: from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net. [50.39.103.96]) by smtp.gmail.com with ESMTPSA id r26sm8001094qki.42.2017.11.06.01.00.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 01:00:06 -0800 (PST) From: Ram Pai To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de Subject: [PATCH v9 39/51] selftest/vm: clear the bits in shadow reg when a pkey is freed. Date: Mon, 6 Nov 2017 00:57:31 -0800 Message-Id: <1509958663-18737-40-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> References: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, ebiederm@xmission.com, linux-doc@vger.kernel.org, x86@kernel.org, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, linux-kselftest@vger.kernel.org, bauerman@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, khandual@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When a key is freed, the key is no more effective. Clear the bits corresponding to the pkey in the shadow register. Otherwise it will carry some spurious bits which can trigger false-positive asserts. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 384cc9a..2823d4d 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -582,6 +582,9 @@ int alloc_pkey(void) int sys_pkey_free(unsigned long pkey) { int ret = syscall(SYS_pkey_free, pkey); + + if (!ret) + shadow_pkey_reg &= reset_bits(pkey, PKEY_DISABLE_ACCESS); dprintf1("%s(pkey=%ld) syscall ret: %d\n", __func__, pkey, ret); return ret; }