[PATCH 0/3] perf: Allow running without stdin

2019-10-22 Thread Igor Lubashev
display_thread() will handle the EOF on the next iteration. 02: perf kvm: Allow running without stdin Make "perf kvm --stdio" handle EOF from stdin correctly. 03: perf kvm: Use evlist layer api when possible This is a simple fix for a needless layering violation. Igor Lubas

[PATCH 3/3] perf kvm: Use evlist layer api when possible

2019-10-22 Thread Igor Lubashev
No need for layer violations when a proper evlist api is available. Signed-off-by: Igor Lubashev --- tools/perf/builtin-kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 5217aa3596c7..340927c2b243 100644

[PATCH 2/3] perf kvm: Allow running without stdin

2019-10-22 Thread Igor Lubashev
Allow perf kvm --stdio to run without access to stdin. This lets perf kvm to run in a batch mode until interrupted. The following now works as expected: $ perf kvm top --stdio < /dev/null Signed-off-by: Igor Lubashev --- tools/perf/builtin-kvm.c | 33 -

[PATCH 1/3] perf top: Allow running without stdin

2019-10-22 Thread Igor Lubashev
Allow perf top --stdio to run without access to stdin. This lets perf top to run in a batch mode until interrupted. The following now works as expected: $ perf top < /dev/null Signed-off-by: Igor Lubashev --- tools/perf/builtin-top.c | 10 -- 1 file changed, 8 insertions(+)

[tip: perf/core] perf tools: Warn that perf_event_paranoid can restrict kernel symbols

2019-08-29 Thread tip-bot2 for Igor Lubashev
The following commit has been merged into the perf/core branch of tip: Commit-ID: d06e5fad8c4692c6e5f1bd626056f23716bfe4a6 Gitweb: https://git.kernel.org/tip/d06e5fad8c4692c6e5f1bd626056f23716bfe4a6 Author:Igor Lubashev AuthorDate:Mon, 26 Aug 2019 21:39:16 -04:00

[tip: perf/core] perf symbols: Use CAP_SYSLOG with kptr_restrict checks

2019-08-29 Thread tip-bot2 for Igor Lubashev
The following commit has been merged into the perf/core branch of tip: Commit-ID: 8859aedefefe7eeea5e67968b7fe39c828d589a0 Gitweb: https://git.kernel.org/tip/8859aedefefe7eeea5e67968b7fe39c828d589a0 Author:Igor Lubashev AuthorDate:Mon, 26 Aug 2019 21:39:15 -04:00

[tip: perf/core] perf evsel: Kernel profiling is disallowed only when perf_event_paranoid > 1

2019-08-29 Thread tip-bot2 for Igor Lubashev
The following commit has been merged into the perf/core branch of tip: Commit-ID: aa97293ff129f504e7c8589e56007ecfe3e3e835 Gitweb: https://git.kernel.org/tip/aa97293ff129f504e7c8589e56007ecfe3e3e835 Author:Igor Lubashev AuthorDate:Mon, 26 Aug 2019 21:39:14 -04:00

[tip: perf/core] perf tools: Use CAP_SYS_ADMIN with perf_event_paranoid checks

2019-08-29 Thread tip-bot2 for Igor Lubashev
The following commit has been merged into the perf/core branch of tip: Commit-ID: dda1bf8ea78add78739d128a20b555c4a1a19c27 Gitweb: https://git.kernel.org/tip/dda1bf8ea78add78739d128a20b555c4a1a19c27 Author:Igor Lubashev AuthorDate:Mon, 26 Aug 2019 21:39:13 -04:00

[tip: perf/core] perf event: Check ref_reloc_sym before using it

2019-08-29 Thread tip-bot2 for Igor Lubashev
The following commit has been merged into the perf/core branch of tip: Commit-ID: e9a6882f267a8105461066e3ea6b4b6b9be1b807 Gitweb: https://git.kernel.org/tip/e9a6882f267a8105461066e3ea6b4b6b9be1b807 Author:Igor Lubashev AuthorDate:Mon, 26 Aug 2019 21:39:12 -04:00

