Page MenuHomeFreeBSD

getrandom(2): Add Linux GRND_INSECURE API flag
ClosedPublic

Authored by cem on Fri, Jan 10, 11:21 PM.

Details

Summary

Treat it as a synonym for GRND_NONBLOCK, for reasons argued in the new code
comment. Document in getrandom.2.

Test Plan

See summary of the Linux change https://lwn.net/ml/linux-kernel/cover.1577088521.git.luto@kernel.org/ :

It adds getentropy(..., GRND_INSECURE). This causes getentropy to always return *something*. There is no guarantee whatsoever that the result will be cryptographically random or even unique, but the kernel will give the best quality random output it can. The name is a big hint: the resulting output is INSECURE.

The purpose of this is to allow programs that genuinely want best-effort entropy to get it without resorting to /dev/urandom. Plenty of programs do this because they need to do *something* during boot and they can't afford to wait. Calling it "INSECURE" is probably the best we can do to discourage using this API for things that need security.

GRND_INSECURE patch: https://lwn.net/ml/linux-kernel/d5473b56cf1fa900ca4bd2b3fc1e5b8874399919.1577088521.git.luto@kernel.org/ ,
GRND_INSECURE accepted by tytso: https://lwn.net/ml/linux-kernel/20200107204400.GH3619@mit.edu/

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.Fri, Jan 10, 11:21 PM
bcr accepted this revision as: manpages.Sat, Jan 11, 7:43 PM
bcr added a subscriber: bcr.

OK from manpages.

cem edited the test plan for this revision. (Show Details)Sat, Jan 11, 7:59 PM
markm accepted this revision.Sun, Jan 12, 12:21 PM
markm added a subscriber: markm.
markm added inline comments.
lib/libc/sys/getrandom.2
1 ↗(On Diff #66607)

Aren't we dropping the "All rights reserved" bit as being legally meaningless?

This revision is now accepted and ready to land.Sun, Jan 12, 12:21 PM
cem added inline comments.Sun, Jan 12, 8:24 PM
lib/libc/sys/getrandom.2
1 ↗(On Diff #66607)

I'm not a lawyer and I haven't heard that from my lawyer, so I'll just leave it in for now. (This revision just pulls it all on a single line, which is the current guidance -- to clarify which copyright(s) the A.R.R. applies to.)

This revision was automatically updated to reflect the committed changes.