Skip to contentSkip to conversation

syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches

PATCH New [email protected] 3 participants 4 messages Aug 23, 2019 – Aug 29, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches

From: He Zhe <[email protected]>

rt_sigtimedwait01 fails as follow on MIPS arches
rt_sigtimedwait01 1 TFAIL : .../sigwaitinfo01.c:58: test_empty_set
(.../sigwaitinfo01.c: 148): Unexpected failure:
TEST_ERRNO=EINVAL(22): Invalid argument

As this case purposely bypasses glibc, it should align with the size of kernel definition of sigset_t which is different from other arches.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/signal.h#n15

This patch adds specific case for MIPS.

---
 testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +10 -3
index 5a32ce1..5c2fa99 100644
@@ -128,9 +128,16 @@ static int my_sigtimedwait(const sigset_t * set, siginfo_t * info,
 static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
 			      struct timespec *timeout)
 {
-
-	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64 and 8, resp. */
-	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout, 8);
+	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64 and 8, resp,
+	 * except for MIPS which are 128 and 8, resp.
+	 */
+	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout,
+#ifdef __mips__
+		16
+#else
+		8
+#endif
+		);
 }
 #endif
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches

----- Original Message -----

Quoted 35 lines

From: He Zhe <[email protected]>

rt_sigtimedwait01 fails as follow on MIPS arches
rt_sigtimedwait01 1 TFAIL : .../sigwaitinfo01.c:58: test_empty_set
(.../sigwaitinfo01.c: 148): Unexpected failure:
TEST_ERRNO=EINVAL(22): Invalid argument

As this case purposely bypasses glibc, it should align with the size of kernel
definition of sigset_t which is different from other arches.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/signal.h#n15

This patch adds specific case for MIPS.

---
 testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +0 -2
index 5a32ce1..5c2fa99 100644
@@ -128,9 +128,16 @@ static int my_sigtimedwait(const sigset_t * set,
 siginfo_t * info,
 static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
 			      struct timespec *timeout)
 {
-
-	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64

and 8, resp. */

testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +1 -1
-	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout, 8);
+	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64

and 8, resp,

testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c static int my_sigtimedwait(const sigset_t * set, siginfo_t * info, · line 139

Quoted 8 lines
testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +8 -0
+	 * except for MIPS which are 128 and 8, resp.
+	 */
+	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout,
+#ifdef __mips__
+		16
+#else
+		8
+#endif

Hi,

looking at kernel SYSCALL_DEFINE4(rt_sigtimedwait,..), the size is used in this check:

        if (sigsetsize != sizeof(sigset_t))                                                                                                                   
                return -EINVAL; 

So I'm wondering if need to have an absolute value here, and if we can't replace it with sizeof(sigset_t) or _NSIG / 8?

Regards,
Jan

#2 lore raw

PATCH 1/1 syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches

Hi!

Quoted 2 lines

So I'm wondering if need to have an absolute value here, and if we can't replace it with sizeof(sigset_t) or _NSIG / 8?

+1

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#3 lore raw

PATCH 1/1 syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches

In reply to Jan Stancek
Quoted 47 lines · Jan Stancek

----- Original Message -----

Quoted 35 lines

From: He Zhe <[email protected]>

rt_sigtimedwait01 fails as follow on MIPS arches
rt_sigtimedwait01 1 TFAIL : .../sigwaitinfo01.c:58: test_empty_set
(.../sigwaitinfo01.c: 148): Unexpected failure:
TEST_ERRNO=EINVAL(22): Invalid argument

As this case purposely bypasses glibc, it should align with the size of kernel
definition of sigset_t which is different from other arches.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/mips/include/uapi/asm/signal.h#n15

This patch adds specific case for MIPS.

---
 testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +0 -2
index 5a32ce1..5c2fa99 100644
@@ -128,9 +128,16 @@ static int my_sigtimedwait(const sigset_t * set,
 siginfo_t * info,
 static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
 			      struct timespec *timeout)
 {
-
-	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64

and 8, resp. */

testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +1 -1
-	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout, 8);
+	/* The last argument is (number_of_signals)/(bits_per_byte), which are 64

and 8, resp,

testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c static int my_sigtimedwait(const sigset_t * set, siginfo_t * info, · line 139

Quoted 8 lines
testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c +8 -0
+	 * except for MIPS which are 128 and 8, resp.
+	 */
+	return ltp_syscall(__NR_rt_sigtimedwait, set, info, timeout,
+#ifdef __mips__
+		16
+#else
+		8
+#endif

Hi,

Quoted 7 lines

looking at kernel SYSCALL_DEFINE4(rt_sigtimedwait,..), the size is used in this check:

        if (sigsetsize != sizeof(sigset_t))                                                                                                                   
                return -EINVAL; 

So I'm wondering if need to have an absolute value here, and if we can't replace it with sizeof(sigset_t) or _NSIG / 8?

Thanks, I did try with sizeof(sigset_t) but it gave 128 bytes for MIPS. _NSIG works well. I'll send v2.

Zhe

Quoted 4 lines

Regards,
Jan