public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] support: Don't fail on fchown when spawning sgid processes
@ 2023-06-01 11:25 Siddhesh Poyarekar
0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2023-06-01 11:25 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6286cca2cb8389dcffec39238a8bf15ffea96396
commit 6286cca2cb8389dcffec39238a8bf15ffea96396
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Thu Jun 1 07:23:15 2023 -0400
support: Don't fail on fchown when spawning sgid processes
In some cases (e.g. when podman creates user containers), the only other
group assigned to the executing user is nobody and fchown fails with it
because the group is not mapped. Do not fail the test in this case,
instead exit as unsupported.
Reported-by: Frédéric Bérat <fberat@redhat.com>
Tested-by: Frédéric Bérat <fberat@redhat.com>
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diff:
---
support/support_capture_subprocess.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
index bae7d5fb20..2a8d37b284 100644
--- a/support/support_capture_subprocess.c
+++ b/support/support_capture_subprocess.c
@@ -153,9 +153,18 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
p += wrcount;
}
}
- TEST_VERIFY (fchown (outfd, getuid (), gid) == 0);
+
+ bool chowned = false;
+ TEST_VERIFY ((chowned = fchown (outfd, getuid (), gid) == 0)
+ || errno == EPERM);
if (support_record_failure_is_failed ())
goto err;
+ else if (!chowned)
+ {
+ ret = 77;
+ goto err;
+ }
+
TEST_VERIFY (fchmod (outfd, 02750) == 0);
if (support_record_failure_is_failed ())
goto err;
@@ -192,8 +201,10 @@ err:
free (dirname);
}
+ if (ret == 77)
+ FAIL_UNSUPPORTED ("Failed to make sgid executable for test\n");
if (ret != 0)
- FAIL_EXIT1("Failed to make sgid executable for test\n");
+ FAIL_EXIT1 ("Failed to make sgid executable for test\n");
return status;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-01 11:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 11:25 [glibc] support: Don't fail on fchown when spawning sgid processes Siddhesh Poyarekar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).