Make minidump name generation on Linux as random as possible

This patch ensures that two crashes taken within the same second have
different minidump names. The random characters used in the minidump
filename are now read from /dev/urandom where possible or generated via
arc4random(). If neither is available we fall back to regular rand() but
mixing the address of an object to the current time when generating the
random seed to make it slightly less predictable.

BUG=681

Change-Id: I2e97454859ed386e199b2628d6b7e87e16481b75
Reviewed-on: https://chromium-review.googlesource.com/445784
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Gabriele Svelto 2017-04-11 11:51:28 +02:00 committed by Mike Frysinger
parent aa7115cfde
commit a9fca58305
4 changed files with 182 additions and 12 deletions

View file

@ -72,7 +72,8 @@ AC_ARG_ENABLE(m32,
AC_HEADER_STDC
AC_SYS_LARGEFILE
AX_PTHREAD
AC_CHECK_HEADERS([a.out.h])
AC_CHECK_HEADERS([a.out.h sys/random.h])
AC_CHECK_FUNCS([arc4random getrandom])
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)