NetBSD Problem Report #59004
From www@netbsd.org Sat Jan 18 07:17:56 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(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
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5B8941A923B
for <gnats-bugs@gnats.NetBSD.org>; Sat, 18 Jan 2025 07:17:56 +0000 (UTC)
Message-Id: <20250118071755.09B691A923C@mollari.NetBSD.org>
Date: Sat, 18 Jan 2025 07:17:54 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: Missing constant for upper bound on systemwide number of lwps
X-Send-Pr-Version: www-1.0
>Number: 59004
>Category: kern
>Synopsis: Missing constant for upper bound on systemwide number of lwps
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Jan 18 07:20:00 +0000 2025
>Originator: Taylor R Campbell
>Release: current
>Organization:
The OverflowLWP Foundation
>Environment:
>Description:
I can't find a well-named constant for an upper bound on the systemwide number of lwps.
The obvious possibilities are:
- MAXLWP, but that's the _default_ _per-process_ maximum
- MAXMAXLWP, but that's an upper bound on the _per-process_ maximum
- maxproc*MAXMAXLWP, but that's not a constant
- PID_MAX*MAXMAXLWP, but that might overflow signed 32-bit arithmetic if we ever expand PID_MAX beyond 30000, and it is larger than the true maximum
It looks like the only name for this is FUTEX_TID_MASK, which is confusing.
>How-To-Repeat:
Write code where it is tempting to write:
unsigned n;
...
KASSERT(n < SYSTEMWIDE MAXIMUM NUMBER OF LWPS);
__CTASSERT(SYSTEMWIDE MAXIMUM NUMBER OF LWPS <= UINT_MAX);
n++;
This way, the compiler will noisily reject the code if the constant bounds are changed so that the arithmetic could overflow.
>Fix:
Yes, please! What colour do we paint this bike shed?
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.