From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3579 invoked by alias); 19 Sep 2003 19:19:29 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 3568 invoked from network); 19 Sep 2003 19:19:27 -0000 Received: from unknown (HELO smtp3.libero.it) (193.70.192.127) by sources.redhat.com with SMTP; 19 Sep 2003 19:19:27 -0000 Received: from aldebaran (151.25.181.187) by smtp3.libero.it (7.0.020-DD01) id 3F6035580026E731; Fri, 19 Sep 2003 21:19:18 +0200 Message-ID: <000501c37ee3$5f24a960$8119fea9@aldebaran> From: "fake" To: , Subject: Some bugs Date: Fri, 19 Sep 2003 19:19:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-SW-Source: 2003/txt/msg00089.txt.bz2 I've found a couple of bugs in pthread-win32. I can't tell you the exact source files/lines 'cause my job requires me not to look at the sources, and I found the bugs during the reverse-engineerign of your official binaries (hey, just doin' my job). Anyway: - sched_setscheduler: you never CloseHnalde tyhe handle obtained through OpenProcess: push esi mov esi, [esp+pid] test esi, esi jz short loc_10005795 call ds:GetCurrentProcessId cmp esi, eax jz short loc_10005795 push esi ; dwProcessId push 0 ; bInheritHandle push PROCESS_SET_INFORMATION ; dwDesiredAccess call ds:OpenProcess test eax, eax jnz short loc_10005795 ; <<< leak!! call ds:GetLastError mov esi, eax sub esi, 5 neg esi sbb esi, esi and esi, 2 inc esi call ds:_errno mov [eax], esi or eax, -1 pop esi retn ; ; ------------------------------------------------------------- loc_10005795: mov eax, [esp+policy] test eax, eax jz short loc_100057AE call ds:_errno mov dword ptr [eax], 40 ; ENOSYS or eax, -1 ; failure pop esi retn ; ------------------------------------------------------------- loc_100057AE: xor eax, eax ; success pop esi retn - you seem to be declaring all functions __declspec(dllimport) even for the build of the dll itself. This generates kinda weird binaries, with all functions residing at the lowest offsets of .text and containing just jmps to hugher addresses in the segment. The M$ linker generatse a warning about it ("local name 'XXX' imported", or something like that), and you shouldn't ignore it. Nothing ciritcal, but it just doesn't look right