PDA

View Full Version : safeseh


_wh_
September 23rd, 2009, 03:32
Hi,

i writting on something like the GNU BFD library, which can convert convert objects to some virtual format and also backwards...

now i have the problem, when i rebuild a given object with a function which throws a exception, the exception handler is not called ..only with the option SAFESEH:no

in the archive below you will find 2 directories
good and bad

in good you will find the test.obj(main function) and h.obj, a small function which throws a exception compiled by nasm


in bad you will find the test.obj(main function) and h.obj, a small function which throws a exception, created from the above nasm obj but rebuilded by my tool

http://file2.ws/safeseh

i cannot see a big differences in the both h.obj objects with dumpbin or ida...

maybe you have a hint for me ?

[yAtEs]
September 25th, 2009, 11:31
The linker creates a LoadConfig data directory in the PE header which lists the allowed exception handlers.
safeseh_yes.exe has this and safeseh_no.exe doesnt.

infact: i think ..
safeseh_yes.exe(GOOD) has no LoadConfig entry which means safeseh is ignored and
safeseh_yes.exe(BAD) does have one but with no seh handler offsets listed, so no handlers are allowed.

_wh_
September 26th, 2009, 02:26
thank you for your reply ...i know the reason why the handler is not executed in the executable...but i don't know, what is different in the objects, thus the linker creates executables with /without LoadConfig data directory

[yAtEs]
September 30th, 2009, 02:00
the only difference i see is in h.obj

the symbols bbb and back are not presence in the bad one however relocation information is.

/yates.

_wh_
October 1st, 2009, 01:44
jup...i guess the linker searches through all labes in an object and build a range between the lowest and the highest symbol, in this case the exception handler was the highest symbol, but missing. the validation of the exception handler fails after the exception beause it points outside the valid range


thank for your help