From patchwork Tue Jul 17 13:49:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 945081 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41VNCJ14jMz9rxs for ; Wed, 18 Jul 2018 00:37:00 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="g/z/ucCp"; 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 41VNCH3689zF3Hh for ; Wed, 18 Jul 2018 00:36:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com 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="g/z/ucCp"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c0d::243; helo=mail-qt0-x243.google.com; envelope-from=ram.n.pai@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="g/z/ucCp"; dkim-atps=neutral Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::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 41VM9f0fbYzF3Hl for ; Tue, 17 Jul 2018 23:50:30 +1000 (AEST) Received: by mail-qt0-x243.google.com with SMTP id b15-v6so879434qtp.11 for ; Tue, 17 Jul 2018 06:50:29 -0700 (PDT) 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=EcR3SDmB0WV2XGlTEZwt9KVPitnK5134qlvUDtzoqfA=; b=g/z/ucCpwLvVJ58dVBBLdnzlKDwFycSwj6eSl2XbH3RCjOxlF1ghl+yTEngxMfIe5q 8vp2Vcy/Oi9Vpmqi9fB9BAHx9tCqMXn9iJFmyfNQyDiD3+mDu8AxznanTJiaPFTbXOKf +CMSCHLA1DMq4lDnvyNQguujKueJHLDxT8ri2hDbo35a1oinL+2zX4X705i2aps2R0NE h5Qq+14BFClJlqzjzOGLpFel1sNcN2UuUwZwKCM9E69yHGKHf+m7v185m/sRelLhraeT rKSPRRyBqrg0lQ2ZEEK2HpFHI+iWEPg0L9zmqZVRQlqp3OVaqAJ1K/YbP6owICiaqHGN 5Gog== 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=EcR3SDmB0WV2XGlTEZwt9KVPitnK5134qlvUDtzoqfA=; b=JjiJNhICHST4K/BanFhpv8cHxMbs6oZVlz2FpP1YqY9fZYxx+XeQIkCQsZT1YwbRQ2 airx0rk3gq5HLkfsExV8RxLlqWoO0WUOcRQoyNCkIcU9jAn7awGzIHJ7UyfEKrgeFQRp oIUVHuSaxkJ5LOLCFm7YgzXQzhfSUnAFUsqBWNUUWInhyFk36pNHPke1dqMO507NApR0 Fx7/QJwbo6G0FV0qrF9R7O3EDJOve+rqPMH+AW0DXxhnCDNt5JCXhd07QEnGRhVNwNkZ 96fpgRSkHIEplk5BBcrDS/BVZOzZZISXiykKBQr3fcWi1BYXBIiiOlmQ2mBMA0uXe9Sv O70g== X-Gm-Message-State: AOUpUlGO+SJZe9XrpLeQIPp6yR+OpR2kbLlLBPLv54JsqUXaZtsozF3b wpXg1HQ1p5qMS8uhJykq2y/OTQ== X-Google-Smtp-Source: AAOMgpc8VCMeULevOwhRuw2S05SejeSP3kwqmAfzu6osIa0Th39JJ8Neelc3h0pGWSqRqIGH0HTVJQ== X-Received: by 2002:ac8:29f6:: with SMTP id 51-v6mr1608348qtt.200.1531835428234; Tue, 17 Jul 2018 06:50:28 -0700 (PDT) Received: from localhost.localdomain (50-39-100-161.bvtn.or.frontiernet.net. [50.39.100.161]) by smtp.gmail.com with ESMTPSA id s83-v6sm640937qki.20.2018.07.17.06.50.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jul 2018 06:50:27 -0700 (PDT) From: Ram Pai To: shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org Subject: [PATCH v14 12/22] selftests/vm: pkey register should match shadow pkey Date: Tue, 17 Jul 2018 06:49:15 -0700 Message-Id: <1531835365-32387-13-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1531835365-32387-1-git-send-email-linuxram@us.ibm.com> References: <1531835365-32387-1-git-send-email-linuxram@us.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 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, fweimer@redhat.com, dave.hansen@intel.com, x86@kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, mingo@redhat.com, aneesh.kumar@linux.vnet.ibm.com, bauerman@linux.vnet.ibm.com, msuchanek@suse.de, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" expected_pkey_fault() is comparing the contents of pkey register with 0. This may not be true all the time. There could be bits set by default by the architecture which can never be changed. Hence compare the value against shadow pkey register, which is supposed to track the bits accurately all throughout cc: Dave Hansen cc: Florian Weimer Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c index 2e448e0..f50cce8 100644 --- a/tools/testing/selftests/vm/protection_keys.c +++ b/tools/testing/selftests/vm/protection_keys.c @@ -913,10 +913,10 @@ void expected_pkey_fault(int pkey) pkey_assert(last_si_pkey == pkey); /* - * The signal handler shold have cleared out PKEY register to let the + * The signal handler should have cleared out pkey-register to let the * test program continue. We now have to restore it. */ - if (__read_pkey_reg() != 0) + if (__read_pkey_reg() != shadow_pkey_reg) pkey_assert(0); __write_pkey_reg(shadow_pkey_reg);