Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 28 Sep 2004 16:32:13 +0400 (MSD) Message-Id: <200409281232.i8SCWDab029529@www3.pochta.ru> From: "Alexei Alexandrov" To: MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit X-Proxy-IP: [62.118.80.133] X-Originating-IP: [10.125.25.65, unknown] Subject: 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 (http://cygwin.com/ml/cygwin/2004-09/msg00465.html). 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[]) { HANDLE h = NULL; void *base = NULL; __try { SECURITY_ATTRIBUTES sec_none; 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) { UnmapViewOfFile(base); base = NULL; } if (h) { CloseHandle(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 wincap.cc 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: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/