Date: Mon, 13 Apr 2020 08:42:13 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359849 - head/lib/libc/gen Message-ID: <202004130842.03D8gEV4088663@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Apr 13 08:42:13 2020 New Revision: 359849 URL: https://svnweb.freebsd.org/changeset/base/359849 Log: Sync with OpenBSD: arc4random.c: In the incredibly unbelievable circumstance where _rs_init() fails to allocate pages, don't call abort() because of corefile data leakage concerns, but simply _exit(). The reasoning is _rs_init() will only fail if someone finds a way to apply specific pressure against this failure point, for the purpose of leaking information into a core which they can read. We don't need a corefile in this instance to debug that. So take this "lever" away from whoever in the future wants to do that. arc4random.3: reference random(4) arc4random_uniform.c: include stdint.h over sys/types.h Modified: head/lib/libc/gen/arc4random.3 head/lib/libc/gen/arc4random.c head/lib/libc/gen/arc4random_uniform.c Modified: head/lib/libc/gen/arc4random.3 ============================================================================== --- head/lib/libc/gen/arc4random.3 Mon Apr 13 08:41:24 2020 (r359848) +++ head/lib/libc/gen/arc4random.3 Mon Apr 13 08:42:13 2020 (r359849) @@ -1,4 +1,4 @@ -.\" $OpenBSD: arc4random.3,v 1.35 2014/11/25 16:45:24 millert Exp $ +.\" $OpenBSD: arc4random.3,v 1.37 2019/09/29 16:30:35 jmc Exp $ .\" .\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> .\" All rights reserved. @@ -31,7 +31,7 @@ .\" Manual page, using -mandoc macros .\" $FreeBSD$ .\" -.Dd April 10, 2020 +.Dd April 13, 2020 .Dt ARC4RANDOM 3 .Os .Sh NAME @@ -71,7 +71,9 @@ On each call, a cryptographic pseudo-random number gen to generate a new result. One data pool is used for all consumers in a process, so that consumption under program flow can act as additional stirring. -The subsystem is re-seeded from the kernel random number subsystem using +The subsystem is re-seeded from the kernel +.Xr random 4 +subsystem using .Xr getentropy 2 on a regular basis, and also upon .Xr fork 2 . Modified: head/lib/libc/gen/arc4random.c ============================================================================== --- head/lib/libc/gen/arc4random.c Mon Apr 13 08:41:24 2020 (r359848) +++ head/lib/libc/gen/arc4random.c Mon Apr 13 08:42:13 2020 (r359849) @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.54 2015/09/13 08:31:47 guenther Exp $ */ +/* $OpenBSD: arc4random.c,v 1.55 2019/03/24 17:56:54 deraadt Exp $ */ /* * Copyright (c) 1996, David Mazieres <dm@uun.org> @@ -84,7 +84,7 @@ _rs_init(u_char *buf, size_t n) if (rs == NULL) { if (_rs_allocate(&rs, &rsx) == -1) - abort(); + _exit(1); } chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8); Modified: head/lib/libc/gen/arc4random_uniform.c ============================================================================== --- head/lib/libc/gen/arc4random_uniform.c Mon Apr 13 08:41:24 2020 (r359848) +++ head/lib/libc/gen/arc4random_uniform.c Mon Apr 13 08:42:13 2020 (r359849) @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random_uniform.c,v 1.2 2015/09/13 08:31:47 guenther Exp $ */ +/* $OpenBSD: arc4random_uniform.c,v 1.3 2019/01/20 02:59:07 bcook Exp $ */ /* * Copyright (c) 2008, Damien Miller <djm@openbsd.org> @@ -18,7 +18,7 @@ * $FreeBSD$ */ -#include <sys/types.h> +#include <stdint.h> #include <stdlib.h> /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004130842.03D8gEV4088663>