-
Notifications
You must be signed in to change notification settings - Fork 167
Add version info to modules #294
Conversation
|
this is a sketch of what's been kicking around in my head, wrote it out partially motivated by #291 today - this also adds a good place to include further codegen quirks like "this module uses pinned heaps". The lack of a good place for that kind of setting is why #273 remains a draft, so I figure this is a good time. |
e71f190 to
9128751
Compare
ff40f4d to
9d363b1
Compare
| LittleEndian::read_u64(&obj_bin[(native_data_symbol_data.offset + 8)..]) as usize; | ||
| let module_data_len = LittleEndian::read_u64( | ||
| &obj_bin[(native_data_symbol_data.offset | ||
| + offset_of!(SerializedModule, module_data_len))..], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
finding this bug was surprisingly annoying. The test failed with a deserialization error because the pointer/length it tried to read became totally invalid, which lead me down a very incorrect path for a bit :(
|
|
||
| #[test] | ||
| pub fn reject_old_modules() { | ||
| let err = DlModule::load("./tests/version_checks/old_module.so") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like committing a 9.something kb binary blob but trying to assemble a minimal object wasn't working out and flipping a bit in a produced binary seems brittle. Keeping an honest to goodness old module to test against old modules seems best here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fine, as it's pretty small and unlikely to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note from future-me to past-me, what source was this module built from?
48f6ad4 to
d24c1eb
Compare
|
okay, I'm done tweaking this every two minutes - actually ready for re-review |
version information is comprised of both the current crate version and the current git commit hash (if available). the current git commit hash is only used in release builds to avoid too much furstration in typical development workflows using tools like "git commit --amend" or "git rebase", or just making non-conflicting spot changes to only one of lucetc or lucet-runtime
d24c1eb to
adef434
Compare
acfoltzer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Honestly this is long overdue
also add a check in lucet-runtime that modules loaded have version
version present, and that the module's version matches the runtime,
rejecting modules that do not
edit: the PR does fewer things, so I fixed the title and message to match