]> git.ipfire.org Git - people/mlorenz/ipfire-2.x.git/blame - src/patches/glibc-2.38/0010-sysdeps-tst-bz21269-handle-ENOSYS-skip-appropriately.patch
glibc: Import patches from upstream
[people/mlorenz/ipfire-2.x.git] / src / patches / glibc-2.38 / 0010-sysdeps-tst-bz21269-handle-ENOSYS-skip-appropriately.patch
CommitLineData
b9215da1
MT
1From ad9b8399537670a990572c4b0c4da5411e3b68cf Mon Sep 17 00:00:00 2001
2From: Sam James <sam@gentoo.org>
3Date: Sat, 5 Aug 2023 00:04:33 +0100
4Subject: [PATCH 10/27] sysdeps: tst-bz21269: handle ENOSYS & skip
5 appropriately
6
7SYS_modify_ldt requires CONFIG_MODIFY_LDT_SYSCALL to be set in the kernel, which
8some distributions may disable for hardening. Check if that's the case (unset)
9and mark the test as UNSUPPORTED if so.
10
11Reviewed-by: DJ Delorie <dj@redhat.com>
12Signed-off-by: Sam James <sam@gentoo.org>
13(cherry picked from commit 652b9fdb77d9fd056d4dd26dad2c14142768ab49)
14---
15 sysdeps/unix/sysv/linux/i386/tst-bz21269.c | 11 ++++++++++-
16 1 file changed, 10 insertions(+), 1 deletion(-)
17
18diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
19index f508ef8f16..28f5359bea 100644
20--- a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
21+++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
22@@ -52,7 +52,16 @@ xset_thread_area (struct user_desc *u_info)
23 static void
24 xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
25 {
26- TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, func, ptr, bytecount) == 0);
27+ long ret = syscall (SYS_modify_ldt, func, ptr, bytecount);
28+
29+ if (ret == -1)
30+ {
31+ if (errno == ENOSYS)
32+ FAIL_UNSUPPORTED ("modify_ldt not supported");
33+ FAIL_EXIT1 ("modify_ldt failed (errno=%d)", errno);
34+ }
35+
36+ return 0;
37 }
38
39 static int
40--
412.39.2
42