Pingu
Computer MySQL PostgreSQL Books Publications
Spielereien Kanu Business TopoDB POI Klettersteigen History TransPool Thermal Baden Brokenstuben Goldwaschen
Blog Contact
Shinguz
Google
/ch/open

Notizen zu Linux

computer - linux

Table of Contents

Zombie processes

How you can find the number of zombie processes:

$ top

last pid:  6803;  load averages:  0.44,  0.67,  0.91
386 processes: 320 sleeping, 64 zombie, 2 on cpu
CPU states:     % idle,     % user,     % kernel,     % iowait,     % swap
Memory: 3072M real, 138M free, 3231M swap in use, 1066M swap free

   PID USERNAME THR PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
  6799 oracle     1   0    0 2112K 1376K cpu/0    0:00  0.43% top
  7852 root      10  38    0   15M 4696K sleep  521:20  0.20% aws_sadmin
...

Finding zombie processes

$ ps -el | grep 'Z'

 F S   UID   PID  PPID  C PRI NI     ADDR     SZ    WCHAN TTY      TIME CMD
 8 Z  8100 25048 24115  0   0                                      0:00
 8 Z  8100 25235 24115  0   0                                      0:00
 8 Z  8100 23416 24115  0   0                                      0:00
...

And kill them…

$ kill -9

And test the result afterwards again…

Shared Libraries and LD_LIBRARY_PATH

Unter UNIX: *.so, unter Windows: *.dll. Im Gegensatz dazu gibt es statischen Libraries: *.a. Details dazu siehe: The Linux Documentation Project und Wikipedia_DE.

Wenn ein Programm gestartet wird lädt der Loader die Libraries in folgender Reihenfolge: $LD_LIBRARY_PATH, /etc/ld.so.conf (LINUX) oder /var/ld (Solaris).

$ cat /etc/ld.so.conf
/usr/X11R6/lib/Xaw95
/usr/X11R6/lib/Xaw3d
/usr/X11R6/lib
...

$ echo $LD_LIBRARY_PATH
/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server:/opt/CA/SharedComponents/lib

Sollten mal Probleme auftauchen kann man mit ldd <library> schauen, was genau das Problem sein könnte:

$ ldd libjava.so
        linux-gate.so.1 =>  (0xffffe000)
        libjvm.so => /tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/libjvm.so (0x40025000)
        libverify.so => not found
        libnsl.so.1 => /lib/libnsl.so.1 (0x40516000)
        libdl.so.2 => /lib/libdl.so.2 (0x4052b000)
        libc.so.6 => /lib/tls/libc.so.6 (0x4052e000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x40644000)
        libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2 (0x40654000)
        libm.so.6 => /lib/tls/libm.so.6 (0x4069c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

Mit folgendem Befehl sieht man, was im Library Cache verzeichnet ist, resp, ob eine Library vorhanden ist:

$ ldconfig -p | grep libstdc
        libstdc++.so.5 (libc6) => /usr/lib/libstdc++.so.5
        libstdc++.so.2.9 (libc6) => /usr/lib/libstdc++.so.2.9
        libstdc++.so.2.8 (libc6) => /usr/lib/libstdc++.so.2.8
        libstdc++.so.2.7.2 (libc6) => /usr/lib/libstdc++.so.2.7.2
        libstdc++.so (libc6) => /usr/lib/libstdc++.so
        libstdc++-libc6.2-2.so.3 (libc6) => /usr/lib/libstdc++-libc6.2-2.so.3
        libstdc++-libc6.1-2.so.3 (libc6) => /usr/lib/libstdc++-libc6.1-2.so.3
        libstdc++-libc6.1-1.so.2 (libc6) => /usr/lib/libstdc++-libc6.1-1.so.2

Und wenn man’s ganz genau wissen will, kann man der Sache so auf den Grund gehen:

$ LD_DEBUG=libs grep -c oracle /etc/passwd
      9599:     find library=libc.so.6; searching
      9599:      search path=/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/tls/i686:/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/tls:/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/i686:/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server:/opt/CA/SharedComponents/lib/tls/i686:/opt/CA/SharedComponents/lib/tls:/opt/CA/SharedComponents/lib/i686:/opt/CA/SharedComponents/lib         (LD_LIBRARY_PATH)
      9599:       trying file=/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/tls/i686/libc.so.6
      9599:       trying file=/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/tls/libc.so.6
      9599:       trying file=/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/i686/libc.so.6
      9599:       trying file=/tmp/OraInstall2005-12-22_09-36-10AM/jre/lib/i386/server/libc.so.6
      9599:       trying file=/opt/CA/SharedComponents/lib/tls/i686/libc.so.6
      9599:       trying file=/opt/CA/SharedComponents/lib/tls/libc.so.6
      9599:       trying file=/opt/CA/SharedComponents/lib/i686/libc.so.6
      9599:       trying file=/opt/CA/SharedComponents/lib/libc.so.6
      9599:      search cache=/etc/ld.so.cache
      9599:       trying file=/lib/tls/libc.so.6
      9599:     calling init: /lib/tls/libc.so.6
      9599:     initialize program: grep
      9599:     transferring control: grep
1
      9599:     calling fini: /lib/tls/libc.so.6

Parameter für LD_DEBUG sind: files, bindings, libs, details und statistics.

Linux Memory Allocators

glibc malloc Website, glibc malloc Wiki glibc Release Notes

Arm Heap Exploitation, Part 1: Understanding the Glibc Heap Implementation Arm Heap Exploitation, Part 2: Understanding the GLIBC Heap Implementation

jemalloc Source Code, jemalloc Website