Target 작성 방법관련 문의드립니다
답변 감사합니다. 우선 5.8.5 소스코드를 다운받아 다시 테스트를 해보았는데, Panic이 발생하였습니다. 1. 테스트 환경 (5.8.5 소스코드 x86_64로 기본 빌드 + 수업교재의 rootfs.cpio 사용) -http://cdn.kernel.org/pub/linux/kernel/v5.x/ 2. exp 수행했을 때, Kernel panic 로그 (맨 아래 붙였습니다) 3. 패닉 로그에 "superviosr read access in kernel mode" 가 보여서 SMAP가 적용된 상태인지 확인해봤는데, /proc/cpuinfo에는 smep 또는 smap가 보이지는 않았습니다 (수업자료 이미지로 확인했을 때도, 동일한 flag로 확인되었구요) 4. 5.8.5 소소코드 빌드 시, CONFIG 수정해줘야 하는 부분이 혹시 있나요? / $ ./exp leak : 0xffffffffa74bb209 [ 5.896325] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 5.897225] #PF: supervisor read access in kernel mode [ 5.897539] #PF: error_code(0x0000) - not-present page [ 5.898110] PGD 1da27067 P4D 1da27067 PUD 1da26067 PMD 0 [ 5.898984] Oops: 0000 [#1] SMP NOPTI [ 5.899711] CPU: 0 PID: 69 Comm: exp Tainted: G O 5.8.5 #1 [ 5.900061] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/2014 [ 5.900525] RIP: 0010:switch_task_namespaces+0x10/0x50 [ 5.901016] Code: 00 4c 8b a0 78 06 00 00 eb c0 b8 ff ff ff ff eb dd 66 0f 1f 84 00 00 00 00 00 55 48 89 0 [ 5.902367] RSP: 0018:ffff98de001a7e98 EFLAGS: 00000286 [ 5.902768] RAX: ffffffffa748b070 RBX: ffffffffa748ae40 RCX: 0000000000000000 [ 5.903156] RDX: 0000000000000000 RSI: 00007ffdfff7d588 RDI: 0000000000000000 [ 5.903491] RBP: ffff98de001a7eb0 R08: 0000000000400bb4 R09: 0000000000000000 [ 5.903998] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 5.904249] R13: 0000000000000008 R14: ffff98de001a7f10 R15: 00007ffdfff7d580 [ 5.904748] FS: 000000000088f880(0000) GS:ffff91871f000000(0000) knlGS:0000000000000000 [ 5.905241] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5.905768] CR2: 0000000000000000 CR3: 000000001da40000 CR4: 00000000000006f0 [ 5.906326] Call Trace: [ 5.907305] ? _copy_from_user+0x2c/0x60 [ 5.908878] ? test_write+0x32/0x50 [test] [ 5.909213] ? vfs_write+0xc2/0x1f0 [ 5.909424] ? ksys_write+0x5a/0xd0 [ 5.909670] ? do_syscall_64+0x3e/0x70 [ 5.909898] ? entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 5.910517] Modules linked in: test(O) [ 5.911133] CR2: 0000000000000000 [ 5.911913] ---[ end trace 4920c48988b92863 ]--- [ 5.912422] RIP: 0010:switch_task_namespaces+0x10/0x50 [ 5.912836] Code: 00 4c 8b a0 78 06 00 00 eb c0 b8 ff ff ff ff eb dd 66 0f 1f 84 00 00 00 00 00 55 48 89 0 [ 5.914237] RSP: 0018:ffff98de001a7e98 EFLAGS: 00000286 [ 5.914993] RAX: ffffffffa748b070 RBX: ffffffffa748ae40 RCX: 0000000000000000 [ 5.915562] RDX: 0000000000000000 RSI: 00007ffdfff7d588 RDI: 0000000000000000 [ 5.915874] RBP: ffff98de001a7eb0 R08: 0000000000400bb4 R09: 0000000000000000 [ 5.916158] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 5.916814] R13: 0000000000000008 R14: ffff98de001a7f10 R15: 00007ffdfff7d580 [ 5.917550] FS: 000000000088f880(0000) GS:ffff91871f000000(0000) knlGS:0000000000000000 [ 5.917881] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5.918605] CR2: 0000000000000000 CR3: 000000001da40000 CR4: 00000000000006f0 [ 5.919259] Kernel panic - not syncing: Fatal exception [ 5.919966] Kernel Offset: 0x26400000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xfff) [ 5.920774] Rebooting in 1 seconds.. ======================= / $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 6 model : 6 model name : QEMU Virtual CPU version 2.5+ stepping : 3 cpu MHz : 3407.985 cache size : 512 KB physical id : 0 siblings : 1 core id : 0 cpu cores : 1 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 13 wp : yes flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm nopl cpuid pni cx16 hypervisor lahf_lm svm 3dnowprefetch vmmcall bugs : fxsave_leak sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass bogomips : 6815.97 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: