Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5317774pxj; Wed, 26 May 2021 07:54:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAoJX2C8GbX16/eVNGmsZYfOp+THD/TlahcTtyctbWBJkJ+0xud18SWC/cYbIHtZ8ZBOL6 X-Received: by 2002:a02:a492:: with SMTP id d18mr3636683jam.28.1622040876942; Wed, 26 May 2021 07:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622040876; cv=none; d=google.com; s=arc-20160816; b=vgJ8HlJnUPAvjCk1+2ZzVyHEqSgOEcDnjyStgbWM01Clkye83DFZDB40wXE0Lt2ozJ ThAHRYeFLo9t/dagEQN+XYiVPwnihGXT5MKlSnfCprSJJJwRHbkOXkpAwt1UUZXrxoQe 0P9RjLty6p6PCj7llDXYNFr2LblarENV4myP7qUgT3WlLcdhXjoZzfItcIJk/ubxFfwK /7JKebaKomX24GpKToE1oOdyanvR6UX9fEagJcGALBWBLBrvK+2c/oUKXielyB6c6WtU V374nWy83t0LmKknaNwe1zerAjgN2O/oZ9VyhCW1HVwSXgpx5uZbNbsXzaV8XoGgsWIG f7CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xz/9oQs5U9jykSc0B+yH5jMNERC/Syf5ilN2sJ/Cug4=; b=h1N+7i2vXKi7gKovuF23/yj3ts2kXSVIvhfwya4W96tua3VeqBoEkbkkgP7/+J22Uj CUDZ+Hr8zRwqTyNVazDOnnvzza7ovVqyKDTjsPNU2EeunjfAts8j5I1z54UE1BxIOich 7IScS6vSDY96DnQDL61Hj4r+9jymzboceALLJbAKNfvfeS3UFEL+hAClio13yg9SrufX ZAcDPOrfAQXreUT+lCNb8GQLzPphiTIBLQ2b2obomcia2PlIzW9tAk/D8hANaq1LhBuk 7gs50tnlqL0MPGEf5QPy48tgFYIfqrBvxC8pO9Bjzne9qWwC5YIT3Gc3p430yBELZJfh d3mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RhxCwRfd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s6si18832801ilj.161.2021.05.26.07.54.22; Wed, 26 May 2021 07:54:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RhxCwRfd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235125AbhEZOxG (ORCPT + 99 others); Wed, 26 May 2021 10:53:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:49596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235077AbhEZOxF (ORCPT ); Wed, 26 May 2021 10:53:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 837B1613B0; Wed, 26 May 2021 14:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622040693; bh=q+C2OhfEzhvJRz37H2GbJ1ehvlpy634ux7zEZguaxBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhxCwRfd2fvBHl+15tMgD7vNuliCOJLce1otPWSZXSADVoEIa1sSAafq72+rBwsTp PxyE8CXuCTErAONVMUmkGwFIQAbj336XmHJjTmEAKIQfA1AfAGRuWDYChnYX1U086n J5E6DysobqoWxHNs7/j4PCdbWmqgA71/svmDr/k3IQmP5PNz6TRfnUQEU7LpIalaXA rDYdlFnywBbxM4CLHymM3LmzI4R2q0LYqtkGc0A5BpdO+QFlZxU4ZoBXXF0LNdGiw/ rhumeBJKoxxyKjBJ+kqy3vLoEGCvubeCtenjjs/CxHypamd/rEsebcV+DtDiX9CdYK x9Wm06D59cU+w== From: Masami Hiramatsu To: Arnaldo Carvalho de Melo , acme@kernel.org Cc: Ravi Bangoria , Jiri Olsa , jolsa@redhat.com, Masami Hiramatsu , linux-kernel@vger.kernel.org, "Aneesh Kumar K . V" Subject: [PATCH v2] tools/perf: doc: Add permission and sysctl notice Date: Wed, 26 May 2021 23:51:29 +0900 Message-Id: <162204068898.388434.16842705842611255787.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <162201967838.287555.4257117900130102987.stgit@devnote2> References: <162201967838.287555.4257117900130102987.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a section to notify the permission and sysctl setting for perf probe. And fix some indentations. Reported-by: Ravi Bangoria Signed-off-by: Masami Hiramatsu --- Changes in v2: - Add tracefs remount option for --list command. - Mention uprobe case for kptr_restrict and vmlinux/debuginfo permission. --- tools/perf/Documentation/perf-probe.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt index ed3ecfa422e1..080981d38d7b 100644 --- a/tools/perf/Documentation/perf-probe.txt +++ b/tools/perf/Documentation/perf-probe.txt @@ -226,7 +226,7 @@ So, "source.c:100-120" shows lines between 100th to l20th in source.c file. And LAZY MATCHING ------------- - The lazy line matching is similar to glob matching but ignoring spaces in both of pattern and target. So this accepts wildcards('*', '?') and character classes(e.g. [a-z], [!A-Z]). +The lazy line matching is similar to glob matching but ignoring spaces in both of pattern and target. So this accepts wildcards('*', '?') and character classes(e.g. [a-z], [!A-Z]). e.g. 'a=*' can matches 'a=b', 'a = b', 'a == b' and so on. @@ -235,8 +235,8 @@ This provides some sort of flexibility and robustness to probe point definitions FILTER PATTERN -------------- - The filter pattern is a glob matching pattern(s) to filter variables. - In addition, you can use "!" for specifying filter-out rule. You also can give several rules combined with "&" or "|", and fold those rules as one rule by using "(" ")". +The filter pattern is a glob matching pattern(s) to filter variables. +In addition, you can use "!" for specifying filter-out rule. You also can give several rules combined with "&" or "|", and fold those rules as one rule by using "(" ")". e.g. With --filter "foo* | bar*", perf probe -V shows variables which start with "foo" or "bar". @@ -295,6 +295,19 @@ Add a probe in a source file using special characters by backslash escape ./perf probe -x /opt/test/a.out 'foo\+bar.c:4' +PERMISSIONS AND SYSCTL +---------------------- +Since perf probe depends on ftrace (tracefs) and kallsyms (/proc/kallsyms), you have to care about the permission and some sysctl knobs. + + - Since tracefs and kallsyms requires root or privileged user to access it, the following perf probe commands also require it; --add, --del, --list (except for --cache option) + + - The system admin can remount the tracefs with 755 (`sudo mount -o remount,mode=755 /sys/kernel/tracing/`) to allow unprivileged user to run the perf probe --list command. + + - /proc/sys/kernel/kptr_restrict = 2 (restrict all users) also prevents perf probe to retrieve the important information from kallsyms. You also need to set to 1 (restrict non CAP_SYSLOG users) for the above commands. Since the user-space probe doesn't need to access kallsyms, this is only for probing the kernel function (kprobes). + + - Since the perf probe commands read the vmlinux (for kernel) and/or the debuginfo file (including user-space application), you need to ensure that you can read those files. + + SEE ALSO -------- linkperf:perf-trace[1], linkperf:perf-record[1], linkperf:perf-buildid-cache[1]