Received: by 10.223.164.200 with SMTP id h8csp928035wrb; Mon, 6 Nov 2017 01:08:08 -0800 (PST) X-Google-Smtp-Source: ABhQp+RerMBMa32Sd7PfTbYiA7/fuw79AHiQJfd2gjD631Y4QMg28BW68VN07Ou/KrTe1JzyUdza X-Received: by 10.159.205.132 with SMTP id v4mr14375952plo.426.1509959287916; Mon, 06 Nov 2017 01:08:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509959287; cv=none; d=google.com; s=arc-20160816; b=EOcSZEloDwn1pjafOINM2pY+OQVbA6zXG7otISVyPma+ERfs5s75kB9Lm+ZEdE/QRB x72dwbXTSsuY7Htww3e+IFK1v/DdWdbLsGccEEz84Dnpm0Aqip4eXjiz7HsIY8mQmFdP BWTncTXzmZC2GUnadipCVkn1pp2oNQyj9ODBUYJt2f0x36zF4CIEUt3iIanFa1mTIlce Jrgl/sW+Dc//8rnaIs04KC4GuGafjwQm3gnh00FnufzrrQEx2CbvbvU/NaDL8D2mgUvk lxmFOD3UEZU3u7MDBLFk761qkW+Qt2gtG8PbWb7X8zLn/e4iY+RN8SZdq1/gy4RctF/s nofw== 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=9UEhhxawN/UOH+Cxn1KF1BSCtRkN1bH+haWbwPEuMZk=; b=SNFdvOLKPSHchZ6RBwI8ZIH4Xkt9MwxcygO+y3WtvOAfegptb69l7Kx2P7pwEkorqd nDzMq//L/A4i9qMm7laZcQU2T55t18hL8be4+VjuUfJKeOlZeJp9Cwv7kecObbQEcSIT HLCsMp98jE//gTQhiARRzeke+XzMwpJMDTxBlddRvYxkJFqHGE30N5u7kQFs/+x6pr52 zsC0Ey3osphOQL1B3LzILfTXWl/8rbFfdEMHypp28RJAERtIaWefMl3jWk9r2/tXNuOq 0vNtyBIdQeuURKOiwToMgjT0QRGzZv8BwUnzkZ/VvkllONcX7Ftb3OKwYqAnIK3sJmKa Ex/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ciAZbw4U; 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 f6si12118543pfe.156.2017.11.06.01.07.53; Mon, 06 Nov 2017 01:08:07 -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=ciAZbw4U; 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 S1752672AbdKFJHU (ORCPT + 98 others); Mon, 6 Nov 2017 04:07:20 -0500 Received: from mail-qk0-f196.google.com ([209.85.220.196]:55970 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752330AbdKFJAI (ORCPT ); Mon, 6 Nov 2017 04:00:08 -0500 Received: by mail-qk0-f196.google.com with SMTP id x195so4397422qkb.12; Mon, 06 Nov 2017 01:00:07 -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=gU5FKb3EtX0rz5gPfoILTb6k3zhwkxfsvd/F5l353i6LFEwc1LZ6i5six4FvNqd58T Nw30JYIuq1HVdWqeU2JQqrdawSbjlqLVQTWaQi5grZbZousKHnlL0I9/As/5QFN9hc+F UwdifNCkyLs/W85Cj4D+Zz3xVreRheJaAIZdZfJ4k4os3DY+P/vzxWhejU6KawqUNaQr KzrMERHBbShGi5t71kI625X/dcGzLnqUCt+iEYTTO0c4j+QMDTn7Gy8dfcepTzEpfZTC LlpjUrsIGEufD1ZP0zYNsFK9lGgcMb3aZwE1Hx/AFaPdO8EGgw/RLB9Uzdtz7u9+J1v3 tFRA== X-Gm-Message-State: AMCzsaVvT1YfQF3EVcZoIbrzTDGZoUP9uW7T5r5JncENGw8Ob0pHI9Hb xLh21NOdj+yDMgHw0bqevpg= 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 Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 1.7.1 From 1582952801086096182@xxx Thu Nov 02 11:17:10 +0000 2017 X-GM-THRID: 1582952801086096182 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread