2002-11-13 00:00:49

by Rusty Lynch

[permalink] [raw]
Subject: How can I verify a memory address exist?

Is there a kernel function to find out if a given memory address exist?

-rustyl


2002-11-13 07:52:26

by Vamsi Krishna S .

[permalink] [raw]
Subject: Re: How can I verify a memory address exist?

On Wed, Nov 13, 2002 at 12:48:44AM +0000, Rusty Lynch wrote:
> Is there a kernel function to find out if a given memory address exist?
>
I think you are trying to validate addresses to be passed into kprobes.
In that context, you need to check if the given address is a kernel
space code address.

Take a look at kernel_text_address() functions in
arch/i386/kernel/traps.c which do this. Unfortunately, they are defined
static inline, so, they can't be used outside of traps.c. You may
want to export that function from kernel and use it in your driver.

Cheers,
Vamsi.
--
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]

2002-11-13 18:42:21

by George Anzinger

[permalink] [raw]
Subject: Re: How can I verify a memory address exist?

Rusty Lynch wrote:
>
> Is there a kernel function to find out if a given memory address exist?
>
> -rustyl

Here is a related question. Is there a way to verify that
an address is a valid slab sub space address? I.e. that it
was allocated by slab for a particular usage and is still
valid (i.e. has not been returned).
--
George Anzinger [email protected]
High-res-timers:
http://sourceforge.net/projects/high-res-timers/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml