lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 7 Oct 2022 08:44:52 -0600
From:   "Jason A. Donenfeld" <Jason@...c4.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     x86@...nel.org, Jann Horn <jannh@...gle.com>,
        Natalie Silvanovich <natashenka@...gle.com>,
        Seth Jenkins <sethjenkins@...gle.com>,
        Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org
Subject: Re: x86/mm: Randomize per-cpu entry area

On Fri, Oct 07, 2022 at 10:42:36AM +0200, Peter Zijlstra wrote:
> +	max_cea = (CPU_ENTRY_AREA_MAP_SIZE - PAGE_SIZE) / CPU_ENTRY_AREA_SIZE;
> +
> +	/* O(sodding terrible) */
> +	for_each_possible_cpu(i) {
> +		unsigned int cea;
> +
> +again:
> +		cea = prandom_u32_max(max_cea);

Just FYI, max_cea is 2274876 (at least in my test rig), which means the
values returned from prandom_u32_max() won't be uniformly distributed.
Right now the kernel doesn't have a function that does rejection
sampling to get uniform distribution, but I could add one if you need.
Alternatively, maybe you don't actually *need* this to be perfectly
distributed -- which seems to be a common perspective -- and so this is
good enough. Your call, but just wanted to make you aware.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