[Devel] [PATCH vz10 2/3] selftests: cgroup: give the O_TMPFILE open in get_temp_fd() a mode
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Sep 22 21:43:18 MSK 2026
> 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 cgroup_util.c:24:9:
> /usr/include/bits/fcntl2.h:50:11: error: call to '__open_missing_mode'
> declared with attribute error: open with O_CREAT or O_TMPFILE in
> second argument needs 3 arguments
>
> cgroup/Makefile builds with "-Wall -pthread" and the fortify checks
> take effect only once the compiler optimises, so the cgroup target
> builds. kvm includes ../cgroup/lib/libcgroup.mk and does
> build with -O2, so the shared object fails there and takes the whole
> kvm target with it. Building with -D_FORTIFY_SOURCE=3, as distributions
> commonly do, therefore loses every kvm test rather than anything in
> cgroup.
>
> Fixes: 844934d16dbc ("selftests/cgroup: move get_temp_fd() to the shared cgroup lib")
commit id from old branch
--
Konstantin Khorenko <khorenko at virtuozzo.com>
More information about the Devel
mailing list