Bug 237778 - sysctl.name (0.1) false positive
Summary: sysctl.name (0.1) false positive
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2019-05-07 21:54 UTC by Alfonso S. Siciliano
Modified: 2020-06-27 13:18 UTC (History)
1 user (show)

See Also:

file to reproduce the problem (1.28 KB, text/plain)
2019-05-07 21:54 UTC, Alfonso S. Siciliano
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alfonso S. Siciliano 2019-05-07 21:54:25 UTC
Created attachment 204249 [details]
file to reproduce the problem

The magical "sysctl.name" (0.1), implemented in kern_sysctl.c, gets the 
'string name' from the 'int id' of a node, It returns 0 (false positive) and 
builds a fake name for a non-existent OID. The problem is reproducible by the 
attached file 'bad_name.c'.

Question: Is it a feature? (this code is 20-years-old)
Others OIDs sysctl.{oiddesc|oidfmt|oidlabel} return an error for a non-existent 

I have a solution, but I would be sure it is a problem before to create a diff 
on review.freebsd.org. 

Comment 1 Alfonso S. Siciliano 2019-05-09 01:43:43 UTC
New review D20205 with a solution
Comment 2 Alfonso S. Siciliano 2020-06-27 13:18:20 UTC
The sysctl.entryname node of the <sysutils/sysctlinfo-kmod> port meets my needs:
it return -1 if a node doens't exist.