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


Groups > linux.kernel > #1703814

Re: Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer
Date 2017-08-04 11:20 +0200
Message-ID <uaGVX-56P-5@gated-at.bofh.it> (permalink)
References <uaFwS-47W-17@gated-at.bofh.it> <uaFwS-47W-15@gated-at.bofh.it> <uaGjf-4D2-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri 04-08-17 17:25:46, Tetsuo Handa wrote:
> Well, while lockdep warning is gone, this problem is remaining.
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index edabf6f..1e06c29 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3931,15 +3931,14 @@ int handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
>         /*
>          * This mm has been already reaped by the oom reaper and so the
>          * refault cannot be trusted in general. Anonymous refaults would
> -        * lose data and give a zero page instead e.g. This is especially
> -        * problem for use_mm() because regular tasks will just die and
> -        * the corrupted data will not be visible anywhere while kthread
> -        * will outlive the oom victim and potentially propagate the date
> -        * further.
> +        * lose data and give a zero page instead e.g.
>          */
> -       if (unlikely((current->flags & PF_KTHREAD) && !(ret & VM_FAULT_ERROR)
> -                               && test_bit(MMF_UNSTABLE, &vma->vm_mm->flags)))
> +       if (unlikely(!(ret & VM_FAULT_ERROR)
> +                    && test_bit(MMF_UNSTABLE, &vma->vm_mm->flags))) {
> +               if (ret & VM_FAULT_RETRY)
> +                       down_read(&vma->vm_mm->mmap_sem);
>                 ret = VM_FAULT_SIGBUS;
> +       }
> 
>         return ret;
>  }

I have re-read your email again and I guess I misread previously. Are
you saying that the data corruption happens with the both patches
applied?

> 
> $ cat /tmp/file.* | od -b | head
> 0000000 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
> *
> 420330000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
> *
> 420340000 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
> *
> 457330000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
> *
> 457340000 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
> *
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs

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


Thread

[PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-03 16:00 +0200
  Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper  races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-04 09:50 +0200
    Re: Re: [PATCH] mm, oom: fix potential data corruption when  oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-04 10:40 +0200
    Re: Re: [PATCH] mm, oom: fix potential data corruption when  oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-04 11:20 +0200
      Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-04 12:50 +0200
        Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper  races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-04 13:10 +0200
          Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper  races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-04 17:00 +0200
            Re: [PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-04 18:50 +0200
            RE: [PATCH] mm, oom: fix potential data corruption when oom_reaper races with writer "陶文苇" <wenwei.tww@alibaba-inc.com> - 2017-08-05 03:50 +0200

csiph-web