Skip to contentSkip to conversation

syscalls: add tgkill test-cases

PATCH Superseded Sumit Garg 3 participants 17 messages Mar 13, 2019 – Mar 18, 2019 Library code

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sumit Garg

author
#0 lore raw

v2 cover syscalls: add tgkill test-cases

This patch-set is inherited from Greg which adds test-cases for tgkill syscall.

Changes in v2:
- Free allocated memory for threads.
- Remove redundant call to stop_threads().
- Apply reviewed-by tag.

Greg Hackmann (3):
syscalls/tgkill01: add new test
syscalls/tgkill02: add new test
syscalls/tgkill03: add new test

 runtest/syscalls                            |   4 +
 testcases/kernel/syscalls/tgkill/.gitignore |   3 +
 testcases/kernel/syscalls/tgkill/Makefile   |  10 ++
 testcases/kernel/syscalls/tgkill/tgkill.h   |  22 +++++
 testcases/kernel/syscalls/tgkill/tgkill01.c | 141 ++++++++++++++++++++++++++++
 testcases/kernel/syscalls/tgkill/tgkill02.c |  80 ++++++++++++++++
 testcases/kernel/syscalls/tgkill/tgkill03.c | 122 ++++++++++++++++++++++++
 7 files changed, 382 insertions(+)
 create mode 100644 testcases/kernel/syscalls/tgkill/.gitignore
 create mode 100644 testcases/kernel/syscalls/tgkill/Makefile
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill.h
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill01.c
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill02.c
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill03.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

From: Greg Hackmann <[email protected]>

tgkill() delivers a signal to a specific thread. Test this by installing a SIGUSR1 handler which records the current pthread ID. Start a number of threads in parallel, then one-by-one call tgkill(..., tid, SIGUSR1) and check that the expected pthread ID was recorded.

---
 runtest/syscalls                            |   2 +
 testcases/kernel/syscalls/tgkill/.gitignore |   1 +
 testcases/kernel/syscalls/tgkill/Makefile   |  10 ++
 testcases/kernel/syscalls/tgkill/tgkill.h   |  22 +++++
 testcases/kernel/syscalls/tgkill/tgkill01.c | 141 ++++++++++++++++++++++++++++
 5 files changed, 176 insertions(+)
 create mode 100644 testcases/kernel/syscalls/tgkill/.gitignore
 create mode 100644 testcases/kernel/syscalls/tgkill/Makefile
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill.h
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill01.c
runtest/syscalls +2 -0
index d752dba..8cd99e0 100644
@@ -1399,6 +1399,8 @@ syslog10 syslog10
 syslog11 syslog11
 syslog12 syslog12
 
+tgkill01 tgkill01
+
 time01 time01
 time02 time02
 
testcases/kernel/syscalls/tgkill/.gitignore new file +1 -0
new file mode 100644
index 0000000..f4566fd
@@ -0,0 +1 @@
+tgkill01
testcases/kernel/syscalls/tgkill/Makefile new file +10 -0
new file mode 100644
index 0000000..a51080c
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Google, Inc.
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
+
+LDLIBS			+= -pthread
testcases/kernel/syscalls/tgkill/tgkill.h new file +22 -0
new file mode 100644
index 0000000..a7d96f4
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2018 Google, Inc.
+ */
+
+#ifndef TGKILL_H
+#define TGKILL_H
+
+#include "config.h"
+#include "lapi/syscalls.h"
+
+static inline int sys_tgkill(int tgid, int tid, int sig)
+{
+	return tst_syscall(__NR_tgkill, tgid, tid, sig);
+}
+
+static inline pid_t sys_gettid(void)
+{
+	return tst_syscall(__NR_gettid);
+}
+
+#endif /* TGKILL_H */
testcases/kernel/syscalls/tgkill/tgkill01.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Hi!
The test itself looks good, my only concern is actually that checkpoints cannot be used for the keeping the thread asleep during the test. However I can easily add one function to the futex library:

TST_CHECKPOINT_SLEEP(id)

That would cause the thread to wait on the checkpoint until:

* we were woken up
* we timeouted

Which would basically loop on tst_checkpoint_wait() and retry in case of EINTR.

Maybe it would be a good idea to retry on EINTR in the TST_CHECKPOINT_WAIT(), then we could easily use that one here as well. I'm not sure though if there are tests that depends on checkpoints being interrupted by signals though, I would have to check.

For the second part we already have a function to wake all threads waiting on checkpoint, but we have to specify exact number of threads to wait for, which is there in order to avoid race coditions (i.e. thread was not sleeping yet at the time we tried to wake it). So we would have to count the number of threads we want to wake before the call to the TST_CHECKPOINT_WAKE2().

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

PATCH v2 1/3 syscalls/tgkill01: add new test

Quoted 8 lines · Cyril Hrubis

Hi!
The test itself looks good, my only concern is actually that checkpoints cannot be used for the keeping the thread asleep during the test. However I can easily add one function to the futex library:

TST_CHECKPOINT_SLEEP(id)

Quoted 8 lines

That would cause the thread to wait on the checkpoint until:

* we were woken up
* we timeouted

Which would basically loop on tst_checkpoint_wait() and retry in case of EINTR.

I am not sure how we would manage actual "msec_timeout" in case we get EINTR and need to retry again as we may need to take care of elapsed time till we receive asynchronous signal.

-Sumit

Quoted 15 lines

Maybe it would be a good idea to retry on EINTR in the TST_CHECKPOINT_WAIT(), then we could easily use that one here as well. I'm not sure though if there are tests that depends on checkpoints being interrupted by signals though, I would have to check.

For the second part we already have a function to wake all threads waiting on checkpoint, but we have to specify exact number of threads to wait for, which is there in order to avoid race coditions (i.e. thread was not sleeping yet at the time we tried to wake it). So we would have to count the number of threads we want to wake before the call to the TST_CHECKPOINT_WAKE2().

--
Cyril Hrubis
[email protected]

#4 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Hi!

Quoted 3 lines

I am not sure how we would manage actual "msec_timeout" in case we get EINTR and need to retry again as we may need to take care of elapsed time till we receive asynchronous signal.

I would have just restarted the timeout after we got signal, the worst case that can happen is that in an unlikely case we will send a signals fast enough so that the checkpoint will never timeout. But even then the test library will timeout and would kill the process anyways.

Another option is to switch checkpoints so that they use absolute timeout and pass clock_gettime() + msec_timeout as timeout.

I would go for something as simple as:

lib/tst_checkpoint.c +7 -3
index 5455d0378..5e5b11496 100644
@@ -85,6 +85,7 @@ void tst_checkpoint_init(const char *file, const int lineno,
 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
 {
        struct timespec timeout;
+       int ret;
 
        if (id >= tst_max_futexes) {
                errno = EOVERFLOW;
@@ -94,8 +95,12 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
        timeout.tv_sec = msec_timeout/1000;
        timeout.tv_nsec = (msec_timeout%1000) * 1000000;
 
-       return syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
-                      tst_futexes[id], &timeout);
+       do {
+               ret = syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
+                             tst_futexes[id], &timeout);
+       } while (ret == -1 && errno == EINTR);
+
+       return ret;
 }
 
-- 

Cyril Hrubis
[email protected]

#5 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Quoted 9 lines · Cyril Hrubis

Hi!

Quoted 3 lines

I am not sure how we would manage actual "msec_timeout" in case we get EINTR and need to retry again as we may need to take care of elapsed time till we receive asynchronous signal.

I would have just restarted the timeout after we got signal, the worst case that can happen is that in an unlikely case we will send a signals fast enough

Maybe we can print something useful there at least for friendly debugging if that unlikely case happens.

Quoted 24 lines

