https://bugs.winehq.org/show_bug.cgi?id=57711
Bug ID: 57711 Summary: The 32-bit wpcap program has a stack leakage issue Product: Wine Version: 10.0-rc5 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wpcap Assignee: wine-bugs@winehq.org Reporter: csumushu@126.com Distribution: ---
Created attachment 77913 --> https://bugs.winehq.org/attachment.cgi?id=77913 test code
I compiled a 32-bit wpcap application using VS2010, and when running this program with Wine, it caused a stack overflow. Therefore, I wrote a test program to print the stack address in the callback function, and I noticed that the address was gradually decreasing. This issue does not occur with the 64-bit program. The test program is included in the attachment.
https://bugs.winehq.org/show_bug.cgi?id=57711
--- Comment #1 from Hans Leidekker hans@meelstraat.net --- Created attachment 77914 --> https://bugs.winehq.org/attachment.cgi?id=77914 patch
Can you try this patch?
https://bugs.winehq.org/show_bug.cgi?id=57711
--- Comment #2 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #1)
Created attachment 77914 [details] patch
Can you try this patch?
This patch resolves the issue. Could you explain how this problem came about? Why do 32-bit and 64-bit programs exhibit different behaviors?
https://bugs.winehq.org/show_bug.cgi?id=57711
--- Comment #3 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #2)
(In reply to Hans Leidekker from comment #1)
Created attachment 77914 [details] patch
Can you try this patch?
This patch resolves the issue. Could you explain how this problem came about? Why do 32-bit and 64-bit programs exhibit different behaviors?
We used the wrong calling convention (CALLBACK maps to 32-bit only __stdcall). It's ignored when building 64-bit, that's why it worked there.
https://bugs.winehq.org/show_bug.cgi?id=57711
--- Comment #4 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #3)
(In reply to mushu from comment #2)
(In reply to Hans Leidekker from comment #1)
Created attachment 77914 [details] patch
Can you try this patch?
This patch resolves the issue. Could you explain how this problem came about? Why do 32-bit and 64-bit programs exhibit different behaviors?
We used the wrong calling convention (CALLBACK maps to 32-bit only __stdcall). It's ignored when building 64-bit, that's why it worked there.
I understand the reason for the behavioral differences between x64 and x32: __stdcall is ignored in ARM and x64 architectures. However, why is __stdcall considered the wrong calling convention? I noticed that many parts of the Wine source code use it.
https://bugs.winehq.org/show_bug.cgi?id=57711
--- Comment #5 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #4)
(In reply to Hans Leidekker from comment #3)
(In reply to mushu from comment #2)
(In reply to Hans Leidekker from comment #1)
Created attachment 77914 [details] patch
Can you try this patch?
This patch resolves the issue. Could you explain how this problem came about? Why do 32-bit and 64-bit programs exhibit different behaviors?
We used the wrong calling convention (CALLBACK maps to 32-bit only __stdcall). It's ignored when building 64-bit, that's why it worked there.
I understand the reason for the behavioral differences between x64 and x32: __stdcall is ignored in ARM and x64 architectures. However, why is __stdcall considered the wrong calling convention? I noticed that many parts of the Wine source code use it.
The callback argument to pcap_loop() (pcap_handler) isn't defined as __stdcall in pcap.h.
https://bugs.winehq.org/show_bug.cgi?id=57711
mushu csumushu@126.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #6 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #5)
(In reply to mushu from comment #4)
(In reply to Hans Leidekker from comment #3)
(In reply to mushu from comment #2)
(In reply to Hans Leidekker from comment #1)
Created attachment 77914 [details] patch
Can you try this patch?
This patch resolves the issue. Could you explain how this problem came about? Why do 32-bit and 64-bit programs exhibit different behaviors?
We used the wrong calling convention (CALLBACK maps to 32-bit only __stdcall). It's ignored when building 64-bit, that's why it worked there.
I understand the reason for the behavioral differences between x64 and x32: __stdcall is ignored in ARM and x64 architectures. However, why is __stdcall considered the wrong calling convention? I noticed that many parts of the Wine source code use it.
The callback argument to pcap_loop() (pcap_handler) isn't defined as __stdcall in pcap.h.
I got it.Thank you.
https://bugs.winehq.org/show_bug.cgi?id=57711
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Resolution|FIXED |--- Status|RESOLVED |REOPENED
--- Comment #7 from Hans Leidekker hans@meelstraat.net --- Let's keep this bug open until the fix is in Wine.
https://bugs.winehq.org/show_bug.cgi?id=57711
Maotong Zhang zmtong1988@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |zmtong1988@gmail.com
--- Comment #8 from Maotong Zhang zmtong1988@gmail.com --- This CALLBACK maps to 32-bit only __stdcall , For 64 bit, this is indeed a problem
https://bugs.winehq.org/show_bug.cgi?id=57711
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |a78be8c5756f0b50f11b5270bf8 | |f7d6ef35a7e2a Status|REOPENED |RESOLVED Resolution|--- |FIXED
--- Comment #9 from Hans Leidekker hans@meelstraat.net --- Fixed by a78be8c5756f0b50f11b5270bf8f7d6ef35a7e2a. Thanks for the bug report!
https://bugs.winehq.org/show_bug.cgi?id=57711
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #10 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 10.1.