[PATCH 0/5] perf: Treat perf_event_paranoid and kptr_restrict like the kernel does it

2019-08-26 Thread Igor Lubashev
has been reviewed previously, but I * modified it in a non-trivial way, so I removed Acks. 05: perf: warn perf_event_paranoid restrict kernel symbols Warn that /proc/sys/kernel/perf_event_paranoid can also restrict kernel symbols. Igor Lubashev (5): perf event: Check ref_reloc_sym bef

[PATCH 1/5] perf event: Check ref_reloc_sym before using it

2019-08-26 Thread Igor Lubashev
Check for ref_reloc_sym before using it instead of checking symbol_conf.kptr_restrict and relying solely on that check. Signed-off-by: Igor Lubashev Reported-by: Mathieu Poirier --- tools/perf/util/event.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf

[PATCH 3/5] perf util: kernel profiling is disallowed only when perf_event_paranoid > 1

2019-08-26 Thread Igor Lubashev
Perf was too restrictive about sysctl kernel.perf_event_paranoid. The kernel only disallows profiling when perf_event_paranoid > 1. Make perf do the same. Signed-off-by: Igor Lubashev --- tools/perf/util/evsel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/u

[PATCH 2/5] perf tools: Use CAP_SYS_ADMIN with perf_event_paranoid checks

2019-08-26 Thread Igor Lubashev
The kernel is using CAP_SYS_ADMIN instead of euid==0 to override perf_event_paranoid check. Make perf do the same. Signed-off-by: Igor Lubashev Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Alexey Budankov Cc: James Morris Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Peter Zijlstra Cc

[PATCH 5/5] perf: warn that perf_event_paranoid can restrict kernel symbols

2019-08-26 Thread Igor Lubashev
Warn that /proc/sys/kernel/perf_event_paranoid can also restrict kernel symbols. Signed-off-by: Igor Lubashev --- tools/perf/builtin-record.c | 2 +- tools/perf/builtin-top.c| 2 +- tools/perf/builtin-trace.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf

[PATCH 4/5] perf symbols: Use CAP_SYSLOG with kptr_restrict checks

2019-08-26 Thread Igor Lubashev
The kernel is using CAP_SYSLOG capability instead of uid==0 and euid==0 when checking kptr_restrict. Make perf do the same. Also, the kernel is a more restrictive than "no restrictions" in case of kptr_restrict==0, so add the same logic to perf. Signed-off-by: Igor Lubashev Cc: Jir

[tip:perf/core] perf ftrace: Use CAP_SYS_ADMIN instead of euid==0

2019-08-15 Thread tip-bot for Igor Lubashev
Commit-ID: c766f3df635de14295e410c6dd5410bc416c24a0 Gitweb: https://git.kernel.org/tip/c766f3df635de14295e410c6dd5410bc416c24a0 Author: Igor Lubashev AuthorDate: Wed, 7 Aug 2019 10:44:17 -0400 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 14 Aug 2019 10:59:59 -0300 perf ftrace

[tip:perf/core] perf tools: Add helpers to use capabilities if present

2019-08-15 Thread tip-bot for Igor Lubashev
Commit-ID: c22e150e3afa6f8db2300bd510e4ac26bbee1bf3 Gitweb: https://git.kernel.org/tip/c22e150e3afa6f8db2300bd510e4ac26bbee1bf3 Author: Igor Lubashev AuthorDate: Wed, 7 Aug 2019 10:44:14 -0400 Committer: Arnaldo Carvalho de Melo CommitDate: Wed, 14 Aug 2019 10:48:39 -0300 perf tools

[tip:perf/core] tools build: Add capability-related feature detection

2019-08-15 Thread tip-bot for Igor Lubashev
Commit-ID: 74d5f3d06f707eb5f7e1908ad88954bde02000ce Gitweb: https://git.kernel.org/tip/74d5f3d06f707eb5f7e1908ad88954bde02000ce Author: Igor Lubashev AuthorDate: Wed, 7 Aug 2019 10:44:14 -0400 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 12 Aug 2019 17:14:14 -0300 tools build

