1 From ad9b8399537670a990572c4b0c4da5411e3b68cf Mon Sep 17 00:00:00 2001
2 From: Sam James <sam@gentoo.org>
3 Date: Sat, 5 Aug 2023 00:04:33 +0100
4 Subject: [PATCH 10/27] sysdeps: tst-bz21269: handle ENOSYS & skip
7 SYS_modify_ldt requires CONFIG_MODIFY_LDT_SYSCALL to be set in the kernel, which
8 some distributions may disable for hardening. Check if that's the case (unset)
9 and mark the test as UNSUPPORTED if so.
11 Reviewed-by: DJ Delorie <dj@redhat.com>
12 Signed-off-by: Sam James <sam@gentoo.org>
13 (cherry picked from commit 652b9fdb77d9fd056d4dd26dad2c14142768ab49)
15 sysdeps/unix/sysv/linux/i386/tst-bz21269.c | 11 ++++++++++-
16 1 file changed, 10 insertions(+), 1 deletion(-)
18 diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
19 index 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)
24 xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
26 - TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, func, ptr, bytecount) == 0);
27 + long ret = syscall (SYS_modify_ldt, func, ptr, bytecount);
31 + if (errno == ENOSYS)
32 + FAIL_UNSUPPORTED ("modify_ldt not supported");
33 + FAIL_EXIT1 ("modify_ldt failed (errno=%d)", errno);