linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Michal Hocko <mhocko@suse.cz>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	riel@redhat.com, peterz@infradead.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm: initialize variable for mem_cgroup_end_page_stat
Date: Thu, 30 Oct 2014 11:06:24 -0400	[thread overview]
Message-ID: <20141030150624.GA24818@phnom.home.cmpxchg.org> (raw)
In-Reply-To: <54524A2F.5050907@oracle.com>

On Thu, Oct 30, 2014 at 10:24:47AM -0400, Sasha Levin wrote:
> On 10/30/2014 10:14 AM, Johannes Weiner wrote:
> >> The problem is that you are attempting to read 'locked' when you call
> >> > mem_cgroup_end_page_stat(), so it gets used even before you enter the
> >> > function - and using uninitialized variables is undefined.
> > We are not using that value anywhere if !memcg.  What path are you
> > referring to?
> 
> You're using that value as soon as you are passing it to a function, it
> doesn't matter what happens inside that function.

It's copied as part of the pass-by-value protocol, but we really don't
do anything with it.  So why does it matter?

> >> > Yes, it's a compiler warning.
> > Could you provide that please, including arch, and gcc version?
> 
> On x86,
> 
> $ gcc --version
> gcc (GCC) 5.0.0 20141029 (experimental)
> 
> [   26.868116] ================================================================================
> [   26.870376] UBSan: Undefined behaviour in mm/rmap.c:1084:2

Well, "compiler warning" is misleading at best, this is some
out-of-tree runtime debugging tool.

As per above, there isn't a practical problem here, but your patch
worsens the code by making callsites ignorant of how the interface
works.

--
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>

  reply	other threads:[~2014-10-30 15:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  1:44 [PATCH] mm: initialize variable for mem_cgroup_end_page_stat Sasha Levin
2014-10-30  8:27 ` Michal Hocko
2014-10-30 13:32   ` Sasha Levin
2014-10-30 14:14     ` Johannes Weiner
2014-10-30 14:24       ` Sasha Levin
2014-10-30 15:06         ` Johannes Weiner [this message]
2014-10-30 16:02           ` Sasha Levin
2014-10-30 15:31         ` Michal Hocko
2014-10-30 17:26           ` Johannes Weiner
2014-10-30 17:42             ` Michal Hocko
2014-10-30 19:30               ` Peter Zijlstra
2014-10-31 18:17               ` Johannes Weiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141030150624.GA24818@phnom.home.cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=sasha.levin@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).