Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp251225pxa; Tue, 4 Aug 2020 23:30:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8tNMUnFAe12LUCJNWc2fyWe2GGzZnxfpvYEGXSgOpDs65BpwTfXNIq2tYwBy47t5Hp/qt X-Received: by 2002:a17:906:d786:: with SMTP id pj6mr1720946ejb.261.1596609035639; Tue, 04 Aug 2020 23:30:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596609035; cv=none; d=google.com; s=arc-20160816; b=F2uW2ko4FNi6o+ilDc3fO//+357wE6jT0WFX2HquHJczKZOkhvFOsXW9y9gpJR36jq dJr/krRL5ZgjUmLFpWRDiK77iePXAiLf0lmAV2gKwQBzEI/qpOmmRM4SydWoppx6FgFa OCjM+Szr5OE8Zi/mBJaKicTsnWflFh3jVLcqeOvP47xtIHixdX/0hcBqjideLbUyNBsO IKcVU+tRZOcMxQdxJXhr8+dxaWUqOT8lrCN3Hm1uuaEX/756rRCsMBmhHjQJk7hI6DFc IfOQQXM2Q4WVnqe6opsey5zNgOjm8lc6McgwKp7Ac90SEULTdIV4FTtO3Zi4yh0sWGwC zUNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FUPi+S9CDjcrpauBJXtL1WvaC1kNVUOGNgxo5QlZC9o=; b=nZ3Qkkt1vbHaYeDAmlkrfF8WUZ+M5pN2yyOFsdw+I65LnM8r4LeNeHaiTvbZLLbsoX QZ4fApK5D+qp0F7yxobZ7uwFViRW9U01ZLBGnwoCa8zGPN2PYJPZXAzgRFF7nnbRD+zj xLMmiXVj0d4v2v7sulouDpO/nAOmOzPSV3rMiPqISRq4F2sMJIUkbvsDCzJfbg/U44iu s1Bs34YqlAW3IhaZjmYR4KyA/5geqNScxzbBVWSkpDnX8iy7w4in4JKJoW/pUjPnKO3f ksjxPzcUZWu8PPPACh82cBM9wccWVJyRHio/9bEOCmYJvK5ft2BEtPxic07IuY2OitQo AenA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id o23si582332eju.715.2020.08.04.23.30.12; Tue, 04 Aug 2020 23:30:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727794AbgHEG22 (ORCPT + 99 others); Wed, 5 Aug 2020 02:28:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37792 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725904AbgHEG22 (ORCPT ); Wed, 5 Aug 2020 02:28:28 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0755YQWH064775; Wed, 5 Aug 2020 02:28:08 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32qcfd7ah9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Aug 2020 02:28:08 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0756FJTv174308; Wed, 5 Aug 2020 02:28:07 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 32qcfd7agc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Aug 2020 02:28:07 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0756Fw9h018966; Wed, 5 Aug 2020 06:28:05 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 32n01842v0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Aug 2020 06:28:05 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0756S1Ht18350376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Aug 2020 06:28:01 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E0884C040; Wed, 5 Aug 2020 06:28:01 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F9274C058; Wed, 5 Aug 2020 06:27:58 +0000 (GMT) Received: from bangoria.ibmuc.com (unknown [9.199.33.73]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 5 Aug 2020 06:27:57 +0000 (GMT) From: Ravi Bangoria To: mpe@ellerman.id.au Cc: ravi.bangoria@linux.ibm.com, mikey@neuling.org, paulus@samba.org, christophe.leroy@c-s.fr, naveen.n.rao@linux.vnet.ibm.com, pedromfc@br.ibm.com, rogealve@br.ibm.com, jniethe5@gmail.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] powerpc/watchpoint/ptrace: Fix SETHWDEBUG when CONFIG_HAVE_HW_BREAKPOINT=N Date: Wed, 5 Aug 2020 11:57:49 +0530 Message-Id: <20200805062750.290289-2-ravi.bangoria@linux.ibm.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200805062750.290289-1-ravi.bangoria@linux.ibm.com> References: <20200805062750.290289-1-ravi.bangoria@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-08-05_04:2020-08-03,2020-08-05 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=1 priorityscore=1501 mlxscore=0 mlxlogscore=999 impostorscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008050049 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kernel is compiled with CONFIG_HAVE_HW_BREAKPOINT=N, user can still create watchpoint using PPC_PTRACE_SETHWDEBUG, with limited functionalities. But, such watchpoints are never firing because of the missing privilege settings. Fix that. Reported-by: Pedro Miraglia Franco de Carvalho Suggested-by: Pedro Miraglia Franco de Carvalho Signed-off-by: Ravi Bangoria --- arch/powerpc/kernel/ptrace/ptrace-noadv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/ptrace/ptrace-noadv.c b/arch/powerpc/kernel/ptrace/ptrace-noadv.c index 697c7e4b5877..bf94ab837735 100644 --- a/arch/powerpc/kernel/ptrace/ptrace-noadv.c +++ b/arch/powerpc/kernel/ptrace/ptrace-noadv.c @@ -217,7 +217,7 @@ long ppc_set_hwdebug(struct task_struct *child, struct ppc_hw_breakpoint *bp_inf return -EIO; brk.address = ALIGN_DOWN(bp_info->addr, HW_BREAKPOINT_SIZE); - brk.type = HW_BRK_TYPE_TRANSLATE; + brk.type = HW_BRK_TYPE_TRANSLATE | HW_BRK_TYPE_USER; brk.len = DABR_MAX_LEN; if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) brk.type |= HW_BRK_TYPE_READ; -- 2.26.2