On Thu, Apr 18, 2019 at 6:35 PM Dave Hansen <dave.hansen@xxxxxxxxx> wrote: > > On 4/18/19 8:42 AM, Alexander Potapenko wrote: > > This option adds the possibility to initialize newly allocated pages and > > heap objects with zeroes. This is needed to prevent possible information > > leaks and make the control-flow bugs that depend on uninitialized values > > more deterministic. > > Isn't it better to do this at free time rather than allocation time? If > doing it at free, you can't even have information leaks for pages that > are in the allocator. I should have mentioned this in the patch description, as this question is being asked every time I send a patch :) If we want to avoid double initialization and take advantage of __GFP_NOINIT (see the second and third patches in the series) we need to do initialize the memory at allocation time, because free() and free_pages() don't accept GFP flags. -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg