Skip to content
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

Add one extra page to avoid colliding with the next page being rounded down #446 #462

Closed
wants to merge 0 commits into from

Conversation

brenoguim
Copy link
Collaborator

@brenoguim brenoguim commented Feb 20, 2023

I wrote my analysis on #446 it seems that this patch fixes the issue. It adds one extra page in the "needed space". Not because the current segment needs it, but because its possible that a following segment is unaligned (and read only).
In such situation there would be a range of addresses loaded by two segments, and the read-only wins.

There is a better way to do this (check the segment for example). But I wanted to share the patch to start a discussion.

Also, it would be very important to come up with a test for this. It would be very easy to break it again while refactoring.

@brenoguim
Copy link
Collaborator Author

brenoguim commented Feb 22, 2023

Added testcase. I took the binary from the issue #446 and used 4b645c7 to remove all the dangerous stuff from it. It now compresses much better, and we don't have the risk of running arbitrary code. The program will simply crash if you try to run it.

Unfortunately, it only runs on x86_64, but I guess it's better than nothing.

@brenoguim brenoguim force-pushed the breno.446 branch 2 times, most recently from 4217a09 to b012146 Compare February 22, 2023 12:26
@brenoguim brenoguim changed the title Hack? for discussion on #446 Add one extra page to avoid colliding with the next page being rounded down #446 Feb 23, 2023
@brenoguim
Copy link
Collaborator Author

I'm pretty sure I messed this up. I didn't realize the master was merged into my PR. Might need to open another one. As soon as I find my code :)

@brenoguim
Copy link
Collaborator Author

Continues at #469 sorry for the mess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants