Merge bitcoin/bitcoin#36448: randomenv: use `KERN_POSIX1` over `KERN_OSREV`
What changed, and why it matters
This is a one-line code cleanup in Bitcoin Core's random environment data gathering. The code was supposed to add a 'POSIX version' system value to the randomness pool when that value is available, but it accidentally added the 'OS revision' value twice instead. The fix makes the code do what the surrounding preprocessor guard already intended. It does not change security meaningfully: both values are harmless system identifiers used only as extra entropy input, and the OS revision was already being collected earlier in the same function.
No security action required. Treat as normal code-quality merge.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In src/randomenv.cpp, inside RandAddStaticEnv(), the block guarded by #ifdef KERN_POSIX1 called AddSysctl<CTL_KERN, KERN_OSREV>(hasher). KERN_OSREV is already added unconditionally a few lines above, so this block was duplicating that input rather than adding the intended KERN_POSIX1 value. The patch changes the template argument to KERN_POSIX1, matching the guard. This is a correctness/cleanup fix with no security boundary change: all sysctl values here are non-secret, static host attributes fed into the entropy pool as additional diversification data.
Changed components
src/randomenv.cppInspect captured patch +1 / −1
### src/randomenv.cpp
@@ -449,7 +449,7 @@ void RandAddStaticEnv(CSHA512& hasher)
AddSysctl<CTL_KERN, KERN_OSTYPE>(hasher);
# endif
# ifdef KERN_POSIX1
- AddSysctl<CTL_KERN, KERN_OSREV>(hasher);
+ AddSysctl<CTL_KERN, KERN_POSIX1>(hasher);
# endif
# ifdef KERN_VERSION
AddSysctl<CTL_KERN, KERN_VERSION>(hasher);Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.