| To: | Joe Buehler <aspam@cox.net> |
|---|---|
| Subject: | Re: using mprotect to write to .text |
| From: | David Daney <david.daney@cavium.com> |
| Date: | Tue, 11 Oct 2011 09:36:49 -0700 |
| Cc: | linux-mips@linux-mips.org |
| In-reply-to: | <loom.20111010T215444-70@post.gmane.org> |
| References: | <loom.20111010T215444-70@post.gmane.org> |
| Sender: | linux-mips-bounce@linux-mips.org |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) 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 2.6.21.7 and 2.6.27.7 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] |