Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4845931imm; Mon, 11 Jun 2018 21:00:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIh5mSuOwskEOUJSaWj6qoiDPiv78ktDa7YGmoT9Udpyb6fxK8K4uefnXAqvAh1E9EW6lBl X-Received: by 2002:a65:6190:: with SMTP id c16-v6mr1612796pgv.405.1528776057192; Mon, 11 Jun 2018 21:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528776057; cv=none; d=google.com; s=arc-20160816; b=YrX7x+11afG6kJDNj3EDQOSroDC9AWq9UYbXFExIrfUX8adi0Dczpl/rq3UzD9g5/4 kT4iDrd6V+r8g/CC2GNfZx0iF9b2hM493nUW9kKbOJAz8LXgVUdkLGAf0rX2VfwS4+Es b8S7QFr34EEBPipSYjr1OkLIvrjswJshONu9m5MlLX5g9g0U4GeWwWWmDTeaGu7M37Bt KZ44zZmIJ5GerCGBGza4BnWeH/eYFI+vWrK02R3ssxAxf2Q2HZl9lVn3GJvHqJT5LBf2 Vh+pbvKETEOKt9UbWrMdYNPIeL4opkNjsb3fpzSIWARDzQ+7Ody4FYn8CdV9Im1wq8ik FpMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=9k60bpuwSJQVsw07c/UxQwX6N/3lRvyJJ6Ub2pawt2w=; b=uPitmv7dMA59AVEYnWUKqsrffq0oHHPLmapOgykM8jyZeLUG/bkfCILufWQfyNXlMz vcQKAZ3b6jCVvGNUqtFPf/GyDpW5XdTW9GOw/zX6k1eT6t/s2o96z9L+P8huA9xS8OKO g1DFB4LwpPWm5zQaRky0TZK8CaFHnufF2rI5HI5kRY/7IXpmkM7bvkIPAJlGkp/t0pwF BC/VaUQp0s3A/oLUKAsYMwSckoY3x1upGQNdB1TWA1gLchDzP+xu+nmcnFQdbLuM2lIl c7bifHHrXwv+3qwm489YcAYNN/HDdptpcIsyy4xGX6ozpQEwkXN5DP0WQscsTt7217g8 QWbA== 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 e90-v6si5905185plb.437.2018.06.11.21.00.42; Mon, 11 Jun 2018 21:00:57 -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 S933753AbeFLD6S (ORCPT + 99 others); Mon, 11 Jun 2018 23:58:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55968 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933182AbeFLD6R (ORCPT ); Mon, 11 Jun 2018 23:58:17 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5C3reVl036841 for ; Mon, 11 Jun 2018 23:58:16 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jj5a32mvc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Jun 2018 23:58:16 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 Jun 2018 04:58:14 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 12 Jun 2018 04:58:13 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5C3wB3I10027188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 12 Jun 2018 03:58:11 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 789734C044; Tue, 12 Jun 2018 04:49:23 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3657F4C046; Tue, 12 Jun 2018 04:49:22 +0100 (BST) Received: from [9.124.31.199] (unknown [9.124.31.199]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 12 Jun 2018 04:49:22 +0100 (BST) Subject: Re: [PATCH] perf report powerpc: Fix crash if callchain is empty To: Sandipan Das , acme@kernel.org Cc: jolsa@redhat.com, linux-kernel@vger.kernel.org, naveen.n.rao@linux.vnet.ibm.com, sukadev@linux.vnet.ibm.com, Ravi Bangoria References: <20180611104049.11048-1-sandipan@linux.ibm.com> From: Ravi Bangoria Date: Tue, 12 Jun 2018 09:28:09 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180611104049.11048-1-sandipan@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18061203-4275-0000-0000-0000028CAFB5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18061203-4276-0000-0000-00003793D1BF Message-Id: <7fe2c26e-a5a7-3141-870e-c93558bb082b@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-12_01:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806120044 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/2018 04:10 PM, Sandipan Das wrote: > For some cases, the callchain provided by the kernel may be > empty. So, the callchain ip filtering code will cause a crash > if we do not check whether the struct ip_callchain pointer is > NULL before accessing any members. > > This can be observed on a powerpc64le system running Fedora 27 > as shown below. > > # perf record -b -e cycles:u ls > > Before applying this patch: > > # perf report --branch-history > > perf: Segmentation fault > -------- backtrace -------- > perf[0x1027615c] > linux-vdso64.so.1(__kernel_sigtramp_rt64+0x0)[0x7fff856304d8] > perf(arch_skip_callchain_idx+0x44)[0x10257c58] > perf[0x1017f2e4] > perf(thread__resolve_callchain+0x124)[0x1017ff5c] > perf(sample__resolve_callchain+0xf0)[0x10172788] > ... > > After applying this patch: > > # perf report --branch-history > > Samples: 25 of event 'cycles:u', Event count (approx.): 2306870 > Overhead Source:Line Symbol Shared Object > + 11.60% _init+35736 [.] _init ls > + 9.84% strcoll_l.c:137 [.] __strcoll_l libc-2.26.so > + 9.16% memcpy.S:175 [.] __memcpy_power7 libc-2.26.so > + 9.01% gconv_charset.h:54 [.] _nl_find_locale libc-2.26.so > + 8.87% dl-addr.c:52 [.] _dl_addr libc-2.26.so > + 8.83% _init+236 [.] _init ls > ... > > Reported-by: Ravi Bangoria > Signed-off-by: Sandipan Das Acked-by: Ravi Bangoria