test/libc: fix cachestat() test on recent Linux kernels.

On Linux kernels which contain the fix for CVE-2025-21691, i.e.
5f537664e705b0bf8b7e329861f20128534f6a83 or its backports such as
780ab8329672464984cf1344bd5c3993af0226c7 , cachestat() requires
that the file is writable or owned.
Use /proc/self/comm instead of /proc/version and /proc.

Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
This commit is contained in:
Lionel Debroux 2025-05-04 20:52:53 +02:00
parent 4ca513cba2
commit be1679e5ed

View file

@ -53,7 +53,7 @@ void SetUpOnce(void) {
TEST(cachestat, testCachestatOnDevices) { TEST(cachestat, testCachestatOnDevices) {
const char *const files[] = { const char *const files[] = {
"/dev/zero", "/dev/null", "/dev/urandom", "/proc/version", "/proc", "/dev/zero", "/dev/null", "/dev/urandom", "/proc/self/comm",
}; };
struct cachestat_range range = {0, 4 * pagesize}; struct cachestat_range range = {0, 4 * pagesize};
struct cachestat cs; struct cachestat cs;