NetBSD-Bugs archive

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

kern/58425: negation of pid or pgid is UB for INT_MIN



>Number:         58425
>Category:       kern
>Synopsis:       negation of pid or pgid is UB for INT_MIN
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 13 19:55:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The -PGID Foundation
>Environment:
>Description:
Certain syscalls such as kill(2) and ktrace(2) that take arguments of type pid_t accept a negative value and take its absolute value to be a process group id.

When the negative value is INT_MIN, however, negation is undefined.

We need to systematically avoid these paths, and it looks like we currently don't.  This could be a theoretical issue or it could be a practical issue, but the UB is a bug either way.
>How-To-Repeat:
code inspection
>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index