Layout.hs (784B)
1 {-# OPTIONS_HADDOCK prune #-} 2 {-# LANGUAGE ForeignFunctionInterface #-} 3 4 -- | 5 -- Module: Vestigia.Layout 6 -- Copyright: (c) 2026 Jared Tobin 7 -- License: MIT 8 -- Maintainer: Jared Tobin <jared@ppad.tech> 9 -- 10 -- Runs compared to find where a secret mattered must lay memory out 11 -- alike, or every address differs between them and no difference 12 -- means anything. 13 14 module Vestigia.Layout ( 15 fixLayout 16 ) where 17 18 import Foreign.C.Types (CInt(..)) 19 20 foreign import ccall unsafe "vestigia_no_randomize" 21 c_noRandomize :: IO CInt 22 23 -- | Turn address-space randomisation off for this process and every 24 -- process it starts (the personality is inherited across fork and 25 -- exec). 'False' where it cannot be: off Linux, or refused. 26 fixLayout :: IO Bool 27 fixLayout = fmap (== 0) c_noRandomize