On Fri, 25 Jan 2019 at 22:57, Richard Henderson <richard.hender...@linaro.org> wrote: > > Initialize the keys to a non-zero value on process start. > > Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> +static uint64_t arm_rand64(void) > +{ > + int shift = 64 - clz64(RAND_MAX); > + int i, n = 64 / shift + (64 % shift != 0); > + uint64_t ret = 0; > + > + for (i = 0; i < n; i++) { > + ret = (ret << shift) | rand(); > + } > + return ret; > +} I'm not a huge fan of the use of rand() here, but it's what we're using to initialize AT_RANDOM in linux-user, so I guess it's OK here. At some point we should investigate whether there's something better we are guaranteed to have available, I suppose. (Coverity gripes about use of rand().) thanks -- PMM