Received: by 10.223.164.200 with SMTP id h8csp925235wrb; Mon, 6 Nov 2017 01:04:53 -0800 (PST) X-Google-Smtp-Source: ABhQp+QqO/T/btaWwhe/CUWh3JYo5zOYiIvALNSJNc3pzsgz8xCz4vOXYUbtLaQDPGRnWwZEmKHo X-Received: by 10.98.139.8 with SMTP id j8mr16158136pfe.30.1509959093124; Mon, 06 Nov 2017 01:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509959093; cv=none; d=google.com; s=arc-20160816; b=MLY1aIaO3FxUahmD4upxtLB187K1YKs/o9w8pazigr/oAfcOA42wCe5ASfq3v55jz8 /ZIqntrGUAZ/5x6eWLdEXGCJBTp2ihreMYhQhCvraJ4Xa6xYpzxFx5CtOsTixpBrVtak nckVbl5fC2vxUukXZ96LXCo76QzDBqzFer1O7YcDLHFB1TX3OhyXgPxeUGHmAMjH7iAx MFqo+53hnBS530T8pmJg91HNyIGkTXejcGX+cbEU1igV+4Iu2BCvOnbz3HJUI1JQs8Hs Xup2r93p9LkDXIPeRp2IxH0t2kCOpzkQwFp8FtWwKa3bjw/Xhr++ZrImzGeaKQSCwouQ Wl2A== 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=urBNYeGJF0trzAiOG0VPy1Uo4LCUXsqL/Do/v77NFlE=; b=rjiPUisd9Ua4cr7h40XU/+Y4DwnrcAH/PgogDH+/YbYs4TzS+UG7j/pKlctK3vaQ3i LE6JI4KaS8hN+4kist7ge0PtPoNGbVLVnrz3Ugggx9kw1C54Nr16FpX4Jk/bifZisIGB 5AQrHvvZYYInqIGyCOcOhQJLX1S7kIX6hQOkTBg8UmPPHYWZyULUaJFIKtpjHOcWvJ3i CPgeMNpCIhxbGB9EWAX3N6TovQc9XMPi3/CpBXOWIa+aIL006nbEiEu/6F63MYRj4odw wbbmx1dNq079JIwhffG5TW5yEKpTNhx5QYE54jaCRiKKF3ZkzWpYm/M4hC1IhNYbq04M A0FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HqjQR30c; 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 t84si12022008pfa.357.2017.11.06.01.04.39; Mon, 06 Nov 2017 01:04:53 -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=HqjQR30c; 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 S1752795AbdKFJD1 (ORCPT + 98 others); Mon, 6 Nov 2017 04:03:27 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:46440 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752686AbdKFJAi (ORCPT ); Mon, 6 Nov 2017 04:00:38 -0500 Received: by mail-qt0-f196.google.com with SMTP id 1so10026270qtn.3; Mon, 06 Nov 2017 01:00:37 -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=urBNYeGJF0trzAiOG0VPy1Uo4LCUXsqL/Do/v77NFlE=; b=HqjQR30cRjVtcNEWTcp1/4nEHgg9HWzDpwXt4SuP0a3SKXajUNDVl8ZaFWUUMfr2iB wODJOPEZQGpKEb42XHNm1g9O6OonJCENax+1u/ac2nOr5MKdU1tqoKIVAcWNt9q1BAEi 0ldxH8cWI95YSuSDc+TMRxmfU6WRqoVOe6GgAGFi4gGx0WKr68tSUc4g4cGCvHCzWqAd hy0aMIgc5WuIRTYIxe9HlGH/if15qHMFbMVZzHXy5cNXEtJxDraEbIkTUM+Y5vn2+LUP 57iQ3teNA5LOBap4FuYE4of5ybu1kj/cUgRUBn/kTAc3hjbbecxUuYtVZ6peOSvolIUY blkw== 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=urBNYeGJF0trzAiOG0VPy1Uo4LCUXsqL/Do/v77NFlE=; b=tv/90uM0A4j238jzjCriFk1DDR3y3BOmJJo3RLF3sscqlrpO9XKJavQZ6gZTYuoX4h 16a+29W6SeYxZB2kpv1qzXOnvXCy4gBAZOC5JMZnhJ/a8jpHP/OMRcn+m+tIae1Th73A etAcwkkpaHdXMI1LmbIVj2Q05hoteVmz0TPYnuHdkgjZTJDR2uKYLoeN0xHcdn7KnIfp ZFXnV5O2p2Q0myOcZ/hvwk2/86wFdUaVHT7EK92jaR/d7LsEOruVPZU9cyf1oqStI1D0 Mtj9wHXP/sYJ3vwVCF/35wQJy0shrWRRYowuFnB0SBUijqf8VNWNECLvLfb/6j+YKJjV BQAw== X-Gm-Message-State: AMCzsaXwi3AvIFt2SUD1FQHb3rznFs8CjyurLOXOvpH7+7bE61pIpHpH xhHryj1ybh0yib5yzWkWPAI= X-Received: by 10.200.46.132 with SMTP id h4mr21973383qta.88.1509958837347; Mon, 06 Nov 2017 01:00:37 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 01:00:36 -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 48/51] selftest/vm: detect write violation on a mapped access-denied-key page Date: Mon, 6 Nov 2017 00:57:40 -0800 Message-Id: <1509958663-18737-49-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 detect write-violation on a page to which access-disabled key is associated much after the page is mapped. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 0b7b826..c790bff 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -1058,6 +1058,18 @@ void test_write_of_access_disabled_region(int *ptr, u16 pkey) *ptr = __LINE__; expected_pkey_fault(pkey); } + +void test_write_of_access_disabled_region_with_page_already_mapped(int *ptr, + u16 pkey) +{ + *ptr = __LINE__; + dprintf1("disabling access; after accessing the page, " + " to PKEY[%02d], doing write\n", pkey); + pkey_access_deny(pkey); + *ptr = __LINE__; + expected_pkey_fault(pkey); +} + void test_kernel_write_of_access_disabled_region(int *ptr, u16 pkey) { int ret; @@ -1342,6 +1354,7 @@ void test_mprotect_pkey_on_unsupported_cpu(int *ptr, u16 pkey) test_write_of_write_disabled_region, test_write_of_write_disabled_region_with_page_already_mapped, test_write_of_access_disabled_region, + test_write_of_access_disabled_region_with_page_already_mapped, test_kernel_write_of_access_disabled_region, test_kernel_write_of_write_disabled_region, test_kernel_gup_of_access_disabled_region, -- 1.7.1 From 1583310302350409398@xxx Mon Nov 06 09:59:30 +0000 2017 X-GM-THRID: 1583310302350409398 X-Gmail-Labels: Inbox,Category Promotions,HistoricalUnread