so that the checkpoint will never timeout. But even then the test library will
timeout and would kill the process anyways.

Another option is to switch checkpoints so that they use absolute timeout and
pass clock_gettime() + msec_timeout as timeout.

I would go for something as simple as:

lib/tst_checkpoint.c +1 -0
index 5455d0378..5e5b11496 100644
@@ -85,6 +85,7 @@ void tst_checkpoint_init(const char *file, const int
 lineno,
 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
 {
        struct timespec timeout;
+       int ret;
 
        if (id >= tst_max_futexes) {
                errno = EOVERFLOW;

lib/tst_checkpoint.c int tst_checkpoint_wait(unsigned int id, unsigned int · line 101

Quoted 9 lines
lib/tst_checkpoint.c +3 -2
@@ -94,8 +95,12 @@ int tst_checkpoint_wait(unsigned int id, unsigned int
 msec_timeout)
        timeout.tv_sec = msec_timeout/1000;
        timeout.tv_nsec = (msec_timeout%1000) * 1000000;
 
-       return syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
-                      tst_futexes[id], &timeout);
+       do {
+               ret = syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
+                             tst_futexes[id], &timeout);

if (ret == -1 && errno == EINTR)
tst_res(TWARN | TERRNO, "FUTEX_WAIT operation was interrupted by a
signal, retry again");

+ } while (ret == -1 && errno == EINTR);

Quoted 8 lines
lib/tst_checkpoint.c +2 -1
+
+       return ret;
 }
 
--

Cyril Hrubis
[email protected]

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190315/e104e07e/attachment-0001.html>
author
#6 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Quoted 40 lines · Li Wang
Quoted 8 lines · Cyril Hrubis

Hi!

Quoted 3 lines

I am not sure how we would manage actual "msec_timeout" in case we get EINTR and need to retry again as we may need to take care of elapsed time till we receive asynchronous signal.

I would have just restarted the timeout after we got signal, the worst case that can happen is that in an unlikely case we will send a signals fast enough

Maybe we can print something useful there at least for friendly debugging if that unlikely case happens.

Quoted 25 lines

so that the checkpoint will never timeout. But even then the test library will timeout and would kill the process anyways.

Another option is to switch checkpoints so that they use absolute timeout and pass clock_gettime() + msec_timeout as timeout.

I would go for something as simple as:

lib/tst_checkpoint.c +1 -0
index 5455d0378..5e5b11496 100644
@@ -85,6 +85,7 @@ void tst_checkpoint_init(const char *file, const int lineno,
 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
 {
        struct timespec timeout;
+       int ret;
 
        if (id >= tst_max_futexes) {
                errno = EOVERFLOW;
@@ -94,8 +95,12 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
        timeout.tv_sec = msec_timeout/1000;
        timeout.tv_nsec = (msec_timeout%1000) * 1000000;
 
Quoted 9 lines

lib/tst_checkpoint.c int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout) · line 100

Quoted 5 lines
lib/tst_checkpoint.c +3 -2
-       return syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
-                      tst_futexes[id], &timeout);
+       do {
+               ret = syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
+                             tst_futexes[id], &timeout);
    if (ret == -1 && errno == EINTR)
        tst_res(TWARN | TERRNO, "FUTEX_WAIT operation was interrupted by a signal, retry again");

I am not sure if this warning message is desired for test-cases which needs to wait on checkpoints irrespective of signals like this tgkill01 test-case.

-Sumit

Quoted 14 lines
Quoted 8 lines
lib/tst_checkpoint.c +3 -1
+       } while (ret == -1 && errno == EINTR);
+
+       return ret;
 }
 
--

Cyril Hrubis
[email protected]

--
Regards,
Li Wang

#7 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Hi!

Quoted 21 lines
Quoted 11 lines
Quoted 11 lines

int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)

 {
        struct timespec timeout;
lib/tst_checkpoint.c +1 -0
+       int ret;
 
        if (id >= tst_max_futexes) {
                errno = EOVERFLOW;
@@ -94,8 +95,12 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
        timeout.tv_sec = msec_timeout/1000;
        timeout.tv_nsec = (msec_timeout%1000) * 1000000;
 
Quoted 9 lines

lib/tst_checkpoint.c int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout) · line 100

Quoted 5 lines
lib/tst_checkpoint.c +3 -2
-       return syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
-                      tst_futexes[id], &timeout);
+       do {
+               ret = syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
+                             tst_futexes[id], &timeout);
    if (ret == -1 && errno == EINTR)
        tst_res(TWARN | TERRNO, "FUTEX_WAIT operation was interrupted by a signal, retry again");
