리눅스 커널 qna (한글 17p, 홍석범)

Download 리눅스 커널 QnA (한글 17p, 홍석범)

Post on 14-Feb-2017

224 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • QnA

    QnA .

    .

    (antihong@tt.co.kr)

    ) ?

    )

    6.2 7.1 . .

    GNU

    () .

    ,

    ,

    .

    .

    ) C ?

    ) .

    Linux 386

    Minix OS gcc . OS

    .

    . OS

    UNIX OS C .

    ) /usr/src linux-x.y.z linux

    linux linux-x.y.z rename linux ,

    ? linux-x.y.z ?

    ) . /usr/src

    .

    linux linux- .

    linux

    .

    mailto:antihong@tt.co.kr

  • rename .

    ) . ?

    ) .

    /

    .

    ,

    .

    .( lilo

    .) LILO:

    .

    . .

    .

    (1) (Security) .

    .

    [user1 @www user1]$ id

    uid=500(user1) gid=500(user1) groups=500(user1),10(wheel)

    [user1 @www user1]$ gcc exploit.c -o exploit

    [user1 @www user1]$ ./exploit

    bug exploited successfully.

    enjoy!

    bash# id

    uid=0(root) gid=0(root) groups=500(user1),10(wheel)

    bash# uname -a

    Linux kernel.tt.co.kr 2.2.18 #1 SMP Tue Nov 21 01:22:41 KST 2000 i686 unknown

    bash# exit

    2.2.19

    6.x

    2.2.16 ,

    gcc root

    .

  • .

    (2)

    CPU Dual .

    .

    ,

    .

    /usr/src/linux make menuconfig

    Network device support ---> Ethernet (10 or 100Mbit) --->

    .

    .

    .

    .

    .

    ) ?

    ) http://kernel.pe.kr/ http://kldp.org/

    _/_/ .

    [root@work /usr/src]# rm -f linux

    [root@work /usr/src]# tar zxvfp linux-2.4.8.tar.gz

    [root@work /usr/src]# mv linux linux-2.4.8

    [root@work /usr/src]# ln -s linux-2.4.8 linux

    [root@work /usr/src]# cd /usr/include/

    [root@work /usr/include]# rm -rf asm linux scsi

    [root@work /usr/include]# ln -s /usr/src/linux/include/asm-i386 asm

    [root@work /usr/include]# ln -s /usr/src/linux/include/linux linux

    [root@work /usr/include]# ln -s /usr/src/linux/include/scsi scsi

    [root@work /usr/include]# cd /usr/src/

    http://kernel.pe.kr/http://kldp.org/_/http://kldp.org/_/

  • [root@work /usr/src/linux]# make menuconfig

    [root@work /usr/src/linux]# make dep; make clean; make bzlilo; make modules; make

    modules_install

    /etc/lilo.conf

    [root@work /boot]# /sbin/lilo

    ) rpm

    .

    )

    .

    .

    ftp://updates.redhat.com/ Kernel

    RPM . ( Kernel RPM

    RPM

    .) 7.X Kernel-2.4.3-12

    .

    kernel rpm -Uvh .

    rpm Uvh -nodeps .

    # rpm -Uvh kernel-source-2.4.3-12.i386.rpm

    Preparing... ########################################### [100%]

    1:kernel-source ########################################## [100%]

    # rpm -Uvh kernel-headers-2.4.3-12.i386.rpm

    Preparing... ########################################### [100%]

    1:kernel-headers ########################################### [100%]

    # rpm -Uvh kernel-2.4.3-12.i386.rpm

    Preparing... ########################################### [100%]

    1:kernel ########################################### [100%]

    /boot/ vmlinuz System.map

    . mkinitrd RAMDISK .

    # mkinitrd /boot/initrd-2.4.3-12.img 2.4.3-12

    mkinitrd /boot/initrd-().img .

    LILO .

    /etc/lilo.conf , initrd

    vmlinuz . /sbin/lilo

  • . rpm

    ( /boot

    .)

    . rpm

    .

    ) , ?

    2.2.X 2.4.X .

    2.2.18

    2.2.19 , 2.4.X

    2.4.X .

    ,

    2..X . 2.4.X

    .

    # finger @finger.kernel.org

    [zeus.kernel.org]

    The latest stable version of the Linux kernel is: 2.4.8

    The latest prepatch (alpha) version *appears* to be: 2.4.9-pre2

    8 14 2.4.8 .

    ftp://ftp.kernel.org/ ftp://ftp.kr.kernel.org/

    .

    ) /usr/include asm, linux, scsi

    , ?

    ) /usr/include C .

    /usr/include

    #include

    /usr/include .

    #include /usr/include/linux

    config.h .

    (/usr/src/linux/) include .

    ftp://ftp.kernel.org/ftp://ftp.kr.kernel.org/

  • ) ? (Static )

    ?

    ) .

    .

    .

    .

    () 10-15%

    .

    ) .

    )

    .

    (1) CPU

    Pentium 3, AMD K6, Cyrix, Pentium 4, Intel 386, DEC Alpha, PowerPC CPU

    . cpu 386 CPU

    Pentium-III 486

    . ,

    . CPU

    cat /proc/cpuinfo .

    "Pentium-Classic" --

    "Pentium-MMX" -- MMX

    "Pentium-Pro" -- //II

    "Pentium-III" -- III .

    (2) SMP

    Single CPU Dual CPU

    . Single CPU SMP , Dual CPU SMP

    .

    (3)

    .

    .

    (4)

  • Loadable module support ---> Enable loadable module support

    . insmod rmmod

    .

    ) , /usr/src/redhat

    /usr/src/linux . ?

    ) /usr/src/redhat RPM

    . /usr/src linux CD

    CD kernel-source rpm

    linux

    .

    ) iptables .

    ?

    ) iptables

    . Iptables

    Networking options ---> [*] Network packet filtering (replaces ipchains)

    IP: Netfilter Configuration ---> .

    Connection tracking (required for masq/NAT)

    FTP protocol support

    IP tables support (required for filtering/masq/NAT)

    Packet filtering

    Full NAT

    . iptables

    .

    iptables ,

    http://netfilter.samba.org/ iptables make ; make

    install http://rpmfind.net/ rpm iptables

    .

    ) ac ?

    )

    .

    ,

    http://netfilter.samba.org/http://rpmfind.net/

  • .

    (?)

    , .

    .

    http://www.kernel.org/pub/linux/kernel/people/ .

    Pre ,

    .

    8 14 2.4.8 , 2.4.9-pre2 .

    ) ?

    )

    20

    .

    , ,

    .

    2.4.5 2.4.7

    2.4.5 /usr/src/linux

    [root@work /usr/src/linux]# patch -p1 < patch-2.4.6

    2.4.5 2.4.6 .

    [root@work /usr/src/linux]# patch -p1 < patch-2.4.7

    2.4.6 2.4.7 .

    2.4.7 2.4.7-ac8

    [root@work /usr/src/linux]# patch -p1 < patch-2.4.7-ac8

    2.4.7 2.4.7-ac8 .

    2.4.5 2.4.7 2.4.5 2.4.7

    2.4.5->2.4.6->2.4.7 .

    . 2.4.7-ac8 2.4.7-ac9

    2.4.7-ac9 ac8

    .

    [root@work /usr/src/linux]# patch -p1 -R < patch-2.4.7-ac8

    http://www.kernel.org/pub/linux/kernel/people/

  • -R 2.4.7

    .

    [root@work /usr/src/linux]# patch -p1 < patch-2.4.7-ac9

    2.4.7 2.4.7-ac9 .

    2.4.8 2.4.9-pre1

    [root@work /usr/src/linux]# gzip -d patch-2.4.9-pre1.gz

    patch-2.4.9-pre1.gz

    [root@work /usr/src/linux]# patch -p1 < patch-2.4.9-pre1 .

    ) lilo.conf initrd , initrd ?

    , ?

    ) initrd SCSI

    . SCSI SCSI

    , SCSI

    .

    . CD

    lilo.conf initrd . SCSI SCSI

    ( *

    ) initrd .

    SCSI

    .

    ) System.map ? ?

    ) (Kernel Panic)

    16

    . /boot/System.map

    . System.map c01000cb

    16 .

    System.map

    .

    ) ?

    )

    .

    ,

  • .

    /proc ,

    .

    ,

    /etc/rc.d/rc.local

    /etc/sysctl.conf .

    sysctl a .

    .

    ) Kernel Panic ,

    ?

    ) .

    CPU

    .

    .( C

    .)

    http://linux.fh-heilbronn.de/doku/Linux/linux-2.4.7/R/panic.htmlz

    ( 2.4.7)

    [root@www log]# cat messages|grep panic

    Jul 22 14:57:45 www kernel: Kernel panic: CPU context corrupt

    Jul 25 19:25:30 www kernel: Kernel panic: CPU context corrupt

    2-3 "CPU context corrupt"

    ,

    .

    (1) CPU overclocking .

    (2) CPU .

    (3) .

    (4) .

    (http://www.uwsg.indiana.edu/hypermail/linux/kernel/index.html )

    .

    )

    . ?

    )

    http://linu