Thanks for the patch.
I tested this v1 on its stated base with an x86_64 KASAN kernel. The supplied
selftest passed 6/6 in three boots. Additional fork/unmap and inherited-VMA
mremap tests also passed.
One question: the inode stores the creator's user_struct, but the fault path
uses the current task's RLIMIT_MEMLOCK.
secretmem_init_inode_priv():
state->user = get_uid(current_user());
__secretmem_account_pages():
page_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
With A limited to one page and B to four, A created the fd and passed it to B.
B faulted four pages, after which A got SIGBUS faulting one page on a new fd:
CROSS_PRINCIPAL receiver_pages=4 creator_fresh_page=0
This seems to charge A's locked_vm using B's limit. Is that intended?
Thanks,
Daehyeon