mm-secretmem-avoid-letting-secretmem_users-drop-to-zero.patch removed from -mm tree
The patch titled
Subject: mm/secretmem: avoid letting secretmem_users drop to zero
has been removed from the -mm tree. Its filename was
mm-secretmem-avoid-letting-secretmem_users-drop-to-zero.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Kees Cook <[email protected]>
Subject: mm/secretmem: avoid letting secretmem_users drop to zero
Quoting Dmitry: "refcount_inc() needs to be done before fd_install(). After fd_install() finishes, the fd can be used by userspace and we can have secret data in memory before the refcount_inc().
A straightforward misuse where a user will predict the returned fd in another thread before the syscall returns and will use it to store secret data is somewhat dubious because such a user just shoots themself in the foot.
But a more interesting misuse would be to close the predicted fd and decrement the refcount before the corresponding refcount_inc, this way one can briefly drop the refcount to zero while there are other users of secretmem."
Move fd_install() after refcount_inc().
---
mm/secretmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/secretmem.c renamed from mm/secretmem.c~mm-secretmem-avoid-letting-secretmem_users-drop-to-zero +1 -1
@@ -218,8 +218,8 @@ SYSCALL_DEFINE1(memfd_secret, unsigned i file->f_flags |=O_LARGEFILE ; -fd_install (fd, file);atomic_inc (&secretmem_users); +fd_install (fd, file);return fd; err_put_fd:
_
Patches currently in -mm which might be from [email protected] are
kasan-test-bypass-__alloc_size-checks.patch rapidio-avoid-bogus-__alloc_size-warning.patch compiler-attributes-add-__alloc_size-for-better-bounds-checking.patch slab-clean-up-function-prototypes.patch slab-add-__alloc_size-attributes-for-better-bounds-checking.patch mm-kvmalloc-add-__alloc_size-attributes-for-better-bounds-checking.patch mm-vmalloc-add-__alloc_size-attributes-for-better-bounds-checking.patch mm-page_alloc-add-__alloc_size-attributes-for-better-bounds-checking.patch percpu-add-__alloc_size-attributes-for-better-bounds-checking.patch kasan-test-consolidate-workarounds-for-unwanted-__alloc_size-protection.patch maintainers-add-exec-binfmt-section-with-myself-and-eric.patch binfmt_elf-reintroduce-using-map_fixed_noreplace.patch