Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2471617pxk; Mon, 14 Sep 2020 14:29:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVtAzoVNdSp+UR0T0PSBfTzWJM3cqOV0kq2HZ6Zk1H+g1q/TypiUFGvNNLFIRI4bSqKYoY X-Received: by 2002:a17:906:f90c:: with SMTP id lc12mr16465148ejb.104.1600118958892; Mon, 14 Sep 2020 14:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600118958; cv=none; d=google.com; s=arc-20160816; b=Z7xq8SN7EmZ5jSw6l3CO55Gg1ioaQRs7BNuA1F+ig+qTcKJW6xG7aVu24+t9kk6cve sSHVXYUO2B2wUWV1xiGqWpB5HhQB/vN/R+JQd7SHPTp4k5Mzt2I79jkfOZtOKBC9wJox 6oNLHc1RUHbsyKwx7H+F4Hjn3RNwJGiSt8W/XIgznBSx27uQQ1zLdVWnhkzCkZbm4Z1u ao/JQlO9PxbBCpfIx5q5e74N/PfTHYpMFFPgHSPAAtOZXLQ7zIie4os9lAT3nQtBLvU7 4PB6HmuQsaxrzXFaguJzj8ZbTGwPaXZVqUorgDAXkhEy0IK9G7c84nGo0aGL4pklkey7 aEDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=WWG3Tr3yKuD3GBk7YS0LkXiqGlCw3VNG+ohqkSn4PF4=; b=keJ0yU2JW14W10zDIxL/UUIgree2ItfCx6O49Rnyel6HVWEiGP7ra+1Jai+NJ+hsgq CF+zwB6LROFCitKMAgIQue8Zd767ubmPnWROb1CbwzMMxg9cV9GVXx/YzMrto4M9dcGq ye91zBb9MSuxArQM6zlBrN00zXTIUbTdugGuLiJaSOhS4gJrpwprccwXxeFjyKaFk1/i I0/OPnpTPV1miH8TBNA2lhc5I612fq+UkU8zOs6E1szuITCaNl9lXngYsDwlze9FQ+4m 6WNGcTNBHDBulznpNYWHLDldk3aDHbU2rRwTAPeDM9Qbi76AccnFT6vay2zACJMMdVxX OJVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Te1MQWTK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv24si7767702ejb.258.2020.09.14.14.28.56; Mon, 14 Sep 2020 14:29:18 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Te1MQWTK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726035AbgINV2L (ORCPT + 99 others); Mon, 14 Sep 2020 17:28:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:52388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725920AbgINV2J (ORCPT ); Mon, 14 Sep 2020 17:28:09 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (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 71E5A20759; Mon, 14 Sep 2020 21:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600118888; bh=8bhZoVD8TkqP7pZrtp8IBtCGwd8g4lCXEJfjLAu/Ark=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Te1MQWTKnzL++nKPCKRSJUSVkg73rHLbKXx2SBQzgtKJJVlq34ZCKmHGMddsc5rOO TybVS7D/Ni2lGGzAqmRhlFCOLSPdfxf7/4HAzvKl6dCr9ZbVNo07+2ZYtAVvLoq8PY f6sZNYRl6UrdOHKIL6H/+Cmnz8kLv+fD7hHiq97U= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 7103C40D3D; Mon, 14 Sep 2020 18:28:06 -0300 (-03) Date: Mon, 14 Sep 2020 18:28:06 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Wang Nan , lkml , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Michael Petlan Subject: Re: [PATCH] perf test: Fix signal test inline assembly Message-ID: <20200914212806.GB166601@kernel.org> References: <20200911130005.1842138-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200911130005.1842138-1-jolsa@kernel.org> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Sep 11, 2020 at 03:00:05PM +0200, Jiri Olsa escreveu: > When compiling with DEBUG=1 on Fedora 32 I'm getting crash for > 'perf test signal': > > Program received signal SIGSEGV, Segmentation fault. > 0x0000000000c68548 in __test_function () > (gdb) bt > #0 0x0000000000c68548 in __test_function () > #1 0x00000000004d62e9 in test_function () at tests/bp_signal.c:61 > #2 0x00000000004d689a in test__bp_signal (test=0xa8e280 #3 0x00000000004b7d49 in run_test (test=0xa8e280 #4 0x00000000004b7e7f in test_and_print (t=0xa8e280 #5 0x00000000004b8927 in __cmd_test (argc=1, argv=0x7fffffffdce0, ... > ... > > It's caused by __test_function being in .bss section: > > $ readelf -a ./perf | less > [Nr] Name Type Address Offset > Size EntSize Flags Link Info Align > ... > [28] .bss NOBITS 0000000000c356a0 008346a0 > 00000000000511f8 0000000000000000 WA 0 0 32 > > $ nm perf | grep __test_function > 0000000000c68548 B __test_function > > I guess most of the time we're just lucky the inline asm ended up > in .text section, so making it specific explicit with push and pop > section cluases. > > $ readelf -a ./perf | less > [Nr] Name Type Address Offset > Size EntSize Flags Link Info Align > ... > [13] .text PROGBITS 0000000000431240 00031240 > 0000000000306faa 0000000000000000 AX 0 0 16 > > $ nm perf | grep __test_function > 00000000004d62c8 T __test_function Thanks, tested and applied. - Arnaldo > Cc: Wang Nan > Fixes: 8fd34e1cce18 ("perf test: Improve bp_signal") > Signed-off-by: Jiri Olsa > --- > tools/perf/tests/bp_signal.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c > index da8ec1e8e064..cc9fbcedb364 100644 > --- a/tools/perf/tests/bp_signal.c > +++ b/tools/perf/tests/bp_signal.c > @@ -45,10 +45,13 @@ volatile long the_var; > #if defined (__x86_64__) > extern void __test_function(volatile long *ptr); > asm ( > + ".pushsection .text;" > ".globl __test_function\n" > + ".type __test_function, @function;" > "__test_function:\n" > "incq (%rdi)\n" > - "ret\n"); > + "ret\n" > + ".popsection\n"); > #else > static void __test_function(volatile long *ptr) > { > -- > 2.26.2 > -- - Arnaldo