[PATCH] getpid/vfork/raise fix

David Mosberger davidm@napali.hpl.hp.com
Wed Mar 10 17:45:00 GMT 2004


>>>>> On Wed, 10 Mar 2004 15:50:52 +0100, Jakub Jelinek <jakub@redhat.com> said:

  >>  Most scratch registers are _not_ preserved across system calls.
  >> You could spill the register onto the memory stack though.  If it
  >> uses at most 16 bytes, you won't have to adjust the stack pointer
  >> even.

  Jakub> But as soon as you spill something into memory the vfork
  Jakub> child can clobber it and you restore in the parent something
  Jakub> different from what you saved.

How many registers need to be preserved?  Just one?  (Sorry, I could
read the code but I'm a bit preoccupied with other stuff at the
moment.)  If it's just one, I think you could use r11 because that one
is required to be preserved for the light-weight syscall convention.

	--david



More information about the Libc-hacker mailing list