Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2955995imm; Thu, 24 May 2018 19:51:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrQtH7HvAgMDDabjIOXdhnvynW3Sz7EulSGJ+HNOj8JLpcmoN7ZZBhkK5NEgVT6qxWSNA86 X-Received: by 2002:a62:6a0a:: with SMTP id f10-v6mr596533pfc.99.1527216695410; Thu, 24 May 2018 19:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527216695; cv=none; d=google.com; s=arc-20160816; b=BbqFyHdlLlNY04k3B6njw9p6sxW6l1drwPMDfV9htyNXN/bCqiFr9Nlyu8D/0Okjl1 EQJzfOFBsZ5pFvk5JmB68kFSV5+y1v5JTH2O34she6khFy+oGb9jm0SrxaJExvjQdipl ZZDkfL5orcfAS0QJ+ruCcnjfHedz2oLcvp1WPWVbwksj6M3VJDOThv8KXP6MpKdB2Y39 9+bEeiCilCmMUV9lLjC7bCO72I81JB/7LP0e06/TkaTElpDMLuLuKVhY6pyRza0XpBIu yDgPAFUBQ8KbUX1o+dLyWGOvFN4AdjPiDaYWxp6w1BUJKVvEuFwm9x9pLfprjIc4ETgA FYOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:mime-version:date:in-reply-to :subject:cc:to:from:user-agent:references:arc-authentication-results; bh=DNJCMCfJxr8ghykgGCpRsx0Y+mu9GHJrMcz0LBlPV8w=; b=EislowwuGt0q91pacUEfy7pNMD51cnn1U57tpqld0zLQK3BKep81rFPkzHUVagonnY UdrEd6U+OrsEdIsnwwrx0HUlvc089MJTbZR4j8bNs6feVUqGSfoXB4vbioFVXqFTFtx/ OSXgRSL2VKRp1mj5oqJwcyvfaa1b99obJ2p+lAlh90YB8ymaTgod/+WXXCkhV9zXBuIF XCVwK0rDTmRaQdoMTxf74/fzN5y2Ui3wOZIqaycXm42iF/VtClRzCwRLCwn0VlfdbN3O Yy8AkhcTGwEONMjM2D6OfVdmBrY04Zy+idKXWoXdKibtQsKhiJpaCsN8Nk/7FHljZCq1 WBUw== ARC-Authentication-Results: i=1; mx.google.com; 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 k65-v6si23175506pfg.38.2018.05.24.19.51.21; Thu, 24 May 2018 19:51:35 -0700 (PDT) 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; 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 S935242AbeEYCOw (ORCPT + 99 others); Thu, 24 May 2018 22:14:52 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42992 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754164AbeEYCOo (ORCPT ); Thu, 24 May 2018 22:14:44 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4P2EFU8103501 for ; Thu, 24 May 2018 22:14:43 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j65fjr32u-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 May 2018 22:14:43 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 May 2018 22:14:42 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 24 May 2018 22:14:40 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4P2EdOV6029812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 25 May 2018 02:14:39 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D927AC03A; Thu, 24 May 2018 22:16:08 -0400 (EDT) Received: from morokweng.localdomain (unknown [9.80.220.137]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTPS id 999EDAC03F; Thu, 24 May 2018 22:16:06 -0400 (EDT) References: <20180223183344.21038-1-bauerman@linux.vnet.ibm.com> <87tvr6mlbe.fsf@concordia.ellerman.id.au> User-agent: mu4e 1.0; emacs 25.3.1 From: Thiago Jung Bauermann To: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Ram Pai , Thiago Jung Bauermann Subject: Re: [PATCH 1/2] selftests/powerpc: Add ptrace tests for Protection Key registers In-reply-to: <87tvr6mlbe.fsf@concordia.ellerman.id.au> Date: Thu, 24 May 2018 23:14:27 -0300 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 x-cbid: 18052502-0056-0000-0000-00000454EF96 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009065; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000261; SDB=6.01036001; UDB=6.00529949; IPR=6.00815130; MB=3.00021234; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-25 02:14:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052502-0057-0000-0000-000008990D38 Message-Id: <874liwqy64.fsf@morokweng.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-24_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805250025 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michael Ellerman writes: > Thiago Jung Bauermann writes: > >> This test exercises read and write access to the AMR, IAMR and UAMOR. >> >> Signed-off-by: Thiago Jung Bauermann >> --- >> tools/testing/selftests/powerpc/include/reg.h | 1 + >> tools/testing/selftests/powerpc/ptrace/Makefile | 5 +- >> tools/testing/selftests/powerpc/ptrace/child.h | 130 ++++++++ >> .../testing/selftests/powerpc/ptrace/ptrace-pkey.c | 326 +++++++++++++++++++++ > > This is failing on machines without pkeys: > > test: ptrace_pkey > tags: git_version:52e7d87 > [FAIL] Test FAILED on line 117 > [FAIL] Test FAILED on line 191 > failure: ptrace_pkey > > > I think the first fail is in the child here: > > int ptrace_read_regs(pid_t child, unsigned long type, unsigned long regs[], > int n) > { > struct iovec iov; > long ret; > > FAIL_IF(start_trace(child)); > > iov.iov_base = regs; > iov.iov_len = n * sizeof(unsigned long); > > ret = ptrace(PTRACE_GETREGSET, child, type, &iov); > FAIL_IF(ret != 0); > > > Which makes sense. Yes, that is indeed what is going on. > The test needs to skip if pkeys are not available/enabled. Using the > availability of the REGSET might actually be a nice way to detect that, > because it's read-only. I forgot to consider the case of pkeys not available or not enabled, sorry about that. I just sent a v2 which implements your suggestion above. -- Thiago Jung Bauermann IBM Linux Technology Center