Record FreeBSD urandom symlink fix
ober
827fdca88b92fe51dcc04dca3c09a245a7d03f4e
--- a/data/error-fixes.sexp +++ b/data/error-fixes.sexp @@ -2713,4 +2713,16 @@ "Do not pass a port to Chez load. For bounded trusted script input, read forms from the port and eval them in one interaction-environment; for untrusted input, use jerboa-read with explicit limits or a schema decoder.") ("id" . "chez-load-requires-pathname") ("pattern" . "Exception in load: .*port.* is not a string") + ("type" . "runtime")) + (("code_example" + . + "#if defined(__FreeBSD__)\n arc4random_buf(out, n);\n return 0;\n#else\n int fd = open(\"/dev/urandom\", O_RDONLY | O_CLOEXEC | O_NOFOLLOW);\n /* checked read loop */\n#endif") + ("explanation" + . + "On FreeBSD, /dev/urandom is a symlink to /dev/random. A hardened open with O_NOFOLLOW rejects that symlink with EMLINK, whose strerror text is 'Too many links', even though the surrounding cache directory is healthy.") + ("fix" + . + "Trace the failing syscall before changing directory logic. On FreeBSD use arc4random_buf (or getentropy) for cryptographic random bytes; retain the checked O_NOFOLLOW /dev/urandom path only on platforms where it is not a symlink.") + ("id" . "freebsd-urandom-nofollow-emlink") + ("pattern" . "create private extraction directory: Too many links") ("type" . "runtime")))