Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3729795ybv; Mon, 10 Feb 2020 05:26:59 -0800 (PST) X-Google-Smtp-Source: APXvYqytaSM+bW4SN/bHXCQbIn4KGvxBU8bi6posyPGZW7XSTxMIiZ60OJq+sBMp4EUhSOxtTIK1 X-Received: by 2002:aca:bb54:: with SMTP id l81mr766181oif.175.1581341219570; Mon, 10 Feb 2020 05:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581341219; cv=none; d=google.com; s=arc-20160816; b=whQ8az/vAX4j2jJpZHxWmy5hUhqw+6eYho3Sa+r2H3NgtTJtNtS4UbLk+BWV20anpP 11NUGci/Q6XHQK7BybgWyhAAMXnpqORUGGM4ZuJrDQ4JR7mvC4ux+qjwBUOCVFsjQA/N tXF9oEMx6zmGJcjHObifKsH20A36IEiw2tTtgsUxQVqsNKHCr2IGU9D3ueY0SkvrVkow iuZRZ+mGGjQu4mB8nzkAZFfjF6YJ16pgqj+sQ46vjRfdzbrkkbmQUYi2/+719K1O4eLE HXM4d/ZQlfHypRnUQqGacEnGysYtnsmU8DLLBksBgKn47XfLl01tMGRifGjGBiCGpps3 pZbw== 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=ujYFqbBZXF8IyeO3l80xsrBESl/CxncQMoZMqEePFXE=; b=VsSSxp5eDUioicBzeQOoDIHIHMnhqycKnLbQ/ChTAG92Tog9Y4pvXvo/rwMWcBgUmO IY+a1eYMYvWhKU/tE/kYjW1dyPc3CjI1dUAYFIEoMzuVT7hAYdiRd/OfJaKiQvXTfRu0 yywpIjTLechlunFcjuXY56ngckeeoekJFUKII4bJObZdRwkpZlEN/ic4/noI02NAQWQ2 nHiqGb6vb/7drBdyODA4cV/SQRBTdfldoMdLzbkqCjuuBKsvf13alQiD2d0tjzrTtXIz rpkull5AJJEV7iGJ4iKG9nrNh3rFs676XwX5YdiqJYWeTHGy1vqXxOt43yS3WyXxXLae /M4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CA3LfErg; 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 k184si168684oib.239.2020.02.10.05.26.47; Mon, 10 Feb 2020 05:26:59 -0800 (PST) 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=CA3LfErg; 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 S1728771AbgBJN0S (ORCPT + 99 others); Mon, 10 Feb 2020 08:26:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:56700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727924AbgBJMgr (ORCPT ); Mon, 10 Feb 2020 07:36:47 -0500 Received: from localhost (unknown [209.37.97.194]) (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 2EAAA20733; Mon, 10 Feb 2020 12:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338206; bh=54VNu45w/vLNKLZ2cxJsWNJgFLn0bNvrtrd9wtIlbaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CA3LfErgIASlYX3Cz5Ufr3LcMEnD/OztakzX4rpmQs/SK5sQMXdA1g3PyWzz4REa8 ApP57dLLTKJDoZE4nr7ljIbkOg49jeGYaaWKXI39rp5zgkdDX4SKHv1NinS/FepgNM SU8aiunlzrYXQOpN3XOVH/S2zVf9T1DeEOkb51CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Thomas Richter , "Steven Rostedt (VMware)" Subject: [PATCH 5.4 026/309] tracing/kprobes: Have uname use __get_str() in print_fmt Date: Mon, 10 Feb 2020 04:29:42 -0800 Message-Id: <20200210122408.499910156@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122406.106356946@linuxfoundation.org> References: <20200210122406.106356946@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: Steven Rostedt (VMware) commit 20279420ae3a8ef4c5d9fedc360a2c37a1dbdf1b upstream. Thomas Richter reported: > Test case 66 'Use vfs_getname probe to get syscall args filenames' > is broken on s390, but works on x86. The test case fails with: > > [root@m35lp76 perf]# perf test -F 66 > 66: Use vfs_getname probe to get syscall args filenames > :Recording open file: > [ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 0.004 MB /tmp/__perf_test.perf.data.TCdYj\ > (20 samples) ] > Looking at perf.data file for vfs_getname records for the file we touched: > FAILED! > [root@m35lp76 perf]# The root cause was the print_fmt of the kprobe event that referenced the "ustring" > Setting up the kprobe event using perf command: > > # ./perf probe "vfs_getname=getname_flags:72 pathname=filename:ustring" > > generates this format file: > [root@m35lp76 perf]# cat /sys/kernel/debug/tracing/events/probe/\ > vfs_getname/format > name: vfs_getname > ID: 1172 > format: > field:unsigned short common_type; offset:0; size:2; signed:0; > field:unsigned char common_flags; offset:2; size:1; signed:0; > field:unsigned char common_preempt_count; offset:3; size:1; signed:0; > field:int common_pid; offset:4; size:4; signed:1; > > field:unsigned long __probe_ip; offset:8; size:8; signed:0; > field:__data_loc char[] pathname; offset:16; size:4; signed:1; > > print fmt: "(%lx) pathname=\"%s\"", REC->__probe_ip, REC->pathname Instead of using "__get_str(pathname)" it referenced it directly. Link: http://lkml.kernel.org/r/20200124100742.4050c15e@gandalf.local.home Cc: stable@vger.kernel.org Fixes: 88903c464321 ("tracing/probe: Add ustring type for user-space string") Acked-by: Masami Hiramatsu Reported-by: Thomas Richter Tested-by: Thomas Richter Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/trace_probe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -876,7 +876,8 @@ static int __set_print_fmt(struct trace_ for (i = 0; i < tp->nr_args; i++) { parg = tp->args + i; if (parg->count) { - if (strcmp(parg->type->name, "string") == 0) + if ((strcmp(parg->type->name, "string") == 0) || + (strcmp(parg->type->name, "ustring") == 0)) fmt = ", __get_str(%s[%d])"; else fmt = ", REC->%s[%d]"; @@ -884,7 +885,8 @@ static int __set_print_fmt(struct trace_ pos += snprintf(buf + pos, LEN_OR_ZERO, fmt, parg->name, j); } else { - if (strcmp(parg->type->name, "string") == 0) + if ((strcmp(parg->type->name, "string") == 0) || + (strcmp(parg->type->name, "ustring") == 0)) fmt = ", __get_str(%s)"; else fmt = ", REC->%s";