Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1045938ybp; Wed, 9 Oct 2019 08:06:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjsnd3Ixgwwy0Twr4wAiQa2tkQbmpcwDZv27gICVp6e2YOOEBeGKdHdZE6kPkiE/NAnZs1 X-Received: by 2002:adf:dd88:: with SMTP id x8mr3272718wrl.140.1570633595111; Wed, 09 Oct 2019 08:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570633595; cv=none; d=google.com; s=arc-20160816; b=e/sffmFMlM65wG0Vz/3sLU99ary/c703C1ecUpTwmi7JUH1SeHkkGOLGkrs3YI3dNo 393BuHxrlt0hFBn3b+WvZKP5s81d9WlElNvSS73jflbYIFWOCRKc+hE6ilolsSpvQLBZ 9BohJAESrQfnIc2ZDVEWoj8rS14Yqd/WQhX6+i9yBaSYeoPdU5xxIGOp4RI0kmRAk07a 5+AJVud3j3sAQ3/cD6HbIfUPXPxHsA8idHw5S+n6C52PuCZEwLhO4um6d3nxJmoIo3KS SwhNsPExlquyfghv0IDb4Y+n6hf5N31XNH26eBtlKjGLGO47tcEsjPBQvzfRRfRXEwbe +j7g== 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=ZTg3j/plbqAHwOma6nj0a2+TsViuNcuql5SQoAxe2mo=; b=qFw9zgAXBHzgxZl+SjuF1bY+vx45YYb/NncWHsq6hMP60+zQQUFVChGPLa6rLc9ohq 1/KYx+5/9lqWy3Gg9IEs/kNqlQXZWdIcwRmEyOAG8iTspLNc/dSqnqfv69Q3h0rErJHO wxRIcPevrEgvaC0SUMfF0Zxs+ZYdlEWEpB48KPqLJ6YNtWAYEphSzImaBTx6fj0xfzDb uDbitP0mFJrNbNgVhZYIPDY06khdiR9ARPSAcxSoIKDLcGlesZpk+uJEWCQ0Fof3s1lM 99rFTCpcdXC9dafxIC6EiP25Et+8DBZ0/Ell2uP6LtMI5tLfq05FCIxj3mgSDL9pwLNu Piyg== 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 sa23si1294276ejb.289.2019.10.09.08.06.10; Wed, 09 Oct 2019 08:06:35 -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 S1731541AbfJIPCe (ORCPT + 99 others); Wed, 9 Oct 2019 11:02:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53100 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731072AbfJIPCe (ORCPT ); Wed, 9 Oct 2019 11:02:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 044B810C050B; Wed, 9 Oct 2019 15:02:34 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.44]) by smtp.corp.redhat.com (Postfix) with SMTP id CDA531001B30; Wed, 9 Oct 2019 15:02:32 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 9 Oct 2019 17:02:32 +0200 (CEST) Date: Wed, 9 Oct 2019 17:02:30 +0200 From: Oleg Nesterov To: Tejun Heo Cc: linux-kernel@vger.kernel.org, Roman Gushchin , Richard Purdie , Bruce Ashfield Subject: [PATCH] cgroup: freezer: call cgroup_enter_frozen() with preemption disabled in ptrace_stop() Message-ID: <20191009150230.GB12511@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Wed, 09 Oct 2019 15:02:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ptrace_stop() does preempt_enable_no_resched() to avoid the preemption, but after that cgroup_enter_frozen() does spin_lock/unlock and this adds another preemption point. Reported-and-tested-by: Bruce Ashfield Fixes: 76f969e8948d ("cgroup: cgroup v2 freezer") Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Oleg Nesterov --- kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/signal.c b/kernel/signal.c index 534fec2..f8eed86 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2205,8 +2205,8 @@ static void ptrace_stop(int exit_code, int why, int clear_code, kernel_siginfo_t */ preempt_disable(); read_unlock(&tasklist_lock); - preempt_enable_no_resched(); cgroup_enter_frozen(); + preempt_enable_no_resched(); freezable_schedule(); cgroup_leave_frozen(true); } else { -- 2.5.0