Closed GoogleCodeExporter closed 8 years ago
Ok, so here's a patch that shifts the ValidAS check from inside the address
space out to the profile. If the check isn't found in VolatilityMagic, then
the check *is assumed to have passed*, so this fails open rather than closed.
Some things to note:
* Currently the check for Pae and NonPae are the same. We can change that by
making it use the __class__.__name__ for the VolatilityMagic lookup (and they
can still point to the same check object if necessary).
* I've moved it to after the JK caching function setup, because otherwise the
cache wouldn't ever be used for the check.
* The caching is disabled by default because people were worried about it. To
enable it requires adding --cache-dtb to the command line.
* The cache only stores the first lookup table, so doesn't offer a huge saving
on Pae spaces.
* This patch only affects the new intel code. The legacy stuff still checks a
hardwired address.
So this won't do anything to improve the performance hit, but will make it
easier on things like linux profiles and so on. The next patch needs to come
from someone else to offer a better check, or better caching (although the
cache needs building on every check, or the check becomes useless)...
I'm probably also going to try working up a patch that make the dtb caching
function make use of the existing cache framework (so that it's
enabled/disabled with the single --no-cache function). Since we've been
getting by without it for such a long time, I don't think it'll have that much
of an impact, but it will mean that ASes such as Ieee1394 will never try to
cache the DTB, which is good. 5:)
Original comment by mike.auty@gmail.com
on 25 Mar 2011 at 11:11
Attachments:
Ok, so I noticed something interesting and have reworked the DTB caching code
based on this. It now caches each read_long_phys/read_long_long_phys (memoizes
the results), when config.NO_CACHE is false. Those functions are private and
not used anywhere else throughout the code, so it should only affect address
lookup times. I've also removed two instances from the hive ASes since they
weren't using them.
This will now do a few more reads (because rather than reading the whole 0x1000
block, it'll read them as necessary), but it will ensure that it reads them
only once (which wasn't true previously for ptes. I don't really have a
windows machine to test out whether this improves read performance, so I'd
appreciate someone testing out this patch.
I also need to talk to scudette sometime about allowing address spaces to block
caches that involve them. Ideally there'd be a tainting system so that data
derived from a non-cachable address space doesn't get cached. Unfortunately at
the moment, I'm not sure there's anything stopping a live AS from being cached.
Also, since this doesn't use the cache mechanism (because that pickles to/from
disk so wouldn't help the disk IO issue), it can't determine whether it should
cache or not. I'm hoping to add a cachable attribute to ASes, true by default,
and then anything that needs to check can traverse the AS stack with AND. The
trick then is to work that into the cache system...
Original comment by mike.auty@gmail.com
on 26 Mar 2011 at 2:13
Attachments:
So scudette quite rightly pointed out that the above memoizing patch won't
really help with the dlllist situation. Other wild options include cloning the
existing AS, rather than making a new one, and just setting the dtb in order to
keep the cache (although since the problem is the check traversing the entire
DTB, there isn't much lookup reuse), or we could get the lower layer to cache
reads (which would solve the lower AS being able to say whether it caches or
nto) but that wouldn't solve the root problem again, since there'd still be
little lookup reuse.
So in the interim, we've got to get the check working more efficiently.
However, since I haven't heard any complaints against moving the check into the
profile, I'll commit patch 1 shortly (I just need to check the inheritance of
the VOLATILITY_MAGIC from winxpsp2)...
Original comment by mike.auty@gmail.com
on 28 Mar 2011 at 9:05
Ok, so patch one has just been commited as r906. We could still do with
improvement to the check itself, and we'll also need a new check for linux once
we merge the more recent changes in the linux branch. Just a friendly
reminder, this will fail open, ie the linux profiles will not carry out any
check and will succeed without a problem until a check is added... 5:)
So anyone made any progress on getting a more efficient check in place?
Original comment by mike.auty@gmail.com
on 28 Mar 2011 at 6:36
Ok, Labarum_X committed and it all looks good, therefore:
This issue was fixed by r943. 5:)
Original comment by mike.auty@gmail.com
on 13 Apr 2011 at 6:04
Original issue reported on code.google.com by
mike.auty@gmail.com
on 13 Mar 2011 at 8:21