Bug 237778

Summary: sysctl.name (0.1) false positive
Product: Base System Reporter: Alfonso S. Siciliano <asiciliano>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Not A Bug    
Severity: Affects Only Me CC: markj
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file to reproduce the problem none

Description Alfonso S. Siciliano freebsd_committer freebsd_triage 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 
node.

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

Regards,
Alfonso
Comment 1 Alfonso S. Siciliano freebsd_committer freebsd_triage 2019-05-09 01:43:43 UTC
New review D20205 with a solution
Comment 2 Alfonso S. Siciliano freebsd_committer freebsd_triage 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.