Re: CONFIG_DEBUG_PAGEALLOC and virt_addr_valid()

From: Sridhar Samudrala
Date: Thu Apr 01 2004 - 20:42:49 EST


On Thu, 1 Apr 2004, Andrew Morton wrote:

> Sridhar Samudrala <sri@xxxxxxxxxx> wrote:
> >
> > On Thu, 1 Apr 2004, Christoph Hellwig wrote:
> >
> > > On Thu, Apr 01, 2004 at 11:11:39AM -0800, Sridhar Samudrala wrote:
> > > > When CONFIG_DEBUG_PAGEALLOC is enabled, i am noticing that virt_addr_valid()
> > > > (called from sctp_is_valid_kaddr()) is returning true even for freed objects.
> > > > Is this a bug or expected behavior?
> > >
> > > Generally every use of virt_addr_valid() is a bug. What are you trying to
> > > do?
> >
> > We are trying to validate a kernel address that is passed by the user. Is
> > there a better way to do that?
>
> yup. Pass the user an integer.
>
> > When an SCTP association is established, the pointer to the association
> > structure is passed to the user as an identifier of the association. This
> > identifier is used in the later calls by the user.
>
> Please don't do that. See lib/idr.c. I expect it does exactly what you
> want.

Yes. I think i should be able to use it to generate ids for the associations.
Thanks for pointing it out.
-Sridhar
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/