NetBSD-Bugs archive

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

kern/58378: Kernel error code origination lacks dtrace probes



>Number:         58378
>Category:       kern
>Synopsis:       Kernel error code origination lacks dtrace probes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 29 01:50:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The ENETBSD Notfoundation
>Environment:
>Description:
When some deeply nested kernel subroutine decides it's time to return EINVAL, and EINVAL comes flying back down the stack and out of a syscall to return to userland, even with the help of ktrace to see syscall arguments and I/O it can be an arduous task to statically analyze code paths to identify which one led to EINVAL.

It should be possible to set a dtrace probe on the origination of EINVAL, e.g. to print a stack trace.
>How-To-Repeat:
try to figure out where EINVAL or ENOBUFS or what have you came from
>Fix:
Change all instances of

        return EINVAL;

to

        return SET_ERROR(EINVAL);

throughout the kernel, using the dtrace SET_ERROR probe.

May require moving SET_ERROR from external/cddl/osnet/ to somewhere under sys/.



Home | Main Index | Thread Index | Old Index