-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[mbr] Fix encmap boundary and method RVA lookup. #50248
Conversation
Two separate issues: 1. When we process the EnC map, any tables after the last one that has an update gets an "enc_recs" pointer that's one past the last row of the table. (the enc_recs pointer is used to speed up relative address lookup). So at lookup time if enc_recs says to look past the end of the EnC map table, we know there won't be any updates - return -1. 2. When looking for the updated RVA of a method, we need to go through every delta and find the latest one that has an update for the given method. The problem is that if a later generation doesn't have an update, we would take the NULL return value at face value and it would look like the method had no updates to its body - we would go back to using the original version from before any updates were applied. Instead now ignore lookup table misses and remember the last successful lookup. Fixes dotnet#50190
Tagging subscribers to this area: @CoffeeFlux Issue DetailsTwo separate issues:
|
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.
LGTM
/* if the table didn't have any updates in this generation and the | ||
* table index is bigger than the last table that got updates, | ||
* enc_recs will point past the last row */ | ||
if (index_map - 1 == encmap_rows) |
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.
And here you promised me no off by one math ;(
/backport to release/6.0-preview3 |
Started backporting to release/6.0-preview3: https://github.com/dotnet/runtime/actions/runs/687493007 |
@lambdageek backporting to release/6.0-preview3 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: [mbr] Fix encmap boundary and method RVA lookup.
Using index info to reconstruct a base tree...
M src/mono/mono/metadata/loader.c
M src/mono/mono/metadata/metadata-update.c
Falling back to patching base and 3-way merge...
Auto-merging src/mono/mono/metadata/metadata-update.c
CONFLICT (content): Merge conflict in src/mono/mono/metadata/metadata-update.c
Auto-merging src/mono/mono/metadata/loader.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 [mbr] Fix encmap boundary and method RVA lookup.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
Manually backported to Preview 3 #50254 |
Two separate issues:
When we process the EnC map, any tables after the last one that has an update gets an "enc_recs" pointer that's one past the last row of the table. (the enc_recs pointer is used to speed up relative address lookup). So at lookup time if enc_recs says to look past the end of the EnC map table, we know there won't be any updates - return -1.
When looking for the updated RVA of a method, we need to go through every delta and find the latest one that has an update for the given method. The problem is that if a later generation doesn't have an update, we would take the NULL return value at face value and it would look like the method had no updates to its body - we would go back to using the original version from before any updates were applied. Instead now ignore lookup table misses and remember the last successful lookup. Fixes WebAssembly hot reload reverts to old version of a type #50190