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.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 04F7AC4360C for ; Tue, 8 Oct 2019 23:53:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6DD020674 for ; Tue, 8 Oct 2019 23:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570578809; bh=Lpy3NYwSAzPBGCnwUhBnvx3bxwe+YtQ77gfXWVSIyuo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=YMR43mNFr1CNPcqDEhrMBS0Og9ErelZFQ36dEJMxFhKsAUMlaHw2tmIlmJ6fx/DWE VK2f9I7ZqlvtIy2YEdVyhGFm8crQGrnSUl87nvT3fBtqNVDXVrxa0yQCLMU95dqDsm wFXyGza3xX+BBzK/U1wqB2zTE0M/++38D94v4qc8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727715AbfJHXx3 (ORCPT ); Tue, 8 Oct 2019 19:53:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:48832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbfJHXx3 (ORCPT ); Tue, 8 Oct 2019 19:53:29 -0400 Received: from localhost (unknown [131.107.159.163]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C0FDC20674; Tue, 8 Oct 2019 23:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570578807; bh=Lpy3NYwSAzPBGCnwUhBnvx3bxwe+YtQ77gfXWVSIyuo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2UQAB2vo9xQmqtch0m7o1qIC/w/s6LWCVOL76UPrsQp0vXUmqM0KuoAK8Ely2GoFm +X5LNUlECo/xvkobVXoDCzDiCq6Jf47+CsujvfZEeQwAk1XdLqSjPWVzhLU8GMB/qF EwNBeV1JfpLPKYEGVSP+112sBK7zUEwbLLBQOyB4= Date: Tue, 8 Oct 2019 19:53:27 -0400 From: Sasha Levin To: gregkh@linuxfoundation.org Cc: srikar@linux.vnet.ibm.com, acme@redhat.com, jolsa@kernel.org, namhyung@kernel.org, naveen.n.rao@linux.vnet.ibm.com, ravi.bangoria@linux.ibm.com, stable@vger.kernel.org Subject: Re: FAILED: patch "[PATCH] perf stat: Fix a segmentation fault when using repeat forever" failed to apply to 4.14-stable tree Message-ID: <20191008235327.GN1396@sasha-vm> References: <157055528553188@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <157055528553188@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Tue, Oct 08, 2019 at 07:21:25PM +0200, gregkh@linuxfoundation.org wrote: > >The patch below does not apply to the 4.14-stable tree. >If someone wants it applied there, or to any other stable or longterm >tree, then please email the backport, including the original git commit >id to . > >thanks, > >greg k-h > >------------------ original commit in Linus's tree ------------------ > >>From 443f2d5ba13d65ccfd879460f77941875159d154 Mon Sep 17 00:00:00 2001 >From: Srikar Dronamraju >Date: Wed, 4 Sep 2019 15:17:38 +0530 >Subject: [PATCH] perf stat: Fix a segmentation fault when using repeat forever > >Observe a segmentation fault when 'perf stat' is asked to repeat forever >with the interval option. > >Without fix: > > # perf stat -r 0 -I 5000 -e cycles -a sleep 10 > # time counts unit events > 5.000211692 3,13,89,82,34,157 cycles > 10.000380119 1,53,98,52,22,294 cycles > 10.040467280 17,16,79,265 cycles > Segmentation fault > >This problem was only observed when we use forever option aka -r 0 and >works with limited repeats. Calling print_counter with ts being set to >NULL, is not a correct option when interval is set. Hence avoid >print_counter(NULL,..) if interval is set. > >With fix: > > # perf stat -r 0 -I 5000 -e cycles -a sleep 10 > # time counts unit events > 5.019866622 3,15,14,43,08,697 cycles > 10.039865756 3,15,16,31,95,261 cycles > 10.059950628 1,26,05,47,158 cycles > 5.009902655 3,14,52,62,33,932 cycles > 10.019880228 3,14,52,22,89,154 cycles > 10.030543876 66,90,18,333 cycles > 5.009848281 3,14,51,98,25,437 cycles > 10.029854402 3,15,14,93,04,918 cycles > 5.009834177 3,14,51,95,92,316 cycles > >Committer notes: > >Did the 'git bisect' to find the cset introducing the problem to add the >Fixes tag below, and at that time the problem reproduced as: > > (gdb) run stat -r0 -I500 sleep 1 > > Program received signal SIGSEGV, Segmentation fault. > print_interval (prefix=prefix@entry=0x7fffffffc8d0 "", ts=ts@entry=0x0) at builtin-stat.c:866 > 866 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep); > (gdb) bt > #0 print_interval (prefix=prefix@entry=0x7fffffffc8d0 "", ts=ts@entry=0x0) at builtin-stat.c:866 > #1 0x000000000041860a in print_counters (ts=ts@entry=0x0, argc=argc@entry=2, argv=argv@entry=0x7fffffffd640) at builtin-stat.c:938 > #2 0x0000000000419a7f in cmd_stat (argc=2, argv=0x7fffffffd640, prefix=) at builtin-stat.c:1411 > #3 0x000000000045c65a in run_builtin (p=p@entry=0x6291b8 , argc=argc@entry=5, argv=argv@entry=0x7fffffffd640) at perf.c:370 > #4 0x000000000045c893 in handle_internal_command (argc=5, argv=0x7fffffffd640) at perf.c:429 > #5 0x000000000045c8f1 in run_argv (argcp=argcp@entry=0x7fffffffd4ac, argv=argv@entry=0x7fffffffd4a0) at perf.c:473 > #6 0x000000000045cac9 in main (argc=, argv=) at perf.c:588 > (gdb) > >Mostly the same as just before this patch: > > Program received signal SIGSEGV, Segmentation fault. > 0x00000000005874a7 in print_interval (config=0xa1f2a0 , evlist=0xbc9b90, prefix=0x7fffffffd1c0 "`", ts=0x0) at util/stat-display.c:964 > 964 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, config->csv_sep); > (gdb) bt > #0 0x00000000005874a7 in print_interval (config=0xa1f2a0 , evlist=0xbc9b90, prefix=0x7fffffffd1c0 "`", ts=0x0) at util/stat-display.c:964 > #1 0x0000000000588047 in perf_evlist__print_counters (evlist=0xbc9b90, config=0xa1f2a0 , _target=0xa1f0c0 , ts=0x0, argc=2, argv=0x7fffffffd670) > at util/stat-display.c:1172 > #2 0x000000000045390f in print_counters (ts=0x0, argc=2, argv=0x7fffffffd670) at builtin-stat.c:656 > #3 0x0000000000456bb5 in cmd_stat (argc=2, argv=0x7fffffffd670) at builtin-stat.c:1960 > #4 0x00000000004dd2e0 in run_builtin (p=0xa30e00 , argc=5, argv=0x7fffffffd670) at perf.c:310 > #5 0x00000000004dd54d in handle_internal_command (argc=5, argv=0x7fffffffd670) at perf.c:362 > #6 0x00000000004dd694 in run_argv (argcp=0x7fffffffd4cc, argv=0x7fffffffd4c0) at perf.c:406 > #7 0x00000000004dda11 in main (argc=5, argv=0x7fffffffd670) at perf.c:531 > (gdb) > >Fixes: d4f63a4741a8 ("perf stat: Introduce print_counters function") >Signed-off-by: Srikar Dronamraju >Acked-by: Jiri Olsa >Tested-by: Arnaldo Carvalho de Melo >Tested-by: Ravi Bangoria >Cc: Namhyung Kim >Cc: Naveen N. Rao >Cc: stable@vger.kernel.org # v4.2+ >Link: http://lore.kernel.org/lkml/20190904094738.9558-3-srikar@linux.vnet.ibm.com >Signed-off-by: Arnaldo Carvalho de Melo Fixed up and queued it for 4.14-4.4. -- Thanks, Sasha