[PATCH v2] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall

Joe Simmons-Talbott josimmon@redhat.com
Thu Jul 27 14:31:25 GMT 2023


If sethostname syscall is filtered return UNSUPPORTED.

Found in a podman container on Fedora x86_64.
---
Changes to v1:
  * update commit message to indicate where the failure was detected.

 resolv/tst-resolv-res_init-skeleton.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
index cbdf377b84..c9bdf9712f 100644
--- a/resolv/tst-resolv-res_init-skeleton.c
+++ b/resolv/tst-resolv-res_init-skeleton.c
@@ -1039,7 +1039,11 @@ do_test (void)
   /* We are in an UTS namespace, so we can set the host name without
      altering the state of the entire system.  */
   if (sethostname (test_hostname, strlen (test_hostname)) != 0)
-    FAIL_EXIT1 ("sethostname: %m");
+    {
+      if (errno == EPERM)
+        FAIL_UNSUPPORTED ("sethostname syscall argument is filtered");
+      FAIL_EXIT1 ("sethostname: %m");
+    }
 
   /* These environment variables affect resolv.conf parsing.  */
   unsetenv ("LOCALDOMAIN");
-- 
2.39.2



More information about the Libc-alpha mailing list