Quoted 3 lines

I am not sure if this warning message is desired for test-cases which needs to wait on checkpoints irrespective of signals like this tgkill01 test-case.

Agreed, it's not an error condition, it's just a coincidence that most of the tests does not get signals when they sleep on futex, otherwise thing would crash and burn. So I would argue that retrying on EINTR is actually a bug fix rather than anything else.

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

PATCH v2 1/3 syscalls/tgkill01: add new test

Quoted 24 lines · Cyril Hrubis

Hi!

Quoted 8 lines
Quoted 8 lines

lib/tst_checkpoint.c int tst_checkpoint_wait(unsigned int id, unsigned

Quoted 8 lines

int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)

 {
        struct timespec timeout;
lib/tst_checkpoint.c +1 -0
+       int ret;
 
        if (id >= tst_max_futexes) {
                errno = EOVERFLOW;
@@ -94,8 +95,12 @@ int tst_checkpoint_wait(unsigned int id, unsigned

int msec_timeout)

Quoted 11 lines
Quoted 11 lines

lib/tst_checkpoint.c int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout) · line 100

Quoted 8 lines
lib/tst_checkpoint.c +3 -2
        timeout.tv_sec = msec_timeout/1000;
        timeout.tv_nsec = (msec_timeout%1000) * 1000000;
 
-       return syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
-                      tst_futexes[id], &timeout);
+       do {
+               ret = syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
+                             tst_futexes[id], &timeout);

if (ret == -1 && errno == EINTR)
tst_res(TWARN | TERRNO, "FUTEX_WAIT operation was interrupted

by a signal, retry again");

Quoted 2 lines
Quoted 1 line
Quoted 9 lines
Quoted 3 lines

I am not sure if this warning message is desired for test-cases which needs to wait on checkpoints irrespective of signals like this tgkill01 test-case.

Agreed, it's not an error condition, it's just a coincidence that most of the tests does not get signals when they sleep on futex, otherwise thing would crash and burn. So I would argue that retrying on EINTR is actually a bug fix rather than anything else.

Okay, here I'm not insist to print the warning. But it's only use for hint on that worst situation which you were mentioned. If the checkpoint got signal leads to never timeout and test eventually killed by test lib. That would hard to know what happened at that moment. My concern is the situation is hard to reproduce later so just want to print more useful messeges:).

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190315/5caa91e0/attachment-0001.html>
#9 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Hi!

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

I am not sure if this warning message is desired for test-cases which needs to wait on checkpoints irrespective of signals like this tgkill01 test-case.

Agreed, it's not an error condition, it's just a coincidence that most of the tests does not get signals when they sleep on futex, otherwise thing would crash and burn. So I would argue that retrying on EINTR is actually a bug fix rather than anything else.

Quoted 6 lines

Okay, here I'm not insist to print the warning. But it's only use for hint on that worst situation which you were mentioned. If the checkpoint got signal leads to never timeout and test eventually killed by test lib. That would hard to know what happened at that moment. My concern is the situation is hard to reproduce later so just want to print more useful messeges:).

As for now that's only a hypotetical corner case, someone would have to send signals to such process sleeping on the checkpoint in a loop for that to happen. The problem is that printing any messages when checkpoint was interrupted by signal would lead to even greater confusion for tests that actually have to send signals to such processes.

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

