This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Prevent object file plugins from messing with the data buffer if they don't match
ClosedPublic

Authored by JDevlieghere on Apr 1 2022, 3:49 PM.

Details

Summary

While discussing D122856 with Pavel on IRC, he pointed out that the current design allows that the file contents could be mapped by one object file plugin and then used by another. Presumably the idea here was to avoid mapping the same file twice. That becomes problematic for ObjectFileELF which after D122856 will map the file as read-write.

Diff Detail

Event Timeline

JDevlieghere created this revision.Apr 1 2022, 3:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 3:49 PM
JDevlieghere requested review of this revision.Apr 1 2022, 3:49 PM
labath added a comment.Apr 2 2022, 4:41 AM

It would be better if we could automatically "reset" these variables by having the plugins accept them as values instead of references. Does anyone I actually need the new values of the variables after these functions are done? I know of at least one place, which actively tries to avoid that...

Prevent object files from changing the buffer by passing it by value

labath added a comment.Apr 4 2022, 6:30 AM

Yes, that's the general idea, but you forgot the CreateMemoryInstance callback -- we should fix that too.

Update CreateMemoryInstance

labath accepted this revision.Apr 4 2022, 8:31 AM
This revision is now accepted and ready to land.Apr 4 2022, 8:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 4 2022, 9:24 AM