History

perf: Limit perf_event_attr::sample_period to 63 bits

Vince reported that using a large sample_period (one with bit 63 set) results in wreckage since while the sample_period is fundamentally unsigned (negative periods don't make sense) the way we implement things very much rely on signed logic. So limit sample_period to 63 bits to avoid tripping over this.

Peter Zijlstra committed 12 years ago

Commit 0819b2e1 parent a45e9031 file · +3 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/events/core.c+3−0
@@ -7029,6 +7029,9 @@ SYSCALL_DEFINE5(perf_event_open, · 7028 unmodified lines
70297029 if (attr.freq) {
70307030 if (attr.sample_freq > sysctl_perf_event_sample_rate)
70317031 return -EINVAL;
7032+ } else {
7033+ if (attr.sample_period & (1ULL << 63))
7034+ return -EINVAL;
70327035 }
70337036
70347037 /*