[MDEV-2576] LP:688404 - pbxt crashes on Windows 64 (misalignment on SSE instruciton) Created: 2010-12-10 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
In Maria 5.2 PBXT crashes directly on startup mysqld.exe!_setjmp() Disassembly reveals sse instruction that requires 16 bit aligment on misaligned address. |
| Comments |
| Comment by Vladislav Vaintroub [ 2010-12-10 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) self = (XTThreadPtr) xt_calloc_ns(sizeof(XTThreadRec)); this returns 8 byte aligned (read 16 byte unaligned) pointer. This structure contains jmp_buf array, for which alignment requirements is 16 byte. When setjmp issues instruction which operates on 16 byte aligned memory, it crashes. |
| Comment by Vladislav Vaintroub [ 2010-12-10 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) #ifdef DEBUG #ifdef DEBUG_MEMORY |
| Comment by Vladislav Vaintroub [ 2010-12-10 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) On other platforms, where debug malloc functionality does not exist (are there any?) it could make sense to ensure 16 byte alignment too, just in case some SSE functionality is used |
| Comment by Vladimir Kolesnikov (Inactive) [ 2010-12-10 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) thanks for the report. Regarding _WIN32 - irc it's defined for 64 bit code as well. MS docs confirm this: http://msdn.microsoft.com/en-us/library/b0084kay%28VS.80%29.aspx so does the #ifdef fix really work? BR, |
| Comment by Vladislav Vaintroub [ 2010-12-10 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) As I see it there are 2 approaches to fix it a) looks more labor-intensive, b) looks simpler I'll attach a patch demostrating b) |
| Comment by Vladislav Vaintroub [ 2010-12-10 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) |
| Comment by Vladislav Vaintroub [ 2010-12-10 ] |
|
ensure jmp_buf is on stack (for proper alignment) |
| Comment by Vladimir Kolesnikov (Inactive) [ 2010-12-13 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) thanks for your patch, however may I ask you to try something else (I don't have a 64-bit windows setup, so I cannot try it myself). The idea is to force alignment of the jump buffer. Paul suggested that if we put jmp_buf into a union with an integer that should force the whole union to be aligned. Here;s the patch: === modified file 'src/thread_xt.h'
typedef struct XTCallStack { Can you try it please? |
| Comment by Vladislav Vaintroub [ 2010-12-13 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) That is, on stack, or global variable static memory will work ok. The problem is only that if you malloc/calloc(or PBXT debug malloc) memory, it is not guaranteed to be 16 bytes aligned, and you patch does not address it at all. Is there anybody in PBXT who has a working Win64 setup? Can you use trials (there is an iso of both windows and visual studio expensive editions freely downloadable, yet timebombed) |
| Comment by Vladislav Vaintroub [ 2011-02-04 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) |
| Comment by Vladislav Vaintroub [ 2011-02-04 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) |
| Comment by Vladislav Vaintroub [ 2011-06-14 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) |
| Comment by Vladimir Kolesnikov (Inactive) [ 2011-06-16 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) I added an aligner to PBXT memory debugging structure, so that now PBXT debug malloc now works fine in 86x64 mode (see the linked lp:pbxt branch). If you're going to merge it to Maria I can push Maria branch with the fix. |
| Comment by Rasmus Johansson (Inactive) [ 2011-06-16 ] |
|
Launchpad bug id: 688404 |
| Comment by Vladislav Vaintroub [ 2011-06-16 ] |
|
Re: pbxt crashes on Windows 64 (misalignment on SSE instruciton) |