-
Notifications
You must be signed in to change notification settings - Fork 26
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
RWX sections (or: custom section permissions) #104
Comments
If you want to have more control about the output, at the cost of less ergonomics, you could use the |
Note that |
Oops, assumed |
@kitlith yes I think it would be very straightforward to add it, if you want to add a PR, go for it ! My hope was the faerie would be useful for exactly these kind of use cases :) |
Heh, looking through the code I got really confused, because SectionBuilder exists, and allows arbitrary permission setting. It's just per-format and private... which makes sense. For a moment I thought I missed something when I was doing research at 1 AM. So, for implementing this: should SectionDecl be expanded to be more generic? At least on the elf side sections added via SectionDecl aren't even loaded at runtime, so we'd need to add (at the very least) flags for write, execute, and allocate to SectionDecl. On the other hand, we could continue reserving SectionDecls for notes that are not loaded at runtime, and add a writable flag to FunctionDecl and/or an executable flag to DataDecl. Though, looking at define_with_symbols, I'm much more likely to do the former because apparently we can't even add symbols to anything other than a SectionDecl. |
@kitlith actually can you paste an invocation you would want? Do you want something like: obj.declare("foo", Decl::function().writeable().executable())?; From your comments, i think so? As you say custom sections aren't loaded, so I think it makes sense to just add the writeable bit to function, and executable to data; this makes the user api nicer (but requires some annoying boilerplate to be added, like in your PR). I can't think of another case where we'd want to specify RWX flags for anything else? |
"we can't even add symbols to anything other than a SectionDecl" is my sticking point here, i need to be able to specify symbols at arbitrary points in the section. I resolved this in the PR by adding a flag to signal if the custom section is loaded or not, which seems extremely reasonable: allows you to create sections that are like '.note.GNU-stack' and sections that are rwx at the same time. |
Hey, I'm looking to use this crate to generate a msp430 binary from the equivilant of a flash dump and a list of symbols, for use with ghidra.
In my case, by default all pages are writable and executable, which is not currently expressable through this API: you can either mark as writable (data) or as executable (code) but not both.
Would it be possible to add a type for self modifying code, or a way to specify the permissions directly?
The text was updated successfully, but these errors were encountered: