Commit fde1116f authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

proc: parse sigpnd and shdpnd separatly

We found that we want to know whether SIGSTOP is queue
in both or is in one of this queues.
Signed-off-by: 's avatarAndrew Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 32452b21
......@@ -93,6 +93,7 @@ struct proc_status_creds {
char state;
int ppid;
unsigned long long sigpnd;
unsigned long long shdpnd;
int seccomp_mode;
u32 last_filter;
......
......@@ -767,11 +767,12 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
}
cr->sigpnd = 0;
cr->shdpnd = 0;
if (bfdopenr(&f))
return -1;
while (done < 11) {
while (done < 12) {
str = breadline(&f);
if (str == NULL)
break;
......@@ -851,7 +852,17 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
continue;
}
if (!strncmp(str, "SigPnd:", 7) || !strncmp(str, "ShdPnd:", 7)) {
if (!strncmp(str, "ShdPnd:", 7)) {
unsigned long long sigpnd;
if (sscanf(str + 7, "%llx", &sigpnd) != 1)
goto err_parse;
cr->shdpnd |= sigpnd;
done++;
continue;
}
if (!strncmp(str, "SigPnd:", 7)) {
unsigned long long sigpnd;
if (sscanf(str + 7, "%llx", &sigpnd) != 1)
......@@ -864,7 +875,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
}
/* seccomp is optional */
if (done >= 10 || (done == 9 && !parsed_seccomp))
if (done >= 11 || (done == 10 && !parsed_seccomp))
ret = 0;
err_parse:
......
......@@ -204,7 +204,7 @@ try_again:
if (cr.seccomp_mode != SECCOMP_MODE_DISABLED && suspend_seccomp(pid) < 0)
goto err;
if (cr.sigpnd & (1 << (SIGSTOP - 1)) || si.si_signo == SIGSTOP) {
if ((cr.sigpnd | cr.shdpnd) & (1 << (SIGSTOP - 1)) || si.si_signo == SIGSTOP) {
/*
* 1) SIGSTOP is queued, but isn't handled yet:
* SGISTOP can't be blocked, so we need to wait when the kernel
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment