From: Catalin Marinas <catalin.marinas@arm.com>
To: Daniel Baluta <daniel.baluta@gmail.com>
Cc: "virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"mst@redhat.com" <mst@redhat.com>
Subject: Re: [PATCH] virtio: suppress kmemleak false positive
Date: Fri, 11 Jan 2013 14:47:19 +0000 [thread overview]
Message-ID: <20130111144719.GE31281@arm.com> (raw)
In-Reply-To: <CAEnQRZCvNZ_1OF7Jc43Oo10ADQEMVgqdTJZG7KG7m9yNoQDBfg@mail.gmail.com>
On Fri, Jan 11, 2013 at 02:32:12PM +0000, Daniel Baluta wrote:
> On Fri, Jan 11, 2013 at 4:02 PM, Catalin Marinas <catalin.marinas@arm.com>
> wrote:
> > On Fri, Jan 11, 2013 at 01:51:43PM +0000, Alexandru Copot wrote:
> > > --- a/drivers/virtio/virtio_ring.c
> > > +++ b/drivers/virtio/virtio_ring.c
> > > @@ -23,6 +23,7 @@
> > > #include <linux/slab.h>
> > > #include <linux/module.h>
> > > #include <linux/hrtimer.h>
> > > +#include <linux/kmemleak.h>
> > >
> > > /* virtio guest is communicating with a virtual "device" that actually runs on
> > > * a host processor. Memory barriers are used to control SMP effects. */
> > > @@ -140,6 +141,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
> > > desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp);
> > > if (!desc)
> > > return -ENOMEM;
> > > + kmemleak_not_leak(desc);
> >
> > Please add a comment above this call in case people later wonder why
> > this annotation is needed.
>
> So, kememleak cannot handle this kind of pointer aliases?
No. Basically it stores the allocated object start/end in an rb-tree and
cannot cope with overlapping blocks. If we allow aliases, we could have
some overlapping.
I think there was a patch in the past to add a separate rb-tree for
aliases but I didn't particularly like it because it affected the
performance.
> Also, I wonder if phys_to_virt(virt_to_phys(x)) == x holds true all the time.
It should as long as x is a valid kernel virtual address in the logical
(linear) mapping.
--
Catalin
next prev parent reply other threads:[~2013-01-11 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1357912303-17026-1-git-send-email-alex.mihai.c@gmail.com>
2013-01-11 14:02 ` [PATCH] virtio: suppress kmemleak false positive Catalin Marinas
[not found] ` <20130111140231.GA31281@arm.com>
2013-01-11 14:32 ` Daniel Baluta
2013-01-11 14:43 ` Daniel Baluta
2013-01-11 14:47 ` Catalin Marinas [this message]
2013-01-18 11:54 Alexandru Copot
-- strict thread matches above, loose matches on Subject: below --
2013-01-11 13:51 Alexandru Copot
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=20130111144719.GE31281@arm.com \
--to=catalin.marinas@arm.com \
--cc=daniel.baluta@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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).