Found with 'stress-ng --cpu-sched 1':
Testcase (attached):
$ uname -r
3.6.0-0.387.g8cebbb2b42bf.x86_64
$ gcc -o timersig timersig.c
$ ./timersig
638: fork()=639
!!!!!!!!!!!!!...!!!!!!!!!!!!!SIGSTOP: Permission denied
0 [itimer] timersig 639 sig_send: error sending signal 14, pid 639,
pipe handle 0x14C, nb 0, packsize 192, Win32 error 0
SIGKILL: Permission denied
$ kill 639
-bash: kill: (639) - Permission denied
$ kill -9 639
-bash: kill: (639) - Permission denied
$ /bin/kill --force 639
$ /bin/kill --force 639
kill: 639: No such process
A similar problem, but without the "error sending signal" message,
occurs if the timer is not used but the parent process issues SIGSTOP
SIGALRM SIGCONT ... sequences.
--
Regards,
Christian
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/wait.h>
static sig_atomic_t sigcnt;
static void sighandler(int sig)
{
(void)sig;
++sigcnt;
write(1, "!", 1);
}
int main()
{
pid_t pid = fork();
if (pid == (pid_t)-1) {
perror("fork"); return 1;
}
if (!pid) {
signal(SIGALRM, sighandler);
timer_t tid;
if (timer_create(CLOCK_REALTIME, NULL, &tid)) {
perror("timer_create"); _exit(1);
}
struct itimerspec t = {};
t.it_value.tv_nsec = t.it_interval.tv_nsec = 100;
timer_settime(tid, 0, &t, NULL);
while (sigcnt < 1000)
sched_yield();
printf("%d: exit\n", (int)getpid()); fflush(stdout);
_exit(0);
}
printf("%d: fork()=%d\n", (int)getpid(), (int)pid);
sleep(1);
int wp, status;
while (!(wp = waitpid(pid, &status, WNOHANG))) {
sched_yield();
if (kill(pid, SIGSTOP)) {
perror("SIGSTOP"); break;
}
sched_yield();
if (kill(pid, SIGCONT)) {
perror("SIGCONT"); break;
}
}
if (wp < 0)
perror("waitpid");
else if (!wp && kill(pid, SIGKILL))
perror("SIGKILL");
return (wp <= 0);
}
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple