intel: check setuid before writing output file in INTEL_MEASURE
Without this check, the INTEL_MEASURE environment variable could be
misused to overwrite arbitrary files.
Fixes: 0f4143ec37
("intel: Print GPU timing data based on INTEL_MEASURE")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9166>
This commit is contained in:
parent
3250e04d25
commit
f54a65c69b
|
@ -40,6 +40,7 @@
|
|||
#include "dev/gen_device_info.h"
|
||||
#include "util/debug.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
|
||||
static const struct debug_control debug_control[] = {
|
||||
|
@ -100,7 +101,7 @@ intel_measure_init(struct intel_measure_device *device)
|
|||
*sep = '\0';
|
||||
}
|
||||
|
||||
if (filename) {
|
||||
if (filename && !__check_suid()) {
|
||||
filename += 5;
|
||||
config.file = fopen(filename, "w");
|
||||
if (!config.file) {
|
||||
|
|
Loading…
Reference in New Issue