Thread (78 messages) 78 messages, 10 authors, 2021-02-04

Re: [PATCH v16 07/11] secretmem: use PMD-size pages to amortize direct map fragmentation

From: James Bottomley <hidden>
Date: 2021-02-02 19:20:30
Also in: linux-api, linux-arch, linux-fsdevel, linux-kselftest, linux-mm, linux-riscv, lkml, nvdimm

On Tue, 2021-02-02 at 20:15 +0200, Mike Rapoport wrote:
On Tue, Feb 02, 2021 at 03:34:29PM +0100, David Hildenbrand wrote:
quoted
On 02.02.21 15:32, Michal Hocko wrote:
quoted
On Tue 02-02-21 15:26:20, David Hildenbrand wrote:
quoted
On 02.02.21 15:22, Michal Hocko wrote:
quoted
On Tue 02-02-21 15:12:21, David Hildenbrand wrote:
[...]
quoted
I think secretmem behaves much more like longterm GUP right
now
("unmigratable", "lifetime controlled by user space",
"cannot go on
CMA/ZONE_MOVABLE"). I'd either want to reasonably well
control/limit it or
make it behave more like mlocked pages.
I thought I have already asked but I must have forgotten. Is
there any
actual reason why the memory is not movable? Timing attacks?
I think the reason is simple: no direct map, no copying of
memory.
This is an implementation detail though and not something
terribly hard
to add on top later on. I was more worried there would be really
fundamental reason why this is not possible. E.g. security
implications.
I don't remember all the details. Let's see what Mike thinks
regarding
migration (e.g., security concerns).
Thanks for considering me a security expert :-)

Yet, I cannot estimate how dangerous is the temporal exposure of
this data to the kernel via the direct map in the simple
map/copy/unmap
sequence.
Well the safest security statement is that we never expose the data to
the kernel because it's a very clean security statement and easy to
enforce.  It's also the easiest threat model to analyse.   Once we do
start exposing the secret to the kernel it alters the threat profile
and the analysis and obviously potentially provides the ROP gadget to
an attacker to do the same.  Instinct tells me that the loss of
security doesn't really make up for the ability to swap or migrate but
if there were a case for doing the latter, it would have to be a
security policy of the user (i.e. a user should be able to decide their
data is too sensitive to expose to the kernel).
More secure way would be to map source and destination in a different
page table rather than in the direct map, similarly to the way
text_poke() on x86 does.
I think doing this would have much less of an impact on the security
posture because it's already theoretically possible to have kmap
restore access to the kernel.

James

I've left the migration callback empty for now because it can be
added on top and its implementation would depend on the way we do (or
do not do) pooling.


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help