public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches
@ 2019-08-23  7:08 zhe.he
  2019-08-27 19:26 ` Jan Stancek
  0 siblings, 1 reply; 4+ messages in thread
From: zhe.he @ 2019-08-23  7:08 UTC (permalink / raw)
  To: ltp

From: He Zhe <zhe.he@windriver.com>

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.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
index 5a32ce1..5c2fa99 100644
--- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
+++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
@@ -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
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches
  2019-08-23  7:08 [LTP] [PATCH] syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches zhe.he
@ 2019-08-27 19:26 ` Jan Stancek
  2019-08-28 12:23   ` Cyril Hrubis
  2019-08-29 13:08   ` He Zhe
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Stancek @ 2019-08-27 19:26 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> From: He Zhe <zhe.he@windriver.com>
> 
> 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.
> 
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> index 5a32ce1..5c2fa99 100644
> --- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> +++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
> @@ -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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches
  2019-08-27 19:26 ` Jan Stancek
@ 2019-08-28 12:23   ` Cyril Hrubis
  2019-08-29 13:08   ` He Zhe
  1 sibling, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2019-08-28 12:23 UTC (permalink / raw)
  To: ltp

Hi!
> 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

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches
  2019-08-27 19:26 ` Jan Stancek
  2019-08-28 12:23   ` Cyril Hrubis
@ 2019-08-29 13:08   ` He Zhe
  1 sibling, 0 replies; 4+ messages in thread
From: He Zhe @ 2019-08-29 13:08 UTC (permalink / raw)
  To: ltp



On 8/28/19 3:26 AM, Jan Stancek wrote:
>
> ----- Original Message -----
>> From: He Zhe <zhe.he@windriver.com>
>>
>> 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.
>>
>> Signed-off-by: He Zhe <zhe.he@windriver.com>
>> ---
>>  testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c | 13 ++++++++++---
>>  1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
>> b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
>> index 5a32ce1..5c2fa99 100644
>> --- a/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
>> +++ b/testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c
>> @@ -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
> 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?

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

Zhe

>
> Regards,
> Jan
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-29 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-23  7:08 [LTP] [PATCH] syscalls: rt_sigwaitinfo01: Fix failure for MIPS arches zhe.he
2019-08-27 19:26 ` Jan Stancek
2019-08-28 12:23   ` Cyril Hrubis
2019-08-29 13:08   ` He Zhe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox