public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice))
@ 2007-06-18 16:52 bugzilla at ryancocks dot net
  2007-06-18 17:56 ` [Bug libc/4662] " jakub at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bugzilla at ryancocks dot net @ 2007-06-18 16:52 UTC (permalink / raw)
  To: glibc-bugs

Working recently on ARM i found my this pointer was being corrupted in a method
containing a setjmp.

When exiting the setjmp via the longjmp the this pointer had been incremented.

There was quite a lot of code between where the setjmp and the longjmp were
called, and the this pointer wasn't used for the tail end of that code. Gcc was
clobbering the this pointer when it went out of use, incrementing it to refer to
a member variable.

That behaviour should be prevented with __attribute__((returns_twice)) in the
headers, likewise for vfork, but returns_twice doesn't seem to be specified
anywhere in glibc (cvs.)

I can try and put a test case together, I refrained so far because I'm a little
busy and it seems obvious that the flag needs to be specified. (and perhaps
implemented in gcc too?..)

-- 
           Summary: setjmp doesn't specify __attribute__((returns_twice))
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: bugzilla at ryancocks dot net
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/4662] setjmp doesn't specify __attribute__((returns_twice))
  2007-06-18 16:52 [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice)) bugzilla at ryancocks dot net
@ 2007-06-18 17:56 ` jakub at redhat dot com
  2007-06-19 10:21 ` bugzilla at ryancocks dot net
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at redhat dot com @ 2007-06-18 17:56 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-06-18 17:56 -------
gcc hardcodes this for setjmp, vfork etc. already, are you sure it makes
a difference?
See special_function_p in gcc/calls.c.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=4662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/4662] setjmp doesn't specify __attribute__((returns_twice))
  2007-06-18 16:52 [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice)) bugzilla at ryancocks dot net
  2007-06-18 17:56 ` [Bug libc/4662] " jakub at redhat dot com
@ 2007-06-19 10:21 ` bugzilla at ryancocks dot net
  2007-06-19 10:34 ` jakub at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla at ryancocks dot net @ 2007-06-19 10:21 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From bugzilla at ryancocks dot net  2007-06-19 10:21 -------
Looks like what you say is true, but if I run a build of our codebase with
-save-temps and take a look at the pre-processor output the symbol being called
is '_setjmp'. It looks to me like that gcc code only spots 'setjmp' and
'syscall_setjmp?'

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/4662] setjmp doesn't specify __attribute__((returns_twice))
  2007-06-18 16:52 [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice)) bugzilla at ryancocks dot net
  2007-06-18 17:56 ` [Bug libc/4662] " jakub at redhat dot com
  2007-06-19 10:21 ` bugzilla at ryancocks dot net
@ 2007-06-19 10:34 ` jakub at redhat dot com
  2007-06-19 15:45 ` bugzilla at ryancocks dot net
  2007-08-22  4:04 ` drepper at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at redhat dot com @ 2007-06-19 10:34 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-06-19 10:33 -------
Even _setjmp is considered to return twice:
      /* Disregard prefix _, __ or __x.  */
      if (name[0] == '_')
        {
          if (name[1] == '_' && name[2] == 'x')
            tname += 3;
          else if (name[1] == '_')
            tname += 2;
          else
            tname += 1;
        }


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/4662] setjmp doesn't specify __attribute__((returns_twice))
  2007-06-18 16:52 [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice)) bugzilla at ryancocks dot net
                   ` (2 preceding siblings ...)
  2007-06-19 10:34 ` jakub at redhat dot com
@ 2007-06-19 15:45 ` bugzilla at ryancocks dot net
  2007-08-22  4:04 ` drepper at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: bugzilla at ryancocks dot net @ 2007-06-19 15:45 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From bugzilla at ryancocks dot net  2007-06-19 15:45 -------
I guess I'm going to have to make up that testcase then, and raise this with the
gcc folk instead [as its evidently a compiler bug wrt returns_twice]

Cheers,

r

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libc/4662] setjmp doesn't specify __attribute__((returns_twice))
  2007-06-18 16:52 [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice)) bugzilla at ryancocks dot net
                   ` (3 preceding siblings ...)
  2007-06-19 15:45 ` bugzilla at ryancocks dot net
@ 2007-08-22  4:04 ` drepper at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: drepper at redhat dot com @ 2007-08-22  4:04 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-08-22 04:04 -------
No bug in glibc.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=4662

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-08-22  4:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-18 16:52 [Bug libc/4662] New: setjmp doesn't specify __attribute__((returns_twice)) bugzilla at ryancocks dot net
2007-06-18 17:56 ` [Bug libc/4662] " jakub at redhat dot com
2007-06-19 10:21 ` bugzilla at ryancocks dot net
2007-06-19 10:34 ` jakub at redhat dot com
2007-06-19 15:45 ` bugzilla at ryancocks dot net
2007-08-22  4:04 ` drepper at redhat dot com

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).