Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2174345ybm; Thu, 23 May 2019 12:34:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/hYlEDmQzzfczOJgECh0V5LH78hqMVf/pSaR6x7f/Z2Z7HCvvoIqs/zkH4YF5AQcxZ95d X-Received: by 2002:a65:610b:: with SMTP id z11mr80599962pgu.204.1558640084601; Thu, 23 May 2019 12:34:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558640084; cv=none; d=google.com; s=arc-20160816; b=Tv1pOZd3I8VJy2kYDgP2Mznfjh4R/saeIqTCt9GRKbeakEKU858SJgFNJdz05Dfs+N NSs/43+DFUg9NwOTfrGTgtkPFdGq4U0WKau5K1R4S4sFRth5x2FJVMyrJt6HeRac3Rg2 P6qQI0l67TKi6H0AZWnggfqoWpCHZrkQMFJ3qYBYUBHadma8xv8akcKScq4QSjfR4TPh OhtNw4dy0nxurLwCBIsrqdIg+ICCSWkeNSnaU2YEmI9gwBgaPWN9u+1GBYRvPM/qg2IW BtRIddaK6U3C8lxFOPNjF2lWs8LDka8t1U3dWF7eHeziDXnGsVYlznWaNrE2fYJg7DcR ae1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WI823f51UGppxnpqyO5S+D00kIS51aeqCYsNpIuALu4=; b=UP+PIgYfrCXGP4TifmWQemRo873hT5Wmcb+phg2TPJt4zUtGVkBbuaPZr6zbVyU14e XRDTBnVTTgVFp9q0cHCzIoJNk16/Dq6QPeZLKxhfzvhtsmY21UaLDmKEPa40YmkHL3kG RXIeulGyfs4gZMeyLnf1nFOVUcCCkIHMb0X+J2UvFtCeclei1jzyHFNjkLfuKRnZ/zhD UJxHEx1QFTAPY8ZFQDaVTFZ+xZXCjpzHpVa24P+NlsRtlS5uwHsZ5pKpXRGIA6pIAzXN AeOQWYypxPHgCJWpllleDF9ui3S3S7I32kDvzkMh9VRUfTKWQSuNN+lNds2QC/R1O9sT yBJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yBpsTC67; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z124si372080pfz.93.2019.05.23.12.34.28; Thu, 23 May 2019 12:34:44 -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=@kernel.org header.s=default header.b=yBpsTC67; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392113AbfEWTaV (ORCPT + 99 others); Thu, 23 May 2019 15:30:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:43792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392102AbfEWTaS (ORCPT ); Thu, 23 May 2019 15:30:18 -0400 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 3EA6021855; Thu, 23 May 2019 19:30:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639817; bh=s72rLvTOwA5x4B2XRi8yDybv5ixqBUHpoT+rgHvTsdc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yBpsTC6760S5NV5fn8XS0xPjTGu3e5RuTigGInIpDS279wdU6GDnLnn1ZB4z/UGb6 eZStCrX+RVkcgK5lNbRad6eBgGsDTt9bbEXGA/F+wKde3z+WAe4JSwx2b56OIoYnC1 rwBlHdE8OwUsNd7u41/gnQG+h4pOjv1L7teMt4AY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Ziegler , Ingo Molnar , Masami Hiramatsu , "Steven Rostedt (VMware)" Subject: [PATCH 5.1 077/122] tracing: probeevent: Fix to make the type of $comm string Date: Thu, 23 May 2019 21:06:39 +0200 Message-Id: <20190523181714.962759068@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181705.091418060@linuxfoundation.org> References: <20190523181705.091418060@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu commit 3dd1f7f24f8ceec00bbbc364c2ac3c893f0fdc4c upstream. Fix to make the type of $comm "string". If we set the other type to $comm argument, it shows meaningless value or wrong data. Currently probe events allow us to set string array type (e.g. ":string[2]"), or other digit types like x8 on $comm. But since clearly $comm is just a string data, it should not be fetched by other types including array. Link: http://lkml.kernel.org/r/155723736241.9149.14582064184468574539.stgit@devnote2 Cc: Andreas Ziegler Cc: Ingo Molnar Cc: stable@vger.kernel.org Fixes: 533059281ee5 ("tracing: probeevent: Introduce new argument fetching code") Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_probe.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -420,13 +420,14 @@ static int traceprobe_parse_probe_arg_bo return -E2BIG; } } - /* - * The default type of $comm should be "string", and it can't be - * dereferenced. - */ - if (!t && strcmp(arg, "$comm") == 0) + + /* Since $comm can not be dereferred, we can find $comm by strcmp */ + if (strcmp(arg, "$comm") == 0) { + /* The type of $comm must be "string", and not an array. */ + if (parg->count || (t && strcmp(t, "string"))) + return -EINVAL; parg->type = find_fetch_type("string"); - else + } else parg->type = find_fetch_type(t); if (!parg->type) { pr_info("Unsupported type: %s\n", t);