On Fri, Feb 27, 2009 at 09:10:10AM +0100, Mathieu Lacage wrote:
>   - if you want to use the stack protector and split stacks, it should
> be fairly trivial to extend the data structure which contains the stack
> protector with a new field, no ?

The stack protector is just a word, not a pointer.  It's held in a
highly magic location on some platforms, e.g. relative to the thread
base register.  There's not a lot of space there.  It might be
possible to reserve more in coordination with glibc, for glibc
targets.

>   - I understand that you need to copy the function parameters from the
> old stack to the new stack, but, why would you need to invoke the C++
> copy or move constructors for this ? Would a memcpy not be sufficient to
> ensure proper C++ semantics in this case ? An example which shows how a
> memcpy would break might be interesting.

I haven't written C++ in a while, so forgive any obvious gaffes.

class X {
  int x, *y;

  X() {
    y = &x;
  }

  X(X &obj) {
    x = obj.x;
    y = &x;
  }
}

Memcpy that somewhere else and the internal pointer is invalid.

-- 
Daniel Jacobowitz
CodeSourcery

Reply via email to