ãã¿ã¦èªåã試ãã¦ã¿ãããªã£ãã®ã§æ¸ãã¾ããã
malloc(3)ããã¨ã¬ãã£ãã³ããfree(3)ããã¨ã ãã¯ãSTDERRã«å ±åãã¦ããã¾ãã便å©ï¼ï¼ï¼
$ make galloc.so $ LD_PRELOAD=./galloc.so ls # or arbitrary command Gachapin .oO(malloc(568) = 0x172e040) Gachapin .oO(malloc(120) = 0x172e280) Mukku .oO(free = 0x172e040) Gachapin .oO(malloc(6) = 0x172e040) Mukku .oO(free = 0x172e040) ...
_init()ã¯å
±æã©ã¤ãã©ãªãèªã¾ããã¨èªåã§å®è¡ããããããªã®ã§ãããmallocã®ç½®ãæãã§ã¯ãã¾ããããªãã£ãï¼SEGVï¼ãã§åæåãã§ãã¯ï¼åæåé¢æ°ã®å®è¡ããããã«ãã¦ã¾ãã
ãªããmallocã¾ããã®ãã¬ã¼ãµã¼ãæ¸ãããã¨ãã¯ããã®ã¸ã使ã£ãã»ããããã¨æãã¾ãã