From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 685F23D6CC5 for ; Wed, 24 Jun 2026 15:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782313928; cv=none; b=kkCMp2UxQK2omjglf+5gROjIt5j+BtLUcTjmVsmw9U2fievrl7KOJKmqE7Z7cTW9LCLwA1o3jJ3DvhfTvWQZqFzlE8GMI99WF3z7v074swcV6ymS4WBY7y8BL1xWcHC4+wkp6PqBRfgaop5dYEhrMu0Hihk9C7I3OfELSGcWw9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782313928; c=relaxed/simple; bh=VFV2wtHT+znoEdJCZePhduDkCJqr7uC+In7keQp/9HU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TOLOKgoD2qjtwku5+iMTJ9su26EdmWUsfgq4Ckzq6f4MaVGGtWqQTd7Jf1MP3exVa+orjMjMbnmfxZV8IHYDDs/tRAXPmsP+AuLGq7yEIAVfdNXrPu4sLNiqRWazExffvpJUO+fTOQGRm/QFSveCNrzPR55XDQIGsZkHXUxhIBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Y5P2QImS; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Y5P2QImS" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-49249072f03so6829975e9.0 for ; Wed, 24 Jun 2026 08:12:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1782313926; x=1782918726; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cwO4re2jsFrLOtebH6LzVA1We3U6OzxkzTyRbIk+QaY=; b=Y5P2QImSExTqPkEBh+T/HzewtqMtsWuhk2+Nr0sE6OESa4EGANNXOvTDiI1PB0QAia M7rnjjdNOpLWELYRhkB+ia13B4y9Hguf/MWg3m1/ZljsEwBVgGMJ1VFkl4oQT6VpPNXp EvxYepKCy0PEol+3DsdH4vOtCyVYouOnVzcpZFVmlyc/g2KAPHgc87MPRkyOlKipkmlw cduALhNh24OU/ctst7OWmujfET/4280Z86wKTddiFdB7niUnxetb1OjjZ/f3ESNSnC8W HJK7/uxzve8iVL7c+DRlNjvttU7rGtp9X8gNRddlIkvFOkuUQALJmgTR3Jp/LK6gazKz gryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782313926; x=1782918726; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cwO4re2jsFrLOtebH6LzVA1We3U6OzxkzTyRbIk+QaY=; b=JILVYV3bkAl40HRlXvGXJ1Y25DkR1pGyslEKO9VEjCSkP9SpazIJ+nxF92XzpmYhmq YNIs5RaSwWwz1BWkQlIvIQJZ1xRP+4P3Y2JCS9tFol5grq2A1WDsKsJRSCZ9H9hNKX4h ySfDXPmIbaMgKs3T/8dI07qhDaN1EC62BcTPfVCH4EurKj7JBLvY1rzWuxkxPkHhLNpy 9G05RqGPlgN5YmukQV6EzRXQN6aR1GTAZikiI7vGDvvn5JuZUBhXQ86yvmgWl1mzkN4V lmp8ypL463cVFvCZ8HOVTUfkUmF0wdd6lzC+lbAst1Zs3bqIJORPWZujA+5HqvDXPfS2 3mrA== X-Forwarded-Encrypted: i=1; AFNElJ8gy5MubEkmILbyN362+dHtD71jKMcl0u6Zw1ZDEOcc1YN7zBhmE9nI0EGx7dZCNRzUv8pfUcl4XYqX1ks=@vger.kernel.org X-Gm-Message-State: AOJu0YxuxI7GC9BLw7KGrCYcfU/i4xzHaQEJjBNNvmXIA33NAkZnezpQ mvFIdlKY8MMqn2xgZBWipZzLAWZTFWGqbymCTWwv+qtjlL8uVH/bGygtAiloYLDWwwo= X-Gm-Gg: AfdE7cn+TM9gcc8Gs1r/EnU9iKt5I+3lyjbRlOmv+SZzSSao8x9/jxYOZrJb5bcWPYI qCFEx2uZNJEC2j4q3y+JdLpY2VqgvaAFixXmCFN/SznHaYphOteFlk5uD/G9VP4oHaiDDZeENK7 q/dy9P67kLqMzq4yi6EJE4GYyl8MYYUnuWi/2gLTXmyoFQBmea/2Rz1gPi9UVE4lC7Zlr4CIbTG n+mpTAokP49Fy/s9dRyn9aeUe38gZvuVXK5pkhBPRaL5TLBMYEXWMkz9FO6HYKUFGAhLjIuvDSk hznEv22zVh2ANW8BuEE9NLXWpdHEFaqQiKGAcMpZYV+UCl0vewk5v+h8O6kIZnU+6fd+97BNKwg Y3KGSF99szdjFOln6JTZmfX80/avBQYFvGmjw+ZmKz3KLYCvaGGhFprYgqKgu87rgjegIXlCnp3 6yUtIcPDOOBl13s4EzSqHZJ3yHHw== X-Received: by 2002:a05:600c:848d:b0:492:454c:347c with SMTP id 5b1f17b1804b1-4926084974dmr49903255e9.7.1782313925815; Wed, 24 Jun 2026 08:12:05 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46c221d93d8sm13117574f8f.23.2026.06.24.08.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2026 08:12:05 -0700 (PDT) Date: Wed, 24 Jun 2026 17:12:03 +0200 From: Petr Mladek To: Jia He Cc: "Paul E. McKenney" , Kees Cook , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] lib/tests: test_ratelimit: fix stress test thread lifecycle and leak Message-ID: References: <20260529085855.1810870-1-justin.he@arm.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: <20260529085855.1810870-1-justin.he@arm.com> On Fri 2026-05-29 08:58:55, Jia He wrote: > The stress test's WARN_ON_ONCE(!sktp->tp) check in the child thread is > racy and unnecessary: since kthread_run() wakes the thread before > returning, the child can run before sktp[i].tp has been assigned. > Moreover, sktp->tp is never actually used in the child function, so the > check serves no purpose. Remove it and keep the original kthread_run() > > Also add a common cleanup path for thread creation failures. If creating > one of the later threads fails, stop all threads that were already > started and free the allocated array instead of leaving orphan kthreads > and leaked memory behind. > > Finally, replace the module-static doneflag with kthread_should_stop(). > With the doneflag, child threads may exit before the parent calls > kthread_stop(), so the task lifetime is no longer guaranteed when the > parent later tries to stop them. Using kthread_should_stop() keeps each > child alive until kthread_stop() synchronously terminates it. > > Suggested-by: Petr Mladek > Signed-off-by: Jia He Looks good to me: Reviewed-by: Petr Mladek Tested-by: Petr Mladek Now, the question is who would push it. I could take it via the printk tree. Or Paul would you prefer to take it yourself? Best Regards, Petr