[PATCH] s390: fix stack frame handling in _dl_runtime_profile.
Martin Schwidefsky
schwidefsky@de.ibm.com
Mon Nov 3 12:45:00 GMT 2008
Greetings,
a code inspection done by Curtis Taylor found a problem with the stack
pointer handling in _dl_runtime_profile. The stack frame is created with
a "aghi %r15,-160" which is fine but it is removed by a "lr %r15,%r12".
If the stack pointer in %r15 crossed a 4GB boundary with the aghi then
the stack will be off by 4GB after the lr. Not likely to happen but fatal
for the application if it does.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
--
2008-11-03 Martin Schwidefsky <schwidefsky@de.ibm.com>
* sysdeps/s390/s390-64/dl-trampoline.S: use the correct instruction
to remove the stack frame in _dl_runtime_profile.
diff -urpN libc/sysdeps/s390/s390-64/dl-trampoline.S libc-s390/sysdeps/s390/s390-64/dl-trampoline.S
--- libc/sysdeps/s390/s390-64/dl-trampoline.S 2005-07-11 10:54:40.000000000 +0200
+++ libc-s390/sysdeps/s390/s390-64/dl-trampoline.S 2008-11-03 13:24:03.000000000 +0100
@@ -91,7 +91,7 @@ _dl_runtime_profile:
ld %f4,120(%r12)
ld %f6,128(%r12)
basr %r14,%r1 # call resolved function
-0: lr %r15,%r12 # remove stack frame
+0: lgr %r15,%r12 # remove stack frame
cfi_def_cfa_register (15)
lg %r14,32(%r15) # restore registers
lg %r12,24(%r15)
More information about the Libc-hacker
mailing list