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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 92684C433DF for ; Tue, 7 Jul 2020 15:23:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 513DB207CD for ; Tue, 7 Jul 2020 15:23:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="u/gEFadk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 513DB207CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D2ED18D001D; Tue, 7 Jul 2020 11:23:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D04A48D0014; Tue, 7 Jul 2020 11:23:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA6E88D001D; Tue, 7 Jul 2020 11:23:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id A4D1D8D0014 for ; Tue, 7 Jul 2020 11:23:55 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 49A9C2DFD for ; Tue, 7 Jul 2020 15:23:55 +0000 (UTC) X-FDA: 77011650030.25.size27_5a0971626eb5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id BC4D01804E532 for ; Tue, 7 Jul 2020 15:19:55 +0000 (UTC) X-HE-Tag: size27_5a0971626eb5 X-Filterd-Recvd-Size: 4879 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 15:19:55 +0000 (UTC) Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 CF0F52065D; Tue, 7 Jul 2020 15:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594135194; bh=IKRcYbDIFHiIBRV8TpFGBWYGnR6Vj1rFMLD4iE/uvww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u/gEFadkt2IeOzhPSikGLfnkNW34+z5L8CsNyGN4ZHMLaz+vuhAAY0y61k7AKs8D4 2TR0KN2dIKbTXpQuASSfgBNoQDYpVtt8dcH3yv3Qc3CT4yyFp+4lhy1XOOXHNCHzcC 0IOXulRQJ5E+Oe5uSH9aveAzoRI4zdn/8KXGcNmc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (VMware)" , Andrew Morton , Jaewon Kim , Jiri Olsa , Kees Kook , Namhyung Kim , Vlastimil Babka , linux-mm@kvack.org, linux-trace-devel@vger.kernel.org, Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.4 11/65] tools lib traceevent: Handle __attribute__((user)) in field names Date: Tue, 7 Jul 2020 17:16:50 +0200 Message-Id: <20200707145752.996517502@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200707145752.417212219@linuxfoundation.org> References: <20200707145752.417212219@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Rspamd-Queue-Id: BC4D01804E532 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Steven Rostedt (VMware) [ Upstream commit 74621d929d944529a5e2878a84f48bfa6fb69a66 ] Commit c61f13eaa1ee1 ("gcc-plugins: Add structleak for more stack initialization") added "__attribute__((user))" to the user when stackleak detector is enabled. This now appears in the field format of system call trace events for system calls that have user buffers. The "__attribute__((user))" breaks the parsing in libtraceevent. That needs to be handled. Signed-off-by: Steven Rostedt (VMware) Cc: Andrew Morton Cc: Jaewon Kim Cc: Jiri Olsa Cc: Kees Kook Cc: Namhyung Kim Cc: Vlastimil Babka Cc: linux-mm@kvack.org Cc: linux-trace-devel@vger.kernel.org Link: http://lore.kernel.org/lkml/20200324200956.663647256@goodmis.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/lib/traceevent/event-parse.c | 39 +++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/ev= ent-parse.c index 4bc3e1b906652..798284f511f16 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -1444,6 +1444,7 @@ static int event_read_fields(struct tep_event *even= t, struct tep_format_field ** enum tep_event_type type; char *token; char *last_token; + char *delim =3D " "; int count =3D 0; int ret; =20 @@ -1504,13 +1505,49 @@ static int event_read_fields(struct tep_event *ev= ent, struct tep_format_field ** field->flags |=3D TEP_FIELD_IS_POINTER; =20 if (field->type) { - ret =3D append(&field->type, " ", last_token); + ret =3D append(&field->type, delim, last_token); free(last_token); if (ret < 0) goto fail; } else field->type =3D last_token; last_token =3D token; + delim =3D " "; + continue; + } + + /* Handle __attribute__((user)) */ + if ((type =3D=3D TEP_EVENT_DELIM) && + strcmp("__attribute__", last_token) =3D=3D 0 && + token[0] =3D=3D '(') { + int depth =3D 1; + int ret; + + ret =3D append(&field->type, " ", last_token); + ret |=3D append(&field->type, "", "("); + if (ret < 0) + goto fail; + + delim =3D " "; + while ((type =3D read_token(&token)) !=3D TEP_EVENT_NONE) { + if (type =3D=3D TEP_EVENT_DELIM) { + if (token[0] =3D=3D '(') + depth++; + else if (token[0] =3D=3D ')') + depth--; + if (!depth) + break; + ret =3D append(&field->type, "", token); + delim =3D ""; + } else { + ret =3D append(&field->type, delim, token); + delim =3D " "; + } + if (ret < 0) + goto fail; + free(last_token); + last_token =3D token; + } continue; } break; --=20 2.25.1