diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-01-31 17:15:11 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-13 11:06:06 -0800 |
commit | 0053779e04bbfabe31287245d89ad10bb66e758a (patch) | |
tree | ae6f94741a12acee80124e25beb0cd62d3990cfb /drivers/rtc | |
parent | b49767a65a6454f7d546068a785e25dbb0eabbcd (diff) | |
download | lwn-0053779e04bbfabe31287245d89ad10bb66e758a.tar.gz lwn-0053779e04bbfabe31287245d89ad10bb66e758a.zip |
proc: make sure mem_open() doesn't pin the target's memory
commit 6d08f2c7139790c268820a2e590795cb8333181a upstream.
Once /proc/pid/mem is opened, the memory can't be released until
mem_release() even if its owner exits.
Change mem_open() to do atomic_inc(mm_count) + mmput(), this only
pins mm_struct. Change mem_rw() to do atomic_inc_not_zero(mm_count)
before access_remote_vm(), this verifies that this mm is still alive.
I am not sure what should mem_rw() return if atomic_inc_not_zero()
fails. With this patch it returns zero to match the "mm == NULL" case,
may be it should return -EINVAL like it did before e268337d.
Perhaps it makes sense to add the additional fatal_signal_pending()
check into the main loop, to ensure we do not hold this memory if
the target task was oom-killed.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/rtc')
0 files changed, 0 insertions, 0 deletions