Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Tracing function runtime patch #1060
base: master
Are you sure you want to change the base?
Tracing function runtime patch #1060
Changes from 27 commits
8d706a5
e1fd774
ee56310
461448f
e237278
0699dbf
0db3e4f
6994b59
0e88a29
86e404b
3725c71
799644e
d572cab
0bd8f36
08029de
b2aee3d
f1794a2
c46bb5f
40c0696
4401153
5ead893
b6fcbd4
b334bfa
6f4bdc3
8e00241
ada68bb
3e7d023
18b7fee
e1be48c
0428dc1
6be7bef
6f0abb3
94597ef
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Let's just use
unwrap
as all theseexpect
s really bloat the code, especially as they shouldn't ever trigger. [As this suggests we almost never useexpect
: it does have a place, but it's really rare for us.]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.
Got it.
updated 👉 0428dc1
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.
Can we get rid of the other
expect
s introduced in this PR too please?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 don't see any other
expect
s only a singleunwrap
.Am I missing it somehow?
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.
We don't want to ignore the return code: we just want to abort changing the machine code. So we need something like
if mprotect(...) { return ... }
and then recover from there.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.
Added 👉 6be7bef8f5968aec6e44f792422d446f306c4c7a
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.
Just to check: is just
return
enough for the system to keep running? If so, let's add a comment to that effect.Alternatively, if we think "if
mprotect
has failed, we've got something wrong", then we might want topanic
ifmprotect
fails.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 think it's ok to return if
mrotect
as it should be transactional and not leave the memory in corrupted state on error. Unless we consider the "runtime patching" as a must-have for SWT, then we should definitelypanic
.I tested it with different invalid memory addresses that resulted in
mrotect
returning a non-0 result and the test suite passed.We still risk changing memory that will not necessarily cause
mrotect
to return with an error but will cause some other part of the process to have invalid memory.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.
Actually, I think this runtime patching is an integral part of SWT.
Added panic 👉 6f0abb3