{"action":"created","issue":{"url":"https://api.github.com/repos/PCSX2/pcsx2/issues/818","labels_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/818/labels{/name}","comments_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/818/comments","events_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/818/events","html_url":"https://github.com/PCSX2/pcsx2/pull/818","id":106187246,"number":818,"title":"Linux: Fix segmentation fault with the new libstdc++ ABI.","user":{"login":"micove","id":1458001,"avatar_url":"https://avatars.githubusercontent.com/u/1458001?v=3","gravatar_id":"","url":"https://api.github.com/users/micove","html_url":"https://github.com/micove","followers_url":"https://api.github.com/users/micove/followers","following_url":"https://api.github.com/users/micove/following{/other_user}","gists_url":"https://api.github.com/users/micove/gists{/gist_id}","starred_url":"https://api.github.com/users/micove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micove/subscriptions","organizations_url":"https://api.github.com/users/micove/orgs","repos_url":"https://api.github.com/users/micove/repos","events_url":"https://api.github.com/users/micove/events{/privacy}","received_events_url":"https://api.github.com/users/micove/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/PCSX2/pcsx2/labels/OS:%20Linux","name":"OS: Linux","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-12T22:05:21Z","updated_at":"2015-09-13T16:38:13Z","closed_at":"2015-09-13T04:31:09Z","pull_request":{"url":"https://api.github.com/repos/PCSX2/pcsx2/pulls/818","html_url":"https://github.com/PCSX2/pcsx2/pull/818","diff_url":"https://github.com/PCSX2/pcsx2/pull/818.diff","patch_url":"https://github.com/PCSX2/pcsx2/pull/818.patch"},"body":"I was avoiding doing actual coding but someone actually reported #780 to the Debian tracker so might as well fix it.\r\n\r\nWell valgrind is happier now it goes from \r\n```\r\n==30213== HEAP SUMMARY:\r\n==30213==     in use at exit: 1,532,472 bytes in 25,224 blocks\r\n==30213==   total heap usage: 567,811 allocs, 542,587 frees, 62,842,710 bytes allocated\r\n==30213== \r\n==30213== LEAK SUMMARY:\r\n==30213==    definitely lost: 15,220 bytes in 59 blocks\r\n==30213==    indirectly lost: 78,648 bytes in 4,708 blocks\r\n==30213==      possibly lost: 15,408 bytes in 472 blocks\r\n==30213==    still reachable: 1,294,096 bytes in 19,254 blocks\r\n==30213==         suppressed: 0 bytes in 0 blocks\r\n==30213== Rerun with --leak-check=full to see details of leaked memory\r\n==30213== \r\n==30213== For counts of detected and suppressed errors, rerun with: -v\r\n==30213== Use --track-origins=yes to see where uninitialised values come from\r\n==30213== ERROR SUMMARY: 12418 errors from 304 contexts (suppressed: 0 from 0)\r\n```\r\n\r\nto\r\n\r\n```\r\n==22778== HEAP SUMMARY:\r\n==22778==     in use at exit: 2,165,700 bytes in 33,188 blocks\r\n==22778==   total heap usage: 1,895,286 allocs, 1,862,098 frees, 173,096,604 bytes allocated\r\n==22778== \r\n==22778== LEAK SUMMARY:\r\n==22778==    definitely lost: 17,546 bytes in 108 blocks\r\n==22778==    indirectly lost: 89,751 bytes in 5,371 blocks\r\n==22778==      possibly lost: 26,946 bytes in 880 blocks\r\n==22778==    still reachable: 1,819,317 bytes in 25,785 blocks\r\n==22778==         suppressed: 0 bytes in 0 blocks\r\n==22778== Rerun with --leak-check=full to see details of leaked memory\r\n==22778== \r\n==22778== For counts of detected and suppressed errors, rerun with: -v\r\n==22778== Use --track-origins=yes to see where uninitialised values come from\r\n==22778== ERROR SUMMARY: 133 errors from 6 contexts (suppressed: 0 from 0)\r\n```\r\n\r\nI'm surprised that the Windows code diverged enough that they can use the wx2.8 path. Not sure what they did.\r\n\r\nThe last ~133 errors from 6 contexts are impressively resilient.\r\n- 5 are Conditional jump or move depends on uninitialised value(s) which I hope are fixed by the coverity PR so I have not looked at them.\r\n- Invalid read of size 1 which is most likely another pointer going out of scope issue.\r\n\r\n```\r\n=22778== Invalid read of size 1\r\n==22778==    at 0x8361CFD: _aligned_realloc(void*, unsigned int, unsigned int) (in /usr/games/PCSX2)\r\n==22778==    by 0x836B32E: format_that_unicode_mess(ScopedAlignedAlloc<char, 16u>&, unsigned int, wchar_t const*, char*) [clone .constprop.38] (in /usr/games/PCSX2)\r\n==22778==    by 0x836B55C: FastFormatUnicode::WriteV(wchar_t const*, char*) (in /usr/games/PCSX2)\r\n==22778==    by 0x836472A: IConsoleWriter::FormatV(wchar_t const*, char*) const (in /usr/games/PCSX2)\r\n==22778==    by 0x836485E: IConsoleWriter::WriteLn(wchar_t const*, ...) const (in /usr/games/PCSX2)\r\n==22778==    by 0x80BD99C: SysLogMachineCaps() (in /usr/games/PCSX2)\r\n==22778==    by 0x81BD581: Pcsx2App::AllocateCoreStuffs() (in /usr/games/PCSX2)\r\n==22778==    by 0x81C0BC4: Pcsx2App::OnInit() (in /usr/games/PCSX2)\r\n==22778==    by 0x413B145: wxEntry(int&, wchar_t**) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)\r\n==22778==    by 0x413B1E2: wxEntry(int&, char**) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)\r\n==22778==    by 0x81C391C: main (in /usr/games/PCSX2)\r\n==22778==  Address 0x612a610 is 0 bytes after a block of size 512 alloc'd\r\n==22778==    at 0x402B554: memalign (vg_replace_malloc.c:760)\r\n==22778==    by 0x8361CBE: _aligned_malloc(unsigned int, unsigned int) (in /usr/games/PCSX2)\r\n==22778==    by 0x836FACA: Threading::BaseTlsVariable<FastFormatBuffers>::GetPtr() const (in /usr/games/PCSX2)\r\n==22778==    by 0x836B9D0: GetFormatBuffer(bool&) (in /usr/games/PCSX2)\r\n==22778==    by 0x836BA72: FastFormatUnicode::FastFormatUnicode() (in /usr/games/PCSX2)\r\n==22778==    by 0x836437A: IConsoleWriter::FormatV(char const*, char*) const (in /usr/games/PCSX2)\r\n==22778==    by 0x83644BE: IConsoleWriter::WriteLn(char const*, ...) const (in /usr/games/PCSX2)\r\n==22778==    by 0x81C0886: Pcsx2App::OnInit() (in /usr/games/PCSX2)\r\n==22778==    by 0x413B145: wxEntry(int&, wchar_t**) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)\r\n==22778==    by 0x413B1E2: wxEntry(int&, char**) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)\r\n==22778==    by 0x81C391C: main (in /usr/games/PCSX2)\r\n```\r\n\r\nIt's probably here\r\n```\r\nvoid* __fastcall _aligned_malloc(size_t size, size_t align)\r\n{\r\n\tpxAssert( align < 0x10000 );\r\n#if defined(__USE_ISOC11) && !defined(ASAN_WORKAROUND) // not supported yet on gcc 4.9\r\n\treturn aligned_alloc(align, size);\r\n#else\r\n\tvoid *result = 0;\r\n\tposix_memalign(&result, align, size);\r\n\treturn result;\r\n#endif\r\n}\r\n```\r\ni changed \r\n```\r\n\tvoid *result = 0;\r\n\tposix_memalign(&result, align, size);\r\n\treturn result;\r\n```\r\nto \r\n```\r\n       memalign(align, size);\r\n```\r\n\r\nBut still the error. I think glibc defines __USE_ISOC11 so I'm probably still getting the error because I'm touching the wrong side of the ifdef."},"comment":{"url":"https://api.github.com/repos/PCSX2/pcsx2/issues/comments/139893435","html_url":"https://github.com/PCSX2/pcsx2/pull/818#issuecomment-139893435","issue_url":"https://api.github.com/repos/PCSX2/pcsx2/issues/818","id":139893435,"user":{"login":"turtleli","id":10976277,"avatar_url":"https://avatars.githubusercontent.com/u/10976277?v=3","gravatar_id":"","url":"https://api.github.com/users/turtleli","html_url":"https://github.com/turtleli","followers_url":"https://api.github.com/users/turtleli/followers","following_url":"https://api.github.com/users/turtleli/following{/other_user}","gists_url":"https://api.github.com/users/turtleli/gists{/gist_id}","starred_url":"https://api.github.com/users/turtleli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/turtleli/subscriptions","organizations_url":"https://api.github.com/users/turtleli/orgs","repos_url":"https://api.github.com/users/turtleli/repos","events_url":"https://api.github.com/users/turtleli/events{/privacy}","received_events_url":"https://api.github.com/users/turtleli/received_events","type":"User","site_admin":false},"created_at":"2015-09-13T16:38:13Z","updated_at":"2015-09-13T16:38:13Z","body":"I think the extra parameter approach would be best. I'll work on it."}}