Musl and glibc syscall wrappers handles the null mq name in different ways and report different errors.
Avoid the syscall wrapper by calling the syscall directly. This needs skipping the leading "/" character in mq_name as is expected by the kernel.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com ---
Changes in v2: *) This is a new patch and added due to error in syscall mq_open reported by Beata.
testcases/kernel/syscalls/mq_open/mq_open01.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c index cd2a229d8..537af5b85 100644 --- a/testcases/kernel/syscalls/mq_open/mq_open01.c +++ b/testcases/kernel/syscalls/mq_open/mq_open01.c @@ -14,6 +14,7 @@ #include "tst_test.h" #include "tst_safe_file_ops.h" #include "tst_safe_posix_ipc.h" +#include "lapi/syscalls.h"
#define QUEUE_NAME "/test_mqueue" #define QUEUE_INIT "/init_mqueue" @@ -95,7 +96,7 @@ static struct test_case tcase[] = { .qname = "", .oflag = O_CREAT, .ret = -1, - .err = EINVAL, + .err = ENOENT, }, { .desc = "NORMAL", @@ -227,8 +228,10 @@ static void do_test(unsigned int i)
if (tc->setup) tc->setup(); - - TEST(fd = mq_open(qname, tc->oflag, S_IRWXU, tc->rq)); + if (*qname == '/') + TEST(fd = tst_syscall(__NR_mq_open, qname + 1, tc->oflag, S_IRWXU, tc->rq)); + else + TEST(fd = tst_syscall(__NR_mq_open, qname, tc->oflag, S_IRWXU, tc->rq));
if (fd > 0 && tc->rq) { if (mq_getattr(fd, &oldattr) < 0) {
Enable struct siginfo and sigevent related signal tests in the extended PCuABI syscall list.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com --- Changes in v2: none
runtest/morello_transitional_extended | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/runtest/morello_transitional_extended b/runtest/morello_transitional_extended index a823fe62a..e75078a8b 100644 --- a/runtest/morello_transitional_extended +++ b/runtest/morello_transitional_extended @@ -34,3 +34,26 @@ semop03 semop03 shmat01 shmat01 shmat02 shmat02 shmat03 shmat03 + +timer_create01 timer_create01 +timer_create02 timer_create02 +timer_create03 timer_create03 +timer_delete01 timer_delete01 +timer_delete02 timer_delete02 + +mq_open01 mq_open01 +mq_notify01 mq_notify01 +mq_notify02 mq_notify02 +mq_timedsend01 mq_timedsend01 +mq_timedreceive01 mq_timedreceive01 +mq_unlink01 mq_unlink01 + +rt_sigqueueinfo01 rt_sigqueueinfo01 +rt_tgsigqueueinfo01 rt_tgsigqueueinfo01 +pidfd_open01 pidfd_open01 +pidfd_open02 pidfd_open02 +pidfd_open03 pidfd_open03 +pidfd_open04 pidfd_open04 +pidfd_send_signal01 pidfd_send_signal01 +pidfd_send_signal02 pidfd_send_signal02 +pidfd_send_signal03 pidfd_send_signal03
Hi Amit,
On Mon, Sep 19, 2022 at 04:12:02PM +0530, Amit Daniel Kachhap wrote:
Enable struct siginfo and sigevent related signal tests in the extended PCuABI syscall list.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
Changes in v2: none
runtest/morello_transitional_extended | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/runtest/morello_transitional_extended b/runtest/morello_transitional_extended index a823fe62a..e75078a8b 100644 --- a/runtest/morello_transitional_extended +++ b/runtest/morello_transitional_extended @@ -34,3 +34,26 @@ semop03 semop03 shmat01 shmat01 shmat02 shmat02 shmat03 shmat03
+timer_create01 timer_create01 +timer_create02 timer_create02 +timer_create03 timer_create03 +timer_delete01 timer_delete01 +timer_delete02 timer_delete02
I haven't looked at the details but not all timer* testcases have been enabled here - any reason for that ?
+mq_open01 mq_open01 +mq_notify01 mq_notify01 +mq_notify02 mq_notify02 +mq_timedsend01 mq_timedsend01 +mq_timedreceive01 mq_timedreceive01 +mq_unlink01 mq_unlink01
+rt_sigqueueinfo01 rt_sigqueueinfo01 +rt_tgsigqueueinfo01 rt_tgsigqueueinfo01
Same here for rt_sigtimedwait
+pidfd_open01 pidfd_open01 +pidfd_open02 pidfd_open02 +pidfd_open03 pidfd_open03 +pidfd_open04 pidfd_open04
It seems that only pidfd_open04 is relying on signals. It makes sense to tun the others to make sure pidfd_open works as expected in the first place I guess.
+pidfd_send_signal01 pidfd_send_signal01 +pidfd_send_signal02 pidfd_send_signal02 +pidfd_send_signal03 pidfd_send_signal03
I do appreciate that those are somehow grouped by relevance, though it seems that the syscalls list is kept in alphabetical order (with some exceptions). I am not entirely convinced that's a rule though.
--- BR B.
-- 2.17.1
Hi,
On 9/23/22 15:06, Beata Michalska wrote:
Hi Amit,
On Mon, Sep 19, 2022 at 04:12:02PM +0530, Amit Daniel Kachhap wrote:
Enable struct siginfo and sigevent related signal tests in the extended PCuABI syscall list.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
Changes in v2: none
runtest/morello_transitional_extended | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/runtest/morello_transitional_extended b/runtest/morello_transitional_extended index a823fe62a..e75078a8b 100644 --- a/runtest/morello_transitional_extended +++ b/runtest/morello_transitional_extended @@ -34,3 +34,26 @@ semop03 semop03 shmat01 shmat01 shmat02 shmat02 shmat03 shmat03
+timer_create01 timer_create01 +timer_create02 timer_create02 +timer_create03 timer_create03 +timer_delete01 timer_delete01 +timer_delete02 timer_delete02
I haven't looked at the details but not all timer* testcases have been enabled here - any reason for that ?
I added as I tested these in kselftests. But yes I agree that the few remaining can be added here for completeness.
+mq_open01 mq_open01 +mq_notify01 mq_notify01 +mq_notify02 mq_notify02 +mq_timedsend01 mq_timedsend01 +mq_timedreceive01 mq_timedreceive01 +mq_unlink01 mq_unlink01
+rt_sigqueueinfo01 rt_sigqueueinfo01 +rt_tgsigqueueinfo01 rt_tgsigqueueinfo01
Same here for rt_sigtimedwait
+pidfd_open01 pidfd_open01 +pidfd_open02 pidfd_open02 +pidfd_open03 pidfd_open03 +pidfd_open04 pidfd_open04
It seems that only pidfd_open04 is relying on signals. It makes sense to tun the others to make sure pidfd_open works as expected in the first place I guess.
+pidfd_send_signal01 pidfd_send_signal01 +pidfd_send_signal02 pidfd_send_signal02 +pidfd_send_signal03 pidfd_send_signal03
I do appreciate that those are somehow grouped by relevance, though it seems that the syscalls list is kept in alphabetical order (with some exceptions). I am not entirely convinced that's a rule though.
I missed seeing the alphabetical order list. I will update in the next iteration.
Thanks, Amit
BR B.
-- 2.17.1
Hi Amit,
On Mon, Sep 19, 2022 at 04:12:01PM +0530, Amit Daniel Kachhap wrote:
Musl and glibc syscall wrappers handles the null mq name in different ways and report different errors.
There is a small subtlety there as musl does not report an error on invalid mq name at all - it ignores it. Note that this is actually an empty string (for the test case affected) but any name which does not follow the expected format (as of: does not start with '/') will be silently accepted by musl and passed over to the actual syscall.
Avoid the syscall wrapper by calling the syscall directly. This needs skipping the leading "/" character in mq_name as is expected by the kernel.
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
Changes in v2: *) This is a new patch and added due to error in syscall mq_open reported by Beata.
testcases/kernel/syscalls/mq_open/mq_open01.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c index cd2a229d8..537af5b85 100644 --- a/testcases/kernel/syscalls/mq_open/mq_open01.c +++ b/testcases/kernel/syscalls/mq_open/mq_open01.c @@ -14,6 +14,7 @@ #include "tst_test.h" #include "tst_safe_file_ops.h" #include "tst_safe_posix_ipc.h" +#include "lapi/syscalls.h" #define QUEUE_NAME "/test_mqueue" #define QUEUE_INIT "/init_mqueue" @@ -95,7 +96,7 @@ static struct test_case tcase[] = { .qname = "", .oflag = O_CREAT, .ret = -1,
.err = EINVAL,
}, { .desc = "NORMAL",.err = ENOENT,
@@ -227,8 +228,10 @@ static void do_test(unsigned int i) if (tc->setup) tc->setup();
- TEST(fd = mq_open(qname, tc->oflag, S_IRWXU, tc->rq));
Minor: We are losing here an empty line separating the 'if' blocks
--- BR B.
if (*qname == '/')
TEST(fd = tst_syscall(__NR_mq_open, qname + 1, tc->oflag, S_IRWXU, tc->rq));
else
TEST(fd = tst_syscall(__NR_mq_open, qname, tc->oflag, S_IRWXU, tc->rq));
if (fd > 0 && tc->rq) { if (mq_getattr(fd, &oldattr) < 0) {
-- 2.17.1
Hi,
On 9/23/22 14:42, Beata Michalska wrote:
Hi Amit,
On Mon, Sep 19, 2022 at 04:12:01PM +0530, Amit Daniel Kachhap wrote:
Musl and glibc syscall wrappers handles the null mq name in different ways and report different errors.
There is a small subtlety there as musl does not report an error on invalid mq name at all - it ignores it. Note that this is actually an empty string (for the test case affected) but any name which does not follow the expected format (as of: does not start with '/') will be silently accepted by musl and passed over to the actual syscall.
Avoid the syscall wrapper by calling the syscall directly. This needs skipping the leading "/" character in mq_name as is expected by the kernel.
Agreed that this patch brings some shortcomings. I will update the commit log with more details.
Thanks, Amit Daniel
Signed-off-by: Amit Daniel Kachhap amit.kachhap@arm.com
Changes in v2: *) This is a new patch and added due to error in syscall mq_open reported by Beata.
testcases/kernel/syscalls/mq_open/mq_open01.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c index cd2a229d8..537af5b85 100644 --- a/testcases/kernel/syscalls/mq_open/mq_open01.c +++ b/testcases/kernel/syscalls/mq_open/mq_open01.c @@ -14,6 +14,7 @@ #include "tst_test.h" #include "tst_safe_file_ops.h" #include "tst_safe_posix_ipc.h" +#include "lapi/syscalls.h" #define QUEUE_NAME "/test_mqueue" #define QUEUE_INIT "/init_mqueue" @@ -95,7 +96,7 @@ static struct test_case tcase[] = { .qname = "", .oflag = O_CREAT, .ret = -1,
.err = EINVAL,
}, { .desc = "NORMAL",.err = ENOENT,
@@ -227,8 +228,10 @@ static void do_test(unsigned int i) if (tc->setup) tc->setup();
- TEST(fd = mq_open(qname, tc->oflag, S_IRWXU, tc->rq));
Minor: We are losing here an empty line separating the 'if' blocks
BR B.
if (*qname == '/')
TEST(fd = tst_syscall(__NR_mq_open, qname + 1, tc->oflag, S_IRWXU, tc->rq));
else
TEST(fd = tst_syscall(__NR_mq_open, qname, tc->oflag, S_IRWXU, tc->rq));
if (fd > 0 && tc->rq) { if (mq_getattr(fd, &oldattr) < 0) {
-- 2.17.1
linux-morello-ltp@op-lists.linaro.org