Skip to contentSkip to conversation

How can I verify a memory address exist?

DISCUSSION Rusty Lynch 3 participants 3 messages Nov 13, 2002

lore
Share & tools
lore
#0 lore raw

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

-rustyl

#1 lore raw
Quoted 2 lines · Rusty Lynch

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.

Signature · 5 lines
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5044959
Internet: [email protected]
#2 lore raw
In reply to Rusty Lynch
Quoted 4 lines · Rusty Lynch

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

Signature · 5 lines
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