[PATCH v3 1/4] perf: Add capability-related utilities

2019-08-07 Thread Igor Lubashev
Add utilities to help checking capabilities of the running procss. Make perf link with libcap, if it is available. If no libcap-dev[el], assume no capabilities. Signed-off-by: Igor Lubashev --- tools/build/Makefile.feature | 2 ++ tools/build/feature/Makefile | 4 tools/build

[PATCH v3 0/4] perf: Use capabilities instead of uid and euid

2019-08-07 Thread Igor Lubashev
and Jiri) v2: * Added a build feature check for libcap-dev[el] as suggested by Arnaldo Igor Lubashev (4): perf: Add capability-related utilities perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks perf: Use CAP_SYSLOG with kptr_restrict checks perf: Use CAP_SYS_ADMIN instead of euid==0

[PATCH v3 2/4] perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks

2019-08-07 Thread Igor Lubashev
The kernel is using CAP_SYS_ADMIN instead of euid==0 to override perf_event_paranoid check. Make perf do the same. Signed-off-by: Igor Lubashev --- tools/perf/arch/arm/util/cs-etm.c| 3 ++- tools/perf/arch/arm64/util/arm-spe.c | 3 ++- tools/perf/arch/x86/util/intel-bts.c | 3 ++- tools

[PATCH v3 3/4] perf: Use CAP_SYSLOG with kptr_restrict checks

2019-08-07 Thread Igor Lubashev
Kernel is using CAP_SYSLOG capability instead of uid==0 and euid==0 when checking kptr_restrict. Make perf do the same. Also, the kernel is a more restrictive than "no restrictions" in case of kptr_restrict==0, so add the same logic to perf. Signed-off-by: Igor Lubashev --- tools

[PATCH v3 4/4] perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace

2019-08-07 Thread Igor Lubashev
Kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs for ftrace. Make perf do the same. Signed-off-by: Igor Lubashev --- tools/perf/builtin-ftrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c

[PATCH v2 4/4] perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace

2019-08-06 Thread Igor Lubashev
Kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs for ftrace. Make perf do the same. Signed-off-by: Igor Lubashev --- tools/perf/builtin-ftrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c

[PATCH v2 0/4] perf: Use capabilities instead of uid and euid

2019-08-06 Thread Igor Lubashev
-dev[el] as suggested by Arnaldo Igor Lubashev (4): perf: Add capability-related utilities perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks perf: Use CAP_SYSLOG with kptr_restrict checks perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace tools/build/Makefile.feature

[PATCH v2 2/4] perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks

2019-08-06 Thread Igor Lubashev
The kernel is using CAP_SYS_ADMIN instead of euid==0 to override perf_event_paranoid check. Make perf do the same. Signed-off-by: Igor Lubashev --- tools/perf/arch/arm/util/cs-etm.c| 3 ++- tools/perf/arch/arm64/util/arm-spe.c | 4 ++-- tools/perf/arch/x86/util/intel-bts.c | 3 ++- tools

[PATCH v2 1/4] perf: Add capability-related utilities

2019-08-06 Thread Igor Lubashev
Add utilities to help checking capabilities of the running procss. Make perf link with libcap, if it is available. If no libcap-dev[el], assume no capabilities. Signed-off-by: Igor Lubashev --- tools/build/Makefile.feature | 2 ++ tools/build/feature/Makefile | 4 tools/build

[PATCH v2 3/4] perf: Use CAP_SYSLOG with kptr_restrict checks

2019-08-06 Thread Igor Lubashev
Kernel is using CAP_SYSLOG capability instead of uid==0 and euid==0 when checking kptr_restrict. Make perf do the same. Also, the kernel is a more restrictive than "no restrictions" in case of kptr_restrict==0, so add the same logic to perf. Signed-off-by: Igor Lubashev --- tools

