diff options
| author | Eva Kurchatova <eva.kurchatova@virtuozzo.com> | 2026-09-16 23:44:31 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-09-16 11:19:14 -1000 |
| commit | c774ec8f0a5d02a06d34c27f5a7de7e333b91265 (patch) | |
| tree | 81091a755f096710d11295cb5cfac30fdc555a38 /tools | |
| parent | 057dac23d329d5c5ed62352f2659a39fd46c6d4a (diff) | |
| download | linux-stable-c774ec8f0a5d02a06d34c27f5a7de7e333b91265.tar.gz linux-stable-c774ec8f0a5d02a06d34c27f5a7de7e333b91265.zip | |
selftests: cgroup: give the O_TMPFILE open in get_temp_fd() a mode
O_TMPFILE, like O_CREAT, needs the third argument. Without it glibc
refuses the call at compile time as soon as fortification is on:
In function 'open',
inlined from 'get_temp_fd' at test_memcontrol.c:33:9:
/usr/include/bits/fcntl2.h:52:11: error: call to '__open_missing_mode'
declared with attribute error: open with O_CREAT or O_TMPFILE in
second argument needs 3 arguments
The fortify checks take effect only once the compiler optimises, and
cgroup/Makefile builds with "-Wall -pthread" alone, so this goes
unnoticed in a plain build. Building the tests with the flags
distributions commonly use, -O2 -D_FORTIFY_SOURCE=3, loses
test_memcontrol entirely.
Fixes: 84092dbcf901 ("selftests: cgroup: add memory controller self-tests")
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/selftests/cgroup/test_memcontrol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 3a84d068f..0ed823470 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -30,7 +30,7 @@ static int page_size; int get_temp_fd(void) { - return open(".", O_TMPFILE | O_RDWR | O_EXCL); + return open(".", O_TMPFILE | O_RDWR | O_EXCL, 0600); } int alloc_pagecache(int fd, size_t size) |
