[LLVMdev] about stackmap intrinsic
marwayusuf at feng.bu.edu.eg
marwayusuf at feng.bu.edu.eg
Sun Nov 16 03:55:28 PST 2014
?Sorry for naiive question but I could not understand the shadow bytes required in the stackmaps.
Regards,
Marwa Yusuf
Teaching Assistant - Computer Engineering Department
Faculty of Engineering - Benha University
E-JUST MSc Student
Computer Science & Engineering Dept.
________________________________
From: Andrew Trick <atrick at apple.com>
Sent: Saturday, June 28, 2014 7:37 PM
To: marwayusuf at feng.bu.edu.eg
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] about stackmap intrinsic
On Jun 28, 2014, at 4:24 AM, marwayusuf at feng.bu.edu.eg<mailto:marwayusuf at feng.bu.edu.eg> wrote:
Dear All
My MSc was about implementing some kind of On stack replacement in LLVM to enhance security by obfuscating running code periodically.
I've tried to implement this job in JIT, but I couldn't. So I implemented it in interpreter, as an initial step.
However, now I'm trying to make it in JIT.
My first step is to extract function state at an arbitrary point. So, I interrupt function at any point (from within JIT) and pause to extract state. My problem now is with state.
By searching I found about stackmap new intrinsic. I got idea about what it does and I think it may help greatly in my task. However, I could not find any source about how to use it exactly, specially, how to retrieve information stored in a stackmap. I'm not understanding the concept of intrinsics very well.? Again, I tried to find any source that explains how intrinsic work, but I couldn't.
So, any help will be greatly appreciated.
http://llvm.org/docs/StackMaps.html
The format of the stackmap section is defined in include/CodeGen/StackMaps.h. You currently have to intercept calls to RTDyldMemoryManager to find the stackmap section.
The intrinsics and stackmap format will probably change again before the next LLVM release.
You cannot arbitrarily stop a thread running compiled code and extract the state. You have to patch the code so that it calls back to your runtime at a known location. The stackmap intrinsic can be useful if you want to destrcutively patch the code and don't want control to resume in the JITed function. The patchpoint intrinsic works if you want to patch into the runtime and return back to the JIT function.
-Andy
Regards,
Marwa Yusuf
Teaching Assistant - Computer Engineering Department
Faculty of Engineering - Benha University
E-JUST MSc Student
Computer Science & Engineering Dept.
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu<http://llvm.cs.uiuc.edu/>
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141116/99667b5b/attachment.html>
More information about the llvm-dev
mailing list