Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1420886

Re: [PATCH] exit: clear TIF_MEMDIE after exit_task_work

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] exit: clear TIF_MEMDIE after exit_task_work
Date 2016-06-13 16:10 +0200
Message-ID <rJAIW-7lo-29@gated-at.bofh.it> (permalink)
References (1 earlier) <r7Whr-3Ha-13@gated-at.bofh.it> <rcDHc-6ja-17@gated-at.bofh.it> <rHoLT-2Pn-13@gated-at.bofh.it> <rJyH7-5Np-7@gated-at.bofh.it> <rJAzk-72E-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon 13-06-16 22:52:43, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > I have checked the vnet code and it doesn't seem to rely on
> > copy_from_user/get_user AFAICS. Other users of use_mm() need to copy to
> > the userspace only as well. So we should be perfectly safe to OOM reap
> > address space even when it is shared by the kthread [1] so this is
> > not really needed for the OOM correctness purpose. It would be much
> > nicer if the kthread didn't pin the mm for two long outside of the OOM
> > handling as well of course but that lowers the priority of the change.
> > 
> > [1] http://lkml.kernel.org/r/20160613112348.GC6518@dhcp22.suse.cz
> 
> It seems to me that vhost code relies on copy from the userspace.
> 
> use_mm(dev->mm) and unuse_mm(dev->mm) are used inside vhost_worker().
> work->fn(work) is initialized by vhost_work_init().
> vhost_scsi_open() passes vhost_scsi_complete_cmd_work() and
> vhost_scsi_evt_work() as ->fn, and both functions call __get_user().
> 
> vhost_scsi_complete_cmd_work() {
>   vhost_signal() {
>     vhost_notify() {
>       __get_user()
>     }
>   }
> }
> 
> vhost_scsi_evt_work() {
>   vhost_scsi_do_evt_work() {
>     vhost_get_vq_desc() {
>       __get_user() / __copy_from_user()
>       get_indirect() {
>         copy_from_iter()
>       }
>     }
>   }
> }

Ahh, I've missed those. Thanks for pointing this out! Let me try to find
out whether the code is robust to see unexpected 0 when reading from the
userspace.

-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] exit: clear TIF_MEMDIE after exit_task_work Michal Hocko <mhocko@kernel.org> - 2016-06-13 14:00 +0200
  Re: [PATCH] exit: clear TIF_MEMDIE after exit_task_work Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-06-13 16:00 +0200
    Re: [PATCH] exit: clear TIF_MEMDIE after exit_task_work Michal Hocko <mhocko@kernel.org> - 2016-06-13 16:10 +0200
  Re: [PATCH] exit: clear TIF_MEMDIE after exit_task_work "Michael S. Tsirkin" <mst@redhat.com> - 2016-06-13 20:20 +0200

csiph-web