mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-17 22:10:54 +00:00
Changed comments
This commit is contained in:
parent
b0a3dc2b88
commit
4103700aa6
@ -182,6 +182,12 @@ static int openPerfEvent(perf_event_attr *hw_event, pid_t pid, int cpu, int grou
|
|||||||
return static_cast<int>(syscall(SYS_perf_event_open, hw_event, pid, cpu, group_fd, flags));
|
return static_cast<int>(syscall(SYS_perf_event_open, hw_event, pid, cpu, group_fd, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cat /proc/sys/kernel/perf_event_paranoid
|
||||||
|
// -1: Allow use of (almost) all events by all users
|
||||||
|
// >=0: Disallow raw tracepoint access by users without CAP_IOC_LOCK
|
||||||
|
// >=1: Disallow CPU event access by users without CAP_SYS_ADMIN
|
||||||
|
// >=2: Disallow kernel profiling by users without CAP_SYS_ADMIN
|
||||||
|
// >=3: Disallow all event access by users without CAP_SYS_ADMIN
|
||||||
static bool getPerfEventParanoid(Int32 & result)
|
static bool getPerfEventParanoid(Int32 & result)
|
||||||
{
|
{
|
||||||
// the longest possible variant: "-1\0"
|
// the longest possible variant: "-1\0"
|
||||||
|
@ -185,19 +185,6 @@ struct PerfEventsCounters
|
|||||||
// must be unsigned to not cause undefined behaviour on increment
|
// must be unsigned to not cause undefined behaviour on increment
|
||||||
typedef UInt64 Id;
|
typedef UInt64 Id;
|
||||||
|
|
||||||
// cat /proc/sys/kernel/perf_event_paranoid - if perf_event_paranoid is set to 3, all calls to `perf_event_open` are rejected (even for the current process)
|
|
||||||
// https://lwn.net/Articles/696234/
|
|
||||||
// -1: Allow use of (almost) all events by all users
|
|
||||||
// >=0: Disallow raw tracepoint access by users without CAP_IOC_LOCK
|
|
||||||
// >=1: Disallow CPU event access by users without CAP_SYS_ADMIN
|
|
||||||
// >=2: Disallow kernel profiling by users without CAP_SYS_ADMIN
|
|
||||||
// >=3: Disallow all event access by users without CAP_SYS_ADMIN
|
|
||||||
|
|
||||||
// https://lwn.net/Articles/696216/
|
|
||||||
// It adds a another value that can be set for the sysctl parameter (i.e. kernel.perf_event_paranoid=3)
|
|
||||||
// that restricts perf_event_open() to processes with the CAP_SYS_ADMIN capability
|
|
||||||
// todo: check whether perf_event_open() is available with CAP_SYS_ADMIN
|
|
||||||
|
|
||||||
static constexpr size_t NUMBER_OF_RAW_EVENTS = 18;
|
static constexpr size_t NUMBER_OF_RAW_EVENTS = 18;
|
||||||
|
|
||||||
static const PerfEventInfo raw_events_info[PerfEventsCounters::NUMBER_OF_RAW_EVENTS];
|
static const PerfEventInfo raw_events_info[PerfEventsCounters::NUMBER_OF_RAW_EVENTS];
|
||||||
|
Loading…
Reference in New Issue
Block a user