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.
This is an updated version of Linux > 4.8 KASLR detection and dismisses the
linux_kaslr_shift
plugin entirely.@atcuno implemented KASLR detection and calculation in upstreams Linux overlay, however at various spots incorrect calculations were done regarding which shift (physical vs virtual) was used.
I tested the attached patches with kernel 4.9 amd64 memory dumps that had KASLR en- and disabled.
Moreover a small typo is fixed.
One upstream change since my PR #385 made the DTB finder skip the only valid DTB in the images I checked, therefore I commented those lines (the
active_mm
checks).@atcuno found a nicer way to determine the virtual shift; instead of walking through the paging levels, looking up the path to a target physical page and then calculating the diff between observed and expected virtual address, he simply used the virtual address stored in the
files
member ofinit_task
stask_struct
that points to the randomized address of symbolinit_files
. By calculating the difference to theinit_files
value in System.map you can also determine thevirtual_shift
.I'd like to note that even though KASLR detection possibly finds the correct values with this PR the
linux_kaslr_shift
plugin might still come in handy, since in contrast to the way it is handled now it will not stop DTB finding after the first possible hit but looks further to find additional DTBs, so in cases where the first found DTB is not correct it can still help out.However I'd like to use the more elegant
init_files
approach for the plugin as well and will refactor this first before resubmitting.