public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] s390: fix stack frame handling in _dl_runtime_profile.
Date: Mon, 03 Nov 2008 12:45:00 -0000	[thread overview]
Message-ID: <1225715759.24817.6.camel@localhost> (raw)

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)


             reply	other threads:[~2008-11-03 12:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03 12:45 Martin Schwidefsky [this message]
2008-11-07 15:35 ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1225715759.24817.6.camel@localhost \
    --to=schwidefsky@de.ibm.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).