On Wed, Sep 30, 2020 at 08:11:28PM +0000, Edgecombe, Rick P wrote:
On Wed, 2020-09-30 at 13:35 +0300, Mike Rapoport wrote:
Our thinking was that copy_*user() would work in the context of the process that "owns" the secretmem and gup() would not allow access in general, unless requested with certail (yet another) FOLL_ flag.
Hmm, yes. I think one easier thing about this design over the series Kirill sent out is that the actual page will never transition to and from unmapped while it's mapped in userspace. If it could transition, you'd have to worry about a race window between get_user_pages(FOLL_foo) and the kmap() where the page might get unmapped.
Without the ability to transition pages though, using this for KVM guests memory remains a not completely worked through problem since it has the get_user_pages()/kmap() pattern quite a bit. Did you have an idea for that? (I thought I saw that use case mentioned somewhere).
I've mentioned the KVM usecase because it was dicussed at the hallway track at KVM Forum last year and also after looking at Kirill's patches I though that "KVM protected" memory could be implemented on top of secretmem. Can't say I have enough expertise in KVM to have a completely worked through solution for that.