open("/dev/tty", O_RDWR|O_NOCTTY|O_NONBLOCK) = -1 ENXIO (No such device or address)
writev(2, [{"*** glibc detected *** ", 23}, {"/usr/sbin/measure", 17}, {": ", 2}, {"free(): invalid next size (fast)", 32}, {": 0x", 4}, {"09fcccc8", 8}, {" ***\n", 5}], 7) = 91
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7752000
open("/etc/ld.so.cache", O_RDONLY) = 43
fstat64(43, {st_mode=S_IFREG|0644, st_size=59951, ...}) = 0
mmap2(NULL, 59951, PROT_READ, MAP_PRIVATE, 43, 0) = 0xb7743000
close(43) = 0
open("/lib/libgcc_s.so.1", O_RDONLY) = 43
read(43, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240\357M\0004\0\0\0"..., 512) = 512
fstat64(43, {st_mode=S_IFREG|0755, st_size=122232, ...}) = 0
mmap2(0x4dd000, 119592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 43, 0) = 0x4dd000
mmap2(0x4fa000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 43, 0x1d) = 0x4fa000
close(43) = 0
munmap(0xb7743000, 59951) = 0
futex(0x6dcd74, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x4fa1e8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "======= Backtrace: =========\n", 29) = 29
writev(2, [{"/lib/libc.so.6", 14}, {"[0x", 3}, {"5b7e31", 6}, {"]\n", 2}], 4) = 25
writev(2, [{"/lib/libc.so.6", 14}, {"[0x", 3}, {"5ba571", 6}, {"]\n", 2}], 4) = 25
writev(2, [{"/usr/lib/libtspi.so.1", 21}, {"(", 1}, {"tcm_free", 8}, {"+0x", 3}, {"1e", 2}, {")", 1}, {"[0x", 3}, {"aae08e", 6}, {"]\n", 2}], 9) = 47
writev(2, [{"/usr/lib/libtspi.so.1", 21}, {"(", 1}, {"obj_list_close", 14}, {"+0x", 3}, {"5e", 2}, {")", 1}, {"[0x", 3}, {"aab43e", 6}, {"]\n", 2}], 9) = 53
writev(2, [{"/usr/lib/libtspi.so.1", 21}, {"(", 1}, {"obj_close_context", 17}, {"+0x", 3}, {"33", 2}, {")", 1}, {"[0x", 3}, {"aab4a3", 6}, {"]\n", 2}], 9) = 56
writev(2, [{"/usr/lib/libtspi.so.1", 21}, {"(", 1}, {"Tspi_Context_Close", 18}, {"+0x", 3}, {"46", 2}, {")", 1}, {"[0x", 3}, {"ab2316", 6}, {"]\n", 2}], 9) = 57
writev(2, [{"/usr/sbin/measure", 17}, {"[0x", 3}, {"804b9e6", 7}, {"]\n", 2}], 4) = 29
writev(2, [{"/usr/sbin/measure", 17}, {"[0x", 3}, {"804c39e", 7}, {"]\n", 2}], 4) = 29
writev(2, [{"/lib/libc.so.6", 14}, {"(", 1}, {"__libc_start_main", 17}, {"+0x", 3}, {"e6", 2}, {")", 1}, {"[0x", 3}, {"55dce6", 6}, {"]\n", 2}], 9) = 49
writev(2, [{"/usr/sbin/measure", 17}, {"[0x", 3}, {"8049e11", 7}, {"]\n", 2}], 4) = 29
write(2, "======= Memory map: ========\n", 29) = 29
open("/proc/self/maps", O_RDONLY) = 43
read(43, "004d6000-004d9000 r-xp 00000000 "..., 1024) = 1024
write(2, "004d6000-004d9000 r-xp 00000000 "..., 1024) = 1024
read(43, "2000 08:01 24257630 /lib/libc-"..., 1024) = 1024
write(2, "2000 08:01 24257630 /lib/libc-"..., 1024) = 1024
read(43, "00872000 r-xp 00000000 08:01 242"..., 1024) = 1024
write(2, "00872000 r-xp 00000000 08:01 242"..., 1024) = 1024
read(43, "libkrb5support.so.0.1\n0645c000-0"..., 1024) = 1024
write(2, "libkrb5support.so.0.1\n0645c000-0"..., 1024) = 1024
read(43, "000-06941000 r--p 00060000 08:01"..., 1024) = 596
write(2, "000-06941000 r--p 00060000 08:01"..., 596) = 596
read(43, "", 1024) = 0
close(43) = 0
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(23356, 23356, SIGABRT) = 0
--- SIGABRT (Aborted) @ 0 (0) ---
上面的是strace -p pid 调试时出现的信息。
写了一个服务,里面有一个信号捕捉函数。红色字体为相关打印信息。
起初,程序卡住不动,/etc/init.d/**** status 显示正在执行,猜测可能是死循环或者阻塞了。
因此,通过strace命令查看,果然在read()处卡住,实质上是fgets函数,修改这个问题后,经多次测试,发现不经意间程序收到abrt信号。经查看日志和strace信息,最终定位。
原因是调用api中用的strdup函数返回,同时还有的函数内部malloc,返回值后没有free。修改这两个问题后,问题解决。
阅读(2722) | 评论(0) | 转发(0) |