NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/59004: Missing constant for upper bound on systemwide number of lwps



>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?



Home | Main Index | Thread Index | Old Index