[PATCH 4/3] perf: Use CAP_SYS_ADMIN instead of euid==0 with ftrace

2019-07-17 Thread Igor Lubashev
Kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs for ftrace. Make perf require the same. Signed-off-by: Igor Lubashev --- tools/perf/builtin-ftrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c

[PATCH 3/3] perf: Use CAP_SYSLOG with kptr_restrict checks

2019-07-02 Thread Igor Lubashev
Kernel is using CAP_SYSLOG capcbility instead of uid==0 and euid==0 when checking kptr_restrict. Make perf do the same. Also, the kernel is a more restrictive than "no restrictions" in case of kptr_restrict==0, so add the same logic to perf. Signed-off-by: Igor Lubashev --- tools

[PATCH 0/3] perf: Use capabilities instead of uid and euid

2019-07-02 Thread Igor Lubashev
is in perf_users group (setup via instructions above), I executed: perf record -a -- sleep 1 Without the patch, perf record did not capture any kernel functions. With the patch, perf included all kernel funcitons. Igor Lubashev (3): perf: Add capability-related utilities perf: Use CAP_SYS_ADMIN

[PATCH 1/3] perf: Add capability-related utilities

2019-07-02 Thread Igor Lubashev
Add utilities to help checking capabilities of the running process. Make perf link with libcap. Signed-off-by: Igor Lubashev --- tools/perf/Makefile.config | 2 +- tools/perf/util/Build | 1 + tools/perf/util/cap.c | 24 tools/perf

[PATCH 2/3] perf: Use CAP_SYS_ADMIN with perf_event_paranoid checks

2019-07-02 Thread Igor Lubashev
The kernel is using CAP_SYS_ADMIN instead of euid==0 to override perf_event_paranoid check. Make perf do the same. Signed-off-by: Igor Lubashev --- tools/perf/arch/arm/util/cs-etm.c| 3 ++- tools/perf/arch/arm64/util/arm-spe.c | 3 ++- tools/perf/arch/x86/util/intel-bts.c | 3 ++- tools

[RFC PATCH 1/1] security: add SECURE_KEEP_FSUID to preserve fsuid/fsgid across execve

2019-06-13 Thread Igor Lubashev
of delegating the minimal set of privileges. Setting SECURE_KEEP_FSUID bit ensures that the current fsuid/fsgiud is retained by execve. Signed-off-by: Igor Lubashev --- include/uapi/linux/securebits.h | 10 +- security/commoncap.c| 9 +++-- 2 files changed, 16 insertions(+), 3

[RFC PATCH 0/1] security: add SECURE_KEEP_FSUID to preserve fsuid/fsgid across execve

2019-06-13 Thread Igor Lubashev
root uid/euid, so a general solution that does not involve updating all such programs seems warranted. I will update man pages, if this patch is deemed a good idea. Igor Lubashev (1): security: add SECURE_KEEP_FSUID to preserve fsuid/fsgid across execve include/uapi/linux/securebits.h | 10

[PATCH 1/1] RFC: security: add SECURE_KEEP_FSUID to preserve fsuid/fsgid across execve

2019-03-25 Thread Igor Lubashev
of delegating the minimal set of privileges. Setting SECURE_KEEP_FSUID bit ensures that the current fsuid/fsgiud is retained by execve. Signed-off-by: Igor Lubashev --- include/uapi/linux/securebits.h | 10 +- security/commoncap.c| 9 +++-- 2 files changed, 16 insertions(+), 3

[PATCH 0/1] RFC: security: add SECURE_KEEP_FSUID to preserve fsuid/fsgid across execve

2019-03-25 Thread Igor Lubashev
uid/suid/euid in setfsuid (and similarly for set*gid and setfsgid). I will update man pages as needed. Igor Lubashev (1): security: add SECURE_KEEP_FSUID to preserve fsuid/fsgid across execve include/uapi/linux/securebits.h | 10 +- security/commoncap.c| 9 +++-- 2