From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD204C433E2 for ; Thu, 17 Sep 2020 15:03:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 625E32220A for ; Thu, 17 Sep 2020 15:03:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="X3lS24Ai" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727676AbgIQPDL (ORCPT ); Thu, 17 Sep 2020 11:03:11 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47770 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727661AbgIQO63 (ORCPT ); Thu, 17 Sep 2020 10:58:29 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08HDC3cb042667; Thu, 17 Sep 2020 09:25:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=gds4Lehf07U2I60c/beSjucqh1grOJeINVNEuXAh78Y=; b=X3lS24Aih8vx02nBgh+lWwfzAkdm0E+VnbaUcOg5BIfsXadUjBVwG+jZQkKtWks08uXn kFor78Bm4M8GFdFHwhI8afihxZOrFQUKOrsyEomAuaCvm1Zky++jBrQLlNOyIlNmsL4J J8lNJmD77jRBMKrvC3gUMUQ1lzrJ8D3IbCmo81Sn5m/Yz1Q+TxG4t3tsGGYrd7DhhKAo y/VkjX9iQdOp4cVXCA+FM0Wc0zIcnJX855C3IaZVHmSvhBmZgCDRHB8V9cGyjCF+EC7w s+kK+91RZ6/tz3e8BxQ+N7/aLVfDXdP+gNVSLaLEghyi8DJEW/PShTKxZNjYAev5mkxa Hw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 33m8fnre4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2020 09:25:49 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08HDDUFg046628; Thu, 17 Sep 2020 09:25:49 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com with ESMTP id 33m8fnre4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2020 09:25:49 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08HDN8Et026404; Thu, 17 Sep 2020 13:25:48 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma04dal.us.ibm.com with ESMTP id 33m7u9rdsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Sep 2020 13:25:48 +0000 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08HDPl4u43254110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Sep 2020 13:25:47 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4983AE064; Thu, 17 Sep 2020 13:25:47 +0000 (GMT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B63ECAE05C; Thu, 17 Sep 2020 13:25:44 +0000 (GMT) Received: from localhost.localdomain (unknown [9.211.95.89]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 17 Sep 2020 13:25:44 +0000 (GMT) Subject: Re: [PATCH v6 3/8] powerpc/watchpoint/ptrace: Fix SETHWDEBUG when CONFIG_HAVE_HW_BREAKPOINT=N To: Ravi Bangoria , mpe@ellerman.id.au, christophe.leroy@c-s.fr Cc: mikey@neuling.org, jniethe5@gmail.com, pedromfc@linux.ibm.com, linux-kernel@vger.kernel.org, paulus@samba.org, rogealve@linux.ibm.com, naveen.n.rao@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org References: <20200902042945.129369-1-ravi.bangoria@linux.ibm.com> <20200902042945.129369-4-ravi.bangoria@linux.ibm.com> From: Rogerio Alves Message-ID: <07c3e17e-df5a-884a-ac5d-f38cf40f2ad9@linux.ibm.com> Date: Thu, 17 Sep 2020 10:25:43 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200902042945.129369-4-ravi.bangoria@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-17_09:2020-09-16,2020-09-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 mlxscore=0 spamscore=0 impostorscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 malwarescore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009170098 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/2/20 1:29 AM, Ravi Bangoria wrote: > 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. > > It's safe to set HW_BRK_TYPE_PRIV_ALL because we don't really leak > any kernel address in signal info. Setting HW_BRK_TYPE_PRIV_ALL will > also help to find scenarios when kernel accesses user memory. > > Reported-by: Pedro Miraglia Franco de Carvalho > Suggested-by: Pedro Miraglia Franco de Carvalho > Signed-off-by: Ravi Bangoria Tested-by: Rogerio Alves > --- > 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..57a0ab822334 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_PRIV_ALL; > brk.len = DABR_MAX_LEN; > if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) > brk.type |= HW_BRK_TYPE_READ; >