Changes between Version 10 and Version 11 of Dev/KernelHack/COINS/worklog/201111


Ignore:
Timestamp:
Nov 25, 2011 2:02:13 AM (13 years ago)
Author:
mitty
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Dev/KernelHack/COINS/worklog/201111

    v10 v11  
    19711971$14 = 0x4855c3c9e11ca49c 
    19721972}}} 
     1973 
     1974 = 11/21 = 
     1975 == check backtrace to stackmod_read == 
     1976 * s0711489@ubuntu-lucid64:~$ sudo insmod stackmod.ko 
     1977 * s0711489@ubuntu-lucid64:~$ sudo mknod /dev/stack c 251 0 
     1978 * s0711489@ubuntu-lucid64:~$ cat /dev/stack 
     1979 * s0711489@ubuntu-lucid64:~$ tail /var/log/kern.log 
     1980{{{ 
     1981Nov 21 06:41:49 ubuntu-lucid64 kernel: [ 5352.251306] stackmod is loaded 
     1982Nov 21 06:41:49 ubuntu-lucid64 kernel: [ 5352.251310] stackmod: 128 entry, major is 251, minor is 0 
     1983Nov 21 06:41:49 ubuntu-lucid64 kernel: [ 5352.251323] stackmod: create /proc/stackmod 
     1984Nov 21 06:41:49 ubuntu-lucid64 kernel: [ 5352.251325] stackmod is added successfully 
     1985Nov 21 06:42:03 ubuntu-lucid64 kernel: [ 5366.796334] stackmod is opened 
     1986Nov 21 06:42:03 ubuntu-lucid64 kernel: [ 5366.796353] stackmod is read 
     1987Nov 21 06:42:03 ubuntu-lucid64 kernel: [ 5366.796357] stackmod is released 
     1988}}} 
     1989 
     1990 * s0711489@ubuntu-lucid64:~$ cat /sys/module/stackmod/sections/.text 
     1991{{{ 
     19920xffffffffa0062000 
     1993}}} 
     1994 * s0711489@ubuntu-lucid64:~$ cat /sys/module/stackmod/sections/.data 
     1995{{{ 
     19960xffffffffa0062478 
     1997}}} 
     1998 * s0711489@ubuntu-lucid64:~$ cat /sys/module/stackmod/sections/.bss 
     1999{{{ 
     20000xffffffffa00626b0 
     2001}}} 
     2002 
     2003 * gdb 
     2004{{{ 
     2005(gdb) file vmlinux 
     2006Reading symbols from /home/ugrad/07/s0711489/coursework/KernelHack/linux-2.6.35.14/x86_64/vmlinux...(no debugging symbols found)...done. 
     2007(gdb) add-symbol-file ../../04/stackmod/stackmod.o 0xffffffffa0062000 -s .data 0xffffffffa0062478 -s .bss 0xffffffffa00626b0 
     2008add symbol table from file "../../04/stackmod/stackmod.o" at 
     2009        .text_addr = 0xffffffffa0062000 
     2010        .data_addr = 0xffffffffa0062478 
     2011        .bss_addr = 0xffffffffa00626b0 
     2012(y or n) y 
     2013Reading symbols from /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.o...done. 
     2014(gdb) target remote localhost:8864 
     2015Remote debugging using localhost:8864 
     20160xffffffff810097a9 in native_safe_halt () 
     2017    at /home/ugrad/07/s0711489/coursework/KernelHack/linux-2.6.35.14/x86_64/arch/x86/include/asm/irqflags.h:49 
     201849              asm volatile("sti; hlt": : :"memory"); 
     2019(gdb) b stackmod_read 
     2020Breakpoint 1 at 0xffffffffa0062016: file /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c, line 56. 
     2021(gdb) c 
     2022Continuing. 
     2023}}} 
     2024 * s0711489@ubuntu-lucid64:~$ cat /dev/stack 
     2025{{{ 
     2026Breakpoint 1, stackmod_read (filep=0xffff88001efcf900, 
     2027    buf_user=0xde9000 <Address 0xde9000 out of bounds>, size=32768, 
     2028    offset=0xffff88001aecdf48) 
     2029    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:56 
     203056      ) { 
     2031(gdb) bt 
     2032#0  stackmod_read (filep=0xffff88001efcf900, 
     2033    buf_user=0xde9000 <Address 0xde9000 out of bounds>, size=32768, 
     2034    offset=0xffff88001aecdf48) 
     2035    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:56 
     2036#1  0xffffffff810df784 in vfs_read (file=0xffff88001efcf900, 
     2037    buf=0xde9000 <Address 0xde9000 out of bounds>, count=32768, 
     2038    pos=0xffff88001aecdf48) at fs/read_write.c:310 
     2039#2  0xffffffff810dfa2b in sys_read (fd=<value optimized out>, 
     2040    buf=0xde9000 <Address 0xde9000 out of bounds>, count=32768) 
     2041    at fs/read_write.c:400 
     2042#3  0xffffffff810029eb in ?? () 
     2043#4  0x0000000000000246 in stackmod_exit () 
     2044    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:175 
     2045Backtrace stopped: previous frame inner to this frame (corrupt stack?) 
     2046}}} 
     2047 
     2048 == implement read/write for char dev == 
     2049 * [http://www.mech.tohoku-gakuin.ac.jp/rde/contents/linux/drivers/chardev1.html 簡単なキャラクタデバイスをつくる] 
     2050 * 参考 
     2051  * drivers/char/mem.c -> read_zero, write_null 
     2052   * access_ok 
     2053  * drivers/char/nvram.c -> nvram_read, nvram_write 
     2054   * loff_t *ppos 
     2055  * drivers/char/tpm/tpm.c -> tpm_read, tpm_write 
     2056 
     2057 * s0711489@ubuntu-lucid64:~$ sudo insmod stackmod.ko 
     2058{{{ 
     2059Nov 21 17:33:19 ubuntu-lucid64 kernel: [   53.780695] stackmod is loaded 
     2060Nov 21 17:33:19 ubuntu-lucid64 kernel: [   53.780699] stackmod: 128 entry, major is 251, minor is 0 
     2061Nov 21 17:33:19 ubuntu-lucid64 kernel: [   53.780707] stackmod: create /proc/stackmod 
     2062Nov 21 17:33:19 ubuntu-lucid64 kernel: [   53.780709] stackmod is added successfully 
     2063}}} 
     2064 
     2065 * s0711489@ubuntu-lucid64:~$ sudo mknod /dev/stack c 251 0 
     2066 * s0711489@ubuntu-lucid64:~$ ls -l /dev/stack 
     2067 * s0711489@ubuntu-lucid64:~$ sudo chmod 666 /dev/stack 
     2068 
     2069 * s0711489@ubuntu-lucid64:~$ echo hoge > /dev/stack 
     2070{{{ 
     2071Nov 21 17:34:37 ubuntu-lucid64 kernel: [  131.432249] stackmod is opened 
     2072Nov 21 17:34:37 ubuntu-lucid64 kernel: [  131.432286] stackmod is written 
     2073Nov 21 17:34:37 ubuntu-lucid64 kernel: [  131.432292] stackmod is released 
     2074}}} 
     2075 * s0711489@ubuntu-lucid64:~$ echo fuga > /dev/stack 
     2076{{{ 
     2077Nov 21 17:34:50 ubuntu-lucid64 kernel: [  144.556110] stackmod is opened 
     2078Nov 21 17:34:50 ubuntu-lucid64 kernel: [  144.556125] stackmod is written 
     2079Nov 21 17:34:50 ubuntu-lucid64 kernel: [  144.556136] stackmod is released 
     2080}}} 
     2081 
     2082 * s0711489@ubuntu-lucid64:~$ cat /dev/stack 
     2083{{{ 
     2084fuga 
     2085���hoge 
     2086���s0711489@ubuntu-lucid64:~$ 
     2087}}} 
     2088{{{ 
     2089Nov 21 17:35:16 ubuntu-lucid64 kernel: [  170.887727] stackmod is opened 
     2090Nov 21 17:35:16 ubuntu-lucid64 kernel: [  170.887745] stackmod is read 
     2091Nov 21 17:35:16 ubuntu-lucid64 kernel: [  170.887758] stackmod is read 
     2092Nov 21 17:35:16 ubuntu-lucid64 kernel: [  170.887763] stackmod is read 
     2093Nov 21 17:35:16 ubuntu-lucid64 kernel: [  170.887766] stackmod is released 
     2094}}} 
     2095  * buggy 
     2096 
     2097 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2098{{{ 
     2099stack: 0 
     2100}}} 
     2101 * s0711489@ubuntu-lucid64:~$ echo hoge > /dev/stack 
     2102 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2103{{{ 
     2104stack: 1 
     2105}}} 
     2106 * s0711489@ubuntu-lucid64:~$ echo fuga > /dev/stack 
     2107 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2108{{{ 
     2109stack: 2 
     2110}}} 
     2111 * s0711489@ubuntu-lucid64:~$ echo piyo > /dev/stack 
     2112 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2113{{{ 
     2114stack: 3 
     2115}}} 
     2116 * s0711489@ubuntu-lucid64:~$ cat /dev/stack 
     2117{{{ 
     2118piyo 
     2119���fuga 
     2120���hoge 
     2121���s0711489@ubuntu-lucid64:~$ 
     2122}}} 
     2123 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2124{{{ 
     2125stack: 0 
     2126}}} 
     2127 
     2128 === check what is bug with gdb === 
     2129 * s0711489@ubuntu-lucid64:~$ sudo insmod stackmod.ko 
     2130 * s0711489@ubuntu-lucid64:~$ sudo mknod /dev/stack c 251 0 
     2131 * s0711489@ubuntu-lucid64:~$ sudo chmod 666 /dev/stack 
     2132 * s0711489@ubuntu-lucid64:~$ cat /sys/module/stackmod/sections/.text 
     2133{{{ 
     21340xffffffffa0056000 
     2135}}} 
     2136 * s0711489@ubuntu-lucid64:~$ cat /sys/module/stackmod/sections/.data 
     2137{{{ 
     21380xffffffffa0056738 
     2139}}} 
     2140 * s0711489@ubuntu-lucid64:~$ cat /sys/module/stackmod/sections/.bss 
     2141{{{ 
     21420xffffffffa0056970 
     2143}}} 
     2144 
     2145 * gdb 
     2146{{{ 
     2147(gdb) file vmlinux 
     2148Reading symbols from /home/ugrad/07/s0711489/coursework/KernelHack/linux-2.6.35.14/x86_64/vmlinux...(no debugging symbols found)...done. 
     2149(gdb) add-symbol-file ../../04/stackmod/stackmod.o 0xffffffffa0056000 -s .data 0xffffffffa0056738 -s .bss 0xffffffffa0056970 
     2150add symbol table from file "../../04/stackmod/stackmod.o" at 
     2151        .text_addr = 0xffffffffa0056000 
     2152        .data_addr = 0xffffffffa0056738 
     2153        .bss_addr = 0xffffffffa0056970 
     2154(y or n) y 
     2155Reading symbols from /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.o...done. 
     2156(gdb) b stackmod_proc_read 
     2157Cannot access memory at address 0xffffffffa00561e0 
     2158(gdb) target remote localhost:8864 
     2159Remote debugging using localhost:8864 
     21600xffffffff810097a9 in native_safe_halt () 
     2161    at /home/ugrad/07/s0711489/coursework/KernelHack/linux-2.6.35.14/x86_64/arch/x86/include/asm/irqflags.h:49 
     216249              asm volatile("sti; hlt": : :"memory"); 
     2163(gdb) b stackmod_proc_read 
     2164Breakpoint 1 at 0xffffffffa00561e0: file /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c, line 137. 
     2165(gdb) c 
     2166Continuing. 
     2167}}} 
     2168 
     2169 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2170{{{ 
     2171stack: 0 
     2172}}} 
     2173{{{ 
     2174Breakpoint 1, stackmod_proc_read (page=0xffff88001f792000 "0\"y\037", 
     2175    start=0xffff88001b6d1e90, off=0, count=3072, eof=0xffff88001b6d1e9c, 
     2176    data=0x0) 
     2177    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2178137     ) { 
     2179(gdb) p stack 
     2180$1 = {buffer = 0xffff88001b6e5000, depth = 0, errno = 0} 
     2181(gdb) p/x stack.buffer 
     2182$2 = 0xffff88001b6e5000 
     2183(gdb) p/x stack.buffer[0] 
     2184$3 = 0x0 
     2185(gdb) p/x stack.buffer[1] 
     2186$4 = 0x0 
     2187(gdb) c 
     2188Continuing. 
     2189 
     2190Breakpoint 1, stackmod_proc_read (page=0xffff88001f792000 "stack: 0\n", 
     2191    start=0xffff88001b6d1e90, off=9, count=3072, eof=0xffff88001b6d1e9c, 
     2192    data=0x0) 
     2193    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2194137     ) { 
     2195(gdb) p/x stack.buffer 
     2196$5 = 0xffff88001b6e5000 
     2197(gdb) p stack 
     2198$6 = {buffer = 0xffff88001b6e5000, depth = 0, errno = 0} 
     2199(gdb) p/x stack.buffer[0] 
     2200$7 = 0x0 
     2201(gdb) c 
     2202Continuing. 
     2203}}} 
     2204 
     2205 * s0711489@ubuntu-lucid64:~$ echo hoge > /dev/stack 
     2206 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2207{{{ 
     2208stack: 1 
     2209}}} 
     2210{{{ 
     2211Breakpoint 1, stackmod_proc_read (page=0xffff88001f7a3000 "@5z\037", 
     2212    start=0xffff88001b6d1e90, off=0, count=3072, eof=0xffff88001b6d1e9c, 
     2213    data=0x0) 
     2214    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2215137     ) { 
     2216(gdb) p stack 
     2217$8 = {buffer = 0xffff88001b6e5000, depth = 1, errno = 0} 
     2218(gdb) p/x stack.buffer 
     2219$9 = 0xffff88001b6e5000 
     2220(gdb) p/x stack.buffer[0] 
     2221$10 = 0xffff880017ea1340 
     2222(gdb) p stack.buffer[0] 
     2223$11 = 0xffff880017ea1340 "hoge\n\210\377\377" 
     2224(gdb) p stack.buffer[1] 
     2225$12 = 0x0 
     2226(gdb) bt 
     2227#0  stackmod_proc_read (page=0xffff88001f7a3000 "@5z\037", 
     2228    start=0xffff88001b6d1e90, off=0, count=3072, eof=0xffff88001b6d1e9c, 
     2229    data=0x0) 
     2230    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2231#1  0xffffffff811291f4 in __proc_file_read (file=<value optimized out>, 
     2232    buf=0x2398000 <Address 0x2398000 out of bounds>, nbytes=32768, 
     2233    ppos=0xffff88001b6d1f48) at fs/proc/generic.c:120 
     2234#2  proc_file_read (file=<value optimized out>, 
     2235    buf=0x2398000 <Address 0x2398000 out of bounds>, nbytes=32768, 
     2236    ppos=0xffff88001b6d1f48) at fs/proc/generic.c:201 
     2237#3  0xffffffff81124b07 in proc_reg_read (file=0xffff88001aeda840, 
     2238    buf=0x2398000 <Address 0x2398000 out of bounds>, count=32768, 
     2239    ppos=0xffff88001b6d1f48) at fs/proc/inode.c:163 
     2240#4  0xffffffff810df784 in vfs_read (file=0xffff88001aeda840, 
     2241    buf=0x2398000 <Address 0x2398000 out of bounds>, count=0, 
     2242    pos=0xffff88001b6d1f48) at fs/read_write.c:310 
     2243#5  0xffffffff810dfa2b in sys_read (fd=<value optimized out>, 
     2244    buf=0x2398000 <Address 0x2398000 out of bounds>, count=32768) 
     2245    at fs/read_write.c:400 
     2246#6  0xffffffff810029eb in ?? () 
     2247#7  0x0000000000000246 in ?? () 
     2248#8  0x00007fffe2db44d0 in ?? () 
     2249#9  0x0000000000000000 in ?? () 
     2250(gdb) c 
     2251Continuing. 
     2252 
     2253Breakpoint 1, stackmod_proc_read (page=0xffff88001f7a3000 "stack: 1\n", 
     2254    start=0xffff88001b6d1e90, off=9, count=3072, eof=0xffff88001b6d1e9c, 
     2255    data=0x0) 
     2256    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2257137     ) { 
     2258(gdb) bt 
     2259#0  stackmod_proc_read (page=0xffff88001f7a3000 "stack: 1\n", 
     2260    start=0xffff88001b6d1e90, off=9, count=3072, eof=0xffff88001b6d1e9c, 
     2261    data=0x0) 
     2262    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2263#1  0xffffffff811291f4 in __proc_file_read (file=<value optimized out>, 
     2264    buf=0x2398000 "stack: 1\n", nbytes=32768, ppos=0xffff88001b6d1f48) 
     2265    at fs/proc/generic.c:120 
     2266#2  proc_file_read (file=<value optimized out>, buf=0x2398000 "stack: 1\n", 
     2267    nbytes=32768, ppos=0xffff88001b6d1f48) at fs/proc/generic.c:201 
     2268#3  0xffffffff81124b07 in proc_reg_read (file=0xffff88001aeda840, 
     2269    buf=0x2398000 "stack: 1\n", count=32768, ppos=0xffff88001b6d1f48) 
     2270    at fs/proc/inode.c:163 
     2271#4  0xffffffff810df784 in vfs_read (file=0xffff88001aeda840, 
     2272    buf=0x2398000 "stack: 1\n", count=9, pos=0xffff88001b6d1f48) 
     2273    at fs/read_write.c:310 
     2274#5  0xffffffff810dfa2b in sys_read (fd=<value optimized out>, 
     2275    buf=0x2398000 "stack: 1\n", count=32768) at fs/read_write.c:400 
     2276#6  0xffffffff810029eb in ?? () 
     2277#7  0x0000000000000246 in ?? () 
     2278#8  0x00007fffe2db44a0 in ?? () 
     2279#9  0x0000000000000000 in ?? () 
     2280(gdb) c 
     2281Continuing. 
     2282 
     2283(gdb) d 
     2284Delete all breakpoints? (y or n) y 
     2285(gdb) b stackmod.c:144 
     2286 
     2287Breakpoint 2 at 0xffffffffa0056216: file /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c, line 144. 
     2288(gdb) c 
     2289Continuing. 
     2290}}} 
     2291 
     2292 * s0711489@ubuntu-lucid64:~$ echo hoge > /dev/stack 
     2293 * s0711489@ubuntu-lucid64:~$ echo hoge > /dev/stack 
     2294 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2295{{{ 
     2296stack: 3 
     2297}}} 
     2298{{{ 
     2299Breakpoint 2, stackmod_proc_read (page=<value optimized out>, 
     2300    start=<value optimized out>, off=<value optimized out>, 
     2301    count=<value optimized out>, eof=0xffff88001ee0de9c, 
     2302    data=<value optimized out>) 
     2303    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:146 
     2304146     } 
     2305(gdb) p len 
     2306No symbol "len" in current context. 
     2307(gdb) p outlen 
     2308$13 = <value optimized out> 
     2309(gdb) p page 
     2310$14 = <value optimized out> 
     2311(gdb) finish 
     2312Run till exit from #0  stackmod_proc_read (page=<value optimized out>, 
     2313    start=<value optimized out>, off=<value optimized out>, 
     2314    count=<value optimized out>, eof=0xffff88001ee0de9c, 
     2315    data=<value optimized out>) 
     2316    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:146 
     2317__proc_file_read (file=<value optimized out>, 
     2318    buf=0x659000 <Address 0x659000 out of bounds>, nbytes=32768, 
     2319    ppos=0xffff88001ee0df48) at fs/proc/generic.c:125 
     2320125                     if (n == 0)   /* end of file */ 
     2321Could not fetch register "orig_rax"; remote failure reply 'E00' 
     2322(gdb) c 
     2323Continuing. 
     2324 
     2325Breakpoint 2, stackmod_proc_read (page=<value optimized out>, 
     2326    start=<value optimized out>, off=<value optimized out>, 
     2327    count=<value optimized out>, eof=0xffff88001ee0de9c, 
     2328    data=<value optimized out>) 
     2329    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:146 
     2330146     } 
     2331(gdb) c 
     2332Continuing. 
     2333 
     2334(gdb) d 
     2335Delete all breakpoints? (y or n) y 
     2336(gdb) b stackmod_proc_read 
     2337 
     2338Breakpoint 3 at 0xffffffffa00561e0: file /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c, line 137. 
     2339(gdb) c 
     2340Continuing. 
     2341}}} 
     2342 
     2343 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2344{{{ 
     2345stack: 3 
     2346}}} 
     2347{{{ 
     2348Breakpoint 3, stackmod_proc_read (page=0xffff88001f792000 "stack: 3\n", 
     2349    start=0xffff88001b669e90, off=0, count=3072, eof=0xffff88001b669e9c, 
     2350    data=0x0) 
     2351    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2352137     ) { 
     2353(gdb) p outlen 
     2354$15 = <value optimized out> 
     2355(gdb) ret 
     2356Make stackmod_proc_read return now? (y or n) y 
     2357Could not fetch register "orig_rax"; remote failure reply 'E00' 
     2358(gdb) c 
     2359Continuing. 
     2360 
     2361Breakpoint 3, stackmod_proc_read (page=0xffff88001f792000 "stack: 3\n", 
     2362    start=0xffff88001b669e90, off=9, count=3072, eof=0xffff88001b669e9c, 
     2363    data=0x0) 
     2364    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2365137     ) { 
     2366(gdb) c 
     2367Continuing. 
     2368}}} 
     2369 
     2370 * s0711489@ubuntu-lucid64:~$ echo hoge > /dev/stack 
     2371 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2372{{{ 
     2373stack: 4 
     2374}}} 
     2375{{{ 
     2376Breakpoint 3, stackmod_proc_read (page=0xffff88001f792000 "stack: 3\n", 
     2377    start=0xffff88001b669e90, off=0, count=3072, eof=0xffff88001b669e9c, 
     2378    data=0x0) 
     2379    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2380137     ) { 
     2381(gdb) p stack 
     2382$16 = {buffer = 0xffff88001b6e5000, depth = 4, errno = 0} 
     2383(gdb) p/x stack.buffer 
     2384$17 = 0xffff88001b6e5000 
     2385(gdb) p/x stack.buffer[0] 
     2386$18 = 0xffff880017ea1340 
     2387(gdb) p/x stack.buffer[4] 
     2388$19 = 0x0 
     2389(gdb) p stack.buffer[0] 
     2390$20 = 0xffff880017ea1340 "hoge\n\210\377\377" 
     2391(gdb) p stack.buffer[1] 
     2392$21 = 0xffff880017ea1640 "hoge\n\210\377\377" 
     2393(gdb) p stack.buffer[2] 
     2394$22 = 0xffff880017ea1200 "hoge\n\210\377\377" 
     2395(gdb) p stack.buffer[3] 
     2396$23 = 0xffff88001ef2cd80 "hoge\n\210\377\377\210\315\362\036" 
     2397(gdb) p stack.buffer[4] 
     2398$24 = 0x0 
     2399(gdb) c 
     2400Continuing. 
     2401 
     2402Breakpoint 3, stackmod_proc_read (page=0xffff88001f792000 "stack: 4\n", 
     2403    start=0xffff88001b669e90, off=9, count=3072, eof=0xffff88001b669e9c, 
     2404    data=0x0) 
     2405    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2406137     ) { 
     2407(gdb) c 
     2408Continuing. 
     2409}}} 
     2410 
     2411 * s0711489@ubuntu-lucid64:~$ cat /dev/stack 
     2412{{{ 
     2413hoge 
     2414������hoge 
     2415���hoge 
     2416���hoge 
     2417���s0711489@ubuntu-lucid64:~$ 
     2418}}} 
     2419 * s0711489@ubuntu-lucid64:~$ cat /proc/stackmod 
     2420{{{ 
     2421stack: 0 
     2422}}} 
     2423{{{ 
     2424Breakpoint 3, stackmod_proc_read (page=0xffff88001f792000 "stack: 4\n", 
     2425    start=0xffff88001afd5e90, off=0, count=3072, eof=0xffff88001afd5e9c, 
     2426    data=0x0) 
     2427    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2428137     ) { 
     2429(gdb) p stack 
     2430$25 = {buffer = 0xffff88001b6e5000, depth = 0, errno = 0} 
     2431(gdb) p stack.buffer[0] 
     2432$26 = 0x0 
     2433(gdb) p stack.buffer[3] 
     2434$27 = 0x0 
     2435(gdb) c 
     2436Continuing. 
     2437 
     2438Breakpoint 3, stackmod_proc_read (page=0xffff88001f792000 "stack: 0\n", 
     2439    start=0xffff88001afd5e90, off=9, count=3072, eof=0xffff88001afd5e9c, 
     2440    data=0x0) 
     2441    at /home/ugrad/07/s0711489/coursework/KernelHack/04/stackmod/stackmod.c:137 
     2442137     ) { 
     2443(gdb) c 
     2444Continuing. 
     2445}}}