diff --git a/tools/db/pdb.createprogram.tbl b/tools/db/pdb.createprogram.tbl index 3363f2b6b9f70239b94f989c724ae62642de3460..98d2de1d906d247853037d3e79aa11456ff45608 100644 --- a/tools/db/pdb.createprogram.tbl +++ b/tools/db/pdb.createprogram.tbl @@ -110,6 +110,7 @@ CREATE TABLE #EHPGM# eh_pgm_id integer, -- id of this object. caf integer, -- code alignment factor. daf integer, -- data alignment factor + return_register integer, -- dwarf return register. ptrsize integer, -- size of a pointer, 4 or 8. cie_program text, -- for the cie, the bytes that make up a cie program, encoded as hex with commas separating instructions. fde_program text -- for the fde, bytes as above diff --git a/tools/eh_frame_tools/eh_to_bin.sh b/tools/eh_frame_tools/eh_to_bin.sh index 1cd032062ed16b87154a3fa8f725bad837f28d0c..e8ec91e18b3d77addf1cf0895270491399460501 100644 --- a/tools/eh_frame_tools/eh_to_bin.sh +++ b/tools/eh_frame_tools/eh_to_bin.sh @@ -1,7 +1,11 @@ #!/bin/bash -gcc sample.eh.s -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=0x602000 -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,./eh_frame.ls || exit -eu-readelf -S ./a.out -objcopy --rename-section eh_frame_hdr=.eh_frame_hdr --rename-section eh_frame=.eh_frame --rename-section gcc_except_table=.gcc_except_table a.out b.out -eu-readelf -S -w ./b.out +infile=$1 +addr=$2 +outfile=$3 + +gcc $infile -nostdlib -Wl,--section-start -Wl,eh_frame_hdr=$addr -Wl,-e -Wl,0x1000 -Wl,--build-id=none -Wl,-T -Wl,${PEASOUP_HOME}/tools/eh_frame_tools/eh_frame.ls -o $outfile || exit +#eu-readelf -S ./a.out +objcopy --rename-section eh_frame_hdr=.eh_frame_hdr --rename-section eh_frame=.eh_frame --rename-section gcc_except_table=.gcc_except_table $outfile +#eu-readelf -S -w ./b.out diff --git a/tools/eh_frame_tools/sample.eh.s b/tools/eh_frame_tools/sample.eh.s index 29cf43762b131a21edb5ebeeded494365b10d750..6a76cf37cbc293016da7d845b2d8ee13d80b106d 100644 --- a/tools/eh_frame_tools/sample.eh.s +++ b/tools/eh_frame_tools/sample.eh.s @@ -23,14 +23,17 @@ eh_frame_hdr_start: .byte 1 # version .byte 0x10 | 0x0B # encoding for pointer to eh-frame -- DH_EH_PE_pcrel (0x10) | DH_EH_PE_sdata4 (0x0B) - .byte 0x03 # encoding for ; of entries in eh-frame-hdr -- BDH_EH_PE_udata4 (0x03) - .byte 0x10 | 0x0B # encoding for pointers (to fdes) held in the eh-frame-hdr header -- DH_EH_PE_pcrel | DH_EH_PE_sdata4 + .byte 0x03 # encoding for ; of entries in eh-frame-hdr -- DH_EH_PE_udata4 (0x03) + .byte 0x30 | 0x0B # encoding for pointers (to fdes) held in the eh-frame-hdr header -- DH_EH_PE_datarel (0x30) | DH_EH_PE_sdata4 (0x0b) .int Lfde_table - . # pointer to fde_table, encoded as an sdata4, pcrel - .byte (eh_frame_table_end-eh_frame_table)/4 # number of FDEs in the header. + .int (eh_frame_table_end-eh_frame_table)/8 # number of FDEs in the header. .align 4 eh_frame_table: - .int Lfde1 - . # fde pointers - .int Lfde2 - . + # an entry in the table is {offset to fde start , offset fde itself }, encoded as datarel|sdata4 + .int fde1_start_addr - eh_frame_hdr_start + .int Lfde1 - eh_frame_hdr_start + .int fde1_start_addr - eh_frame_hdr_start + .int Lfde2 - eh_frame_hdr_start eh_frame_table_end: @@ -48,9 +51,9 @@ Lcie1: .sleb128 -8 # data alignment factor .uleb128 16 # return address reg. -Lcie1_aug_data_start: # encode the Z (length) .sleb128 Lcie1_aug_data_end-Lcie1_aug_data_start # Z -- handle length field +Lcie1_aug_data_start: #encode the P (personality encoding + personality routine) .byte 0x80 | 0x10 | 0x0B # personality pointer encoding DH_EH_PE_indirect (0x80) | pcrel | sdata4 diff --git a/tools/ps_analyze.sh b/tools/ps_analyze.sh index 9b22fbad04c4ac27b20517a3b32ea6e497d52010..83fcb38dfda3509f1ca82dd5f3740fcaee258068 100755 --- a/tools/ps_analyze.sh +++ b/tools/ps_analyze.sh @@ -247,7 +247,7 @@ check_options() if [ "X$2" = "Xzipr" ]; then echo "Using Zipr backend." export backend="zipr" - phases_spec=" $phases_spec stratafy_with_pc_confine=off generate_spri=off spasm=off fast_annot=off zipr=on preLoaded_ILR1=off preLoaded_ILR2=off fast_spri=off " + phases_spec=" $phases_spec stratafy_with_pc_confine=off generate_spri=off spasm=off fast_annot=off zipr=on preLoaded_ILR1=off preLoaded_ILR2=off fast_spri=off create_binary_script=off is_so=off" phases_spec=${phases_spec/preLoaded_ILR1=on/} phases_spec=${phases_spec/preLoaded_ILR2=on/} step_options_gather_libraries="$step_options_gather_libraries --main_exe_only" @@ -938,45 +938,6 @@ check_for_bad_funcs $newname.ncexe mkdir logs -# copy in some shared libraries if requested. -#perform_step diehard none cp $CFAR_HOME/DieHard/src/libdiehard.so libheaprand.so -#perform_step diehard none $PEASOUP_HOME/tools/update_env_var.sh DO_DIEHARD 1 -#perform_step libtwitcher none cp $GT_COLLAB_HOME/downloads/libtwitcher.so libheaprand.so -#perform_step noh none cp $CFAR_HOME/non_overlapping_heap/noh.so noh.so -#perform_step nol none cp $CFAR_HOME/non_overlapping_libraries/ld-linux-x86-64.so.2 ld-linux-x86-64.so.2.nol - -# -# create a stratafied binary that does pc confinement. -# -#perform_step stratafy_with_pc_confine none sh $STRATA_HOME/tools/pc_confinement/stratafy_with_pc_confine.sh $newname.ncexe $newname.stratafied -#cp a.ncexe a.ncexe.orig -#perform_step add_confinement_section none $STRATA_HOME/tools/pc_confinement/add_confinement_section.sh a.ncexe.orig a.ncexe - -# -# CGC CRCX elide -# -#perform_step cgc_optimize_start none $DAFFY_HOME/dead_code_ident/optimize_start.sh a.ncexe - -# -# Let's output the modified binary -# This binary will really be a shell script that calls the newly stratafied binary -# -#perform_step create_binary_script mandatory $PEASOUP_HOME/tools/do_makepeasoupbinary2.sh $name -#perform_step heaprand pc_confine,double_free $PEASOUP_HOME/tools/update_env_var.sh STRATA_HEAPRAND 1 -#perform_step controlled_exit none $PEASOUP_HOME/tools/update_env_var.sh STRATA_CONTROLLED_EXIT 1 -#perform_step detect_server pc_confine $PEASOUP_HOME/tools/update_env_var.sh STRATA_DETECT_SERVERS 1 -#perform_step rekey none $PEASOUP_HOME/tools/update_env_var.sh STRATA_REKEY_AFTER 5000 -#perform_step double_free heaprand $PEASOUP_HOME/tools/update_env_var.sh STRATA_DOUBLE_FREE 1 -#perform_step pc_confine none $PEASOUP_HOME/tools/update_env_var.sh STRATA_PC_CONFINE 1 -#perform_step isr pc_confine $PEASOUP_HOME/tools/update_env_var.sh STRATA_PC_CONFINE_XOR 1 -#perform_step watchdog signconv_func_monitor $PEASOUP_HOME/tools/update_env_var.sh STRATA_WATCHDOG $watchdog_val -#perform_step is_so mandatory $PEASOUP_HOME/tools/update_env_var.sh STRATA_IS_SO $($PEASOUP_HOME/tools/is_so.sh a.ncexe) -#perform_step ibtl ilr $PEASOUP_HOME/tools/update_env_var.sh STRATA_IBTL 1 - -# turn on sign conversion function monitoring -#perform_step signconv_func_monitor heaprand $PEASOUP_HOME/tools/update_env_var.sh STRATA_NUM_HANDLE 1 - - # # turn off runtime protections for BED. turn off runtime prrotections for BED. turn off runtime prrotections for BED. # @@ -1048,7 +1009,7 @@ fi # build basic IR perform_step fill_in_cfg mandatory $SECURITY_TRANSFORMS_HOME/bin/fill_in_cfg.exe $varid perform_step fill_in_safefr mandatory $SECURITY_TRANSFORMS_HOME/bin/fill_in_safefr.exe $varid -perform_step fill_in_indtargs mandatory $SECURITY_TRANSFORMS_HOME/bin/fill_in_indtargs.exe $varid +perform_step fill_in_indtargs mandatory $SECURITY_TRANSFORMS_HOME/bin/fill_in_indtargs.exe $varid $step_options_fill_in_indtargs # finally create a clone so we can do some transforms perform_step clone mandatory $SECURITY_TRANSFORMS_HOME/bin/clone.exe $varid clone.id