OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10 2/3] selftests: cgroup: give the O_TMPFILE open in get_temp_fd() a mode
Date: Tue,  1 Sep 2026 01:36:23 +0300	[thread overview]
Message-ID: <20260831223631.1637488-2-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20260831223631.1637488-1-eva.kurchatova@virtuozzo.com>

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")
https://virtuozzo.atlassian.net/browse/VSTOR-139672
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/cgroup/lib/cgroup_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/lib/cgroup_util.c b/tools/testing/selftests/cgroup/lib/cgroup_util.c
index 9a677fdf0bf6..8f996b54849e 100644
--- a/tools/testing/selftests/cgroup/lib/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/lib/cgroup_util.c
@@ -21,7 +21,7 @@
 
 int get_temp_fd(void)
 {
-	return open(".", O_TMPFILE | O_RDWR | O_EXCL);
+	return open(".", O_TMPFILE | O_RDWR | O_EXCL, 0600);
 }
 
 /* Returns read len on success, or -errno on failure. */
-- 
2.55.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-08-31 22:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 22:36 [Devel] [PATCH vz10 1/3] ms/KVM: selftests: Forcefully override ARCH from x86_64 to x86 Eva Kurchatova
2026-08-31 22:36 ` Eva Kurchatova [this message]
2026-08-31 22:36 ` [Devel] [PATCH vz10 3/3] selftests: kvm: raise the timeout the suite gives each test Eva Kurchatova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831223631.1637488-2-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox