libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] Checking Local Memory Accesses


From: Christopher Ferris
Subject: [Libunwind-devel] Checking Local Memory Accesses
Date: Mon, 18 Nov 2013 16:35:37 -0800

While working with the libunwind library on Android, there are some cases that crash the library. Specifically, when unwinding the stack of the local process, if the unwind data is not quite right, you might wind up with a bad pc (such as having a value of 0xe). Unfortunately, the code will gladly try to access this memory and then the code crashes. Any attempt to read memory that is unreadable or write memory that is unwritable will cause this type of crash.

I have a proof of concept patch to demonstrate a way to fix this. Essentially the patch would use the linux /proc/self/maps data to figure out if a particular address is readable/writable then return an error for cases where a crash is likely. I only implemented this for x86_64 on linux based systems.

For the final version, I would add a version of the map generation functions which always returns true for the other os types and add the check code to all of the memory access routines for all of the different supported architectures.

Does this seem like a valid approach?

Christopher Ferris
(address@hidden)

Attachment: check_memory.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]