about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-08-05 00:04:33 +0100
committerSam James <sam@gentoo.org>2023-08-24 13:17:10 +0100
commitad9b8399537670a990572c4b0c4da5411e3b68cf (patch)
treef0547b24840a2ed90b30c1ad082583532744bd99 /sysdeps/unix/sysv
parentc8ecda6251dd4a0dfe074e0a6011211cadeef742 (diff)
downloadglibc-ad9b8399537670a990572c4b0c4da5411e3b68cf.tar.gz
glibc-ad9b8399537670a990572c4b0c4da5411e3b68cf.tar.xz
glibc-ad9b8399537670a990572c4b0c4da5411e3b68cf.zip
sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
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>
(cherry picked from commit 652b9fdb77d9fd056d4dd26dad2c14142768ab49)
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/i386/tst-bz21269.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
index f508ef8f16..28f5359bea 100644
--- a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
+++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
@@ -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