-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGILL's on ARM32 while using valgrind #33727
Comments
I couldn't add an area label to this Issue. Checkout this page to find out which area owner to ping, or please add exactly one area label to help train me in the future. |
What's wrong with using one register there? The document you've pointed to says:
As for the sub with SP
@dotnet/jit-contrib do we generate |
Hi @janvorli , Thanks for your reply. Concerning to the use of only one register, you are correct about that. But the documentation also points (in the restrictions section):
So, this may lead to two possibilities:
Thanks. |
@igorsnunes ah, I've missed the restrictions section. I guess the case of LDMIA with one register in the list is something that works, but is not supported according to the doc, so we should not be emitting that. |
I can look into this, although in the case shown here it looks like that instruction is in native code (unless the symbols are incorrect). |
i'm seeing the same thing:
|
@janvorli As far as I can tell, the JIT will never generate |
I'll investigate. |
Able to repro, here is valgrind on 8Queens.dll
Instruction is same form as first bad instruction in the top comment
This is from Clang. Seems like it comes from heavy use of |
Checked for the Did not try hacking past this to get to the next bug, but will try and do so relatively soon. At any rate, we're unlikely to be able to fix this in 5.0, so will move to future. |
for the illegal arm instruction ldm I reported at #33344. I found a way to reproduce it and actually the illegal ldm instruction is not generated when "jit" but it is generated when compile for "r2r". The following is the detail steps:
dotnet publish -c release -r linux-arm -p:PublishReadyToRun=true
./R2RDump/R2RDump -d -i testlib.dll
You can see the ldm illegal instruction at the above.
That can explain why there is no crash for the same method in my testing if I publish it as non-r2r image.
I think the illegal ldm instruction reported in my case at #33344 is not the same as this one. It is obvious the illegal instruction in my case is generated by our libclrjit.so, but in this case, the illegal instruction is in libcoreclr.so which instructions are generated by Clang/LLVM or injected by some other tools. |
I worked out a POC fix for arm ldm illegal instruction by modifying emitarm.cpp as the below:
before the patch: the arm instructions generated for the method testlib.struct2 testlib.class01.test01(testlib.struct1)
after the patch: the arm instructions generated for the method testlib.struct2 testlib.class01.test01(testlib.struct1)
also wrote a simple program to test calling the R2R test01 method, before the POC patch, could see the crash caused by illegal instruction, after the POC patch, it works without any problem calling into the R2R test01 method. |
@oldzhu thanks. You might consider using ``` blocks in your text above to fix the formatting. |
Thanks Dan! I fixed.. |
Hi all,
I am currently debugging an application with valgrind in a raspberry pi and I came across some "Illegal Instructions" issues on "libcoreclr.so".
Not sure if these instructions are actually being executed, however, as they are being detected by valgrind, an "Illegal Instruction" signal is being raised.
See the messages below:
The first one concerns to sub.w instruction: SP is being used in Rd position and r8 in Rn (according to the ISA, if SP is being used as Rd, SP should also be in Rn, see http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABFFEJF.html).
done.
0x04000a30 in _start () from /lib/ld-linux-armhf.so.3
(gdb) c
Continuing.
[New Thread 17257]
Thread 1 received signal SIGILL, Illegal instruction.
0x05f837fe in _DacGlobals::InitializeEntries(unsigned int) () from /home/pi/workspace-00032/edge/libcoreclr.so
(gdb) x/i $pc
0x5f837ff <_ZN11_DacGlobals17InitializeEntriesEj+3262>: sub.w sp, r8, #80 ; 0x50
I managed to bypass this SIGILL by patching valgrind, explicitly allowing this constraint (this probably shouldn`t be done). However, another SIGILL was raised, but this time it was located elsewhere.
(gdb) c
Continuing.
[New Thread 4291]
Thread 1 received signal SIGILL, Illegal instruction.
0x23f7d48e in ?? ()
(gdb) x/i $pc
0x23f7d48f: ldmia.w sp!, {lr}
(gdb)
Apparently, this one concerns to the use of only one register in the register list in instruction LDMIA. For more information, see: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489g/Cihcadda.html.
I wonder if these instructions are being emmited by the JIT compiler, or maybe this is a CLANG issue.
Thanks in advance!
PS:
more info about my environment:
First, I am running a container to publish my app. The app publishing process is located in build.sh.
docker run -v %ProductContainersFolder%:/product_containers --rm mcr.microsoft.com/dotnet/core/sdk:3.1 bash /product_containers/build.sh
The "dotnet publish" command is described below:
dotnet publish -c Release --framework netcoreapp3.1 -r linux-arm --self-contained yes --output .....
After publishing the app, I`m copying the whole environment (app+runtime+libs including libcoreclr.so) to my raspberry to run it there.
It's important to note that, if I don`t use valgrind, my application runs without problems on raspberry.
category:correctness
theme:codegen
skill-level:beginner
cost:small
The text was updated successfully, but these errors were encountered: