使用RBAC运行性能工具

问题描述 投票:1回答:1

我最近开始了一项涉及很多性能调整的工作。

我想知道RBAC是否可以使用eBPF和perf之类的工具吗?还是需要完全root用户访问权限?获得root用户访问权限可能很困难。我们主要使用相当老的Linux机器-RHEL 6.5。我对RBAC不太熟悉。我在Solaris,macOS和FreeBSD上使用过Dtrace,但我有root密码。

rbac perf ebpf
1个回答
0
投票

RHEL在其RHEL6中列出了一些针对perl的性能分析和跟踪解决方案,包括perfPerformance Tuning GuideDeveloper Guidehttps://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/performance_tuning_guide/s-analyzperf-perfhttps://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/developer_guide/perf-using

[Chapter 3. Monitoring and Analyzing System Performance中的[Performance Tuning Guide提到了几个工具:Gnome系统监视器,KDE System Guard,性能副驾驶(PCP),top / ps / vmstat / sar,已调优和ktune,MRG Tuna和应用程序分析器SystemTap,Oprofile ,Valgrind(不是真正的探查器,而是具有指令和缓存事件计数功能的cpu仿真器),性能。

Chapter 5. Profiling的[Developer Guide列出Valgrind,oprofile,SystemTap,perf和ftrace。

通常,仅对root用户或具有CAP_SYS_ADMIN功能的用户才允许对内核或整个系统进行性能分析。某些配置文件受sysctl变量限制

  • perf_event_paranoid:
    控制非特权人员对绩效事件系统的使用用户(无CAP_SYS_ADMIN)。默认值为2。

    -1: Allow use of (almost) all events by all users Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK >=0: Disallow ftrace function tracepoint by users without CAP_SYS_ADMIN Disallow raw tracepoint access by users without CAP_SYS_ADMIN >=1: Disallow CPU event access by users without CAP_SYS_ADMIN >=2: Disallow kernel profiling by users without CAP_SYS_ADMIN

  • kptr_restrict: This toggle indicates whether restrictions are placed on exposing kernel addresses via /proc and other interfaces.
    [ubuntu and rhel(7.4)的最新版本也有kernel.yama.ptrace_scope http://security-plus-data-science.blogspot.com/2017/09/some-security-updates-in-rhel-74.html

    ...使用kernel.yama.ptrace_scope设置谁可以使用ptrace。不同值具有以下含义:

    # 0 - Default attach security permissions. # 1 - Restricted attach. Only child processes plus normal permissions. # 2 - Admin-only attach. Only executables with CAP_SYS_PTRACE. # 3 - No attach. No process may call ptrace at all. Irrevocable until next boot.

    您可以这样临时设置:

    echo 2 > /proc/sys/kernel/yama/ptrace_scope

    要分析程序,您应该有权对其进行调试,例如,附加gdb(ptrace功能)或strace。我不知道RHEL或its RBAC,所以您应该检查可用的内容。通常,对于更多情况,可以对软件事件进行自己的用户空间程序性能分析。对每个进程的cpu硬件计数器的访问,对其他用户程序的性能分析,对内核的性能分析都受到限制。我可以期望正确启用的RBAC不应允许您或root来配置内核,因为perf可以注入跟踪探针并从内核或其他用户泄漏信息。

    [Qeole在comment中说,RB6未实现eBPF(added in RHEL7.6;对于XDP - eXpress Data Path in RHEL8,因此您只能尝试使用ftrace进行跟踪,或者尝试使用stap(SystemTap)进行高级跟踪。

  • © www.soinside.com 2019 - 2024. All rights reserved.