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


Groups > linux.kernel > #1486197

Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps

From Xiao Guangrong <guangrong.xiao@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps
Date 2016-09-19 09:30 +0200
Message-ID <sj1bz-2rl-5@gated-at.bofh.it> (permalink)
References (2 earlier) <sgB1U-4WE-21@gated-at.bofh.it> <sgEVP-7xR-13@gated-at.bofh.it> <sgXvs-3zH-5@gated-at.bofh.it> <sgYKS-4ky-29@gated-at.bofh.it> <shks1-2zX-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 09/14/2016 11:38 PM, Oleg Nesterov wrote:
> On 09/13, Dave Hansen wrote:
>>
>> On 09/13/2016 07:59 AM, Oleg Nesterov wrote:
>>> I agree. I don't even understand why this was considered as a bug.
>>> Obviously, m_stop() which drops mmap_sep should not be called, or
>>> all the threads should be stopped, if you want to trust the result.
>>
>> There was a mapping at a given address.  That mapping did not change, it
>> was not split, its attributes did not change.  But, it didn't show up
>> when reading smaps.  Folks _actually_ noticed this in a test suite
>> looking for that address range in smaps.
>
> I understand, and I won't argue with any change which makes the things
> better. Just I do not think this is a real problem. And this patch can't
> fix other oddities and it seems it adds another one (at least) although
> I can easily misread this patch and/or the code.
>
> So we change m_cache_vma(),
>
> 	-        m->version = m_next_vma(m->private, vma) ? vma->vm_start : -1UL;
> 	+        m->version = m_next_vma(m->private, vma) ? vma->vm_end : -1UL;
>
> OK, and another change in m_start()
>
> 	-        if (vma && (vma = m_next_vma(priv, vma)))
> 	+        if (vma)
>
> means that it can return the same vma if it grows in between.
>
> show_map_vma() has another change
>
> 	+       start = max(vma->vm_start, start);
>
> so it will be reported as _another_ vma, and this doesn't look exactly
> right.

We noticed it in the discussion of v1, however it is not bad as Dave said
it is about 'address range' rather that vma.

>
> And after that *ppos will be falsely incremented... but probably this
> doesn't matter because the "if (pos < mm->map_count)" logic in m_start()
> looks broken anyway.

The 'broken' can happen only if it is not the first read and m->version is
zero (*ppos != 0 && m->version == 0). If i understand the code correctly,
only m->buffer overflowed can trigger this, for smaps, each vma only
uses ~1k memory that means this could not happen. Right?

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


Thread

[PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-09-12 05:30 +0200
  Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Michal Hocko <mhocko@kernel.org> - 2016-09-12 15:00 +0200
    Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Dave Hansen <dave.hansen@intel.com> - 2016-09-12 17:10 +0200
      Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Michal Hocko <mhocko@kernel.org> - 2016-09-12 21:20 +0200
        Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-09-13 05:10 +0200
        Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Oleg Nesterov <oleg@redhat.com> - 2016-09-13 17:10 +0200
          Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Dave Hansen <dave.hansen@intel.com> - 2016-09-13 18:30 +0200
            Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Oleg Nesterov <oleg@redhat.com> - 2016-09-14 17:40 +0200
              Re: [PATCH v2] mm, proc: Fix region lost in /proc/self/smaps Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-09-19 09:30 +0200

csiph-web