From: Tejun Heo <tj@kernel.org>
To: Roman Gushchin <guro@fb.com>
Cc: Oleg Nesterov <oleg@redhat.com>, Alex Xu <alex_y_xu@yahoo.ca>,
kernel-team@fb.com, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] signal: unconditionally leave the frozen state in ptrace_stop()
Date: Thu, 16 May 2019 10:45:23 -0700 [thread overview]
Message-ID: <20190516174523.GD374014@devbig004.ftw2.facebook.com> (raw)
In-Reply-To: <20190516173821.1498807-1-guro@fb.com>
On Thu, May 16, 2019 at 10:38:21AM -0700, Roman Gushchin wrote:
> Alex Xu reported a regression in strace, caused by the introduction of
> the cgroup v2 freezer. The regression can be reproduced by stracing
> the following simple program:
>
> #include <unistd.h>
>
> int main() {
> write(1, "a", 1);
> return 0;
> }
>
> An attempt to run strace ./a.out leads to the infinite loop:
> [ pre-main omitted ]
> write(1, "a", 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
> write(1, "a", 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
> write(1, "a", 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
> write(1, "a", 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
> write(1, "a", 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
> write(1, "a", 1) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
> [ repeats forever ]
>
> The problem occurs because the traced task leaves ptrace_stop()
> (and the signal handling loop) with the frozen bit set. So let's
> call cgroup_leave_frozen(true) unconditionally after sleeping
> in ptrace_stop().
>
> With this patch applied, strace works as expected:
> [ pre-main omitted ]
> write(1, "a", 1) = 1
> exit_group(0) = ?
> +++ exited with 0 +++
>
> Reported-by: Alex Xu <alex_y_xu@yahoo.ca>
> Fixes: 76f969e8948d ("cgroup: cgroup v2 freezer")
> Signed-off-by: Roman Gushchin <guro@fb.com>
> Acked-by: Oleg Nesterov <oleg@redhat.com>
> Cc: Tejun Heo <tj@kernel.org>
Applied to cgroup/for-5.2-fixes.
Thanks.
--
tejun
prev parent reply other threads:[~2019-05-16 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 17:38 [PATCH RESEND] signal: unconditionally leave the frozen state in ptrace_stop() Roman Gushchin
2019-05-16 17:45 ` Tejun Heo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190516174523.GD374014@devbig004.ftw2.facebook.com \
--to=tj@kernel.org \
--cc=alex_y_xu@yahoo.ca \
--cc=cgroups@vger.kernel.org \
--cc=guro@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).