Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Conversation

@awortman-fastly
Copy link
Contributor

@awortman-fastly awortman-fastly commented Sep 11, 2019

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

@awortman-fastly
Copy link
Contributor Author

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.

@awortman-fastly awortman-fastly force-pushed the aw/add-module-versioninfo branch from e71f190 to 9128751 Compare September 12, 2019 21:05
@awortman-fastly awortman-fastly changed the title formalize codegen toggles, add that and version info to modules And version info to modules Sep 12, 2019
@awortman-fastly awortman-fastly force-pushed the aw/add-module-versioninfo branch 2 times, most recently from ff40f4d to 9d363b1 Compare September 12, 2019 23:44
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))..],
Copy link
Contributor Author

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")
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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?

@awortman-fastly awortman-fastly force-pushed the aw/add-module-versioninfo branch 2 times, most recently from 48f6ad4 to d24c1eb Compare September 13, 2019 00:09
@awortman-fastly
Copy link
Contributor Author

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
@awortman-fastly awortman-fastly force-pushed the aw/add-module-versioninfo branch from d24c1eb to adef434 Compare September 13, 2019 03:22
Copy link
Contributor

@acfoltzer acfoltzer left a 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

@awortman-fastly awortman-fastly merged commit eca48fb into master Sep 16, 2019
@awortman-fastly awortman-fastly deleted the aw/add-module-versioninfo branch September 16, 2019 17:05
@awortman-fastly awortman-fastly changed the title And version info to modules Add version info to modules Sep 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants