Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5175266yba; Mon, 13 May 2019 06:40:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqySCJuy0bC2E3bTePThnINbLPoNAOSNh9sZyp3tlUZiM0WYJwhlTm1S4OspfswhTQ89RqPJ X-Received: by 2002:a62:6807:: with SMTP id d7mr32500165pfc.75.1557754814734; Mon, 13 May 2019 06:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557754814; cv=none; d=google.com; s=arc-20160816; b=BYKzPARozK+c6bgB3Da/eihcsmACKVsn2mfB2AqmFaCvbSDJTNmef7+Pl3QRtZsB4y sxdsiGMcH5HEChW/drnuP5lBglKPEb9m9Slx7MdfvF+YPFxKXhM+TsG7JaxF1UUkY89m YtoNW6phDZk69thmTVydSpBZLhpNvdoV0n+RiXYSRTRlVx7asVe3fyBvEvMCTyhBP3EZ y0pst5h/Fh/pG/bRR5VBfHXsl17M1qV6g9lpynnzrFsDAXk5NtBf2+gPeFnQ7bbB9Tie wf6NamlJpHacS2NHOJT2TOj46XV1G6wqWAo79EAGPfLmc0oDxHhmRHnYCkTCw7POBwDB PwlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2ywGAIp1f527kApFVjkKRWhrKsBfG4t7nmHWUYF4Ou4=; b=Yr3/LDSJRQSUHMWOqJuOGEItB/WpRHp2Jmahqfk4Sm5EQQMX1xjjo5iBzRip7JuRSs GQbeqDztT8TIwvx9aYpXtpr2AtQIw31ZBLaS2PsVVQLiQ6rip2H+xsxHPZjeaLYN2Z13 O0aQ2FucqPTnT+UMz1f3DXxrI4rFL1RTIPEVgpXovHsXmvUnynM5R2Zx3LENLEkH8SMw +c7kJb1gMBU6Xrg0Fe+eF+JLm2rGK6/k3qRTzuOTI0b0ZBevG9KVXsBBQ7EGXnsqyKp2 KpCm/WviV1cWiQ2OcVmRTYQsOKI92YxImtHIY918rgRfYDmBdBjRcsBN0+iABfUeuL7i 72vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k34si15924355pgl.286.2019.05.13.06.39.57; Mon, 13 May 2019 06:40:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729751AbfEMMRI (ORCPT + 99 others); Mon, 13 May 2019 08:17:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36910 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727437AbfEMMRI (ORCPT ); Mon, 13 May 2019 08:17:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EA6FD30821FF; Mon, 13 May 2019 12:17:07 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id C3DF119C67; Mon, 13 May 2019 12:17:06 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 13 May 2019 14:17:05 +0200 (CEST) Date: Mon, 13 May 2019 14:17:04 +0200 From: Oleg Nesterov To: "Alex Xu (Hello71)" Cc: linux-kernel@vger.kernel.org, tj@kernel.org, guro@fb.com, kernel-team@fb.com Subject: Re: [REGRESSION] ptrace broken from "cgroup: cgroup v2 freezer" (76f969e) Message-ID: <20190513121703.GA24724@redhat.com> References: <1557709124.798rxdb4l3.astroid@alex-desktop.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1557709124.798rxdb4l3.astroid@alex-desktop.none> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 13 May 2019 12:17:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/12, Alex Xu (Hello71) wrote: > > Hi, > > I was trying to use strace recently and found that it exhibited some > strange behavior. I produced this minimal test case: > > #include > > int main() { > write(1, "a", 1); > return 0; > } > > which, when run using "gcc test.c && strace ./a.out" produces this > strace output: > > [ 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 ] Yes, cgroup_enter_frozen() alone is wrong, we have already discussed this a bit... see https://lore.kernel.org/lkml/20190508152536.GA17058@redhat.com/ Probably we add leave_frozen(true) after freezable_schedule() for now, then think try to make something better... But I am not sure I 100% understand whats going on in this case, could you try the patch below? (Just in case, of course it is wrong). Oleg. --- x/kernel/signal.c +++ x/kernel/signal.c @@ -149,8 +149,7 @@ { if ((t->jobctl & (JOBCTL_PENDING_MASK | JOBCTL_TRAP_FREEZE)) || PENDING(&t->pending, &t->blocked) || - PENDING(&t->signal->shared_pending, &t->blocked) || - cgroup_task_frozen(t)) { + PENDING(&t->signal->shared_pending, &t->blocked) { set_tsk_thread_flag(t, TIF_SIGPENDING); return true; }