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


Groups > linux.kernel > #1709175

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

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] mm, oom: fix potential data corruption when oom_reaper races with writer
Date 2017-08-11 04:30 +0200
Message-ID <ud7S1-62F-3@gated-at.bofh.it> (permalink)
References <ubOy5-7Bo-9@gated-at.bofh.it> <ubOy5-7Bo-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Michal Hocko wrote:
> +/*
> + * Checks whether a page fault on the given mm is still reliable.
> + * This is no longer true if the oom reaper started to reap the
> + * address space which is reflected by MMF_UNSTABLE flag set in
> + * the mm. At that moment any !shared mapping would lose the content
> + * and could cause a memory corruption (zero pages instead of the
> + * original content).
> + *
> + * User should call this before establishing a page table entry for
> + * a !shared mapping and under the proper page table lock.
> + *
> + * Return 0 when the PF is safe VM_FAULT_SIGBUS otherwise.
> + */
> +static inline int check_stable_address_space(struct mm_struct *mm)
> +{
> +	if (unlikely(test_bit(MMF_UNSTABLE, &mm->flags)))
> +		return VM_FAULT_SIGBUS;
> +	return 0;
> +}
> +

Will you explain the mechanism why random values are written instead of zeros
so that this patch can actually fix the race problem? I consider that writing
random values (though it seems like portion of process image) instead of zeros
to a file might cause a security problem, and the patch that fixes it should be
able to be backported to stable kernels.

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


Thread

[PATCH 0/2] mm, oom: fix oom_reaper fallouts Michal Hocko <mhocko@kernel.org> - 2017-08-07 13:40 +0200
  [PATCH 1/2] mm: fix double mmap_sem unlock on MMF_UNSTABLE enforced SIGBUS Michal Hocko <mhocko@kernel.org> - 2017-08-07 13:40 +0200
  [PATCH 2/2] mm, oom: fix potential data corruption when oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-07 13:40 +0200
    Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Andrea Arcangeli <aarcange@redhat.com> - 2017-08-08 19:50 +0200
      Re: [PATCH 2/2] mm, oom: fix potential data corruption when oom_reaper races with writer Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-09 01:40 +0200
        Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Andrea Arcangeli <aarcange@redhat.com> - 2017-08-09 20:40 +0200
      Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-10 10:30 +0200
        Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-10 15:40 +0200
    Re: [PATCH 2/2] mm, oom: fix potential data corruption when oom_reaper races with writer Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-11 04:30 +0200
      Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-11 09:10 +0200
        Re: [PATCH 2/2] mm, oom: fix potential data corruption when oom_reaper races with writer Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-11 10:00 +0200
          Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Andrea Arcangeli <aarcange@redhat.com> - 2017-08-11 12:30 +0200
            Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Andrea Arcangeli <aarcange@redhat.com> - 2017-08-11 12:50 +0200
          Re: [PATCH 2/2] mm, oom: fix potential data corruption when  oom_reaper races with writer Michal Hocko <mhocko@kernel.org> - 2017-08-11 14:10 +0200
            Re: [PATCH 2/2] mm, oom: fix potential data corruption when oom_reaper races with writer Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-11 17:50 +0200
  Re: [PATCH 0/2] mm, oom: fix oom_reaper fallouts Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-07 15:30 +0200
    Re: [PATCH 0/2] mm, oom: fix oom_reaper fallouts Michal Hocko <mhocko@kernel.org> - 2017-08-07 16:10 +0200
      Re: [PATCH 0/2] mm, oom: fix oom_reaper fallouts Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-08-07 17:30 +0200

csiph-web