Petrovski, Roman | 29 Jul 16:11 2015

RtlFillMemory fails on block sizes over 0x7fffffff

Hi, just ran into a problem which boils down to the following at least with Windows 7:

char *p = (char*)malloc(0x80000000UL);	//works fine, allocates memory as requested
memset(p, 0, 0x80000000UL);			//Watch process segfault.

The RtlFillMemory either crashes or underfills the buffer depending on the size given.
Looks like internally it treats size as a signed 4-byte integer.

Please apply the patch below or implement an alternative.


From 60ed745b75d16755769653f19882335ef69960dd Mon Sep 17 00:00:00 2001
From: Roman Petrovski <rpetrovski <at>>
Date: Wed, 29 Jul 2015 06:45:45 -0700
Subject: [PATCH] RtlFillMemory fails on block sizes over 0x7fffffff

 winsup/cygwin/ | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/ b/winsup/cygwin/
index 4a7a1b8..7308498 100644
--- a/winsup/cygwin/
+++ b/winsup/cygwin/
 <at>  <at>  -904,17 +904,35  <at>  <at>  err:
 extern "C" void NTAPI RtlFillMemory (PVOID, SIZE_T, BYTE);
 extern "C" void NTAPI RtlCopyMemory (PVOID, const VOID *, SIZE_T);

(Continue reading)

Michael Haubenwallner | 24 Jul 17:43 2015

[PATCH] winsup/cygwin: Protect fork() against dll- and exe-updates.


When starting to port Gentoo Prefix to Cygwin, the first real problem
discovered is that fork() does use the original executable's location
to Create the child's Process, probably finding linked dlls that just
have emerged in the current directory (sth. like /my/prefix/usr/bin),
causing "Loaded different DLL with same basename in forked child" errors.

