Segmentation violation detected on run - matlab

I'm new to MATLAB and I get the following crash information when running GISTIC2 based on MCR. No problem running that algorithm in other machine we are using.
------------------------------------------------------------------------
Segmentation violation detected at Thu Jul 8 23:01:05 2021
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Current Visual : 0x21 (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.31 stable
MATLAB Architecture: glnxa64
MATLAB Root : /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83
MATLAB Version : 8.3.0.532 (R2014a)
Operating System : Linux 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64
Processor ID : x86 Family 143 Model 96 Stepping 1, AuthenticAMD
Virtual Machine : Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (12009000), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Register State (from fault):
RAX = 0000000000000000 RBX = 00007f7790b2c190
RCX = 0000000000000000 RDX = 0000000000000000
RSP = 00007f77f2becde8 RBP = 00007f77ec0376c0
RSI = 000000003e07c725 RDI = 0000000000000000
R8 = 0000000000000007 R9 = 00312d3634363031
R10 = 00007f77f2becc70 R11 = 0000000000000000
R12 = 0000000000000000 R13 = 00007f77f2bed180
R14 = 0000000000000000 R15 = 0000000000000000
RIP = 00007f7807063675 EFL = 0000000000010283
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007f7807063675 /lib/x86_64-linux-gnu/libc.so.6+01619573
[ 1] 0x00007f77f588ec18 /lib/x86_64-linux-gnu/libX11.so.6+00134168 XLoadQueryFont+00000056
[ 2] 0x00007f77f870adf0 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwuix.so+00261616
[ 3] 0x00007f77f870baae /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwuix.so+00264878
[ 4] 0x00007f77f870bd29 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwuix.so+00265513
[ 5] 0x00007f77f8e5d143 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00663875 _Z21wm_SetUnadjWindowFontP10WinRec_tagP6mxFont+00000083
[ 6] 0x00007f77f8e5d74b /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00665419 _Z22wm_GetDeviceFontExtentP10WinRec_tagP6mxFontPKcdP6mwrect+00000315
[ 7] 0x00007f77f8e78fff /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00778239 uiGetDeviceFont+00000815
[ 8] 0x00007f77f8e79171 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00778609 _Z15uiSetWindowFontP10WinRec_tagP6mxFont+00000017
[ 9] 0x00007f77f8e5d013 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00663571 _Z16wm_SetWindowFontP10WinRec_tagP6mxFont+00000083
[ 10] 0x00007f77a5d81195 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05001621
[ 11] 0x00007f77f8e9489d /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00891037 _ZN11gui_objects10tickpicker12nicefyLimitsERNS0_14AxisDescriptorENS0_8AxisTypeE+00000173
[ 12] 0x00007f77f8e94cc3 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwgui.so+00892099 _ZN11gui_objects10tickpicker12nicefyLimitsERNS0_14AxisDescriptorE+00000019
[ 13] 0x00007f77a5d816d9 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05002969
[ 14] 0x00007f77a5ce57df /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+04364255
[ 15] 0x00007f77a5cd0b1f /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+04279071
[ 16] 0x00007f77a5dd4740 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05343040
[ 17] 0x00007f77a5dd427c /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05341820
[ 18] 0x00007f77a5dc72b0 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05288624
[ 19] 0x00007f77f746bded /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwudd.so+00634349
[ 20] 0x00007f77f7465153 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwudd.so+00606547 _ZN11UDInterface15notifyPropEventEP16UDDatabaseClientPK10UDPropInfoPK11UDEventInfoP7UDEvent+00000115
[ 21] 0x00007f77f7468671 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwudd.so+00620145 _ZN11UDInterface4setEEP16UDDatabaseClientP10UDPropInfoPvP13UDErrorStatus+00000593
[ 22] 0x00007f77a5dd15b6 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05330358
[ 23] 0x00007f77a5dcbadd /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05307101
[ 24] 0x00007f77a5dca0d0 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05300432
[ 25] 0x00007f77a5db06f5 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05195509
[ 26] 0x00007f77a5dbdfd0 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05251024
[ 27] 0x00007f77a5db7408 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05223432
[ 28] 0x00007f77a5dbe432 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05252146
[ 29] 0x00007f77a5dc3113 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhg.so+05271827 hgSet+00001107
[ 30] 0x00007f77a6c80742 /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwhgbuiltins.so+00345922
...
[125] 0x00007f77fba703bf /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwmcr.so+00365503
[126] 0x00007f77fba6b28f /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/bin/glnxa64/libmwmcr.so+00344719
[127] 0x00007f78070d3609 /lib/x86_64-linux-gnu/libpthread.so.0+00038409
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.** This crash report has been saved to disk as /home/lcj/matlab_crash_dump.29508-1 **
Segmentation fault (core dumped)
After renaming the libstdc++.so.6 library to libstdc++.so.6.old in ~/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83/sys/os/glnxa64, I got the following crash information.
------------------------------------------------------------------------
Segmentation violation detected at Sat Jul 10 23:22:39 2021
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Current Visual : 0x21 (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.31 stable
MATLAB Architecture: glnxa64
MATLAB Root : /home/lcj/Biosoft/GISTIC2/MATLAB_Compiler_Runtime/v83
MATLAB Version : 8.3.0.532 (R2014a)
Operating System : Linux 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64
Processor ID : x86 Family 143 Model 96 Stepping 1, AuthenticAMD
Virtual Machine : Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (12009000), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Register State (from fault):
RAX = 0000000000000000 RBX = 00007f26c0b99880
RCX = 0000000000000000 RDX = 0000000000000000
RSP = 00007f2720dcede8 RBP = 00007f271c0376c0
RSI = 000000003e07c725 RDI = 0000000000000000
R8 = 0000000000000007 R9 = 00312d3634363031
R10 = 00007f2720dcec70 R11 = 0000000000000000
R12 = 0000000000000000 R13 = 00007f2720dcf180
R14 = 0000000000000000 R15 = 0000000000000000
RIP = 00007f2735246675 EFL = 0000000000010283
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
Caught "std::exception" Exception message is:
FatalException
Error:FatalException
Any clues to solve this errors?

Related

How to set a conditional breakpoint on register's value in windbg?

I wonder if there is a way in windbg to set a breakpoint in all over the code when one of the register get a specific value or point to specific value.
to be more specific, somewhere in the code return "Err". I want to set a breakpoint that whenever EAX or other registers point to somthing like "Err", stop the code.
also I must say that there is no way to find "Err" in disassemblers.
a break point is always tied to an address be it software breakpoint or hardware breakpoint
if you use a memory breakpoint it would be triggered on a page boundary (page_gaurd_violation)
other than that you have to single step
you can try windbgs wt (watch and trace command with a depth argument )
combined with a generic break-point address if You want to watch only eax (the return value of any call )
an example below
os windows 7 sp1 32 bit
windbg version 10.0.16299.15
debuggee calc.exe
generic breakpoint calc!WinMain
command used wt -l 8 -or
before windbg breaks it would have traced around 7500 calls in this depth
>wc -l foo.txt & head foo.txt
7679 foo.txt
0:000> bp calc!WinMain
0:000> wt -l 8 -or
3 0 [ 0] ntdll!LdrpDoDebuggerBreak
11 0 [ 1] ntdll!_SEH_epilog4 eax = 0
4 11 [ 0] ntdll!LdrpDoDebuggerBreak eax = 0
>> No match on ret
4 11 [ 0] ntdll!LdrpDoDebuggerBreak
12 0 [ 0] ntdll!LdrpInitializeProcess
*** ERROR: Module load completed but symbols could not be
1 0 [ 1] ntdll!NtQueryInformationProcess
and you know eax has 88 and you want to check for it you can employ some grep magic like this
>grep -i "eax = .*88" foo.txt
21 0 [ 7] msvcrt!_SEH_prolog4 eax = ef388
21 0 [ 8] KERNELBASE!_SEH_prolog4 eax = ee788
14 0 [ 8] ntdll!RtlpAllocateDebugInfo eax = 2c7b88
21 0 [ 7] ntdll!_SEH_prolog4 eax = ef388
44 0 [ 8] ntdll!RtlAllocateHeap eax = 2c88c0
57 0 [ 8] ntdll!RtlDebugAllocateHeap eax = 2c88c0
3 0 [ 8] ntdll!RtlpAllocateHeap eax = 2c88c0
15 0 [ 8] ntdll!RtlAllocateHeap eax = 2c88c0
6 0 [ 7] ole32!CPageAllocator::CPageAllocator eax = 76b88814
6 0 [ 7] ole32!CPageAllocator::CPageAllocator eax = 76b87688
6 0 [ 7] ole32!CPageAllocator::CPageAllocator eax = 76b86788
3 0 [ 6] ole32!`dynamic initializer for 'arDcomInterfaces'' eax = 76a87988
32 0 [ 8] ole32!_onexit eax = 76a7e88b
31 96 [ 7] ole32!ComVerifierSettings::ComVerifierSettings eax = 76b88aef
104 0 [ 8] ntdll!RtlDebugAllocateHeap eax = 2ca880
11 0 [ 8] ntdll!_SEH_epilog4 eax = 2ca880
33 136 [ 7] ntdll!RtlpAllocateHeap eax = 2ca880
44 169 [ 6] ntdll!RtlAllocateHeap eax = 2ca880
14 0 [ 5] WINMM!WPP_INIT_CONTROL_ARRAY eax = 68d68f88
7 0 [ 8] WINMM!soundPlay eax = ffffffff`f7d0ed88
7 0 [ 8] WINMM!soundPlay eax = ffffffff`fbf886bb
13 0 [ 8] KERNELBASE!GetTickCount eax = 346883
7 0 [ 8] WINMM!soundPlay eax = ffffffff`ff48a886
7 0 [ 8] WINMM!soundPlay eax = 3010388
once you narrow down set specific breaks based on the sample data gathered
here is a specific scenerio you know the error code is 0xc0000034 and you know you dont want NtOpenKey which returns that value but some other api
you can employ some thing like this notic there is only one avast hook which return the error which you can latch on
>grep -i "eax =.*c.*34" foo.txt | grep -v -iE "ntopen|query|Image"
18 0 [ 8] KERNELBASE!BaseGetProcessDllPath eax = 2c634c
51 0 [ 8] KERNELBASE!BasepGetCachedPath eax = 2c634c
18 80 [ 7] KERNELBASE!BaseGetProcessDllPath eax = 2c634c
99 0 [ 8] aswhookx eax = ffffffff`c0000034

Genetic algorithm (using parallel computing) stops when using google random forest as cost function in MATLAB

I'm using random forest (google code) (THIS LINK) as cost function of MATLAB genetic algorithm using MATLAB parallel computing. When I active parallel computing in genetic algorithm, after some hours of processing, parallel computing stops. This is log from temp folder. There isn't any problem when I use genetic algorithm without parallel computing. My MATLAB version is R2016b.
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000000 RBX = 00000000043f9710
RCX = 00000000585b33c0 RDX = 0000000000000001
RSP = 00000000043f8640 RBP = 00000000043f9710
RSI = 000000000000016a RDI = 000000009dc60f10
R8 = 0000000000000000 R9 = 000000009dc60f10
R10 = 000000000000000f R11 = 00000000043f9710
R12 = 0000000000000000 R13 = 0000000089ee3090
R14 = 000000000000127f R15 = 000000000000000f
RIP = 0000000022057b05 EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x0000000022057b05 C:\Users\XXX\Desktop\XB\Code - Tree - new\mexClassRF_train.mexw64+00031493 mexFunction+00000197
[ 1] 0x00000000fc5fc5d1 C:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00116177 mexRunMexFile+00000129
[ 2] 0x00000000fc5fb2e2 C:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00111330 mexFeature_mexver+00001794
[ 3] 0x00000000fc5fa506 C:\Program Files\MATLAB\R2016b\bin\win64\libmex.dll+00107782 mexUnlock+00020182
[ 4] 0x0000000015b646de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 5] 0x0000000015b644b6 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017590 Mfh_file::dispatch_fh+00000062
[ 6] 0x0000000015b65827 C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00022567 Mfunction_handle::dispatch+00001015
[ 7] 0x0000000016a28c29 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00887849 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00798773
[ 8] 0x0000000016a28707 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00886535 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00797459
[ 9] 0x0000000016a274b8 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00881848 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00792772
[ 10] 0x00000000169a9eab C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00368299 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00279223
[ 11] 0x00000000169a9740 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00366400 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00277324
[ 12] 0x0000000016a31d1c C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00924956 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00835880
[ 13] 0x0000000016a31939 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923961 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834885
[ 14] 0x0000000016a31884 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00923780 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00834704
[ 15] 0x0000000015b646de C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00018142 Mfh_file::dispatch_fh_impl+00000434
[ 16] 0x0000000015b644fa C:\Program Files\MATLAB\R2016b\bin\win64\m_dispatcher.dll+00017658 Mfh_file::dispatch_fh_with_reuse+00000062
[ 17] 0x0000000016a25166 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00872806 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00783730
[ 18] 0x00000000169a40b7 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00344247 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00255171
[ 19] 0x00000000169a430a C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00344842 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00255766
[ 20] 0x00000000169f38ea C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00669930 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00580854
[ 21] 0x0000000016b61a56 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+02169430 boost::archive::detail::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >+00001726
[ 22] 0x0000000016b619e9 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+02169321 boost::archive::detail::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >::oserializer<boost::archive::binaryTerm_oarchive,boost::shared_ptr<MathWorks::lxe::MatlabIrTree> >+00001617
[ 23] 0x00000000169f2ca2 C:\Program Files\MATLAB\R2016b\bin\win64\m_lxe.dll+00666786 boost::serialization::singleton<boost::archive::detail::iserializer<boost::archive::binaryTerm_iarchive,ir::IrTree> >::get_instance+00577710
[ 24] 0x0000000015d80123 C:\Program Files\MATLAB\R2016b\bin\win64\m_interpreter.dll+00196899 inCallFcnWithTrapInDesiredWSAndPublishEvents+00000071
[ 25] 0x00000000fcfdcf52 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00315218 iqm::BaseFEvalPlugin::inCallFcnWithTrap+00000066
[ 26] 0x00000000fcfdcb7f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00314239 iqm::BaseFEvalPlugin::execute+00000335
[ 27] 0x0000000015a6ae39 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00306745 mcrRegisterExternalFunction+00035625
[ 28] 0x000000001d2f501e C:\Program Files\MATLAB\R2016b\bin\win64\jmi.dll+00675870 LoadJAWTLibrary+00009438
[ 29] 0x00000000fcfd42fa C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00279290 iqm::Iqm::setupIqmFcnPtrs+00071530
[ 30] 0x00000000fcfd41d3 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00278995 iqm::Iqm::setupIqmFcnPtrs+00071235
[ 31] 0x00000000fcfb95a5 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00169381 iqm::Iqm::deliver+00001045
[ 32] 0x00000000fb5fb545 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00046405 ioReadLine+00000293
[ 33] 0x00000000fb5fb342 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00045890 ioCmdLineEditSave+00019986
[ 34] 0x00000000fb5fb40b C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00046091 ioReadLine+00000107
[ 35] 0x00000000fb609691 C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00104081 mnDebugPrompt+00001521
[ 36] 0x00000000fb6091ba C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00102842 mnDebugPrompt+00000282
[ 37] 0x00000000fb6098fa C:\Program Files\MATLAB\R2016b\bin\win64\libmwbridge.dll+00104698 mnParser+00000410
[ 38] 0x0000000015a56841 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00223297 mcr::runtime::setInterpreterThreadToCurrent+00025585
[ 39] 0x0000000015a557d7 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219095 mcr::runtime::setInterpreterThreadToCurrent+00021383
[ 40] 0x0000000015a55853 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00219219 mcr::runtime::setInterpreterThreadToCurrent+00021507
[ 41] 0x0000000015a56141 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00221505 mcr::runtime::setInterpreterThreadToCurrent+00023793
[ 42] 0x00000000fd01d347 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00578375 iqm::UserEvalPlugin::pre+00030679
[ 43] 0x00000000fd029e7c C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00630396 iqm::UserEvalPlugin::pre+00082700
[ 44] 0x00000000fd017480 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00554112 iqm::UserEvalPlugin::pre+00006416
[ 45] 0x00000000fd02c99a C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00641434 iqm::UserEvalPlugin::pre+00093738
[ 46] 0x00000000fcff9a37 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00432695 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000727
[ 47] 0x00000000fcffa08f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00434319 iqm::PackagedTaskPlugin::execute+00000575
[ 48] 0x00000000fcff9aa9 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00432809 iqm::PackagedTaskPlugin::PackagedTaskPlugin+00000841
[ 49] 0x00000000fcff9f04 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00433924 iqm::PackagedTaskPlugin::execute+00000180
[ 50] 0x00000000fcfd42fa C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00279290 iqm::Iqm::setupIqmFcnPtrs+00071530
[ 51] 0x00000000fcfd41d3 C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00278995 iqm::Iqm::setupIqmFcnPtrs+00071235
[ 52] 0x00000000fcfb9e5a C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00171610 iqm::Iqm::deliver+00003274
[ 53] 0x00000000fcfbad2f C:\Program Files\MATLAB\R2016b\bin\win64\iqm.dll+00175407 iqm::Iqm::deliver+00007071
[ 54] 0x0000000100108173 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01147251 services::system_events::PpeDispatchHook::dispatchOne+00019059
[ 55] 0x000000010010c3a3 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164195 sysq::addProcessPendingEventsUnitTestHook+00001923
[ 56] 0x000000010010c580 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01164672 sysq::addProcessPendingEventsUnitTestHook+00002400
[ 57] 0x000000010010d685 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01169029 sysq::getCondition+00002917
[ 58] 0x000000010010e4b2 C:\Program Files\MATLAB\R2016b\bin\win64\libmwservices.dll+01172658 svWS_ProcessPendingEvents+00000162
[ 59] 0x0000000015a56b7d C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00224125 mcr::runtime::setInterpreterThreadToCurrent+00026413
[ 60] 0x0000000015a5726a C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00225898 mcr::runtime::setInterpreterThreadToCurrent+00028186
[ 61] 0x0000000015a4e385 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00189317 mcr_process_events+00010293
[ 62] 0x0000000015a502d2 C:\Program Files\MATLAB\R2016b\bin\win64\mcr.dll+00197330 mcr_process_events+00018306
[ 63] 0x00000000158fbd0e C:\Program Files\MATLAB\R2016b\bin\win64\MVMLocal.dll+00245006 mvm_server::inproc::LocalFactory::terminate+00070846
[ 64] 0x00000000fa942cd9 C:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01125593 mvm::detail::initLocalMvmHack+00000521
[ 65] 0x00000000fa9432a5 C:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01127077 mvm::detail::SessionImpl::privateSession+00000373
[ 66] 0x00000000fa9434b1 C:\Program Files\MATLAB\R2016b\bin\win64\mvm.dll+01127601 mvm::detail::SessionImpl::privateSession+00000897
[ 67] 0x0000000140006fd5 C:\Program Files\MATLAB\R2016b\bin\win64\MATLAB.exe+00028629
[ 68] 0x0000000140007661 C:\Program Files\MATLAB\R2016b\bin\win64\MATLAB.exe+00030305
[ 69] 0x00007ffbed5c8364 C:\WINDOWS\System32\KERNEL32.DLL+00033636 BaseThreadInitThunk+00000020
[ 70] 0x00007ffbf00970d1 C:\WINDOWS\SYSTEM32\ntdll.dll+00422097 RtlUserThreadStart+00000033
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.

Matlab crashes when plotting specific 3D functions

Matlab crashes (closes) when I try to plot a 3D function of the like z=(x,y), whenever the function involves the following conditions together:
incorrect multiplication and power notation: e.g. x*y^2 instead of x.*y.^2
x,y support grid very small: e.g. meshgrid(0.01:.01:0.99)
For example, the following code doesn't work:
[x,y] = meshgrid(0.01:.01:0.99);
z=x*y^2;
surf(z)
Same happens if I use mesh instead of surf. Normally, you would expect an error about the notation.
It seems to be a bug of Matlab. An automatic crash report contain this:
------------------------------------------------------------------------
Illegal instruction detected at Fri Aug 7 15:59:56 2015
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: ATI Technologies Inc. AMD Radeon HD 8400 / R3 Series Version 4.4.13374 Compatibility Profile Context 15.20.1013
Current Visual : 0x23 (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.19 stable
Host Name : -------
MATLAB Architecture : glnxa64
MATLAB Root : /usr/local/MATLAB/R2015a
MATLAB Version : 8.5.0.197613 (R2015a)
OpenGL : hardware
Operating System : Linux 3.16.0-45-generic #60~14.04.1-Ubuntu SMP Fri Jul 24 21:16:23 UTC 2015 x86_64
Processor ID : x86 Family 127 Model 0 Stepping 1, AuthenticAMD
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (11600000), display :0.0
Fault Count: 4
Abnormal termination:
Illegal instruction
Register State (from fault):
RAX = 00007feb4c01b000 RBX = 00007feb4c01e000
RCX = 0000000000000010 RDX = 00007febabd64e80
RSP = 00007feb20d48400 RBP = 0000000000000018
RSI = 0000000000000000 RDI = 00007feb20d484d0
R8 = 0000000000000400 R9 = 00007feb4c01e000
R10 = 0000000000000948 R11 = 0000000000000318
R12 = 0000000000000020 R13 = 0000000000000018
R14 = 0000000000000040 R15 = 0000000000000020
RIP = 00007feb0bf47e02 EFL = 0000000000010216
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007feb0bf47e02 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30535170 mkl_blas_cnr_def_dgemm_kernel_bdz+00000210
[ 1] 0x00007feb0bf3f665 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30500453 mkl_blas_cnr_def_xdgemm_bdz+00001381
[ 2] 0x00007feb0a4dbe4f /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02829903 mkl_blas_dgemm_2d_bsrc+00000527
[ 3] 0x00007feb0a4d709e /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02810014
[ 4] 0x00007febb8bd3623 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00558627 __kmp_invoke_microtask+00000147
[ 5] 0x00007febb8babf64 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00397156
[ 6] 0x00007febb8baae02 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00392706
[ 7] 0x00007febb8bd38d9 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00559321
[ 8] 0x00007febcd62f182 /lib/x86_64-linux-gnu/libpthread.so.0+00033154
[ 9] 0x00007febcd35c47d /lib/x86_64-linux-gnu/libc.so.6+01025149 clone+00000109
[ 10] 0x0000000000000000 <unknown-module>+00000000
Abnormal termination:
Illegal instruction
Register State (from fault):
RAX = 00007febabd95000 RBX = 00007febabd97000
RCX = 0000000000000010 RDX = 00007febabd64c40
RSP = 00007febb7ea4d00 RBP = 0000000000000018
RSI = 0000000000000000 RDI = 00007febb7ea4dd0
R8 = 0000000000000400 R9 = 00007febabd97000
R10 = 0000000000000948 R11 = 0000000000000318
R12 = 0000000000000020 R13 = 0000000000000018
R14 = 0000000000000040 R15 = 0000000000000020
RIP = 00007feb0bf47e02 EFL = 0000000000010216
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007feb0bf47e02 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30535170 mkl_blas_cnr_def_dgemm_kernel_bdz+00000210
[ 1] 0x00007feb0bf3f665 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+30500453 mkl_blas_cnr_def_xdgemm_bdz+00001381
[ 2] 0x00007feb0a4dbe4f /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02829903 mkl_blas_dgemm_2d_bsrc+00000527
[ 3] 0x00007feb0a4d709e /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02810014
[ 4] 0x00007febb8bd3623 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00558627 __kmp_invoke_microtask+00000147
[ 5] 0x00007febb8babf64 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00397156
[ 6] 0x00007febb8bad26a /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00402026 __kmp_fork_call+00004474
[ 7] 0x00007febb8b8c2e8 /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libiomp5.so+00266984 __kmpc_fork_call+00000200
[ 8] 0x00007feb0a4d6cf0 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02809072
[ 9] 0x00007feb0a4d2db3 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+02792883 mkl_blas_dgemm+00001475
[ 10] 0x00007feb0a9d23b2 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+08033202 mkl_lapack_dgehrd+00001826
[ 11] 0x00007feb0a9d65a2 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+08050082 mkl_lapack_dgeevx+00002706
[ 12] 0x00007feb0a350537 /usr/local/MATLAB/R2015a/bin/glnxa64/mkl.so+01209655 dgeevx_+00000327
[ 13] 0x00007feb32addf04 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+01310468
[ 14] 0x00007feb32adc875 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+01304693
[ 15] 0x00007feb32a6b4a2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+00840866
[ 16] 0x00007feb32a6b83e /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+00841790
[ 17] 0x00007febc217d305 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00557829
[ 18] 0x00007febc2164744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 19] 0x00007febc142bd20 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04189472
[ 20] 0x00007febc13db432 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03859506
[ 21] 0x00007febc13dd612 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03868178
[ 22] 0x00007febc13e3597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 23] 0x00007febc13decff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 24] 0x00007febc13df934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 25] 0x00007febc14552ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 26] 0x00007febc21bbaea /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00813802 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00000762
[ 27] 0x00007febc21bbfb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 28] 0x00007febb52e8edd /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02473693
[ 29] 0x00007febb527e5c2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02037186
[ 30] 0x00007febb527fddf /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02043359
[ 31] 0x00007febb52858e0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02066656
[ 32] 0x00007febb5281053 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02048083
[ 33] 0x00007febb52efbb6 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+02501558
[ 34] 0x00007febb537471b /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+03045147
[ 35] 0x00007febc2164744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 36] 0x00007febb5372451 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcos_impl.so+03036241
[ 37] 0x00007feb32a9737c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmathlinalg.so+01020796
[ 38] 0x00007febc217d305 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00557829
[ 39] 0x00007febc2164744 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00456516 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000244
[ 40] 0x00007febc154dfee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+05378030
[ 41] 0x00007febc147ca71 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04520561
[ 42] 0x00007febc147d7ee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04524014
[ 43] 0x00007febc1489619 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04572697
[ 44] 0x00007febc1489783 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04573059
[ 45] 0x00007febc15c0b54 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+05847892
[ 46] 0x00007febc13dd9b9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03869113
[ 47] 0x00007febc13e3597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 48] 0x00007febc13decff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 49] 0x00007febc13df934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 50] 0x00007febc14552ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 51] 0x00007febc21bbc39 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00814137 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00001097
[ 52] 0x00007febc21bbfb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 53] 0x00007febc142bd20 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04189472
[ 54] 0x00007febc13ac4b3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03667123
[ 55] 0x00007febc13dc6ee /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03864302
[ 56] 0x00007febc13e3597 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03892631
[ 57] 0x00007febc13decff /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03874047
[ 58] 0x00007febc13df934 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03877172
[ 59] 0x00007febc14552ce /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04358862
[ 60] 0x00007febc21bbc39 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00814137 _ZN8Mfh_file16dispatch_fh_implEMS_FviPP11mxArray_tagiS2_EiS2_iS2_+00001097
[ 61] 0x00007febc21bbfb0 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_dispatcher.so+00815024 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000032
[ 62] 0x00007febc1414495 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+04093077
[ 63] 0x00007febc13d4fb9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03833785
[ 64] 0x00007febc13d13f5 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03818485
[ 65] 0x00007febc13d1ad3 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwm_interpreter.so+03820243
[ 66] 0x00007febc30c7b6c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00228204
[ 67] 0x00007febc30c8751 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwbridge.so+00231249 _Z8mnParserv+00000737
[ 68] 0x00007febce7cc3af /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00799663 _ZN11mcrInstance30mnParser_on_interpreter_threadEv+00000031
[ 69] 0x00007febce7ac133 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00667955
[ 70] 0x00007febce7adfd9 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00675801 _ZN5boost6detail11task_objectIvNS_3_bi6bind_tIvPFvRKNS_8functionIFvvEEEENS2_5list1INS2_5valueIS6_EEEEEEE6do_runEv+00000025
[ 71] 0x00007febce7ae9a7 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00678311 _ZN5boost6detail9task_baseIvE3runEv+00000071
[ 72] 0x00007febce7aea07 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00678407
[ 73] 0x00007febce7a9d8a /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00658826
[ 74] 0x00007febc0767a56 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwuix.so+00334422
[ 75] 0x00007febc074f3a2 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwuix.so+00234402
[ 76] 0x00007febcef9af1f /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02621215
[ 77] 0x00007febcef9b08c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02621580
[ 78] 0x00007febcef9cbdf /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02628575
[ 79] 0x00007febcef9d61c /usr/local/MATLAB/R2015a/bin/glnxa64/libmwservices.so+02631196 _Z25svWS_ProcessPendingEventsiib+00000092
[ 80] 0x00007febce7aa408 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00660488
[ 81] 0x00007febce7aa724 /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00661284
[ 82] 0x00007febce796b0d /usr/local/MATLAB/R2015a/bin/glnxa64/libmwmcr.so+00580365
[ 83] 0x00007febcd62f182 /lib/x86_64-linux-gnu/libpthread.so.0+00033154
[ 84] 0x00007febcd35c47d /lib/x86_64-linux-gnu/libc.so.6+01025149 clone+00000109
[ 85] 0x0000000000000000 <unknown-module>+00000000
Abnormal termination
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.
In suggestion from this forum, I submitted a service request. Clearly, I solved my problem by using the correct dot notation. Yet, regardless of any wrong notation, Matlab should not crash. I will update this post once I receive further information and either delete or answer this question.

Reproducible MATLAB System Error (simple code)

I am trying to run the pretty simple code given in file Assignment6.m which can be found here:
https://www.dropbox.com/sh/xs2m0arvv9lxydw/AAA6uLU75R-7Blv7GqOJaNGka?dl=0
however I get a MATLAB System Error under my system (it runs on others though). I reinstalled MATLAB without improvement though. I cannot post code here directly as it involves a small data sample that is given under the link above. Does anyone have an idea? Can you reproduce the error or does it run smooth on your PC? Here is the full error message:
------------------------------------------------------------------------
Illegal instruction detected at Tue Jun 23 10:35:30 2015
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Graphics card 1 : Advanced Micro Devices, Inc. ( 0x1002 ) AMD Radeon(TM) R5 M240 Version 13.302.1101.1004
Graphics card 2 : Advanced Micro Devices, Inc. ( 0x1002 ) AMD Radeon(TM) R5 Graphics Version 13.302.1101.1004
Host Name : Andy
MATLAB Architecture : win64
MATLAB Root : C:\Program Files\MATLAB\R2015a
MATLAB Version : 8.5.0.197613 (R2015a)
OpenGL : hardware
Operating System : Microsoft Windows 8.1
Processor ID : x86 Family 127 Model 48 Stepping 1, AuthenticAMD
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 6.3 (Build 9600)
Fault Count: 1
Abnormal termination:
Illegal instruction
Register State (from fault):
RAX = 000000007cd88000 RBX = 000000007cd91000
RCX = 000000000402d150 RDX = 0000000084e374c0
RSP = 000000000402cf60 RBP = 000000000402e020
RSI = 000000000402e008 RDI = 000000000402e028
R8 = 0000000000001780 R9 = 000000007cd91000
R10 = 0000000000000138 R11 = 0000000000000068
R12 = 00000000000000bc R13 = 000000000000000c
R14 = 000000000000000c R15 = 00000000000000bc
RIP = 00000000b68ea342 EFL = 00010212
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00000000b68ea342 C:\Program Files\MATLAB\R2015a\bin\win64\mkl.dll+26387266 xerbla+23942290
[ 1] 0x00000000b5e639ea C:\Program Files\MATLAB\R2015a\bin\win64\mkl.dll+15350250 xerbla+12905274
[ 2] 0x00000000b5e51ec1 C:\Program Files\MATLAB\R2015a\bin\win64\mkl.dll+15277761 xerbla+12832785
[ 3] 0x00000000b50af9c2 C:\Program Files\MATLAB\R2015a\bin\win64\mkl.dll+00981442 mkl_cbwr_set+00610690
[ 4] 0x00000000b50ab35c C:\Program Files\MATLAB\R2015a\bin\win64\mkl.dll+00963420 mkl_cbwr_set+00592668
[ 5] 0x00000000b4fd9369 C:\Program Files\MATLAB\R2015a\bin\win64\mkl.dll+00103273 dgemm+00000377
[ 6] 0x00000000ee23cfd3 C:\Program Files\MATLAB\R2015a\bin\win64\libmwmathlinalg.dll+00643027 UMFPACK_RealLUFactor::whackSymbolic+00115187
[ 7] 0x00000000ee23e5fe C:\Program Files\MATLAB\R2015a\bin\win64\libmwmathlinalg.dll+00648702 UMFPACK_RealLUFactor::whackSymbolic+00120862
[ 8] 0x00000000ee2c631e C:\Program Files\MATLAB\R2015a\bin\win64\libmwmathlinalg.dll+01205022 ssmult+00110158
[ 9] 0x00000000ee2c61cb C:\Program Files\MATLAB\R2015a\bin\win64\libmwmathlinalg.dll+01204683 ssmult+00109819
[ 10] 0x00000000ee2c652a C:\Program Files\MATLAB\R2015a\bin\win64\libmwmathlinalg.dll+01205546 ssmult+00110682
[ 11] 0x0000000004f52f5e C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00077662 mdLogging::log_function_exit+00000110
[ 12] 0x0000000004f5295c C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00076124 Mfunction_handle::dispatch+00000476
[ 13] 0x000000000510ce2c C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00642604 inPublishWSEvents+00010700
[ 14] 0x000000000509bda6 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00179622 in_is_matlab_function+00124246
[ 15] 0x00000000050cbbea C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00375786 inGetCurrentWS+00147450
[ 16] 0x000000000508f19c C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00127388 in_is_matlab_function+00072012
[ 17] 0x0000000005089f95 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00106389 in_is_matlab_function+00051013
[ 18] 0x000000000515684f C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 19] 0x00000000051567b1 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 20] 0x00000000050cda75 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 21] 0x00000000050cce8c C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 22] 0x00000000050cb6e9 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 23] 0x0000000004f52694 C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[ 24] 0x0000000004f52a7e C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 25] 0x0000000005089597 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00103831 in_is_matlab_function+00048455
[ 26] 0x000000000508a1ab C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00106923 in_is_matlab_function+00051547
[ 27] 0x000000000515684f C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 28] 0x00000000051567b1 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 29] 0x00000000050cda75 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 30] 0x00000000050cce8c C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 31] 0x00000000050cb6e9 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 32] 0x0000000004f52694 C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[ 33] 0x0000000004f52a7e C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 34] 0x0000000005089597 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00103831 in_is_matlab_function+00048455
[ 35] 0x00000000051a31a7 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+01257895 inIsKeyword+00027799
[ 36] 0x000000000508b69a C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00112282 in_is_matlab_function+00056906
[ 37] 0x000000000515684f C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 38] 0x00000000051567b1 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 39] 0x00000000050cda75 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 40] 0x00000000050cce8c C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 41] 0x00000000050cb6e9 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 42] 0x0000000004f52757 C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00075607 Mfh_file::dispatch_fh+00000743
[ 43] 0x0000000004f52a7e C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 44] 0x0000000005089597 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00103831 in_is_matlab_function+00048455
[ 45] 0x00000000051a31a7 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+01257895 inIsKeyword+00027799
[ 46] 0x000000000508b69a C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00112282 in_is_matlab_function+00056906
[ 47] 0x000000000515684f C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 48] 0x00000000051567b1 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 49] 0x00000000050cda75 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 50] 0x00000000050cce8c C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 51] 0x00000000050cb6e9 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 52] 0x0000000004f52757 C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00075607 Mfh_file::dispatch_fh+00000743
[ 53] 0x0000000004f52a7e C:\Program Files\MATLAB\R2015a\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 54] 0x000000000515b268 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00963176 inAnonymousFunction+00000360
[ 55] 0x000000000515b864 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00964708 inAnonymousFunction+00001892
[ 56] 0x000000000515ba25 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00965157 inAnonymousFunction+00002341
[ 57] 0x000000000515b9f2 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00965106 inAnonymousFunction+00002290
[ 58] 0x000000000515b9a7 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00965031 inAnonymousFunction+00002215
[ 59] 0x000000000510f6bd C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00652989 inGetCallersWorkSpace+00001805
[ 60] 0x000000000510854d C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00623949 inEvalCmdWithLocalReturn+00000285
[ 61] 0x0000000005108471 C:\Program Files\MATLAB\R2015a\bin\win64\m_interpreter.dll+00623729 inEvalCmdWithLocalReturn+00000065
[ 62] 0x00000000fb5fe82d C:\Program Files\MATLAB\R2015a\bin\win64\libmwbridge.dll+00059437 mnGetPrompt+00002717
[ 63] 0x00000000fb5ff2a9 C:\Program Files\MATLAB\R2015a\bin\win64\libmwbridge.dll+00062121 mnParser+00000745
[ 64] 0x00000000fd0e13d4 C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00398292 mcrInstance::mnParser_on_interpreter_thread+00000036
[ 65] 0x00000000fd0a9757 C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00169815 mcr::runtime::setInterpreterThreadToCurrent+00019751
[ 66] 0x00000000fd0a9793 C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00169875 mcr::runtime::setInterpreterThreadToCurrent+00019811
[ 67] 0x00000000fd0a9f91 C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00171921 mcr::runtime::setInterpreterThreadToCurrent+00021857
[ 68] 0x00000000fab5d216 C:\Program Files\MATLAB\R2015a\bin\win64\uiw.dll+00512534 UIW_AttachThreadInput+00001270
[ 69] 0x00000000fab5caa5 C:\Program Files\MATLAB\R2015a\bin\win64\uiw.dll+00510629 wsd_to_MSW+00004373
[ 70] 0x00000000fab5cb29 C:\Program Files\MATLAB\R2015a\bin\win64\uiw.dll+00510761 wsd_to_MSW+00004505
[ 71] 0x00007ffa095ebb5a C:\Windows\system32\USER32.dll+00572250 BroadcastSystemMessageExA+00000558
[ 72] 0x00007ffa09563785 C:\Windows\system32\USER32.dll+00014213 MsgWaitForMultipleObjects+00000229
[ 73] 0x00007ffa095637f6 C:\Windows\system32\USER32.dll+00014326 MsgWaitForMultipleObjects+00000342
[ 74] 0x00007ffa09773034 C:\Windows\SYSTEM32\ntdll.dll+00602164 KiUserCallbackDispatcher+00000036
[ 75] 0x00007ffa09562f7a C:\Windows\system32\USER32.dll+00012154 PeekMessageW+00000202
[ 76] 0x00007ffa09567bd3 C:\Windows\system32\USER32.dll+00031699 GetMessageA+00000243
[ 77] 0x00007ffa09567b7f C:\Windows\system32\USER32.dll+00031615 GetMessageA+00000159
[ 78] 0x00000000fab09bdb C:\Program Files\MATLAB\R2015a\bin\win64\uiw.dll+00170971 UIW_ShowMenuItem+00005179
[ 79] 0x00000000fab5db52 C:\Program Files\MATLAB\R2015a\bin\win64\uiw.dll+00514898 UIW_SuspendAttachThreadInput+00000466
[ 80] 0x0000000100122c83 C:\Program Files\MATLAB\R2015a\bin\win64\libmwservices.dll+01256579 services::system_events::PpeDispatchHook::dispatchOne+00032291
[ 81] 0x000000010012e6f5 C:\Program Files\MATLAB\R2015a\bin\win64\libmwservices.dll+01304309 sysq::addProcessPendingEventsUnitTestHook+00005813
[ 82] 0x000000010012e7a0 C:\Program Files\MATLAB\R2015a\bin\win64\libmwservices.dll+01304480 sysq::addProcessPendingEventsUnitTestHook+00005984
[ 83] 0x0000000100130595 C:\Program Files\MATLAB\R2015a\bin\win64\libmwservices.dll+01312149 sysq::getCondition+00004629
[ 84] 0x0000000100131f52 C:\Program Files\MATLAB\R2015a\bin\win64\libmwservices.dll+01318738 svWS_ProcessPendingEvents+00000162
[ 85] 0x00000000fd0aa6ad C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00173741 mcr::runtime::setInterpreterThreadToCurrent+00023677
[ 86] 0x00000000fd0ab31a C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00176922 mcr::runtime::setInterpreterThreadToCurrent+00026858
[ 87] 0x00000000fd0a2f75 C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00143221 mcr_process_events+00007557
[ 88] 0x00000000fd0a4882 C:\Program Files\MATLAB\R2015a\bin\win64\mcr.dll+00149634 mcr_process_events+00013970
[ 89] 0x000000000810b49d C:\Program Files\MATLAB\R2015a\bin\win64\MVMLocal.dll+00177309 mvm_server::inproc::LocalFactory::terminate+00048141
[ 90] 0x00000000fa8fa27a C:\Program Files\MATLAB\R2015a\bin\win64\mvm.dll+00828026 mvm::detail::initLocalMvmHack+00000490
[ 91] 0x00000000fa8fa838 C:\Program Files\MATLAB\R2015a\bin\win64\mvm.dll+00829496 mvm::detail::SessionImpl::privateSession+00000376
[ 92] 0x00000000fa8faa88 C:\Program Files\MATLAB\R2015a\bin\win64\mvm.dll+00830088 mvm::detail::SessionImpl::privateSession+00000968
[ 93] 0x000000014000630d C:\Program Files\MATLAB\R2015a\bin\win64\MATLAB.exe+00025357
[ 94] 0x0000000140007dd0 C:\Program Files\MATLAB\R2015a\bin\win64\MATLAB.exe+00032208
[ 95] 0x00007ffa072e16ad C:\Windows\system32\KERNEL32.DLL+00005805 BaseThreadInitThunk+00000013
[ 96] 0x00007ffa096f5444 C:\Windows\SYSTEM32\ntdll.dll+00087108 RtlUserThreadStart+00000052
If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/
A technical support engineer might contact you with further information.
Thank you for your help.

ld linker script producing huge binary

I'm using binutils-2.21.53.0.1-6.fc16.x86_64.
I have a small object file, hello.o with just enough "stuff" to have contents in all sections:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000000000000 00000040
000000000000005d 0000000000000000 AX 0 0 4
[ 2] .rela.text RELA 0000000000000000 00000808
0000000000000060 0000000000000018 15 1 8
[ 3] .data PROGBITS 0000000000000000 000000a0
0000000000000000 0000000000000000 WA 0 0 4
[ 4] .bss NOBITS 0000000000000000 000000a0
0000000000000053 0000000000000000 WA 0 0 32
[ 5] .rodata PROGBITS 0000000000000000 000000a0
000000000000000f 0000000000000000 A 0 0 1
[ 6] .data.rel.local PROGBITS 0000000000000000 000000b0
0000000000000008 0000000000000000 WA 0 0 8
[ 7] .rela.data.rel.lo RELA 0000000000000000 00000868
0000000000000018 0000000000000018 15 6 8
[ 8] .data.rel PROGBITS 0000000000000000 000000b8
0000000000000008 0000000000000000 WA 0 0 8
[ 9] .rela.data.rel RELA 0000000000000000 00000880
0000000000000018 0000000000000018 15 8 8
[10] .comment PROGBITS 0000000000000000 000000c0
000000000000002d 0000000000000001 MS 0 0 1
[11] .note.GNU-stack PROGBITS 0000000000000000 000000ed
0000000000000000 0000000000000000 0 0 1
[12] .eh_frame PROGBITS 0000000000000000 000000f0
0000000000000058 0000000000000000 A 0 0 8
[13] .rela.eh_frame RELA 0000000000000000 00000898
0000000000000030 0000000000000018 15 12 8
[14] .shstrtab STRTAB 0000000000000000 00000148
0000000000000085 0000000000000000 0 0 1
[15] .symtab SYMTAB 0000000000000000 00000610
00000000000001b0 0000000000000018 16 11 8
[16] .strtab STRTAB 0000000000000000 000007c0
0000000000000045 0000000000000000 0 0 1
If I use -pie and no linker script, the results are as expected:
$ ld -pie -Map hello_pie.map -o hello_pie.elf hello.o
$ ll hello_pie.elf
-rwxrwx---. 1 jreinhart jreinhart 3453 Mar 13 23:44 hello_pie.elf
However, if I include any sort of linker script, the output size explodes:
$ cat 1.ld
SECTIONS
{
}
$ ld -T 1.ld -pie -Map hello_pie.map -o hello_pie.elf hello.o
$ ll hello_pie.elf
-rwxrwx---. 1 jreinhart jreinhart 2100070 Mar 13 23:45 hello_pie.elf
As you can see, this file became huge.
Note that this appears to happen because the .text section insists on starting at offset 0x200000 in the file:
$ readelf -l -S hello_pie.elf
There are 19 section headers, starting at offset 0x200400:
Section Headers:
[Nr] Name Type Address Offset
Size EntSize Flags Link Info Align
[ 0] NULL 0000000000000000 00000000
0000000000000000 0000000000000000 0 0 0
[ 1] .text PROGBITS 0000000000000000 00200000 <--- Why?
000000000000005d 0000000000000000 AX 0 0 4
[ 2] .rodata PROGBITS 000000000000005d 0020005d
000000000000000f 0000000000000000 A 0 0 1
[ 3] .eh_frame PROGBITS 0000000000000070 00200070
0000000000000058 0000000000000000 A 0 0 8
[ 4] .interp PROGBITS 00000000000000c8 002000c8
000000000000000f 0000000000000000 A 0 0 1
[ 5] .dynsym DYNSYM 00000000000000d8 002000d8
0000000000000078 0000000000000018 A 6 2 8
[ 6] .dynstr STRTAB 0000000000000150 00200150
0000000000000014 0000000000000000 A 0 0 1
[ 7] .hash HASH 0000000000000168 00200168
0000000000000028 0000000000000004 A 5 0 8
[ 8] .rela.dyn RELA 0000000000000190 00200190
0000000000000078 0000000000000018 A 5 0 8
[ 9] .data.rel.local PROGBITS 0000000000000208 00200208
0000000000000008 0000000000000000 WA 0 0 8
[10] .data.rel PROGBITS 0000000000000210 00200210
0000000000000008 0000000000000000 WA 0 0 8
[11] .dynamic DYNAMIC 0000000000000218 00200218
00000000000000f0 0000000000000010 WA 6 0 8
[12] .got PROGBITS 0000000000000308 00200308
0000000000000018 0000000000000008 WA 0 0 8
[13] .got.plt PROGBITS 0000000000000320 00200320
0000000000000018 0000000000000008 WA 0 0 8
[14] .bss NOBITS 0000000000000340 00200338
0000000000000053 0000000000000000 WA 0 0 32
[15] .comment PROGBITS 0000000000000000 00200338
000000000000002c 0000000000000001 MS 0 0 1
[16] .shstrtab STRTAB 0000000000000000 00200364
000000000000009a 0000000000000000 0 0 1
[17] .symtab SYMTAB 0000000000000000 002008c0
0000000000000258 0000000000000018 18 19 8
[18] .strtab STRTAB 0000000000000000 00200b18
000000000000004e 0000000000000000 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Elf file type is DYN (Shared object file)
Entry point 0x0
There are 5 program headers, starting at offset 64
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000200040 0x0000000000000000
0x0000000000000118 0x0000000000000118 R E 8
INTERP 0x00000000002000c8 0x00000000000000c8 0x00000000000000c8
0x000000000000000f 0x000000000000000f R 1
[Requesting program interpreter: /lib/ld64.so.1]
LOAD --> 0x0000000000200000 0x0000000000000000 0x0000000000000000
0x0000000000000338 0x0000000000000393 RWE 200000
DYNAMIC 0x0000000000200218 0x0000000000000218 0x0000000000000218
0x00000000000000f0 0x00000000000000f0 RW 8
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 8
This has been happening regardless of the contents of my linker script. Any ideas what's going on?
I ran into this same problem today when learning about linker scripts. SIZEOF_HEADERS was the magic bullet to solve it. Here is my simple source file to build the object I'm linking:
.section .text
.global _start
_start:
mov $1, %eax
mov $8, %ebx
int $0x80
With the following linker script, I get a 2+ MB executable:
SECTIONS
{
. = 0x400000;
.text : { *(.text) }
}
If I add +SIZEOF_HEADERS, as shown below, I get a 568-byte executable:
SECTIONS
{
. = 0x400000 + SIZEOF_HEADERS;
.text : { *(.text) }
}
Per the LD documentation, this function returns the size of the output file's headers. Manually setting the offset to include the header size also yields a 568-byte executable:
SECTIONS
{
. = 0x400078;
.text : { *(.text) }
}
If I move .text even further down, the executable starts to expand. The following yields a 65984-byte executable:
SECTIONS
{
. = 0x410000;
.text : { *(.text) }
}
So basically, from what I can tell, it appears that:
The first output section appears to share a memory page with the output file headers. If the first section overlaps with the headers, LD emits a full page of pad bytes before outputting the first section to avoid a conflict
To fix this, set the output address for the first output section to X + SIZEOF_HEADERS. This is what the built-in linker script for LD does (you can take a look by running "ld --verbose")
Try the following command line option with ld (or gcc):
-z max-page-size=0x1000
By default ld page-aligns input sections. Since your kernel enforces superpages (pages of 2MB = 0x200000 bytes) your .text section gets aligned at offset 0x200000. It seems like a bug in ld as it should use offset 0x0000000 instead (see EDIT below for a possible explanation)
To prevent this alignment which creates a bigger file, you can use the --nmagic flag to ld to prevent it from page-aligning your .text section although it has side effects (it also disables linking against shared libraries). Be careful though to align other sections (.data, .rodata,...) to 2M pages because they can't live in the same page as .text since all these sections require different access bits.
EDIT: thinking about it, we all expect accesses to virtual address 0x00000000 to generate an exception (segfault). To do so, I see two possibilities: either the kernel maps a page with no access rights (r/w/x) or (more likely) it simply doesn't map anything (no page mapped => segfault) and the linker must know that somehow... that could explain why ld skips the first page which is at address zero. This is TBC.