tools/intel_gpu_frequency: prevent SEGFAULT w/o root
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | tools/intel_gpu_frequency: prevent failure w/o root by properly specifying the write modetools/ | +30 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATH i-g-t v1 0/1] tools/intel_gpu_frequency: prevent SEGFAULT w/o root
Dear Maintainers,
This patch addresses a core dump in intel_gpu_frequency that occurs when the tool is executed without root privileges and the write modes for frequency files are not correctly specified.
While debugging, printf("%s %s\n", freq_info->path, freq_info->mode) in initialize_freq_info() made it clear that the write mode logic was allowing invalid access patterns. To fix the issue without breaking existing read-only usage, this patch introduces verify_write_cond(). The helper checks both the program’s privilege level and the requested write mode, updating the "min" and "max" modes to "rb+" when needed. This prevents crashes while preserving expected behavior for read-only operations.
The issue is tracked here:
Feedback is welcome.
Thanks,
Kostiantyn Naddur
Kostiantyn Naddur (1):
tools/intel_gpu_frequency: prevent failure w/o root by properly
specifying the write mode
tools/intel_gpu_frequency.c | 38 +++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-)
Signature · 1 line
2.52.0