Received: by 10.213.65.68 with SMTP id h4csp2114658imn; Sun, 8 Apr 2018 20:05:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48E6U5awrpT9h6/I8Qg4v2V/91NTBVTuvKCDkDpvY6Q0olIHlg/VM+ufr7aV5uEzp8xlD5Z X-Received: by 10.98.8.133 with SMTP id 5mr27465189pfi.154.1523243101122; Sun, 08 Apr 2018 20:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243101; cv=none; d=google.com; s=arc-20160816; b=BBzw19SnxtbZ9+1Js211w92R4JXhk9DeRXuvYwFSs8XBqhxpHnXiVYm4s21UCaRjiO FcBt36sCwQ3V0x3nJKF2PC4WioOAiEbKZnH90+JZUPj5Lik+huWAIUssXItMYoEuVdC7 6YZp+yJ0xy7S0ul9Hd4j9xCQ6GhL7XV9Ag+8lsinMKzA5nGxLcqVElLTYct5N5dmgo88 64v321p29vzpOpKfLFV45rFEpLCroKe1XzpXUh5a9jVTRzC7RRzsmwqK3TqaTNACdzg4 Up/Bt0Cqu8+icaUeHbD0K8GWaQQvlJ0PESVd7I4SGdc1NpOTGckMzI+eXRkcSGFz3L5R KJqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=pv2XmIehKRoc3CfilaoWpnuvQAPfo+a+GJOh7h8gdSw=; b=M3+isA9GimSsjuEXfMYfQHqk7BcBL9l6NYEA6LjyskO9yxtXQtbbWGswUis/A7rYl9 3143ZrX5VJg/ehaIPFttTc8B5WYcUEDUlw5mFPbdUZdN/0bsnT35Si36LX5JWMv29ZXU hVec11BKAs4ou91qFK6Im7jEM4FVr7Cboz1JhtrJLGMwmBqM2c7TU5yaDq+Fv6mQIfUN 3YTCEfjz9qJd2GXZWT28PPH9aRIr4VWW5HH8gzq668qmKLxzVGlL+oJ4rRlADLugUKx4 vPSXF0GU3mAQJlhzwanORCvV2pyHZaSp2WjqDzDNsmFjjkaOzLRvrs5sHFwkGGzrMnsG 8zzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=MF0f3hGs; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si10299121pgv.558.2018.04.08.20.04.24; Sun, 08 Apr 2018 20:05:01 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=MF0f3hGs; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932908AbeDIAh7 (ORCPT + 99 others); Sun, 8 Apr 2018 20:37:59 -0400 Received: from mail-by2nam01on0100.outbound.protection.outlook.com ([104.47.34.100]:3232 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932882AbeDIAhz (ORCPT ); Sun, 8 Apr 2018 20:37:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pv2XmIehKRoc3CfilaoWpnuvQAPfo+a+GJOh7h8gdSw=; b=MF0f3hGsXGyIKB0PDR3dgwHhLeMAW42yremajnMyfj44LGQQYhpXC7Bb1qygqwOYdANEBs4Y21a0PyRblzLZgqu6KPrkYNXzkGfrIaVOr2aNtchRDAKInaY77EP8FMiSyW14NrXeyIowp/r3sF/qa7do+NY0g5pf5xazygGTf58= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1110.namprd21.prod.outlook.com (52.132.131.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:37:50 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:37:50 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Hendrick Brueckner , Jiri Olsa , Namhyung Kim , Thomas Richter , Wang Nan , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 113/162] perf callchain: Fix attr.sample_max_stack setting Thread-Topic: [PATCH AUTOSEL for 4.4 113/162] perf callchain: Fix attr.sample_max_stack setting Thread-Index: AQHTz5nIxLCOa4/DJEGtVc2/OdknNw== Date: Mon, 9 Apr 2018 00:29:12 +0000 Message-ID: <20180409002738.163941-113-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1110;7:ra7ZfhGX3rl2bpfdOH1SxhWyHvyzDsHEnwlFWs6Mqvz1KcVgO2mkA56SbXNx+ugnfwh0zYbX4D2MQpfRBmNW2Cm4OohkhONCQCKn6RZkez3Rk468n9ttVQisp08HvJEy0mNtMTfyL5Kf6k0B+otP5qlMxSBEBCq/VlJa2lRiG0gRQnLi+HIEQCP1+yiYUFVvdd4S/hZ79CNugJHvgbhwk22FHlXZrQKZqXG3Mb//ZJXddlSirFeWGL+GhnhoEeQB;20:fCoZU9z5MWXhouTXGlcvOU3nz3qvcp1yyvehiAtMGMyeDckZ0h7o8YSb8LNBXCXENAsWKV9+iN12kVoYx4sMZzOax5lkPJfYb286o81YnUL03XTM2BEsxxUCRYFPBdXzjC09I3ARJKdNoTy3IyGXjoWzvEyHOrgL9tFjJGm5EdQ= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 8a2deb90-ff4d-4553-4528-08d59db21ff6 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1110; x-ms-traffictypediagnostic: DM5PR2101MB1110: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513)(85827821059158)(42068640409301)(84791874153150)(104084551191319)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1110;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1110; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(39380400002)(346002)(396003)(376002)(366004)(199004)(189003)(53936002)(6306002)(186003)(5250100002)(105586002)(966005)(11346002)(99286004)(476003)(66066001)(6512007)(86362001)(575784001)(3660700001)(1076002)(54906003)(68736007)(110136005)(3280700002)(39060400002)(316002)(305945005)(4326008)(107886003)(22452003)(14454004)(7736002)(446003)(6666003)(2501003)(10290500003)(3846002)(6116002)(72206003)(106356001)(25786009)(6486002)(6436002)(8936002)(478600001)(7416002)(5660300001)(86612001)(8676002)(81156014)(2906002)(102836004)(81166006)(6506007)(2900100001)(76176011)(2616005)(486006)(26005)(36756003)(10090500001)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1110;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: C+CYCEOYEAVHM2zZmdcrQhpaghDdM3gYnBIa6PmVKqgw0mad/IxOsXHqqj9I9+lIXoV951qyb+n5kA3NDDsK34bCGw2Fwy/Jheiim8oK4/PHc9cFMgltvDQxpLl1v+OWd/Ljhia+aV1w5f6cfqoQBHsb5kt9qZeY3mTZRN7TF6g68HJQ3Yl1nZ0i55Qef0FYYmGGXCt7GBp8oY2Pv/NlC1bxOTlSjtMrAupsZO9fFgBZvLQkVLc6RLcyOESrdBD9rzd3AXusW2In/ZqKUQGw5MxXF8gta1co/UV0tTB9MnizguidG9YN/BnG5zKTq1o9K/QZHo2aCdVHoPPUvJESlSn1/rg1NiiZH5iQbEhYXnyuw6uoHoCZYQCwI3rxzba2DrHE7RNq4aHyyKpQ2yKkxxCQdb2HViveRLGmvaWLqbo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a2deb90-ff4d-4553-4528-08d59db21ff6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:29:12.2398 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1110 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 249d98e567e25dd03e015e2d31e1b7b9648f34df ] When setting the "dwarf" unwinder for a specific event and not specifying the max-stack, the attr.sample_max_stack ended up using an uninitialized callchain_param.max_stack, fix it by using designated initializers for that callchain_param variable, zeroing all non explicitely initialized struct members. Here is what happened: # perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call= -graph=3Ddwarf/ ping -6 -c 1 ::1 callchain: type DWARF callchain: stack dump size 8192 perf_event_attr: type 2 size 112 config 0x730 { sample_period, sample_freq } 1 sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|= RAW|REGS_USER|STACK_USER|DATA_SRC exclude_callchain_user 1 { wakeup_events, wakeup_watermark } 1 sample_regs_user 0xff0fff sample_stack_user 8192 sample_max_stack 50656 sys_perf_event_open failed, error -75 Value too large for defined data type # perf trace -vv --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call= -graph=3Ddwarf/ ping -6 -c 1 ::1 callchain: type DWARF callchain: stack dump size 8192 perf_event_attr: type 2 size 112 config 0x730 sample_type IP|TID|TIME|ADDR|CALLCHAIN|CPU|PERIOD|= RAW|REGS_USER|STACK_USER|DATA_SRC exclude_callchain_user 1 sample_regs_user 0xff0fff sample_stack_user 8192 sample_max_stack 30448 sys_perf_event_open failed, error -75 Value too large for defined data type # Now the attr.sample_max_stack is set to zero and the above works as expected: # perf trace --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-gra= ph=3Ddwarf/ ping -6 -c 1 ::1 PING ::1(::1) 56 data bytes 64 bytes from ::1: icmp_seq=3D1 ttl=3D64 time=3D0.072 ms --- ::1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev =3D 0.072/0.072/0.072/0.000 ms 0.000 probe_libc:inet_pton:(7feb7a998350)) __inet_pton (inlined) gaih_inet.constprop.7 (/usr/lib64/= libc-2.26.so) __GI_getaddrinfo (inlined) [0xffffaa39b6108f3f] (/usr/bin/pin= g) # Cc: Adrian Hunter Cc: David Ahern Cc: Hendrick Brueckner Cc: Jiri Olsa Cc: Namhyung Kim Cc: Thomas Richter Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-is9tramondqa9jlxxsgcm9iz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/evsel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 397fb4ed3c97..f0bd4825f95a 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -624,13 +624,13 @@ static void apply_config_terms(struct perf_evsel *evs= el, struct perf_evsel_config_term *term; struct list_head *config_terms =3D &evsel->config_terms; struct perf_event_attr *attr =3D &evsel->attr; - struct callchain_param param; + /* callgraph default */ + struct callchain_param param =3D { + .record_mode =3D callchain_param.record_mode, + }; u32 dump_size =3D 0; char *callgraph_buf =3D NULL; =20 - /* callgraph default */ - param.record_mode =3D callchain_param.record_mode; - list_for_each_entry(term, config_terms, list) { switch (term->type) { case PERF_EVSEL__CONFIG_TERM_PERIOD: --=20 2.15.1