第11åã strace ãã¹ã¹ã¡ã
Tweet
ä»åã¯ãããã°ã©ã ãæå¾ éãã«åä½ããªãå ´åã«ãç¹å®ã®ããã»ã¹ã®æåã追ããããããã®æé ã«ã¤ãã¦ç´¹ä»ãã¾ãã
ããã»ã¹ã®æåã追ããããæ¹æ³ã«ã¯ããããããã¾ããä¾ãã°ãã¹ã¯ãªããè¨èªã§è¨è¿°ãããããã°ã©ã ã®æåã追ããããå ´åããããã°ã®ããã® print å½ä»¤ãæ¿å ¥ãããã¨ãããã§ããããã§ããããã°ã©ã ã®ç¨®é¡ã«ãããã«æåã追ããããå ´åãååã¨ãã¦ã«ã¼ãã«ãæä¾ããæ©è½ã使ãã¾ããä¾ãã° strace ã³ãã³ããç¨ãã¦ã·ã¹ãã ã³ã¼ã«ã®å¼ã³åºãå±¥æ´ãåå¾ãããã ltrace ã³ãã³ããç¨ãã¦ã©ã¤ãã©ãªé¢æ°ã®å¼ã³åºãå±¥æ´ãåå¾ããããã¾ããã¾ãã対象ã¨ãªãããã»ã¹ãä¸æãªå ´åã«ã¯å ¨ããã»ã¹ã対象ã«ããããã« System Call Auditing ã使ã£ã¦å±¥æ´ãåå¾ãããã SystemTap ã使ã£ã¦ä»»æã®ç®æã§å±¥æ´ãåå¾ããããããã¨ãããã¾ãã
ä»å㯠strace ã³ãã³ãã«ã¤ãã¦åãä¸ãã¾ãããããã»ã¹ã®æåã追ããããä¸ã§ã¯ããã®æåãåç¾ããæé ã確ç«ã§ãã¦ãããã¨ãéè¦ã§ãã Bugzilla ã«ä¸å ·åãå ±åããéã«åç¾æé ãå¿ è¦ã§ããããã«ã strace ã³ãã³ãã§è¿½è·¡ããå ´åãåç¾æé ã確ç«ã§ããªãã¨è©±ãå§ã¾ãã¾ããã
ã¾ãããã°ãæå»æ å ±ä»ãã§ä¿åãããã¨ãéè¦ã§ãã strace ã³ãã³ããç¨ãã¦æ å ±ãåå¾ããå ´åã«éãããåé¡äºè±¡ãçºçããæ£ç¢ºãªæ¥æãä¼ãããã¨ã¯ãç確ãªå¯¾å¿ãè¡ãä¸ã§æ¬ ããã¾ãããåé¡äºè±¡ãåãã¦çºçããæã«ã¯ååãªæ å ±ãåå¾ã§ããªãã£ãã¨ãã¦ããæ°ãæçµã£ã¦åé¡äºè±¡ãåçºããæã«ååã®æ å ±ã¨ç §åããªãã調æ»ãã¦ããã¨ããã±ã¼ã¹ãããã¾ããã¾ããåé¡äºè±¡ãçºçãã¦ãã調æ»æ å½è ã«ä¾é ¼ãå±ãã¾ã§ã«æ°æ¥ã¨ã1é±éã¨ãã®é 延ãçºçããã±ã¼ã¹ãããã¾ããçºçæ¥æãä¼ããã«ä½é±éåãã®ãã°ã ããéä»ããã¦ãã調æ»æ å½è ã¯å°ã£ã¦ãã¾ãã¾ãã調æ»æ å½è ã¨ãã¦ã¯ããæ¨å¤ãââã¨ããããã»ã¹ãç°å¸¸çµäºãã¾ãããã®ãããªèª¬æã§ã¯ãªããâæâæ¥âæâåé ãââã¨ããããã»ã¹ãç°å¸¸çµäºãã¾ãããã®ãããªèª¬æã欲ããã®ã§ãã
strace ã³ãã³ãã«ã¯ãããããªãªãã·ã§ã³ãããã¾ãããã·ã¹ãã ã³ã¼ã«ãçºè¡ããæå»ãä»ä¸ããããã® -tt ã¨ãããªãã·ã§ã³ã¨ãã·ã¹ãã ã³ã¼ã«ã®å®è¡ã«è¦ããæéãä»ä¸ããããã® -T ã¨ãããªãã·ã§ã³ã¯å¿ é ã¨ãè¨ããã§ãããã
strace ã³ãã³ãã¯ãæ¢ã«åä½ä¸ã®ããã»ã¹ã®æåã追ãããããã¨ãã strace ã³ãã³ãå®è¡æã®ã³ãã³ãã©ã¤ã³ããèµ·åãããããã»ã¹ã®æåã追ãããããã¨ãã§ãã¾ããå ã«ãæ¢ã«åä½ä¸ã®ããã»ã¹ã®æåã追ããããæ¹æ³ã説æãã¾ãã
ã¾ããããã»ã¹ã®ååããããã»ã¹IDãæ¢ãã«ã¯ pidof ã¨ããã³ãã³ãã使ç¨ãã¾ãã
# pidof 対象ã¨ãªãããã»ã¹ã®åå
pidof ã³ãã³ããåºåããããã»ã¹IDã strace ã³ãã³ãã® -p ãªãã·ã§ã³ã«æ¸¡ãã¾ãã -p ãªãã·ã§ã³ãç¹°ãè¿ããã¨ã§è¤æ°ã®ããã»ã¹IDãæå®ã§ãã¾ãã
# strace -tt -T -p 対象ã¨ãªãããã»ã¹ID1 -p 対象ã¨ãªãããã»ã¹ID2
ããã対象ã¨ãªãããã»ã¹IDã1åã ãã§ãããã¨ãæããã§ããã°ã strace ã³ãã³ãå®è¡æã®ã³ãã³ãã©ã¤ã³ã§ pidof ã³ãã³ããå®è¡ãããã¨ãã§ãã¾ãã
# strace -tt -T -p `pidof 対象ã¨ãªãããã»ã¹ã®åå`
ãã«ãã¹ã¬ãããªããã°ã©ã ãããã¯å½è©²ããã»ã¹ãä»å¾ä½æããåããã»ã¹ãå«ãã¦å¯¾è±¡ã«ãããå ´åã«ã¯ã -f ã¨ãããªãã·ã§ã³ãæå®ãã¾ããä¾ãã° rsyslogd ã¯ãã«ãã¹ã¬ããã§åä½ããã®ã§ã -f ãªãã·ã§ã³ä»ãã§å®è¡ãã¾ãã
# strace -tt -T -f -p `pidof rsyslogd`
ä¸è¨ã®ããã«å®è¡ãããã¨ã§æåã追跡ã§ããããã«ãªãã¾ããããã°ãããã«ç»é¢ä¸ããæ¶ãã¦ãã¾ã£ã¦ã¯æå³ãããã¾ããããã®ãããå®éã«ã¯ãã°ãã¡ã¤ã«ã«ä¿åããããã® -o ãªãã·ã§ã³ãä»ãããã¨ã«ãªãã§ãããã
# strace -tt -T -f -o rsyslogd-strace.log -p `pidof rsyslogd`
strace ã³ãã³ããçµäºãããã«ã¯ããã¼ãã¼ããã Ctrl-C ãå ¥åãã¾ãã対象ã¨ãªãããã»ã¹IDãæå®ã㦠strace ã³ãã³ããå®è¡ããæ¹æ³ã§ããã°ã strace ã³ãã³ãã«ãã追跡ã ããçµäºããããã¨ãã§ãã¾ãã®ã§ããã¼ã¢ã³ã¨ãã¦åä½ããããã»ã¹ãä¸æçã«è¿½è·¡ããå ´åã«éå®ãã¾ãã
次ã«ã strace ã³ãã³ãå®è¡æã®ã³ãã³ãã©ã¤ã³ããèµ·åãããããã»ã¹ã®æåã追ããããä¾ã示ãã¾ãã
$ strace -tt -T -f -o echo-strace.log /bin/echo 'Happy Holidays!'
strace ã³ãã³ãå®è¡æã®ã³ãã³ãã©ã¤ã³ããèµ·åãããããã»ã¹ãçµäºãã㨠strace ã³ãã³ããèªåçã«çµäºããã®ã§ããã¼ã¢ã³ã§ã¯ãªãããã»ã¹ã追跡ããå ´åã«éå®ãã¾ãã
strace ã³ãã³ãã¯ãã«ã¼ãã«ã¨ããã°ã©ã ã¨ã®æ¥ç¹ã§ããã·ã¹ãã ã³ã¼ã«å¼ã³åºãã追跡ãããããã«ã¼ãã«å´ã®åé¡ãå¦ããåãåããç®çã§ä½¿ç¨ãããã¨ãããã¾ããããã°ã©ã å´ã®ã½ã¼ã¹ã³ã¼ãã確èªããæ¹æ³ã¯ååç´¹ä»ããã¨ããã§ããããããå ã¯å½è©²ããã°ã©ã ã®ç¥èãå¿ è¦ã«ãªãã®ã§ããµãã¼ãçªå£ã«è§£æãä¾é ¼ãããã¨ã«ãªãããããã¾ããã
ã¹ã ã¼ãºãªå¯¾å¿ã®ããã«ããå©ç¨ã®ç°å¢ã§ strace ã³ãã³ãã使ç¨ããæ å ±åå¾ãè¡ããã¨ã許容ã§ãããã©ããããåé¡äºè±¡ã«ééããåã«ç¢ºèªãã¦ããã¦ãã ããã
ï¼åç°å²å¤«ï¼
ã³ã¼ãã¼ãã¬ã¼ã¯ã誰ããã²ã¹ãã§èª°ãããã£ã¹ãã
å æ¥ä¹ ãã¶ãã«ãã£ãºãã¼ã©ã³ãã«è¡ã£ã¦ãã¾ãããã·ã³ãã¬ã©åããã£ã³ãã¹ã¨ããããã¸ã§ã¯ã·ã§ã³ãããã³ã°ããã¯ã³ã¹ã»ã¢ãã³ã»ã¢ã»ã¿ã¤ã ãã¯å¤§å¤ãªäººæ°ã§ããç§ãåå è ï¼ã²ã¹ãï¼ã®ä¸äººã¨ãã¦å ªè½ããã¦ãããã¾ããããè·æ¥æã¤ãã³ãã®è£å´ãæ°ã«ãªãã¾ãããã®å£®å¤§ãªã·ã§ã¼ã¯ã©ããããã®æéãããã¦æºåãããã©ããªãµãã«ãã¹ãããªãã¼ãµã«ãè¡ãããã©ãã ãã®ã¹ã¿ããï¼ãã£ã¹ãï¼ãé ç½®ããã¦ããã®ããã¨ã
ãªãªã¨ã³ã¿ã«ã©ã³ãã®ã¦ã§ããã¼ã¸ã«ããã£ãºãã¼ã®ä¸çãæ¼åºããããã«ãåå ã®å»ºç©ããé³æ¥½ã«ãããã¾ã§ããããããã®ããã¼ããæã£ã¦è¨è¨ãããéæ¥å¸¸çãªç©ºéãåµãã ãã¦ãã¾ããã¨ããè¨èãããã¾ãã訪ãããã²ã¹ããã«ãåéºãæ´å²ããã¡ã³ã¿ã¸ã¼ãæªæ¥ããã¼ãã¨ããæ¥å¸¸ã®çæ´»ã«ã¯åå¨ããªããããªæ§ãã«å½©ãããä¸çãã人éã®æã¤äºæãã¹ã¦ã使ã£ã¦æ¥½ããã§æ¬²ãããããã®ããã«éããããã§ãããåªåã¨æºåãæ³åããè¸ãç±ããªãã¾ããã
åãã¨ãããã¨ã¯èª°ããå©ãããã¨ãããèããã°ããã£ãºãã¼ã©ã³ãã§åãã¦ããªãã¦ãã誰ãããã£ã¹ãã§ããåæã«ã²ã¹ãã§ããå¹´é½¢ããããã¯äºæ
ã«ããä»äºãæã£ã¦ããªã人ããã®åå¨ã¯ãå¿
ã誰ãã«ä¸ãã¦ãããã®ããããå½¹å²ããããç§ã¯ããæãã¾ãã
ãã®è¨äºãå
¬éãããã®ã¯ã12æ24æ¥ã®äºå®ã§ããèãªãå¤ã«ãä¸äººä¸äººãä¸è©±ã«ãªã£ãï¼ãªã£ã¦ããï¼ãã®ã人ã®ãã¨ãæ¯ãè¿ã£ã¦ã¿ãã®ãæªããªãã§ãããã
Linus Torvalds ã¨ããå¦çããèªåã®æ¸ããã³ã¼ããå
¬éããªããã° Linux ã¯åå¨ãã¦ãã¾ãããã¹ãã£ã¼ãã»ã¸ã§ããºãããªããã°ãããªããè¨äºãèªãã§ããã¹ãã¼ããã©ã³ã¯ã¾ã åå¨ãã¦ããªãããããã¾ããããã£ã¨æ ¹æºçãªè©±ã¨ãã¦ãç§ãã¡ä¸äººä¸äººã¯ãã²ã¨ã¤ã®ç´°èãåç²¾åµã¨ãã¦ãã®ä¸ã§ã®åå¨ãå§ã¾ã£ã¦ãã¾ããã©ããªäººããã®ä¸¡è¦ªãããªããã°ãåå¨ãã¦ãã¾ããï¼ããã«ãã®ä¸¡è¦ªã®ä¸¡è¦ªãã»ã»ã»ï¼ã
çãã¦ããã¨ãããã¨ã¯ã DNA ã¨ããããã³ãå¼ãç¶ãã§ããã¨ãããã¨ã§ããéä¸ã®èª°ãä¸äººãããªãã¦ããããªããç§ãåå¨ãã¦ããªãã®ã§ãã
誰ããããã¾ããã£ã¦ããªããã¨ãæãããã«ã§ãã¦ããªããã¨ãããã¨æãã¾ãï¼ãã¡ãããç§ãããã§ãï¼ãã§ããèªåãªãã«é å¼µã£ãã®ã§ããããèªåã«ã声ãããã¦ããã¾ãããããä¸å¹´éããããã£ãããé å¼µã£ãããã¨ã
æ¬è¨äºã 2014 å¹´æå¾ã®ã³ã©ã ã¨ãªãã¾ããæ¬ã³ã©ã ãæ¸ããã¨ãã§ãããã¨ãèªãã§ããã ããæ¹ã
ããããã¨ã«æè¬ããæ¥å¹´ãä¸å±¤æç¨ãªæ
å ±ããæä¾ãããã¨æãã¾ãã
ã§ã¯ãã¾ãæ¥å¹´ãä¼ããã¾ãããï¼ããã¾ã§ããªãã®ã·ã¹ãã ã¨ããªãã¨ããªãã®å¤§åãªäººãå¹³åã§ããã¾ãããã«ï¼ï¼ã
ï¼åç°å£æ ï¼
Tweet