This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]


Hi Cygwin friends and users,

I released another TEST version of Cygwin.  The version number is

This test release needs some more good testing!

While the changes are still mostly interesting for developers, the
under-the-hood changes will potentially impact existing applications.

I'd like to release 2.1.0-1 end of next week, if possible.

==================================== tl;dr ==================================

What's new:

- Handle pthread stacksizes as in GLibc:  Default to RLIMIT_STACK resource.
  Allow to set RLIMIT_STACK via setrlimit.  Default RLIMIT_STACK to value
  from executable header as described on
  Default stacksize to 2 Megs in case RLIMIT_STACK is set to RLIM_INFINITY.

- First cut of an implementation to allow signal handlers running on an
  alternate signal stack.
- New API sigaltstack, plus definitions for SA_ONSTACK, SS_ONSTACK, SS_DISABLE,

- New API: sethostname.

Bug Fixes

- Enable non-SA_RESTART behaviour on threads other than main thread.

- Try to handle concurrent close on socket more gracefully

- Fix fork failing after the parent recovered from a stack overflow.

- Fix a crash on 64 bit XP/2003 when opening /proc/$PID/maps.

- Apparently on some Windows systems timezones differ in case
  from the standard.  Fix the tzset tool to check case-insensitive.


Changes compared to the previous test release:

o tzset now checks for timezone strings case-insensitve since,
  apparently, on some Windows systems the case differs from the

o Workaround a problem calling certain Cygwin functions from a signal
  handler running on an alternate signal stack:

  Some Cygwin functions may SEGV in a deliberate way, usually when
  testing invalid object pointers for validity, but the functions are
  supposed to recover from that and, for instance, return an EFAULT

  The problem here is, when running on the alternate stack, the 64 bit
  Windows exception handling will treat the alternate stack as
  "corrupted" and not call SEH handlers.  The workaround adds a
  vectored continuation handler to pick up the slack.

o Child stack allocation after fork has been rearranged.  It should
  be functional identical to the old version with a single change:

  If the stack you give to pthread_attr_setstack has been allocated
  with Windows functions, a subsequent fork will now very certainly

  This functionality was partially broken for a longer time and nobody
  complained.  It's also hard to argue why a POSIX application using
  POSIX calls like pthread_attr_setstack should use, e.g, VirtualAlloc
  to allocate a pthread stack.  Use POSIX functions instead, e.g,
  malloc, mmap.

o Change how the child stack after fork gets extended to the size of
  the parent stack.  The old method poked into the stack in 4K steps
  to move the guardpage up and let the system commit the stack page-wise.
  The new method is to call VirtualAlloc to set up the stack in two
  simple steps.

Implementation details:

- The alternate signal stack installed via sigaltstack is only valid for
  the current thread.  Each thread must call its own sigaltstack.  On
  pthread_create, the alternate signal stack setting of the calling
  thread is *not* propagated to the newly created thread.  This follows
  current Linux semantics.

- The alternate signal stack is a minimal stack.  Certain datastructures
  used by Cygwin (_cygtls area) and Windows (on 32 bit: exception
  records) are not copied over to the alternate signal stack.  The stack
  settings in the Thread Environment Block (TEB) are not reflecting the
  current alternate stack while running the signal handler.  The TEB
  will still point to the original thread stack.  This seems to work
  nicely in my testing, but there may be Windows functions which stop
  working in this scenario.

- The volatile registers and the original stack registers are stored at
  the base of the alternate stack.  If you screw this up while running
  the signal handler, your thread is doomed on return to the caller.

I'd be grateful if curious developers would give this new sigaltstack
implementation and the changed RLIMIT_STACK handling a whirl and report
back if it's working for them as desired/expected.  And if not, simple
reproducers in plain C are most welcome in this case.  Discussing
aspects of this implementation may be best handled on the
cygwin-developers mailing list or the #cygwin-developers IRC channel on

Have fun,

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]