ç·æ¥ã³ã©ã ï¼ glibc èå¼±æ§ï¼ CVE-2015-0235 ï¼ã®å½±é¿ç¯å²ã®èª¿æ»æ¹æ³ã«ã¤ãã¦
Tweet
å é±å ¬éããã glibc ã®èå¼±æ§ã«ã¤ãã¦ã管çããã¦ãããµã¼ãã¼ã¸ã®å½±é¿ã®æç¡ãæ°ã«ããã¦ããæ¹ãå¤ãã¨æãã¾ããããã§ç·æ¥ã³ã©ã ã¨ãã¦ãèå¼±æ§ã®è¦ã¤ãã£ãé¢æ°ã使ããã¦ãããã©ããã調æ»ããæ¹æ³ã«ã¤ãã¦ç´¹ä»ãã¾ãã
ãã®èå¼±æ§ã«ã¤ãã¦èª¿æ»ããã«ãããã
- ã¹ããã1ï¼
- èå¼±æ§ã®è¦ã¤ãã£ãé¢æ°ãå¼ã³åºãã¦ããå¯è½æ§ããããã©ããï¼
- ã¹ããã2ï¼
- èå¼±æ§ã®è¦ã¤ãã£ãé¢æ°ãå¼ã³åºãã¦ããå ´åãèå¼±æ§ãæ»æããããã«ä»»æã®å¤ãæ»æè ã渡ããã¨ãã§ãããã©ããï¼
- ã¹ããã3ï¼
- ä»»æã®å¤ãæ»æè ã渡ããã¨ãã§ããå ´åãã©ã®ãããªè¢«å®³ãçããããï¼
ã¨ãã3ã¤ã®ã¹ããããèããå¿ è¦ãããã¾ãã
ã¹ããã1ã«é¢ãã¦ã¯ã
- ã©ã¤ãã©ãªãéçã«ãªã³ã¯ããããã°ã©ã ãã¡ã¤ã«ã¯ããã®è¨äºã§ç´¹ä»ãã¦ããæ¹æ³ã§ã¯èª¿æ»ã§ããªãã
- glibc 以å¤ã®ã©ã¤ãã©ãªãçµç±ãã¦å¼ã³åºãã¦ããå ´åã¯èª¿æ»æé ãè¤éã«ãªãã
- .tar.gz ãªã©ã®ã¢ã¼ã«ã¤ããã¡ã¤ã«ã«å«ã¾ãã¦ãããã¡ã¤ã«ã¯ãå 容ãæ½åºããªãã¨èª¿æ»ã§ããªãã
ãªã©ã®å¶ç´ãããã¾ãããããç¨åº¦ã¯æºä¸ã§èª¿æ»ãããã¨ãå¯è½ã§ãããªãã 2.ã®å¶ç´ã«ã¤ãã¦ã¯ãå®æ¸¬ã«åºã¥ã調æ»ã¨çµã¿åããããã¨ã§ç·©åãããã¨ãå¯è½ã§ãã
ã¹ããã2ã«é¢ãã¦ã¯ã第10åãã½ã¼ã¹ã³ã¼ãé²è¦§ãã¹ã¹ã¡ãï¼ http://www.intellilink.co.jp/column/oss/2014/120900 ï¼ã§ç´¹ä»ããæé ã«æ²¿ã£ã¦ãããã°ã©ã ã®ã½ã¼ã¹ããã±ã¼ã¸ããã¦ã³ãã¼ããã¦å±éãã¦èª¿æ»ãããã¨ã«ãªããã¨æãã¾ãããã ãã対象ã¨ãªãããã°ã©ã ãå¤æ°ãããè¤éãã¯åå·®ä¸å¥ã§ãããããä½ç¾æéãã®ç¨¼åã¨ä½ç¾ä¸åã¨ãããè²»ç¨ãããã¦ãæ°ãé ããªããããªèª¿æ»ãè¡ãè¦æãå¿ è¦ããããã¾ããã
glibc 㯠Linux ä¸ã§åä½ããã»ã¼å ¨ã¦ã®ããã°ã©ã ãã使ç¨ããã¦ããã©ã¤ãã©ãªã§ãããããèå¼±æ§ã®è¦ã¤ãã£ãé¢æ°ãå¼ã³åºããã¦ãããã©ãããç°¡åãã¤ç¢ºå®ã«å¤æã§ããä¸è½ãªæ¹æ³ã¯åå¨ãã¾ãããèå¼±æ§ã®å½±é¿ã®æç¡ã®èª¿æ»çµæãå¾ ã£ã¦ããéã«ä¾µå ¥ããã¦ãã¾ã£ã¦ã¯æå³ãããã¾ããã第9åãã¢ãããã¼ããã¹ã¹ã¡ãï¼ http://www.intellilink.co.jp/column/oss/2014/112500 ï¼ã§ç´¹ä»ããéããRHEL ã®ã¡ã¸ã£ã¼ãã¼ã¸ã§ã³ãåãã§ããéã¯ã¢ããªã±ã¼ã·ã§ã³ã®äºææ§ãç¶æããã¦ãã¾ãã Red Hat 社ã®è¨äº GHOST: glibc èå¼±æ§ (CVE-2015-0235) ï¼ https://access.redhat.com/ja/articles/1333303 ï¼ã確èªã®ä¸ãç´ ç´ã«ã¢ãããã¼ãããã»ããå®ãããªå¤ãè¿ããããå¯è½æ§ãé«ãã¨æãã¾ãã
調æ»æ¹æ³1ï¼æºä¸ã§èª¿æ»ããæ¹æ³
ä»åçºè¦ãããèå¼±æ§ã¯ gethostbyname ã¨ããååã§å§ã¾ãé¢æ°ã®ä¸ã«åå¨ãã¦ãããã¨ãããããã°ã©ã ãã©ã¤ãã©ãªå ã§å®ç¾©ããã¦ããï¼å¼ã³åºãã¦ããã·ã³ãã«ãåæãã nm ã³ãã³ããç¨ãã¦ããç¨åº¦ã®èª¿æ»ãè¡ããã¨ãã§ãã¾ãã
ã¾ãã glibc ããã±ã¼ã¸ã®ä¸ãã対象ã¨ãªãã·ã³ãã«ã®ä¸è¦§ãåæãã¦ã¿ãã¨ãgethostbyname() gethostbyname_r() gethostbyname2() gethostbyname2_r() ã®ï¼ã¤ã該å½ãã¦ãããã¨ãç¢ºèª (*1) ã§ãã¾ãã
次ã«ãã·ã¹ãã ä¸ã«åå¨ãã¦ãããå®è¡å¯è½ããããä»ä¸ããã¦ããå ¨ã¦ã®é常ãã¡ã¤ã«ï¼ããã°ã©ã ãã©ã¤ãã©ãªãªã©ï¼ã対象ã«ã gethostbyname ã¨ããååã§å§ã¾ãã·ã³ãã«ãåæ (*2) (*3) ãã¦ã¿ã¾ãã
# /usr/bin/find / -type f \( -perm /100 -o -perm /10 -o -perm /1 \) -exec /usr/bin/nm -A -D -- \{\} \; 2> /dev/null | /bin/grep -F " gethostbyname"
ä¸è¨ã®å®è¡çµæãããæ§ã ãªããã°ã©ã ãã©ã¤ãã©ãªã対象ã¨ãªããã¨ã確èªã§ãã¾ããä¾ãã°ã RHEL 6 以éã® /bin/tar ã«å¯¾ã㦠nm ã³ãã³ããå®è¡ããã¨ã tar ã³ãã³ã㯠gethostbyname ã¨ããã·ã³ãã«ãåç §ãã¦ããã㨠(*4) ãå¤ãã¾ãã
ã©ã¤ãã©ãªå ã®é¢æ°å¼ã³åºãã追跡ãã ltrace ã³ãã³ããç¨ããã¨ããã®é¢æ°ãå®éã«å¼ã°ãã¦ãããã©ããã確èªãããã¨ãã§ãã¾ãã ltrace ã³ãã³ããçµç±ãã¦tar ã³ãã³ããå®è¡ããã¨ãå®éã« gethostbyname() é¢æ°ãå¼ã³åºãã¦ãããã¨ãç¢ºèª (*5) ã§ãã¾ãã
ããã«ãã¡ã¢ãªé¢é£ã®ã¨ã©ã¼ãæ¤åºãã valgrind ã¨ããã³ãã³ããçµç±ãã¦tar ã³ãã³ãã«å¯¾ãã¦é常ã«é·ãIPã¢ãã¬ã¹ã渡ãã¦ããã¨ããã®èå¼±æ§ãä¿®æ£ãããåã® glibc ã使ç¨ãã¦ããå ´åã«ã¯ gethostbyname() é¢æ°ããå¼ã°ãã__nss_hostname_digits_dots() é¢æ°å ã§ã¡ã¢ãªç ´å£ãçºçãã¦ãããã¨ãç¢ºèª (*6)ã§ãã¾ãã
注æãå¿
è¦ãªã®ã¯ã glibc 以å¤ã®ã©ã¤ãã©ãªãçµç±ãã¦éæ¥çã« glibc ã®ã©ã¤ãã©ãªãå¼ã³åºãã¦ããå ´åã§ããä¾ãã°ã RHEL 6 以éã® /bin/rpm ã«å¯¾ã㦠nm ã³ãã³ããå®è¡ããã¨ã rpm ã³ãã³ã㯠gethostbyname ã¨ããã·ã³ãã«ãåç
§ãã¦ããªãã¨ããçµæã«ãªãã¾ã
(*7) ãããããããã°ã©ã ãã©ã¤ãã©ãªã®æ
å ±ãåºåãã objdump ã³ãã³ããç¨ãã¦ä¾åé¢ä¿ã®ããã©ã¤ãã©ãªãæ½åºãã¦ã¿ã (*8) ã¨ã RHEL 7 ã«ããã /bin/rpm ã¨ããããã°ã©ã 㯠librpm.so.3 ã¨ããã©ã¤ãã©ãªãå¿
è¦ã¨ãããã¨ãç¢ºèª (*9) ã§ãã¾ãã
ããã¦ã librpm.so.3 ã«å¯¾ã㦠nm ã³ãã³ããå®è¡ããçµæ (*10) ããã rpmã³ãã³ããéæ¥çã« gethostbyname ã¨ããã·ã³ãã«ãåç
§ãã¦ãããã¨ãå¤ãã¾ããltrace ã³ãã³ããçµç±ã㦠rpm ã³ãã³ããå®è¡ããã¨ã rpm ã³ãã³ããå®éã«gethostbyname() é¢æ°ãå¼ã³åºãã¦ãããã¨ãç¢ºèª (*11) ã§ãã¾ãã
以ä¸ããã以ä¸ã®ããã« ltrace ã³ãã³ããç¨ãããã¨ã§ãä»åèå¼±æ§ã®è¦ã¤ãã£ãé¢æ°ãå®éã«å¼ã³åºãã¦ãããã©ããã調æ»ã§ãã (*12) çã§ãã
$ /usr/bin/ltrace -tt -T -f -s 4096 -e gethostbyname -e gethostbyname2 -e gethostbyname_r -e gethostbyname2_r 調æ»å¯¾è±¡ã®ããã°ã©ã ã®ã³ãã³ãã©ã¤ã³
ããããæºä¸ã§èª¿æ»ããæ¹æ³ã§ã¯ãã¤ã³ã¹ãã¼ã«ããã¦ããããã°ã©ã ãã©ã¤ãã©ãªãå®éã«ä½¿ç¨ããã¦ãããã©ããã«ã¤ãã¦ã¯èæ ®ã§ãã¾ãããã¾ããæ»æè ãæ»æã§ãããã©ããï¼ã¹ããã2ãã¹ããã3ï¼ãå¤æããããã«ã対象ã®ããã°ã©ã ãã©ãããã©ã®ããã«èµ·åããã¦ããã®ããå«ãã¦è¿½è·¡ããç®çã§ã¯åä¸è¶³ã§ããããã§ãRHEL 7 ã®å ´åã«ã¯ã次ã«ç´¹ä»ããå®æ¸¬ã«åºã¥ã調æ»ããæ¹æ³ãä½µç¨ãããã¨ãã§ãã¾ãã
調æ»æ¹æ³2ï¼å®æ¸¬ã«åºã¥ã調æ»ããæ¹æ³ï¼ RHEL 7 ç¨ï¼
å®æ¸¬ã«åºã¥ã調æ»ããæ¹æ³ã¯ç·æ¥ã³ã©ã ï¼ bash èå¼±æ§ï¼ CVE-2014-6271 ï¼ã®å½±é¿ç¯å²ã®èª¿æ»æ¹æ³ã«ã¤ãã¦ï¼ http://www.intellilink.co.jp/column/oss/2014/093001 ï¼ã§èª¬æããæ¹æ³ã¨ä¼¼ã¦ããã®ã§ãããç¶æ³ãç°ãªã£ã¦ãã¾ãã
ã¤ã³ã¹ãã¼ã«ããã¦ããã»ã¼å ¨ã¦ã®ããã°ã©ã ããä»åèå¼±æ§ã®è¦ã¤ãã£ãé¢æ°ãæä¾ãã¦ãã /lib/libc.so.6 ããã㯠/lib64/libc.so.6 ã使ç¨ãã¦ããããã第12åã System Call Auditing ãã¹ã¹ã¡ãï¼ http://www.intellilink.co.jp/column/oss/2015/010600 ï¼ã§ç´¹ä»ããæé ã«æ²¿ã£ã¦ libc.so.6 ãã¡ã¤ã«ã®ãªã¼ãã³ãææãã¦ãæå³ãããã¾ããã
Linux 3.5 ã§è¿½å ããã UPROBES æ©è½ãå©ç¨å¯è½ãªã«ã¼ãã«ã®å ´åã第14åã SystemTap ãã¹ã¹ã¡ãï¼ http://www.intellilink.co.jp/column/oss/2015/020200 ï¼ã«ç»å ´ããSystemTap ãç¨ãã¦ã¦ã¼ã¶ç©ºéã®é¢æ°å¼ã³åºããææã§ããããã«ãªã (*13) ãããSystem Call Auditing ã TOMOYO Linux / AKARI ã®ããã«ã«ã¼ãã«å é¨ã§ææããæ¹æ³ã§ã¯å¯¾å¦ã§ããªãä»åã®ãããªã±ã¼ã¹ã«ã対å¿ã§ããããã«ãªãã¾ãã以ä¸ã«æé ã示ãã¾ãã
1. kernel ã® debuginfo ããã±ã¼ã¸ã¨ systemtap ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã¾ãã
# debuginfo-install kernel # yum install systemtap
2. gethostbyname.stp (*14) ãã³ã³ãã¤ã«ã㦠stap_gethostbyname.ko ãä½æãã¾ãã
# stap -p4 -g -DMAXSTRINGLEN=4096 -m stap_gethostbyname gethostbyname.stp
3. stap_gethostbyname.ko ããã¼ãããç¶æ ã§ã·ã¹ãã ã稼åããããã¨ã«ããã /lib/libc.so.6 ããã㯠/lib64/libc.so.6 ãæä¾ãã¦ãã gethostbyname ã§å§ã¾ãé¢æ°ã®å¼ã³åºãå±¥æ´ãåå¾ãã (*15) ãã¨ãã§ãã¾ãã
# staprun stap_gethostbyname.ko
Linux ã«ã¯ããã©ã¼ãã³ã¹è¨æ¸¬ããããã°ãªã©ã®ããã«ä½¿ããæ§ã ãªãã¼ã«ãåå¨ãã¦ãã¾ããæ¯éããããã®ãã¼ã«ã®åå¨ãç¥ã£ã¦ãåé¡è§£æ±ºã«å½¹ç«ã¦ã¦ããã ãããã¨æãã¾ãã
(*1) 以ä¸ã«ç¤ºãã¾ããåºåãããå 容ã¯ãã¼ã¸ã§ã³ã«ããç°ãªãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ for i in `/bin/rpm -ql glibc nscd`; do /usr/bin/nm -A -D -- $i ; done 2> /dev/null | /bin/grep " gethostbyname" /lib64/libc-2.17.so:000000000010e8a0 T gethostbyname /lib64/libc-2.17.so:000000000010eaa0 T gethostbyname2 /lib64/libc-2.17.so:000000000010ecb0 T gethostbyname2_r /lib64/libc-2.17.so:000000000010f070 T gethostbyname_r /lib64/libc.so.6:000000000010e8a0 T gethostbyname /lib64/libc.so.6:000000000010eaa0 T gethostbyname2 /lib64/libc.so.6:000000000010ecb0 T gethostbyname2_r /lib64/libc.so.6:000000000010f070 T gethostbyname_r ---------- å®è¡çµæä¾ãããã¾ã§ ----------
(*2) -perm /numeric ã¨ããæ§æããµãã¼ããã¦ããªãå¤ã find ã³ãã³ãã®å ´åã /numeric ã®ä»£ããã« +numeric ã使ç¨ãã¾ãã RHEL 7 ã§ä½¿ããã¦ãã findã³ãã³ãã§ã¯ã以ä¸ã®å ±åã«ããããã« +numeric ãæå®ããå ´åã®æåãRHEL 6 ã¾ã§ä½¿ããã¦ãã find ã³ãã³ãã¨ã¯ç°ãªã£ã¦ãã¾ãã®ã§ã注æãã¦ãã ããã
Bug 1116237 - find -perm +numeric does not work as expected https://bugzilla.redhat.com/show_bug.cgi?id=1116237
(*3) nm ã³ãã³ãã«ã¯è¤æ°ã®ãã¹åãæå®ãããã¨ãã§ããã®ã§ãæ¬æ¥ã§ããã° find ã³ãã³ãã® -print0 㨠xargs ã³ãã³ãã® -0 ã¨ãçµã¿åããããã¨ã§å¹ççã«å¦çã§ããçã§ãããããã以ä¸ã®å ±åã«ããããã«æå¾ éãã«åä½ããªããããfind ã³ãã³ãã® -exec ãç¨ãã¦ï¼åãã¤å¦çããããã«ãã¦ãã¾ãã
Bug 1022845 - binutils: nm -D does not process subsequent files after "No symbols". https://bugzilla.redhat.com/show_bug.cgi?id=1022845
(*4) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/nm -A -D /bin/tar | /bin/grep -F " gethostbyname" /bin/tar: U gethostbyname ---------- å®è¡çµæä¾ãããã¾ã§ ----------
(*5) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/ltrace -tt -T -e gethostbyname /bin/tar -tf 127.0.0.1: 09:56:30.325517 tar->gethostbyname("127.0.0.1") = 0x7f7c98f34e20 <0.002021> bash: /etc/rmt: No such file or directory 09:56:30.541222 --- SIGCHLD (Child exited) --- /bin/tar: 127.0.0.1\:: Cannot open: Input/output error /bin/tar: Error is not recoverable: exiting now 09:56:30.541839 +++ exited (status 2) +++ ---------- å®è¡çµæä¾ãããã¾ã§ ---------- 0.002021>
(*6) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/valgrind /bin/tar -tf 127.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0.1: ==3856== Memcheck, a memory error detector ==3856== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==3856== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==3856== Command: /bin/tar -tf 127.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0.1: ==3856== ==3856== Invalid write of size 1 ==3856== at 0x4C2B430: __GI_strcpy (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==3856== by 0x5369520: __nss_hostname_digits_dots (in /usr/lib64/libc-2.17.so) ==3856== by 0x536E92F: gethostbyname (in /usr/lib64/libc-2.17.so) ==3856== by 0x4263FC: ??? (in /usr/bin/tar) ==3856== by 0x4088D9: ??? (in /usr/bin/tar) ==3856== by 0x41922D: ??? (in /usr/bin/tar) ==3856== by 0x404F76: ??? (in /usr/bin/tar) ==3856== by 0x5281AF4: (below main) (in /usr/lib64/libc-2.17.so) ==3856== Address 0x60d4ef1 is 0 bytes after a block of size 1,041 alloc'd ==3856== at 0x4C2A3AA: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==3856== by 0x536946B: __nss_hostname_digits_dots (in /usr/lib64/libc-2.17.so) ==3856== by 0x536E92F: gethostbyname (in /usr/lib64/libc-2.17.so) ==3856== by 0x4263FC: ??? (in /usr/bin/tar) ==3856== by 0x4088D9: ??? (in /usr/bin/tar) ==3856== by 0x41922D: ??? (in /usr/bin/tar) ==3856== by 0x404F76: ??? (in /usr/bin/tar) ==3856== by 0x5281AF4: (below main) (in /usr/lib64/libc-2.17.so) ==3856== ==3856== Invalid write of size 1 ==3856== at 0x4C2B443: __GI_strcpy (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==3856== by 0x5369520: __nss_hostname_digits_dots (in /usr/lib64/libc-2.17.so) ==3856== by 0x536E92F: gethostbyname (in /usr/lib64/libc-2.17.so) ==3856== by 0x4263FC: ??? (in /usr/bin/tar) ==3856== by 0x4088D9: ??? (in /usr/bin/tar) ==3856== by 0x41922D: ??? (in /usr/bin/tar) ==3856== by 0x404F76: ??? (in /usr/bin/tar) ==3856== by 0x5281AF4: (below main) (in /usr/lib64/libc-2.17.so) ==3856== Address 0x60d4ef8 is 7 bytes after a block of size 1,041 alloc'd ==3856== at 0x4C2A3AA: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==3856== by 0x536946B: __nss_hostname_digits_dots (in /usr/lib64/libc-2.17.so) ==3856== by 0x536E92F: gethostbyname (in /usr/lib64/libc-2.17.so) ==3856== by 0x4263FC: ??? (in /usr/bin/tar) ==3856== by 0x4088D9: ??? (in /usr/bin/tar) ==3856== by 0x41922D: ??? (in /usr/bin/tar) ==3856== by 0x404F76: ??? (in /usr/bin/tar) ==3856== by 0x5281AF4: (below main) (in /usr/lib64/libc-2.17.so) ==3856== bash: /etc/rmt: No such file or directory ==3856== Warning: invalid file descriptor -1 in syscall close() ==3856== Warning: invalid file descriptor -1 in syscall close() /bin/tar: 127.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0.1\:: Cannot open: Input/output error /bin/tar: Error is not recoverable: exiting now ==3856== ==3856== HEAP SUMMARY: ==3856== in use at exit: 19,609 bytes in 6 blocks ==3856== total heap usage: 109 allocs, 103 frees, 43,968 bytes allocated ==3856== ==3856== LEAK SUMMARY: ==3856== definitely lost: 0 bytes in 0 blocks ==3856== indirectly lost: 0 bytes in 0 blocks ==3856== possibly lost: 0 bytes in 0 blocks ==3856== still reachable: 19,609 bytes in 6 blocks ==3856== suppressed: 0 bytes in 0 blocks ==3856== Rerun with --leak-check=full to see details of leaked memory ==3856== ==3856== For counts of detected and suppressed errors, rerun with: -v ==3856== ERROR SUMMARY: 8 errors from 2 contexts (suppressed: 3 from 3) ---------- å®è¡çµæä¾ãããã¾ã§ ----------
(*7) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/nm -A -D /bin/rpm | /bin/grep -F " gethostbyname" ---------- å®è¡çµæä¾ãããã¾ã§ ----------
(*8) 以ä¸ã®ãã¼ã¸ã«ããããã«ãã»ãã¥ãªãã£ä¸ã®çç±ãã ldd ã³ãã³ãã§ã¯ãªã objdump ã³ãã³ãã使ç¨ãã¦ãã¾ãã
Man page of LDD http://linuxjm.sourceforge.jp/html/LDP_man-pages/man1/ldd.1.html
(*9) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/objdump -p /bin/rpm | /bin/grep NEEDED NEEDED librpm.so.3 NEEDED librpmio.so.3 NEEDED libselinux.so.1 NEEDED libcap.so.2 NEEDED libacl.so.1 NEEDED libdb-5.3.so NEEDED libbz2.so.1 NEEDED libelf.so.1 NEEDED liblzma.so.5 NEEDED liblua-5.1.so NEEDED libm.so.6 NEEDED libnss3.so NEEDED libpopt.so.0 NEEDED libz.so.1 NEEDED libdl.so.2 NEEDED libpthread.so.0 NEEDED libc.so.6 ---------- å®è¡çµæä¾ãããã¾ã§ ----------
(*10) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/nm -A -D /usr/lib64/librpm.so.3 | /bin/grep -F " gethostbyname" /usr/lib64/librpm.so.3: U gethostbyname ---------- å®è¡çµæä¾ãããã¾ã§ ----------
(*11) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- $ /usr/bin/ltrace -tt -T -e gethostbyname /bin/rpm -qlp http://127.0.0.1/ 10:00:00.293391 librpm.so.3->gethostbyname("localhost") = 0x7fa42db26e20 <0.015916> curl: (7) Failed connect to 127.0.0.1:80; Connection refused 10:00:00.358327 --- SIGCHLD (Child exited) --- error: open of http://127.0.0.1/ failed: No such file or directory 10:00:00.359835 +++ exited (status 1) +++ ---------- å®è¡çµæä¾ãããã¾ã§ ---------- 0.015916>
(*12) 以ä¸ã®å ±åã«ããããã«ãå¤ã ltrace ã³ãã³ãã§ã¯ãã«ãã¹ã¬ããã®ããã°ã©ã ãæ±ãã¾ããã®ã§ã該å½ããæ¹ã¯ã¢ãããã¼ããã¦ãã ããã
Bug 742340 - ltrace cannot properly handle multi-threaded processes https://bugzilla.redhat.com/show_bug.cgi?id=742340 Bug 526007 - ltrace cannot properly handle multi-threaded processes https://bugzilla.redhat.com/show_bug.cgi?id=526007
(*13) 以ä¸ã®é£è¼ã§ã¯ã RHEL 6 ä¸ã§ SystemTap ãç¨ã㦠Java ããããã°ããäºä¾ãç´¹ä»ããã¦ãã¾ãã
Java on Linuxã鬼åãã¤ãã£ããããã°ï¼ http://www.atmarkit.co.jp/ait/kw/java_on_linux_wo_onisugo.html
(*14) 以ä¸ã«ç¤ºãã¾ãã
---------- gethostbyname.stpããããã ---------- global task_domain%[32768]; function get_current:long() { return task_current() & %{ ULONG_MAX %}; } function is_success:long(ret:long) { return ret <= -4096="" ||="" ret="">= 0; } function make_domain:string() { task = get_current(); if (task_domain[task] == "") task_domain[task] = sprintf("%s(%d) ", execname(), pid()); return task_domain[task]; } probe kernel.function("copy_process").return { if (is_success($return)) task_domain[$return] = make_domain(); } probe kernel.function("do_execve") { make_domain(); } probe kernel.function("install_exec_creds") { task_domain[get_current()] .= sprintf("%s(%d) ", execname(), pid()); } probe kernel.function("free_task") { delete task_domain[$tsk]; } probe end { delete task_domain; } probe process("/lib*/libc.so.6").function("gethostbyname*") { printf("[%s] Called by uid=%d from %s\n", ctime(gettimeofday_s()), uid(), make_domain()); } ---------- gethostbyname.stpãããã¾ã§ ---------- =>
(*15) 以ä¸ã«ç¤ºãã¾ãã
---------- å®è¡çµæä¾ããããã ---------- [Mon Feb 2 10:08:53 2015] Called by uid=0 from sshd(1592) sshd(5423) bash(5425) tar(5476) [Mon Feb 2 10:08:53 2015] Called by uid=0 from sshd(1592) sshd(5478) [Mon Feb 2 10:09:29 2015] Called by uid=0 from sshd(1592) sshd(5423) bash(5425) rpm(5519) [Mon Feb 2 10:09:29 2015] Called by uid=0 from sshd(1592) sshd(5423) bash(5425) rpm(5519) [Mon Feb 2 10:09:58 2015] Called by uid=0 from sshd(1592) sshd(5423) bash(5425) yum(5548) [Mon Feb 2 10:09:58 2015] Called by uid=0 from sshd(1592) sshd(5423) bash(5425) yum(5548) ---------- å®è¡çµæä¾ãããã¾ã§ ----------
Tweet