public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall
@ 2023-07-25 19:34 Joe Simmons-Talbott
  2023-07-27  2:19 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Simmons-Talbott @ 2023-07-25 19:34 UTC (permalink / raw)
  To: libc-alpha; +Cc: Joe Simmons-Talbott

If sethostname syscall is filtered return UNSUPPORTED.
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall
  2023-07-25 19:34 [PATCH] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall Joe Simmons-Talbott
@ 2023-07-27  2:19 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2023-07-27  2:19 UTC (permalink / raw)
  To: Joe Simmons-Talbott, libc-alpha

On 7/25/23 15:34, Joe Simmons-Talbott via Libc-alpha wrote:
> If sethostname syscall is filtered return UNSUPPORTED.

Under which environment does this happen?

Documenting under which conditions this happens in the commit message
is very valuable for later forensics when we're cleaning up code.



> ---
>  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");

Shouldn't this just be "sethostname syscall is filtered"?

> +      FAIL_EXIT1 ("sethostname: %m");
> +    }
>  
>    /* These environment variables affect resolv.conf parsing.  */
>    unsetenv ("LOCALDOMAIN");

-- 
Cheers,
Carlos.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-27  2:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 19:34 [PATCH] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall Joe Simmons-Talbott
2023-07-27  2:19 ` Carlos O'Donell

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).