On Tue, Apr 15, 2008 at 11:08 PM, Arun Sharma <[EMAIL PROTECTED]> wrote:
> Your fix looks right to me. David, please apply.
I just discovered a "performance bug" in that same code:
the intent (according to Arun Sharma) was to only turn validation
on for this particular check, but since as->validate is never
cleared, and since 'as' always points to Ginit.c:local_addr_space
global (when !UNW_REMOTE_ONLY), the effect of 'as->validate=1'
is to introduce msync() call on every subsequent access_mem() check.
Attached patch fixes that (and also corrects comment to reflect
previous fix).
Regards,
--
Paul Pluzhnikov
--- src/x86_64/Gis_signal_frame.c.orig 2008-05-19 17:30:10.000000000 -0700
+++ src/x86_64/Gis_signal_frame.c 2008-05-19 17:35:14.305976000 -0700
@@ -36,10 +36,11 @@ unw_is_signal_frame (unw_cursor_t *curso
unw_addr_space_t as;
unw_accessors_t *a;
void *arg;
- int ret;
+ int ret, validate;
as = c->dwarf.as;
a = unw_get_accessors (as);
+ validate = as->validate;
as->validate = 1; /* Don't trust the ip */
arg = c->dwarf.as_arg;
@@ -47,13 +48,16 @@ unw_is_signal_frame (unw_cursor_t *curso
on x86_64 Linux that is (see libc.so):
48 c7 c0 0f 00 00 00 mov $0xf,%rax
0f 05 syscall
- 66 data16
*/
ip = c->dwarf.ip;
if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0
|| (ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0)
- return 0;
+ {
+ as->validate = validate;
+ return 0;
+ }
+ as->validate = validate;
w1 &= 0xff;
return (w0 == 0x0f0000000fc0c748 && w1 == 0x05);
}
_______________________________________________
Libunwind-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/libunwind-devel