Re: Memory zeroed when made available to user process

From: Michal Hocko
Date: Wed Jun 27 2018 - 09:12:55 EST


On Wed 27-06-18 13:29:05, Richard Weinberger wrote:
> On Wed, Jun 27, 2018 at 11:34 AM, Jefferson Carpenter
> <jeffersoncarpenter2@xxxxxxxxx> wrote:
> > Is there a way for a user process to mark memory as 'sensitive' or
> > 'non-sensitive' when it is allocated? That could allow it not to have to be
> > zeroed before being allocated to another process.
>
> Isn't this what we have Meltdown and Spectre for? ;-)
>
> No, memory from the kernel is always zeroed.
> libc offers malloc() and calloc() for this purpose.

Well, except for the weird MAP_UNINITIALIZED. Anyway agreed that this is
a bad idea and the flag should have never been merged. I've just
mentioned it for completness.

--
Michal Hocko
SUSE Labs