Memory zeroed when made available to user process
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.
Quoted 3 lines · Jefferson Carpenter
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.
Signature · 2 lines
Thanks, //richard
Quoted 10 lines · Richard Weinberger
Quoted 3 lines · Jefferson Carpenter
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()andcalloc()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.
Signature · 2 lines
Michal Hocko SUSE Labs
Am Mittwoch, 27. Juni 2018, 15:12:48 CEST schrieb Michal Hocko:
Quoted 7 lines · Richard Weinberger
Quoted 6 lines
Quoted 3 lines · Jefferson Carpenter
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.
Quoted 8 lines
Quoted 4 lines
Isn't this what we have Meltdown and Spectre for? ;-)
No, memory from the kernel is always zeroed. libc offers
malloc()andcalloc()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.
Oh, I forgot about the crazy nommu world. :-)
Thanks,
//richard
Signature · 2 lines
sigma star gmbh - Eduard-Bodem-Gasse 6 - 6020 Innsbruck - Austria ATU66964118 - FN 374287y
Quoted 12 lines · Richard Weinberger
Am Mittwoch, 27. Juni 2018, 15:12:48 CEST schrieb Michal Hocko:
Quoted 11 lines · Richard Weinberger
Quoted 10 lines
Quoted 3 lines · Jefferson Carpenter
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()andcalloc()for this purpose.
Interesting. Let's say
Process 1:
free(use_memory(malloc(1024)));
Then Process 2:
malloc(1024);
The physical RAM used to service Process 2's malloc call has to be zeroed to prevent it from leaking data from Process 1. However, if Process 1 could mark that memory as non-sensitive, then it would not have to be zeroed, saving the time it takes to do that. However, this would require at least a bit per memory page, so maybe it's not worth it.
Quoted 10 lines
Quoted 4 lines
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.Oh, I forgot about the crazy nommu world. :-)
Thanks,
//richard
Am Freitag, 29. Juni 2018, 02:52:16 CEST schrieb Jefferson Carpenter:
Quoted 19 lines · Richard Weinberger
Quoted 12 lines
Am Mittwoch, 27. Juni 2018, 15:12:48 CEST schrieb Michal Hocko:
Quoted 11 lines · Richard Weinberger
Quoted 10 lines
Quoted 3 lines · Jefferson Carpenter
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()andcalloc()for this purpose.Interesting. Let's say
Process 1:
free(use_memory(malloc(1024)));
Quoted 8 lines
Then Process 2:
malloc(1024);The physical RAM used to service Process 2's malloc call has to be zeroed to prevent it from leaking data from Process 1. However, if Process 1 could mark that memory as non-sensitive, then it would not have to be zeroed, saving the time it takes to do that. However, this would require at least a bit per memory page, so maybe it's not worth it.
Is this really a measurable overhead on your system? Do you have numbers?
Thanks,
//richard