Diving into the details, I'm coming up with (a patch-draft based on) the
idea to create hardlinks for the binaries-in-use into some cygwin-specific
directory, like \proc\<ntpid>\object\ ('ve seen this name on AIX),
and use these hardlinks instead to create the new child's process.

Thoughts so far?

For now, when <cygroot>\proc\ directory does exist, the patch (roughly) does:

For /bin/bash.exe, cygwin1.dll creates these hardlinks at process startup:
  \proc\<ntpid>\object\bash.exe         -> /bin/bash.exe
  \proc\<ntpid>\object\bash.exe.local      (empty file for dll redirection)
  \proc\<ntpid>\object\cygwin1.dll      -> /bin/cygwin1.dll
  \proc\<ntpid>\object\cygreadline7.dll -> /bin/cygreadline7.dll

And frok::parent then does:

  CreateProcess("\proc\<ntpid>\object\bash.exe", "/bin/bash.exe", ...)

Resulting in another \proc\<ntpid>\object\ directory with same hardlinks.

While attached patch does work so far already, there's a few issues:
(Continue reading)

Jon TURNEY | 5 Jul 20:11 2015

[PATCH] winsup/doc: Add a configure test to find docbook2xtexi

Fedora installs docbook2texi under the name db2x_docbook2texi
Other distros and Cygwin install docbook2texi under the name docbook2x-texi

Add a configure test to find either.

2015-07-05  Jon Turney  <jon.turney <at>>

	* Add check for DOCBOOK2XTEXI
	* configure: Regenerate.

Signed-off-by: Jon TURNEY <jon.turney <at>>
 winsup/doc/ChangeLog    |  6 ++++++
 winsup/doc/  |  2 +-
 winsup/doc/configure    | 44 ++++++++++++++++++++++++++++++++++++++++++++
 winsup/doc/ |  1 +
 4 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index 841bbe2..b452fa9 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
 <at>  <at>  -1,3 +1,9  <at>  <at> 
+2015-07-05  Jon Turney  <jon.turney <at>>
+	* Add check for DOCBOOK2XTEXI
+	* configure: Regenerate.
(Continue reading)

Jeffrey Walton | 1 Jul 03:38 2015

Using g++ and -m32 option on x86_64 broken

Cygwin's GCC responds to the -m32 option, but it causes a compile error:

   expected unqualified-id before ‘__int128’
       inline __int128

If the project does not support the -m32 option, then it should be
removes so that using it causes a compile error.

Below is the changed needed to get through the compile with -m32:

$ diff /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/x86_64-pc-cygwin/bits/c++config.h
< #ifndef __CYGWIN32__      /* -m32 used on x86_64 */
< # define _GLIBCXX_USE_INT128 1
< #endif
> #define _GLIBCXX_USE_INT128 1


And this project really needs a bug tracker...

Jon TURNEY | 22 Jun 16:39 2015

[PATCH 0/5] More cygwin-doc stuff

intro.1 and intro.3 man pages for Cygwin
Cygwin User's Guide and Cygwin API reference .info
A few documentation related cleanups.

Jon TURNEY (5):
  winsup/doc: Create info pages from cygwin documentation
  winsup/doc: Add intro man pages from cygwin-doc
  winsup/doc: Remove 'Usage' prefix from synopses
  winsup/doc: Use xidepend to generate the source list for FAQ targets
    as well
  winsup/doc: Update ancient README about building documentation

 winsup/doc/ChangeLog         |  26 ++++++
 winsup/doc/       |  40 +++++++--
 winsup/doc/README            |  23 +----
 winsup/doc/cygwin-api.xml    |   3 +
 winsup/doc/cygwin-ug-net.xml |   3 +
 winsup/doc/intro.xml         | 196 +++++++++++++++++++++++++++++++++++++++++++
 winsup/doc/ntsec.xml         |  18 +++-
 winsup/doc/utils.xml         |  88 +++++++++----------
 8 files changed, 321 insertions(+), 76 deletions(-)
 create mode 100644 winsup/doc/intro.xml



Jon TURNEY | 17 Jun 14:37 2015

[PATCH 0/5] Generate cygwin-api manpages

This patch set changes the DocBook source XML for the Cygwin API reference to 
use refentry elements, and also generates man pages from that.

Again, note that after this, the chunked html now has a page for each function, 
rather than one containing all functions.

Jon TURNEY (5):
  winsup/doc: Rename cygwin.xsl as html.xsl
  winsup/doc: Generate ANSI rather than K&R style function prototypes
  winsup/doc: Convert cygwin-api function documentation to refentry
  winsup/doc: Make and install cygwin-api function manpages
  winsup/doc: Add man.xsl customization stylesheet

 winsup/doc/ChangeLog                |  28 ++++++
 winsup/doc/              |  31 ++++---
 winsup/doc/cygwin-api.xml           |   6 +-
 winsup/doc/fo.xsl                   |   3 +
 winsup/doc/{cygwin.xsl => html.xsl} |   5 +-
 winsup/doc/logon-funcs.xml          |  59 ++++++++++---
 winsup/doc/man.xsl                  |  13 +++
 winsup/doc/misc-funcs.xml           |  81 +++++++++++++----
 winsup/doc/path.xml                 | 172 +++++++++++++++++++++++++++---------
 9 files changed, 318 insertions(+), 80 deletions(-)
 rename winsup/doc/{cygwin.xsl => html.xsl} (85%)
 create mode 100644 winsup/doc/man.xsl



(Continue reading)

Christian Franke | 16 Jun 18:27 2015

[PATCH] Hide sethostname() in unistd.h

Found during an experimental build of busybox:

The sethostname() prototype in /usr/include/sys/unistd.h is enabled also 
on Cygwin.
It should be disabled because Cygwin does not provide this function.


Attachment (unistd-sethostname.patch): text/x-patch, 750 bytes
Jon TURNEY | 15 Jun 14:36 2015

[PATCH 0/8] Generate utilities manpages

Sorry about the patch-bomb.

Currently, the manpages in the cygwin-doc package are generated by a conversion 
from the DocBook XML by perl scripts with minimal understanding of the markup, 
which gives sub-optimal results.  I've been looking at doing that in a better 

This patch set changes the DocBook source XML for the Cygwin utilities to use 
refentry entities, and also generates man pages from that.

Note that after this, the chunked html now has a page for each utility, rather 
than one containing all utilities.  This probably could be changed back with 
further stylesheet customization, but I'm not sure that's required.

Jon TURNEY (8):
  winsup/doc: Remove tarball target from .PHONY
  winsup/doc: Fix xidepend to handle relative pathnames
  winsup/doc: Some preparatory XML fixes
  winsup/doc: Use fo.xsl to customize PDF generation from DocBook XML
  winsup/doc: Convert utils.xml to using refentry
  winsup/doc: Make it easier to extend xidepend to more targets
  winsup/doc: Make and install manpages for utils
  winsup/doc: Fix an issue with parallel make

 winsup/doc/ChangeLog         |  46 +++
 winsup/doc/       |  40 +-
 winsup/doc/cygwin-ug-net.xml |   1 -
 winsup/doc/cygwin.xsl        |  13 +
 winsup/doc/fo.xsl            |  36 ++
 winsup/doc/utils.xml         | 852 ++++++++++++++++++++++++++++++-------------
(Continue reading)

Jon TURNEY | 10 Jun 14:05 2015

[PATCH] Improve strace to log most Windows debug events

Not sure if this is wanted, but on a couple of occasions recently I have been
presented with strace output which contains an exception at an address in an
unknown module (i.e. not in the cygwin DLL or the main executable), so here is a
patch which adds some more information, including DLL load addresses, to help
interpret such straces.

2015-06-07  Jon Turney  <jon.turney <at>>

	* (proc_child): Log process and thread create and exit,
	and DLL load and unload.
	(GetFileNameFromHandle): New function.
	* (strace.exe): Link against psapi.dll.

Signed-off-by: Jon TURNEY <jon.turney <at>>
 winsup/utils/ChangeLog   |  7 ++++++
 winsup/utils/ |  2 +-
 winsup/utils/   | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index bfdb42a..7561a58 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
 <at>  <at>  -1,3 +1,10  <at>  <at> 
+2015-06-07  Jon Turney  <jon.turney <at>>
+	* (proc_child): Log process and thread create and exit,
+	and DLL load and unload.
+	(GetFileNameFromHandle): New function.
(Continue reading)

Jon TURNEY | 4 Jun 21:55 2015

[PATCH] winsup/doc: Remove ancient unused Makefile rules to make documentation tarball

This used to be used by cygwin-doc to make a tarball which would be used with a
ssh script to run docbook tools on a linux host since they weren't available on
Cygwin or something crazy like that...

2015-06-04  Jon Turney  <jon.turney <at>>

	* Remove ancient unused rules to make a documentation

Signed-off-by: Jon TURNEY <jon.turney <at>>
 winsup/doc/ChangeLog   |  5 +++++
 winsup/doc/ | 11 -----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog
index 0c961fa..05d78a8 100644
--- a/winsup/doc/ChangeLog
+++ b/winsup/doc/ChangeLog
 <at>  <at>  -1,3 +1,8  <at>  <at> 
+2015-06-04  Jon Turney  <jon.turney <at>>
+	* Remove ancient unused rules to make a documentation
+	tarball.
 2015-06-01  Jon Turney  <jon.turney <at>>

 	* ov-ex-unix.xml: Remove unhelpful mention of and inaccurate size
diff --git a/winsup/doc/ b/winsup/doc/
index 8bf86f7..396d9bc 100644
(Continue reading)

Jon TURNEY | 21 May 18:44 2015

[PATCH] Update the estimate of the size of installing everything

Update the estimate of the size of installing everything from "hundreds of
megabytes" to "tens of gigabytes", just in case someone should think it's a
good idea with contemporary hard disk sizes :)

2015-05-21  Jon Turney  <jon.turney <at>>

	* ov-ex-unix.xml: Update the estimate of the size of installing
	* ov-ex-win.xml: Ditto.

Signed-off-by: Jon TURNEY <jon.turney <at>>
 winsup/doc/ov-ex-unix.xml | 2 +-
 winsup/doc/ov-ex-win.xml  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/doc/ov-ex-unix.xml b/winsup/doc/ov-ex-unix.xml
index 75a0ff6..7459381 100644
--- a/winsup/doc/ov-ex-unix.xml
+++ b/winsup/doc/ov-ex-unix.xml
 <at>  <at>  -39,7 +39,7  <at>  <at>  at the Cygwin web site.
 Another option is to install everything by clicking on the
 <literal>Default</literal> field next to the <literal>All</literal>
 category. However, be advised that this will download and install
-several hundreds of megabytes of software to your computer. The best
+several tens of gigabytes of software to your computer. The best
 plan is probably to click on individual categories and install either
 entire categories or packages from the categories themselves.
 After installation, you can find Cygwin-specific documentation in
diff --git a/winsup/doc/ov-ex-win.xml b/winsup/doc/ov-ex-win.xml
(Continue reading)