NetBSD-Bugs archive

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

kern/57996: sysctl kern.ccd.info and kern.ccd.components abuse sysctl interface



>Number:         57996
>Category:       kern
>Synopsis:       sysctl kern.ccd.info and kern.ccd.components abuse sysctl interface
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 03 22:55:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, 8, 7, ...
>Organization:
The NetCCD Foundation
>Environment:
>Description:
The sysctl nodes kern.ccd.info and kern.ccd.components, which are used by `ccdconfig -g', work as follows:

- As `oldp' (old-data pointer), userland passes a pointer to buffer that is to be filled with the information about a ccd instance.
- As `newp' (new-data pointer), userland passes a pointer to an int that specifies _which_ ccd instance.
- The kernel reads out *(const int *)newp to decide which instance to read out, then writes to oldp on the basis of that.

This is an abuse of the sysctl interface.  The unit information is not actually being written, and the sysctls don't (or shouldn't) have side effects, so there's no need for the knobs to be writable.

Instead, this information should be exposed through one child node per ccd(4) instance, like sysctl hw.ccdN.info and hw.ccdN.components.
>How-To-Repeat:
code inspection
>Fix:
Yes, please!  Separate sysctl knobs per ccd(4) instance.



Home | Main Index | Thread Index | Old Index