PATCH v2 1/3 syscalls/tgkill01: add new test

Quoted 20 lines · Cyril Hrubis

Hi!

Quoted 11 lines
Quoted 9 lines
Quoted 3 lines

I am not sure if this warning message is desired for test-cases which needs to wait on checkpoints irrespective of signals like this tgkill01 test-case.

Agreed, it's not an error condition, it's just a coincidence that most of the tests does not get signals when they sleep on futex, otherwise thing would crash and burn. So I would argue that retrying on EINTR is actually a bug fix rather than anything else.

Okay, here I'm not insist to print the warning. But it's only use for

hint

Quoted 2 lines

on that worst situation which you were mentioned. If the checkpoint got signal leads to never timeout and test eventually killed by test lib.

That

Quoted 3 lines

would hard to know what happened at that moment. My concern is the situation is hard to reproduce later so just want to print more useful messeges:).

Quoted 7 lines

As for now that's only a hypotetical corner case, someone would have to send signals to such process sleeping on the checkpoint in a loop for that to happen. The problem is that printing any messages when checkpoint was interrupted by signal would lead to even greater confusion for tests that actually have to send signals to such processes.

That's true. I'm ok to withdraw my suggestion.

Signature · 5 lines
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190318/0369cce3/attachment.html>
author
#11 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

In reply to Cyril Hrubis
Quoted 32 lines · Cyril Hrubis

Hi!

Quoted 3 lines

I am not sure how we would manage actual "msec_timeout" in case we get EINTR and need to retry again as we may need to take care of elapsed time till we receive asynchronous signal.

I would have just restarted the timeout after we got signal, the worst case that can happen is that in an unlikely case we will send a signals fast enough so that the checkpoint will never timeout. But even then the test library will timeout and would kill the process anyways.

Another option is to switch checkpoints so that they use absolute timeout and pass clock_gettime() + msec_timeout as timeout.

I would go for something as simple as:

lib/tst_checkpoint.c +1 -0
index 5455d0378..5e5b11496 100644
@@ -85,6 +85,7 @@ void tst_checkpoint_init(const char *file, const int lineno,
 int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
 {
        struct timespec timeout;
+       int ret;
 
        if (id >= tst_max_futexes) {
                errno = EOVERFLOW;
@@ -94,8 +95,12 @@ int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout)
        timeout.tv_sec = msec_timeout/1000;
        timeout.tv_nsec = (msec_timeout%1000) * 1000000;
 

lib/tst_checkpoint.c int tst_checkpoint_wait(unsigned int id, unsigned int msec_timeout) · line 105

Quoted 10 lines
lib/tst_checkpoint.c +6 -2
-       return syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
-                      tst_futexes[id], &timeout);
+       do {
+               ret = syscall(SYS_futex, &tst_futexes[id], FUTEX_WAIT,
+                             tst_futexes[id], &timeout);
+       } while (ret == -1 && errno == EINTR);
+
+       return ret;
 }
 

Wouldn't this loop be more appropriate in "tst_safe_checkpoint_wait()"? As at later stage we may have tests that depends on checkpoints being interrupted by signals and could directly use "tst_checkpoint_wait()".

-Sumit

Quoted 3 lines
lib/tst_checkpoint.c +0 -1
--

Cyril Hrubis
[email protected]

#12 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Hi!

Quoted 4 lines

Wouldn't this loop be more appropriate in "tst_safe_checkpoint_wait()"? As at later stage we may have tests that depends on checkpoints being interrupted by signals and could directly use "tst_checkpoint_wait()".

The tst_checkpoint_wait() has a single use in the source tree and that is testcases/lib/tst_checkpoint.c which is binary wrapper around checkpoints so that we can use them in shell scripts as well, which is pretty cool btw. And I think that we should retry on EINTR there as well.

