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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 65D1AC43457 for ; Fri, 9 Oct 2020 15:17:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D12621D41 for ; Fri, 9 Oct 2020 15:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602256650; bh=pqbdPnMML7SpyoGS3xqUMZMoHcLQfnfK9Yd8Fb4EB9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:List-ID:From; b=vYR+NkVPHzNrfPeguupbY+lSJ8llfnyOGLEGXI3JbS7RUBxvT5ni/U6BWQd4iKD6Y eCS8rMQ4fyKfo/IpA37eTMVY3nIaEx76XVnWsREfleXt+hiaTLkrUpeGuwyHccKivY dH4WbaChQ8mhVgNhe6DiSPBPAFyWY+2ictVFsGIU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389256AbgJIPR0 (ORCPT ); Fri, 9 Oct 2020 11:17:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:40798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389231AbgJIPRT (ORCPT ); Fri, 9 Oct 2020 11:17:19 -0400 Received: from localhost.localdomain (c-73-209-127-30.hsd1.il.comcast.net [73.209.127.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39362222D9; Fri, 9 Oct 2020 15:17:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602256638; bh=pqbdPnMML7SpyoGS3xqUMZMoHcLQfnfK9Yd8Fb4EB9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=RAY1X/OJOYQlriiS7FZuFBkg2Zro6HZ0gQ3nsmCfPu97I6LBVUQDusKj5NdnnqMrs Q4lt2HYBS0nwuf2cIKoN556nH7/esK9vvrLnuxDB19BO6bFIjseva3z+0xevUqiLnZ m72HNzxTlX88SsyWvwLTSm2AOXBui0evA/2kVEZk= From: Tom Zanussi To: rostedt@goodmis.org, axelrasmussen@google.com Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] tracing: Check that the synthetic event and field names are legal Date: Fri, 9 Oct 2020 10:17:09 -0500 Message-Id: <82b1b533c54f83bb7cd466a32244533717c8f291.1602255803.git.zanussi@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call the is_good_name() function used by probe events to make sure synthetic event and field names don't contain illegal characters and cause unexpected parsing of synthetic event commands. Fixes: 4b147936fa50 (tracing: Add support for 'synthetic' events) Reported-by: Masami Hiramatsu Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_synth.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index b19e2f4159ab..8c9d6e464da0 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -572,6 +572,10 @@ static struct synth_field *parse_synth_field(int argc, const char **argv, ret = -ENOMEM; goto free; } + if (!is_good_name(field->name)) { + ret = -EINVAL; + goto free; + } if (field_type[0] == ';') field_type++; @@ -1112,6 +1116,11 @@ static int __create_synth_event(int argc, const char *name, const char **argv) mutex_lock(&event_mutex); + if (!is_good_name(name)) { + ret = -EINVAL; + goto out; + } + event = find_synth_event(name); if (event) { ret = -EEXIST; -- 2.17.1