Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp29949lqp; Sat, 8 Jun 2024 05:08:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1MVMqc1dz4JKFfHboquC+SjHJI0nG4VktouSaxp9inwmzy2DVW+D8ccjrt4O52sMASH9Rhjn37AqDuLT5syLOryV3m32I8t5VWin6iA== X-Google-Smtp-Source: AGHT+IGFTpaWZGkRmpvJovSnm2zdIKjdUCJvYabv0leLIGNnNIXmDSoGcJ3n0L6zaNS3awdiu9pJ X-Received: by 2002:a05:6a00:4b0e:b0:6f8:e442:a28a with SMTP id d2e1a72fcca58-7040c72ea5cmr4880703b3a.21.1717848499407; Sat, 08 Jun 2024 05:08:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717848499; cv=pass; d=google.com; s=arc-20160816; b=DLO1842DtfoP19P7RZYKkWITfK2GMpZpuAsFgLuN+gxllGF9WNXPTH5dN8iz/vcQyd 1wo7NK4R3RSDY4syJKMxuDfYe/8SYtRH1TBYXolRkM6Uvh1T01wrwghkUQqkiCukyWRF F5Mt0y8XAZDVS9I49CJpY2FNT3vm2qlFr1M16eTYtb5I7uKsQoirkAyROlI7x3wxMW7k BK3BXRRxMnNxQRBp+0hjOnqrantsF9y+4F1RRf5mbc5Y6yAmxg2CphlzJS/8M9UxPdId ntksd7mNpvWt1krIj6YzK5eNt3CgAlYC3aaWmZ0hap8ZZBv/n2XUaODpbDnDu3bYCOG1 vE0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=tihwQeLY+L4QDzE6e4TVA4azaI+U0hokqGYwbyGDbK0=; fh=6dvwaQyMqlET7q+BAMDEXw5LoQoPwQ+dSQG88i/8MA8=; b=FEO727MA6HxgFx3NvP7pluqGXUXBouXtgO9UjQKRPypy/UbsozFGqDV79lV9JnBvy7 svzNdILh1orYL1AKSLz4EAzGz16oevancGixTAT2jEBujw6SfJ6WhrzyDzY6upA5RY5w pQFiwkzXt2gU88zSCokqRl17ct8CueJPhXTcRsEqt2CYICZBx50KtJAXpGOeGsRojJxW XwmBFF1cqd4JdRqHc9eNjL4z8SUgKMnwDnN4cQcE7Z9Y8kvKpvzeKZLHgKGr1iju+MMp T958NPj6XKDRr9//Uhh/kkO1XOKEx2iD4SAwFnfFDL12Je8hZJz3iO6kAWNeOftOz2aA Oj9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eOjUgQc/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-207027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-70419d649edsi2282008b3a.371.2024.06.08.05.08.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 05:08:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eOjUgQc/"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-207027-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2496FB214B6 for ; Sat, 8 Jun 2024 12:08:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BD621779BB; Sat, 8 Jun 2024 12:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eOjUgQc/" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56EFC11718 for ; Sat, 8 Jun 2024 12:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717848483; cv=none; b=gKfCW6/8daKzDhN5v2jdE/Uyp4Y2a7Js8uP/8zs6XtNLJy8l9MZ4IaGTY806lseQbSmN0uhjG0QKR5R+g+wxV6CoIAZPDvxN+RVpCvedIKN2p5RqaRMaT6fk7GYt2/hEG/BezlKWbNZ79Qx5oriPoHe7GqOMBB1nuUfAyO7ONUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717848483; c=relaxed/simple; bh=GgYAa9550Pch0bRAbfsvJHat41KwkWRFcMdTNDecigg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=d7yWfJXN3qasidIDVfeIbGrqtt8HN+Rabkk/T5EdflZtF1nDoQmRagtHDywZjMidTmpBSfHeO9euNp0kIJ5F9s02MgbwGZfWAJzlde8a1lLfMnjUWMV3ZFAnJTEdS28eqXFyYvCYxcNuxlN75R51Y1y4VzhOTA/PGy4sotEjdzc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=eOjUgQc/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717848481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tihwQeLY+L4QDzE6e4TVA4azaI+U0hokqGYwbyGDbK0=; b=eOjUgQc/DglBNWsFgNyNrqlyLIpMwcDelK1OuXHb0KcClckSzNmRLK2Hkm3B9G+0jXCBYv TySYYwSOaNUPhpGqY0qaB28RHG56BN+34VGTnp7xR026eMsYSw0he5wk/v6xuUFYx1yVi9 Gv83v3mqTRBzS04EByfVKtWzjNGGWrk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-zlWpO-0fPniZi4a9zdfHxg-1; Sat, 08 Jun 2024 08:07:52 -0400 X-MC-Unique: zlWpO-0fPniZi4a9zdfHxg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0C7885A5B5; Sat, 8 Jun 2024 12:07:51 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.55]) by smtp.corp.redhat.com (Postfix) with SMTP id B0AB21C060A4; Sat, 8 Jun 2024 12:07:46 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sat, 8 Jun 2024 14:06:22 +0200 (CEST) Date: Sat, 8 Jun 2024 14:06:16 +0200 From: Oleg Nesterov To: Andrew Morton , Rachel Menge Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Wei Fu , apais@linux.microsoft.com, Sudhanva Huruli , Jens Axboe , Christian Brauner , Mike Christie , Joel Granados , Mateusz Guzik , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang Subject: [PATCH] zap_pid_ns_processes: clear TIF_NOTIFY_SIGNAL along with TIF_SIGPENDING Message-ID: <20240608120616.GB7947@redhat.com> References: <1386cd49-36d0-4a5c-85e9-bc42056a5a38@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386cd49-36d0-4a5c-85e9-bc42056a5a38@linux.microsoft.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 kernel_wait4() doesn't sleep and returns -EINTR if there is no eligible child and signal_pending() is true. That is why zap_pid_ns_processes() clears TIF_SIGPENDING but this is not enough, it should also clear TIF_NOTIFY_SIGNAL to make signal_pending() return false and avoid a busy-wait loop. Fixes: 12db8b690010 ("entry: Add support for TIF_NOTIFY_SIGNAL") Reported-by: Rachel Menge Closes: https://lore.kernel.org/all/1386cd49-36d0-4a5c-85e9-bc42056a5a38@linux.microsoft.com/ Signed-off-by: Oleg Nesterov --- kernel/pid_namespace.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index dc48fecfa1dc..25f3cf679b35 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -218,6 +218,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) */ do { clear_thread_flag(TIF_SIGPENDING); + clear_thread_flag(TIF_NOTIFY_SIGNAL); rc = kernel_wait4(-1, NULL, __WALL, NULL); } while (rc != -ECHILD); -- 2.25.1.362.g51ebf55