Also there does not seem to be test relying on checkpoints being interrupted by signals and I would like to avoid this pattern ideally as asynchronous events such as signals interrupting functions is something rather counter intuitive.

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

PATCH v2 1/3 syscalls/tgkill01: add new test

Quoted 7 lines · Cyril Hrubis

Hi!

Quoted 4 lines

Wouldn't this loop be more appropriate in "tst_safe_checkpoint_wait()"? As at later stage we may have tests that depends on checkpoints being interrupted by signals and could directly use "tst_checkpoint_wait()".

Quoted 5 lines

The tst_checkpoint_wait() has a single use in the source tree and that is testcases/lib/tst_checkpoint.c which is binary wrapper around checkpoints so that we can use them in shell scripts as well, which is pretty cool btw. And I think that we should retry on EINTR there as well.

Ah, I see.

Quoted 6 lines

Also there does not seem to be test relying on checkpoints being interrupted by signals and I would like to avoid this pattern ideally as asynchronous events such as signals interrupting functions is something rather counter intuitive.

Ok got it. Should I pick up this change as separate patch in this patch-set or would you like to commit it and then I would update patch-set to use these checkpoints?

-Sumit

Quoted 3 lines

--
Cyril Hrubis
[email protected]

#14 lore raw

PATCH v2 1/3 syscalls/tgkill01: add new test

Hi!

Quoted 3 lines

Ok got it. Should I pick up this change as separate patch in this patch-set or would you like to commit it and then I would update patch-set to use these checkpoints?

I will send my patch to the ML soon, you can then rebase your work on the top of that then I will commit the patches in right order.

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

PATCH v2 2/3 syscalls/tgkill02: add new test

In reply to Sumit Garg

From: Greg Hackmann <[email protected]>

tgkill() should fail with EAGAIN when RLIMIT_SIGPENDING is reached with a real-time signal. Test this by starting a child thread with SIGRTMIN blocked and a limit of 0 pending signals, then attempting to deliver SIGRTMIN from the parent thread.

---
 runtest/syscalls                            |  1 +
 testcases/kernel/syscalls/tgkill/.gitignore |  1 +
 testcases/kernel/syscalls/tgkill/tgkill02.c | 80 +++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+)
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill02.c
runtest/syscalls +1 -0
index 8cd99e0..1f4a2da 100644
@@ -1400,6 +1400,7 @@ syslog11 syslog11
 syslog12 syslog12
 
 tgkill01 tgkill01
+tgkill02 tgkill02
 
 time01 time01
 time02 time02
testcases/kernel/syscalls/tgkill/.gitignore +1 -0
index f4566fd..42be2bb 100644
@@ -1 +1,2 @@
 tgkill01
+tgkill02
testcases/kernel/syscalls/tgkill/tgkill02.c new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#16 lore raw

PATCH v2 3/3 syscalls/tgkill03: add new test

In reply to Sumit Garg

From: Greg Hackmann <[email protected]>

Test simple tgkill() error cases.

---
 runtest/syscalls                            |   1 +
 testcases/kernel/syscalls/tgkill/.gitignore |   1 +
 testcases/kernel/syscalls/tgkill/tgkill03.c | 122 ++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+)
 create mode 100644 testcases/kernel/syscalls/tgkill/tgkill03.c
runtest/syscalls +1 -0
index 1f4a2da..b92244d 100644
@@ -1401,6 +1401,7 @@ syslog12 syslog12
 
 tgkill01 tgkill01
 tgkill02 tgkill02
+tgkill03 tgkill03
 
 time01 time01
 time02 time02
testcases/kernel/syscalls/tgkill/.gitignore +1 -0
index 42be2bb..a6d2299 100644
@@ -1,2 +1,3 @@
 tgkill01
 tgkill02
+tgkill03
testcases/kernel/syscalls/tgkill/tgkill03.c new file +122 -0

122 lines not on this page · raw message

Signature · 1 line
2.7.4