]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
authorSam James <sam@gentoo.org>
Fri, 4 Aug 2023 23:04:33 +0000 (00:04 +0100)
committerSam James <sam@gentoo.org>
Wed, 16 Aug 2023 20:01:39 +0000 (21:01 +0100)
SYS_modify_ldt requires CONFIG_MODIFY_LDT_SYSCALL to be set in the kernel, which
some distributions may disable for hardening. Check if that's the case (unset)
and mark the test as UNSUPPORTED if so.

Reviewed-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Sam James <sam@gentoo.org>
sysdeps/unix/sysv/linux/i386/tst-bz21269.c

index f508ef8f164bdfc8d702288b337fb272081797f2..28f5359bea7df8ebc21bd61112f17774bab446b7 100644 (file)
@@ -52,7 +52,16 @@ xset_thread_area (struct user_desc *u_info)
 static void
 xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
 {
-  TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, func, ptr, bytecount) == 0);
+  long ret = syscall (SYS_modify_ldt, func, ptr, bytecount);
+
+  if (ret == -1)
+    {
+      if (errno == ENOSYS)
+       FAIL_UNSUPPORTED ("modify_ldt not supported");
+      FAIL_EXIT1 ("modify_ldt failed (errno=%d)", errno);
+    }
+
+  return 0;
 }
 
 static int