* [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter
@ 2023-08-16 6:29 Sam James
2023-08-16 6:29 ` [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately Sam James
2023-08-16 19:07 ` [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter DJ Delorie
0 siblings, 2 replies; 7+ messages in thread
From: Sam James @ 2023-08-16 6:29 UTC (permalink / raw)
To: libc-alpha; +Cc: Sam James
All callers pass 1 or 0x11 anyway (same meaning according to man page),
but still.
Signed-off-by: Sam James <sam@gentoo.org>
---
sysdeps/unix/sysv/linux/i386/tst-bz21269.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
index 51d4a1b082..f508ef8f16 100644
--- a/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
+++ b/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
@@ -52,7 +52,7 @@ 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, 1, ptr, bytecount) == 0);
+ TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, func, ptr, bytecount) == 0);
}
static int
--
2.41.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
2023-08-16 6:29 [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter Sam James
@ 2023-08-16 6:29 ` Sam James
2023-08-16 19:14 ` DJ Delorie
2023-08-17 7:07 ` Andreas Schwab
2023-08-16 19:07 ` [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter DJ Delorie
1 sibling, 2 replies; 7+ messages in thread
From: Sam James @ 2023-08-16 6:29 UTC (permalink / raw)
To: libc-alpha; +Cc: Sam James
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.
Signed-off-by: Sam James <sam@gentoo.org>
---
Fix the FAIL_EXIT1 error.
sysdeps/unix/sysv/linux/i386/tst-bz21269.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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
--
2.41.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter
2023-08-16 6:29 [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter Sam James
2023-08-16 6:29 ` [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately Sam James
@ 2023-08-16 19:07 ` DJ Delorie
1 sibling, 0 replies; 7+ messages in thread
From: DJ Delorie @ 2023-08-16 19:07 UTC (permalink / raw)
To: Sam James; +Cc: libc-alpha
Sam James via Libc-alpha <libc-alpha@sourceware.org> writes:
> All callers pass 1 or 0x11 anyway (same meaning according to man page),
> but still.
Confirmed. LGTM. I was just wondering about this yesterday, by
coincidence.
Reviewed-by: DJ Delorie <dj@redhat.com>
> - TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, 1, ptr, bytecount) == 0);
> + TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, func, ptr, bytecount) == 0);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
2023-08-16 6:29 ` [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately Sam James
@ 2023-08-16 19:14 ` DJ Delorie
2023-08-16 20:13 ` Sam James
2023-08-17 7:07 ` Andreas Schwab
1 sibling, 1 reply; 7+ messages in thread
From: DJ Delorie @ 2023-08-16 19:14 UTC (permalink / raw)
To: Sam James; +Cc: libc-alpha
Sam James via Libc-alpha <libc-alpha@sourceware.org> writes:
> 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.
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
> Signed-off-by: Sam James <sam@gentoo.org>
> ---
> Fix the FAIL_EXIT1 error.
>
> sysdeps/unix/sysv/linux/i386/tst-bz21269.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
2023-08-16 19:14 ` DJ Delorie
@ 2023-08-16 20:13 ` Sam James
0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2023-08-16 20:13 UTC (permalink / raw)
To: DJ Delorie; +Cc: Sam James, libc-alpha
DJ Delorie <dj@redhat.com> writes:
> Sam James via Libc-alpha <libc-alpha@sourceware.org> writes:
>> 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.
>
> LGTM
> Reviewed-by: DJ Delorie <dj@redhat.com>
Thanks DJ! Pushed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
2023-08-16 6:29 ` [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately Sam James
2023-08-16 19:14 ` DJ Delorie
@ 2023-08-17 7:07 ` Andreas Schwab
2023-08-17 8:31 ` Sam James
1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2023-08-17 7:07 UTC (permalink / raw)
To: Sam James via Libc-alpha; +Cc: Sam James
../sysdeps/unix/sysv/linux/i386/tst-bz21269.c: In function 'xmodify_ldt':
../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:64:10: error: 'return' with a value, in function returning void [-Werror=return-type]
64 | return 0;
| ^
../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:53:1: note: declared here
53 | xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
| ^~~~~~~~~~~
cc1: all warnings being treated as errors
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately
2023-08-17 7:07 ` Andreas Schwab
@ 2023-08-17 8:31 ` Sam James
0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2023-08-17 8:31 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Sam James via Libc-alpha, Sam James
Andreas Schwab <schwab@suse.de> writes:
> ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c: In function 'xmodify_ldt':
> ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:64:10: error: 'return' with a value, in function returning void [-Werror=return-type]
> 64 | return 0;
> | ^
> ../sysdeps/unix/sysv/linux/i386/tst-bz21269.c:53:1: note: declared here
> 53 | xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
> | ^~~~~~~~~~~
> cc1: all warnings being treated as errors
Fixed, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-17 8:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 6:29 [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter Sam James
2023-08-16 6:29 ` [PATCH v2 2/2] sysdeps: tst-bz21269: handle ENOSYS & skip appropriately Sam James
2023-08-16 19:14 ` DJ Delorie
2023-08-16 20:13 ` Sam James
2023-08-17 7:07 ` Andreas Schwab
2023-08-17 8:31 ` Sam James
2023-08-16 19:07 ` [PATCH v2 1/2] sysdeps: tst-bz21269: fix test parameter DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).