1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check or read from potentially invalid virtual address catching GP/page faults

Discussion in 'FreeBSD Development' started by rlyeh, May 8, 2012.

  1. rlyeh

    rlyeh New Member

    Messages:
    1
    Thanks Received:
    0
    Hello,

    I've been working on a personal project, where I must handle potentially invalid information in scenario similar to a kernel panic. When I detect an erroneous condition, I try to dump certain structures, following pointers whenever possible.

    So far I've implemented a test similar to those built in the copyin/copyout functions, using the MAX_USER_ADDRESS. On amd64, however, addresses like 0xdeadbeefdeadbeef would still fall within the range of kernel addresses assumed as "valid".

    1. Is there any fault-tolerant way to test for the true validity of a given virtual address? ie. it can be read/accessed. kernacc is not working for me in certain cases, because it only searches for kernel_map pmaps, which is not going to work, say, for boot memory pages.
    2. Is there any arch-independent helper API to "examine" an address and dump its information in a similar way to ddb? How does ddb implement the override for the general protection fault handler when accessing unmapped memory?
    3. 121212

    I could foresee questions about why do I actually need to do this, but I would appreciate it if we could just stick to providing answers disregarding of any subjective opinions. I have reasons to do this rather unorthodox checking and do not intend to waste anyone's time submitting my patch, for now. I'm just learning more about the vm internals.

    Thanks!