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]

Problems on Itanium: Found the Cause, What's Next?

Hi, All!
This message is related to my previous post about diff crashing on Itanium, Windows Server 2003 
( During debugging I found out that the problem is in 
CreateFileMapping/MapViewOfFileEx behavior on this particular platform. Somehow these functions return OK status but 
when you try to write something to the area allocated, everything crashes down. The following is the illustration of 
the problem:

int main(int argc, char* argv[])
	void *base = NULL;

    __try {
		sec_none.nLength = sizeof(sec_none);
		sec_none.bInheritHandle = TRUE;
		sec_none.lpSecurityDescriptor = NULL;

		int len = 16 * 1024;

		h = CreateFileMapping(INVALID_HANDLE_VALUE, &sec_none, PAGE_WRITECOPY,
				0, len, NULL);

		if (!h) {
			printf(\"FAIL: CreateFileMapping(...)\\n\");
			return -1;

		printf(\"PASS: CreateFileMapping(...)\\n\");

		base = MapViewOfFile(h, FILE_MAP_COPY, 0, 0, len);

		if (!base) {
			printf(\"FAIL: MapViewOfFile(...)\\n\");
			return -1;

		printf(\"PASS: MapViewOfFile(...), base = 0x%08x\\n\", base);

		int tmp;
		tmp = *((int*)base);
		printf(\"PASS: Reading memory\\n\");

		*((int*)base) = tmp;
		printf(\"PASS: Writing memory\\n\");

	__finally {
		if (base) {
			base = NULL;

		if (h) {
			h = NULL;

	return 0;

If you compile this code with 32-bit compiler and then run it on 64-bit Server 2003 it will crash. At the same time it 
works on 32-bit machines.

So the questions is to cygwin developers: what can be done next? I\'ve found file with particular platforms 
capability descriptions. I\'ve tried to set has_working_copy_on_write to false when IsWow64Process return true and it 
seems to work, but how can I be sure that I didn\'t break anything else? Are there any tests or something? And generally 
is this fix OK? Which drawbacks can it have? If the fix is OK - let me know, I will provide a patch.

Unsubscribe info:
Problem reports:

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