aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2021-10-28 21:36:21 +0000
committerLinus Torvalds <[email protected]>2021-10-29 00:18:55 +0000
commit855d44434fa24d5344c1cb0edb38723f891cd415 (patch)
treec4550d2d91c2e494d21b37304c72dba65b4c0fa4 /mm/vmalloc.c
parentocfs2: fix race between searching chunks and release journal_head from buffer... (diff)
downloadkernel-855d44434fa24d5344c1cb0edb38723f891cd415.tar.gz
kernel-855d44434fa24d5344c1cb0edb38723f891cd415.zip
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(). Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/lkml/CACT4Y+b1sW6-Hkn8HQYw_SsT7X3tp-CJNh2ci0wG3ZnQz9jjig@mail.gmail.com Fixes: 9a436f8ff631 ("PM: hibernate: disable when there are active secretmem users") Signed-off-by: Kees Cook <[email protected]> Reported-by: Dmitry Vyukov <[email protected]> Reviewed-by: Dmitry Vyukov <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Jordy Zomer <[email protected]> Cc: Mike Rapoport <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'mm/vmalloc.c')
0 files changed, 0 insertions, 0 deletions