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=-5.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 F2E45C433E0 for ; Thu, 4 Feb 2021 14:23:19 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3061A64E4A for ; Thu, 4 Feb 2021 14:23:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3061A64E4A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4DWgkr0bqDzDwxL for ; Fri, 5 Feb 2021 01:23:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=ananth@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=aQpa6zBw; dkim-atps=neutral Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4DWgfy5Hm5zDrgx for ; Fri, 5 Feb 2021 01:19:52 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 114E62no029368 for ; Thu, 4 Feb 2021 09:19:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=reply-to : subject : to : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=uQEAhMsDHNuCpnbQUKYLGiZSCAf5LZtNGSaKjz2DwmU=; b=aQpa6zBws7pSaEX4q9ueunyWdRx5m+Z2Loj4kUf2IKOCqvw70ppHzCWXLfo+1yf+wGya t6c2QbjF7zQ5/ysjamXH3igsqZLkPJL3QvU0JStG/8fQ4aVAI+3eeVpISqy7iUDYKwm6 z8H/qhdkihfW60gGiD+dP/JEv24+AlPMu89cTIlKZdvHS5cK/gJQquIAg/e0yeEba8u7 FBi/ehXiz+MBa1QeW0iVbrK0QDT2NhKBfCcrHa+v35P7TViXF7B/OduimFkfPIPqPCGK ar4kJSro6BD2lXLE3V0HGV5nvc0L0Drb5GtJgal1KfNfvVFvaynCog0Bm+7ahtKFDIpb dQ== 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 36gj908rtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Feb 2021 09:19:49 -0500 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 114EGLal001824 for ; Thu, 4 Feb 2021 14:19:48 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma04dal.us.ibm.com with ESMTP id 36ex3p8m3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 04 Feb 2021 14:19:48 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 114EJld317105354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 4 Feb 2021 14:19:47 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF224AC05E for ; Thu, 4 Feb 2021 14:19:47 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37E9BAC059 for ; Thu, 4 Feb 2021 14:19:47 +0000 (GMT) Received: from [9.85.93.213] (unknown [9.85.93.213]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 14:19:46 +0000 (GMT) Subject: Re: [PATCH v2] powerpc/uprobes: Validation for prefixed instruction To: linuxppc-dev@lists.ozlabs.org References: <20210204104703.273429-1-ravi.bangoria@linux.ibm.com> <79b0bed7-8b98-d58d-dc47-644195bbc095@linux.ibm.com> From: Ananth N Mavinakayanahalli Organization: IBM Message-ID: Date: Thu, 4 Feb 2021 19:49:46 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <79b0bed7-8b98-d58d-dc47-644195bbc095@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.369, 18.0.737 definitions=2021-02-04_07:2021-02-04, 2021-02-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102040086 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ananth@linux.ibm.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 2/4/21 4:19 PM, Ravi Bangoria wrote: > > > On 2/4/21 4:17 PM, Ravi Bangoria wrote: >> Don't allow Uprobe on 2nd word of a prefixed instruction. As per >> ISA 3.1, prefixed instruction should not cross 64-byte boundary. >> So don't allow Uprobe on such prefixed instruction as well. >> >> There are two ways probed instruction is changed in mapped pages. >> First, when Uprobe is activated, it searches for all the relevant >> pages and replace instruction in them. In this case, if we notice >> that probe is on the 2nd word of prefixed instruction, error out >> directly. Second, when Uprobe is already active and user maps a >> relevant page via mmap(), instruction is replaced via mmap() code >> path. But because Uprobe is invalid, entire mmap() operation can >> not be stopped. In this case just print an error and continue. > > @mpe, > > arch_uprobe_analyze_insn() can return early if > cpu_has_feature(CPU_FTR_ARCH_31) is not set. But that will > miss out a rare scenario of user running binary with prefixed > instruction on p10 predecessors. Please let me know if I > should add cpu_has_feature(CPU_FTR_ARCH_31) or not. Wouldn't that binary get a SIGILL in any case? I concur with Naveen... it makes sense to add the check. -- Ananth