Skip to contentSkip to conversation

Add test for epoll_pwait{04, 05}

PATCH New Xie Ziyao 2 participants 4 messages Aug 10, 2021 – Aug 11, 2021

lore
Share & tools
lore

Xie Ziyao

author
#0 lore raw

cover Add test for epoll_pwait{04, 05}

Xie Ziyao (2):
epoll_pwait: Add invalid sigmask test for epoll_pwait04
epoll_pwait: Add invalid timespec test for epoll_pwait05

 runtest/syscalls                              |  2 +
 .../kernel/syscalls/epoll_pwait/.gitignore    |  2 +
 .../syscalls/epoll_pwait/epoll_pwait04.c      | 61 ++++++++++++++++
 .../syscalls/epoll_pwait/epoll_pwait05.c      | 70 +++++++++++++++++++
 4 files changed, 135 insertions(+)
 create mode 100644 testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c
 create mode 100644 testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c

--
2.17.1

author
#1 lore raw

PATCH 1/2 epoll_pwait: Add invalid sigmask test for epoll_pwait04

Verify that, epoll_pwait() and epoll_pwait2() return -1 and set errno to EFAULT with a sigmask points outside user's accessible address space.

Fixes #792
---
 runtest/syscalls                              |  1 +
 .../kernel/syscalls/epoll_pwait/.gitignore    |  1 +
 .../syscalls/epoll_pwait/epoll_pwait04.c      | 61 +++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c
runtest/syscalls +1 -0
index 9af5aa5c0..206281f6e 100644
@@ -168,6 +168,7 @@ epoll_wait03 epoll_wait03
 epoll_pwait01 epoll_pwait01
 epoll_pwait02 epoll_pwait02
 epoll_pwait03 epoll_pwait03
+epoll_pwait04 epoll_pwait04
 
 eventfd01 eventfd01
 
testcases/kernel/syscalls/epoll_pwait/.gitignore +1 -0
index 1d16367e6..cdefffa2d 100644
@@ -1,3 +1,4 @@
 epoll_pwait01
 epoll_pwait02
 epoll_pwait03
+epoll_pwait04
testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c new file +61 -0

61 lines not on this page · raw message

--
2.17.1

#2 lore raw

PATCH 1/2 epoll_pwait: Add invalid sigmask test for epoll_pwait04

Hi!

testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c line 25

Quoted 4 lines
testcases/kernel/syscalls/epoll_pwait/epoll_pwait04.c new file +4 -0
+static void run(void)
+{
+	TST_EXP_FAIL(do_epoll_pwait(efd, &e, 1, -1, tst_get_bad_addr(NULL)),
+		     EFAULT, "with an invalid sigmask pointer");

The tst_get_bad_addr() allocates memory so I've moved it to the test setup() so that the test does not get out of memory with large enough -i option.

Patchset pushed, good work, thanks.

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

PATCH 2/2 epoll_pwait: Add invalid timespec test for epoll_pwait05

In reply to Xie Ziyao

Verify that, epoll_pwait2() return -1 and set errno to EINVAL with an invalid timespec.

Fixes #792
---
 runtest/syscalls                              |  1 +
 .../kernel/syscalls/epoll_pwait/.gitignore    |  1 +
 .../syscalls/epoll_pwait/epoll_pwait05.c      | 70 +++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100644 testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c
runtest/syscalls +1 -0
index 206281f6e..d3fc98758 100644
@@ -169,6 +169,7 @@ epoll_pwait01 epoll_pwait01
 epoll_pwait02 epoll_pwait02
 epoll_pwait03 epoll_pwait03
 epoll_pwait04 epoll_pwait04
+epoll_pwait05 epoll_pwait05
 
 eventfd01 eventfd01
 
testcases/kernel/syscalls/epoll_pwait/.gitignore +1 -0
index cdefffa2d..fafb2d782 100644
@@ -2,3 +2,4 @@ epoll_pwait01
 epoll_pwait02
 epoll_pwait03
 epoll_pwait04
+epoll_pwait05
testcases/kernel/syscalls/epoll_pwait/epoll_pwait05.c new file +70 -0

70 lines not on this page · raw message

--
2.17.1