2

I want to check if a virtual address can be dereferenced without raising segmentation fault. the virtual address I am talking about is not just untrustworthy user space address. I want to check the kernel virtual address as well.

In x86 Linux kernel, __virt_addr_valid() function can be used to check if the virtual address has valid mapping.

Is there any equivalent in ARM linux kernel??

Thank you in advance.

artless noise
  • 21,212
  • 6
  • 68
  • 105
daehee
  • 5,047
  • 7
  • 44
  • 70
  • What about `virt_addr_valid()` (no leading underscores)? – oakad May 08 '14 at 07:22
  • 1
    In both cases, these are macros. See: [Arm memory.h](http://lxr.free-electrons.com/source/arch/arm/include/asm/memory.h#L347). You may use [the *find physical address...* answer](http://stackoverflow.com/questions/19275718/find-the-physical-address-of-exception-vector-table-from-kernel-module) on a Cortex-A CPU to determine if the page has a mapping; I guess the CP15 access has some way to flag it is not mapped. – artless noise May 08 '14 at 16:39

0 Answers0