summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorQingshuang Fu <fuqingshuang@kylinos.cn>2026-08-25 14:46:05 +0800
committerThomas Gleixner <tglx@kernel.org>2026-09-29 22:05:04 +0200
commit348f54c435bf3177baa78201952810b255d44b30 (patch)
tree298a658dbbdbc4092726a05f442db2ce9cd00f12 /scripts/Makefile.thinlto
parentb03638013add0609d35aaa8291548dea92cb9484 (diff)
downloadlinux-348f54c435bf3177baa78201952810b255d44b30.tar.gz
linux-348f54c435bf3177baa78201952810b255d44b30.zip
selftests/timers: clocksource-switch: Fix unchecked open()/read()
get_clocksources() and get_cur_clocksource() open and read the clocksource sysfs files without checking the return values and without NUL-terminating the buffer. If open() fails, read() is called on fd -1 and returns -1, which is stored in a size_t as SIZE_MAX. The token-scanning loop in get_clocksources() then walks past the uninitialized stack buffer, reading and writing out of bounds. Even on success the buffer is not NUL-terminated, so a fully read buffer makes the inner scan run past the data, and get_cur_clocksource() lets change_clocksource() call strlen() on a non-terminated buffer. Check the open()/read() results, use ssize_t for the read length, NUL-terminate the buffer, and close the fd in get_cur_clocksource(). Fixes: 7290ce1423c3 ("selftests/timers: Add clocksource-switch test from timetest suite") Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: John Stultz <jstultz@google.com> Link: https://patch.msgid.link/20260825064605.472889-1-fffsqian@163.com
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions