mirror of
https://github.com/GaloisInc/macaw.git
synced 2024-12-28 08:34:23 +03:00
Hack: filter out known bad addresses from concretize abs ptrs
This commit is contained in:
parent
c1b6b472ef
commit
ebbca0aded
@ -98,26 +98,39 @@ import Data.Macaw.Types
|
||||
-- Utilities
|
||||
|
||||
-- | Get code pointers out of a abstract value.
|
||||
concretizeAbsCodePointers :: MemWidth w
|
||||
concretizeAbsCodePointers' :: MemWidth w
|
||||
=> Memory w
|
||||
-> AbsValue w (BVType w)
|
||||
-> [MemSegmentOff w]
|
||||
concretizeAbsCodePointers mem (FinSet s) =
|
||||
concretizeAbsCodePointers' mem (FinSet s) =
|
||||
[ sa
|
||||
| a <- Set.toList s
|
||||
, sa <- maybeToList (resolveAbsoluteAddr mem (fromInteger a))
|
||||
, segmentFlags (msegSegment sa) `Perm.hasPerm` Perm.execute
|
||||
]
|
||||
concretizeAbsCodePointers _ (CodePointers s _) =
|
||||
concretizeAbsCodePointers' _ (CodePointers s _) =
|
||||
[ sa
|
||||
| sa <- Set.toList s
|
||||
, segmentFlags (msegSegment sa) `Perm.hasPerm` Perm.execute
|
||||
]
|
||||
-- FIXME: this is dangerous !!
|
||||
concretizeAbsCodePointers _mem StridedInterval{} = [] -- FIXME: this case doesn't make sense
|
||||
concretizeAbsCodePointers' _mem StridedInterval{} = [] -- FIXME: this case doesn't make sense
|
||||
-- debug DCFG ("I think these are code pointers!: " ++ show s) $ []
|
||||
-- filter (isCodeAddr mem) $ fromInteger <$> SI.toList s
|
||||
concretizeAbsCodePointers _mem _ = []
|
||||
concretizeAbsCodePointers' _mem _ = []
|
||||
|
||||
|
||||
concretizeAbsCodePointers :: MemWidth w
|
||||
=> Memory w
|
||||
-> AbsValue w (BVType w)
|
||||
-> [MemSegmentOff w]
|
||||
concretizeAbsCodePointers mem aVal = filteredResults
|
||||
where rval = concretizeAbsCodePointers' mem aVal
|
||||
-- GIANT HACK: filter out known invalid addresses for current experiments only
|
||||
filteredResults = [r | r <- rval
|
||||
, addr <- maybeToList (msegAddr r)
|
||||
, addr >= 0x1c04
|
||||
]
|
||||
|
||||
{-
|
||||
printAddrBacktrace :: Map (ArchMemAddr arch) (FoundAddr arch)
|
||||
|
Loading…
Reference in New Issue
Block a user