|To:||Joe Buehler <firstname.lastname@example.org>|
|Subject:||Re: using mprotect to write to .text|
|From:||David Daney <email@example.com>|
|Date:||Tue, 11 Oct 2011 09:36:49 -0700|
|User-agent:||Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:22.214.171.124) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10|
On 10/10/2011 01:02 PM, Joe Buehler wrote:
I intend to use mprotect in a running binary to allow it to modify its .text section. The detailed behavior of mprotect for a multithreaded program on SMP hardware is not documented as far as I can tell.
It is well documented. What is not well defined is what happens if you modify the code and then try to execute it.
Can I depend on the LINUX mprotect call to take care of icache flushing, handling of hazards, etc.?
No, it does nothing of the sort. You need cacheflush() for that.
I am using Octeon CN5650 on 126.96.36.199 and 188.8.131.52 if it matters.
It doesn't really matter. What you need is something like: #include <sys/cachectl.h> . . . cacheflush(location, size, ICACHE); . . . David Daney
|<Prev in Thread]||Current Thread||[Next in Thread>|
|Previous by Date:||Re: [RESEND PATCH v3 0/2] Pass resources to pci_create_bus() and fix MIPS PCI resources, Bjorn Helgaas|
|Next by Date:||Re: using mprotect to write to .text, Joe Buehler|
|Previous by Thread:||using mprotect to write to .text, Joe Buehler|
|Next by Thread:||Re: using mprotect to write to .text, Joe Buehler|
|Indexes:||[Date] [Thread] [Top] [All Lists]|