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 { ...@@ -93,6 +93,7 @@ struct proc_status_creds {
char state; char state;
int ppid; int ppid;
unsigned long long sigpnd; unsigned long long sigpnd;
unsigned long long shdpnd;
int seccomp_mode; int seccomp_mode;
u32 last_filter; u32 last_filter;
......
...@@ -767,11 +767,12 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr) ...@@ -767,11 +767,12 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
} }
cr->sigpnd = 0; cr->sigpnd = 0;
cr->shdpnd = 0;
if (bfdopenr(&f)) if (bfdopenr(&f))
return -1; return -1;
while (done < 11) { while (done < 12) {
str = breadline(&f); str = breadline(&f);
if (str == NULL) if (str == NULL)
break; break;
...@@ -851,7 +852,17 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr) ...@@ -851,7 +852,17 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
continue; 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; unsigned long long sigpnd;
if (sscanf(str + 7, "%llx", &sigpnd) != 1) if (sscanf(str + 7, "%llx", &sigpnd) != 1)
...@@ -864,7 +875,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr) ...@@ -864,7 +875,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
} }
/* seccomp is optional */ /* seccomp is optional */
if (done >= 10 || (done == 9 && !parsed_seccomp)) if (done >= 11 || (done == 10 && !parsed_seccomp))
ret = 0; ret = 0;
err_parse: err_parse:
......
...@@ -204,7 +204,7 @@ try_again: ...@@ -204,7 +204,7 @@ try_again:
if (cr.seccomp_mode != SECCOMP_MODE_DISABLED && suspend_seccomp(pid) < 0) if (cr.seccomp_mode != SECCOMP_MODE_DISABLED && suspend_seccomp(pid) < 0)
goto err; 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: * 1) SIGSTOP is queued, but isn't handled yet:
* SGISTOP can't be blocked, so we need to wait when the kernel * 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