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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -7029,6 +7029,9 @@ SYSCALL_DEFINE5(perf_event_open, · 7028 unmodified lines | |||
| 7029 | if (attr.freq) { | 7029 | if (attr.freq) { |
| 7030 | if (attr.sample_freq > sysctl_perf_event_sample_rate) | 7030 | if (attr.sample_freq > sysctl_perf_event_sample_rate) |
| 7031 | return -EINVAL; | 7031 | return -EINVAL; |
| 7032 | } else { | ||
| 7033 | if (attr.sample_period & (1ULL << 63)) | ||
| 7034 | return -EINVAL; | ||
| 7032 | } | 7035 | } |
| 7033 | 7036 | ||
| 7034 | /* | 7037 | /* |