Received: by 10.223.176.46 with SMTP id f43csp3258430wra; Mon, 22 Jan 2018 10:57:59 -0800 (PST) X-Google-Smtp-Source: AH8x226+ai80V4gEvaz2Jyrrb6J69ZeKYQzy9W28peBU4BvWIy7EtzKmcCRIdmm1zikQotDIxZeV X-Received: by 10.36.78.140 with SMTP id r134mr8958143ita.27.1516647479656; Mon, 22 Jan 2018 10:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516647479; cv=none; d=google.com; s=arc-20160816; b=OLmcUoWM+MqmH/OncTnlacmzjyf6+KP0FH7MmkM+9iUL9SZRKhTTMz34uwGOIt75Z1 Ls1xiFAoh6tJ9G1f7EbXvoEEVoIdXNxQlfCY7su71c5C91/la2B0gBeH+fCTiZcxUjCX m1wz+uw8vC2bjrGgx3aQAHcyH97YsXqvOMBlnq+OAeBpUsunisrdyFR9JG6ShjA3kOSa l+S95EAgZkYXpvL2CtVXggyA8YIFKkBkCSURO1USKSwQCe9EahcwQFvtaWyJB1KZZ0Dl c+Mle7pEM4fvvUp9QET5FmATWaITbY9Iesb5k7mzekRqoqBHeqMy13Zy2hJND8arTjtA R6Qw== 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=44rQITY9DaDodeIBIPfwot0aefJAd5ZPTj/2PaqgyR8=; b=T3v0DhaiXb2MkYdQdfhp7ekXlAw1Xg4ZVuiTNGtigbweMuL0qllUknCviljlDiqMoB Rcaa6psRESoBRN1EDS8bVzseQrhvSmsry0m0cAhjA/K5BBQ275urIUpSdNbcVItsTNhN wo7yeblpOP24ZSUQkD4mrhe3EBXOEdW8GQZKhYmPD4rn3ODn6XHZGGiDDq8ABPshaOt4 2CxVbc1u8cixkYTHdMXb0pRUMOoIuPiG0Ogfu+/ii8dsuoKdwCLqwEultbCYgO8Ge949 Yfds8gzolwdSTecfomgsknQ31KOG1O4jEWhcDmPOh4QCn3YROS3xTebZxuCm8pxaudkp mV5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=DkXxdHSP; 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 b37si13468402ioj.180.2018.01.22.10.57.47; Mon, 22 Jan 2018 10:57:59 -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=DkXxdHSP; 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 S1751471AbeAVSxc (ORCPT + 99 others); Mon, 22 Jan 2018 13:53:32 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:47074 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751255AbeAVSx3 (ORCPT ); Mon, 22 Jan 2018 13:53:29 -0500 Received: by mail-qt0-f193.google.com with SMTP id o35so23439486qtj.13; Mon, 22 Jan 2018 10:53:28 -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=44rQITY9DaDodeIBIPfwot0aefJAd5ZPTj/2PaqgyR8=; b=DkXxdHSPF26fEoBXAWOO3J3qfK4mi99g1OgwVlf0Eg2Hw8cOoiI985aBzn2LTOWSX6 emgtsTYPdsLHjw8I1799Bagn4kOVV65ExsR/6uf7r+fJYPJjF8Vrb8EpHwmnseGhr68b 8J9NGVkVxuc1kz+5iolePUo4Khd4w0VX4zLnamWcCWo8GDI5iiaG8GJ9zxYboFEk1n0R +NmtWOHt2JmuWZmwuvqfTohV5jqMonTMI9LAKHNakqAze+qnoSu78m3gFtC9ov/3DzHw 5MFL8jC79QzCzISW2tXXmp7jFExm4Kixg98jvPo76Fp7Vz1i5rLTTbUOHXMkf2CXUkaM 11iA== 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=44rQITY9DaDodeIBIPfwot0aefJAd5ZPTj/2PaqgyR8=; b=OZrs2lttGfKmT6fdUUPLccZCNtvdqilI9GzkoRPQ7Tzm/9iQR162N65Ki216HdU1w2 OHujMshi1X8CdV8qj5nqTC76OhSGwzCkdnsQWfBCc4QA1mv3Ebt8bY9lzpEMFU0Gb8/3 FaRXccG1pyFYnY70fEoETqSKJpcvUR6oWJlEeGItrFgwoZZlfEMDGiH+aFN0p8x+dpg8 R08PjtOSnQFPkrfBEpCiAqbgds8eKdqQ3OixIBawETgLimklM8c9V5k6ZCKKvROEQh6J 4aFZKUE5bevUkcAauLATmU6l43o2+qv4ZSq/EtxVTpm0l39Xpp6WSYdhMJcI9YNWDCOo P8Ag== X-Gm-Message-State: AKwxytel5wvOmq/tX7v1kR191yW3zHWiGcCzvPuIXp0qQDM11OwlPcOA /+XX4RsKtmtaEJPeivFj0o8= X-Received: by 10.237.49.105 with SMTP id 96mr11809509qtg.52.1516647208360; Mon, 22 Jan 2018 10:53:28 -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.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 10:53:27 -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 14/24] selftests/vm: clear the bits in shadow reg when a pkey is freed. Date: Mon, 22 Jan 2018 10:52:07 -0800 Message-Id: <1516647137-11174-15-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 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, 2 insertions(+), 1 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 55a25e1..d1cbdfe 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -586,7 +586,8 @@ 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); + shadow_pkey_reg &= reset_bits(pkey, + PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE); dprintf1("%s(pkey=%ld) syscall ret: %d\n", __func__, pkey, ret); return ret; } -- 1.7.1