Message ID | tnxy6rbv0oq.fsf@pc1117.cambridge.arm.com |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
Hi Catalin, On Mon, Jun 29, 2009 at 12:39 PM, Catalin Marinas<catalin.marinas@arm.com> wrote: > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c > index ddeb819..26fb808 100644 > --- a/drivers/base/firmware_class.c > +++ b/drivers/base/firmware_class.c > @@ -179,6 +179,13 @@ static ssize_t firmware_loading_store(struct device *dev, > dev_err(dev, "%s: vmap() failed\n", __func__); > goto err; > } > + /* > + * This block of memory is later freed using vfree. > + * Since kmemleak does not track vmap calls, just > + * inform it about this block but ignore it during > + * scanning. > + */ > + kmemleak_alloc(fw_priv->fw->data, 0, -1, GFP_KERNEL); > /* Pages will be freed by vfree() */ > fw_priv->pages = NULL; > fw_priv->page_array_size = 0; Would it be possible to put this hook in vmap() somehow? -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, 2009-06-29 at 12:48 +0300, Pekka Enberg wrote: > Hi Catalin, > > On Mon, Jun 29, 2009 at 12:39 PM, Catalin > Marinas<catalin.marinas@arm.com> wrote: > > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c > > index ddeb819..26fb808 100644 > > --- a/drivers/base/firmware_class.c > > +++ b/drivers/base/firmware_class.c > > @@ -179,6 +179,13 @@ static ssize_t firmware_loading_store(struct device *dev, > > dev_err(dev, "%s: vmap() failed\n", __func__); > > goto err; > > } > > + /* > > + * This block of memory is later freed using vfree. > > + * Since kmemleak does not track vmap calls, just > > + * inform it about this block but ignore it during > > + * scanning. > > + */ > > + kmemleak_alloc(fw_priv->fw->data, 0, -1, GFP_KERNEL); > > /* Pages will be freed by vfree() */ > > fw_priv->pages = NULL; > > fw_priv->page_array_size = 0; > > Would it be possible to put this hook in vmap() somehow? It can be (and it could track vmap leaks as well). BTW, is there any use-case where vmap'ed memory may contain pointers? I did a grep but none of the vmap'ed blocks seem to have pointers.
On Mon, 2009-06-29 at 12:48 +0300, Pekka Enberg wrote: > Hi Catalin, > > On Mon, Jun 29, 2009 at 12:39 PM, Catalin > Marinas<catalin.marinas@arm.com> wrote: > > diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c > > index ddeb819..26fb808 100644 > > --- a/drivers/base/firmware_class.c > > +++ b/drivers/base/firmware_class.c > > @@ -179,6 +179,13 @@ static ssize_t firmware_loading_store(struct device *dev, > > dev_err(dev, "%s: vmap() failed\n", __func__); > > goto err; > > } > > + /* > > + * This block of memory is later freed using vfree. > > + * Since kmemleak does not track vmap calls, just > > + * inform it about this block but ignore it during > > + * scanning. > > + */ > > + kmemleak_alloc(fw_priv->fw->data, 0, -1, GFP_KERNEL); > > /* Pages will be freed by vfree() */ > > fw_priv->pages = NULL; > > fw_priv->page_array_size = 0; > > Would it be possible to put this hook in vmap() somehow? I tried to do this but it has some other implications. If I add the vmap hook, I would need to add vunmap as well. On ARM, at least, iounmap calls vunmap (but not vmap) which means that I would need to add ioremap support as well. That's not a bug issue but this is more like a new feature than a bug fix. I propose that for now I disable the kmemleak warning for unknown pointers and add a patch to linux-next which tracks ioremap and vmap mappings. Does this sound fine? Thanks.
Hi Catalin, On Mon, Jun 29, 2009 at 5:33 PM, Catalin Marinas<catalin.marinas@arm.com> wrote: > I tried to do this but it has some other implications. If I add the vmap > hook, I would need to add vunmap as well. On ARM, at least, iounmap > calls vunmap (but not vmap) which means that I would need to add ioremap > support as well. That's not a bug issue but this is more like a new > feature than a bug fix. > > I propose that for now I disable the kmemleak warning for unknown > pointers and add a patch to linux-next which tracks ioremap and vmap > mappings. Does this sound fine? Yup, makes sense. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index ddeb819..26fb808 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -179,6 +179,13 @@ static ssize_t firmware_loading_store(struct device *dev, dev_err(dev, "%s: vmap() failed\n", __func__); goto err; } + /* + * This block of memory is later freed using vfree. + * Since kmemleak does not track vmap calls, just + * inform it about this block but ignore it during + * scanning. + */ + kmemleak_alloc(fw_priv->fw->data, 0, -1, GFP_KERNEL); /* Pages will be freed by vfree() */ fw_priv->pages = NULL; fw_priv->page_array_size = 0;