]>
Commit | Line | Data |
---|---|---|
b9215da1 MT |
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 | |
5 | appropriately | |
6 | ||
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. | |
10 | ||
11 | Reviewed-by: DJ Delorie <dj@redhat.com> | |
12 | Signed-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 | ||
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) | |
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 | -- | |
41 | 2.39.2 | |
42 |