Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ch04: create a proc file with empty handler
/ # ls /proc/rust_demo/ rust_proc_fs / # cat /proc/rust_demo/rust_proc_fs [ 43.097837] BUG: kernel NULL pointer dereference, address: 0000000000000002 [ 43.098565] #PF: supervisor instruction fetch in kernel mode [ 43.099176] #PF: error_code(0x0010) - not-present page [ 43.099832] PGD 5490067 P4D 5490067 PUD 572a067 PMD 0 [ 43.100501] Oops: 0010 [#1] PREEMPT SMP NOPTI [ 43.101051] CPU: 0 PID: 122 Comm: cat Tainted: G E 6.3.0+ Rust-for-Linux#17 [ 43.101745] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 [ 43.101745] RIP: 0010:0x2 [ 43.101745] Code: Unable to access opcode bytes at 0xffffffffffffffd8. [ 43.101745] RSP: 0018:ffff88800573fc68 EFLAGS: 00010202 [ 43.101745] RAX: ffff8880057339c0 RBX: 0000000000000001 RCX: 0000000000000000 [ 43.101745] RDX: 0000000000000000 RSI: ffff888005729700 RDI: ffff888004f5e308 [ 43.101745] RBP: ffff88800573fca0 R08: ffff88800573fc28 R09: ffff8880056b5ac8 [ 43.101745] R10: 0000000031a4a4f0 R11: 0000000000000002 R12: ffff8880056b5ac8 [ 43.101745] R13: ffff888005729700 R14: ffff888005469480 R15: ffff888004f5e308 [ 43.101745] FS: 00000000020ee3c0(0000) GS:ffff888007a00000(0000) knlGS:0000000000000000 [ 43.101745] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 43.101745] CR2: ffffffffffffffd8 CR3: 000000000561e000 CR4: 00000000000006f0 [ 43.101745] Call Trace: [ 43.101745] <TASK> [ 43.101745] ? proc_reg_open+0xf1/0x1d0 [ 43.101745] ? proc_reg_mmap+0x110/0x110 [ 43.101745] do_dentry_open+0x166/0x450 [ 43.101745] vfs_open+0x2d/0x30 [ 43.101745] path_openat+0xa8b/0xc50 [ 43.101745] do_filp_open+0xa1/0x130 [ 43.101745] ? getname_flags+0x50/0x1e0 [ 43.101745] ? alloc_fd+0x146/0x190 [ 43.101745] do_sys_openat2+0x6d/0x130 [ 43.101745] __x64_sys_openat+0x71/0x80 [ 43.101745] do_syscall_64+0x35/0x50 [ 43.101745] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 43.101745] RIP: 0033:0x4ad15b [ 43.101745] Code: 25 00 00 41 00 3d 00 00 41 00 74 4b 64 8b 04 25 18 00 00 00 85 c0 75 67 44 89 e2 48 89 ee bf 9c ff ff ff b5 [ 43.101745] RSP: 002b:00007fffb2dcd4e0 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 [ 43.101745] RAX: ffffffffffffffda RBX: 00007fffb2dcd830 RCX: 00000000004ad15b [ 43.101745] RDX: 0000000000000000 RSI: 00007fffb2dcefb2 RDI: 00000000ffffff9c [ 43.101745] RBP: 00007fffb2dcefb2 R08: 0000000000000001 R09: 0000000000000000 [ 43.101745] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 43.101745] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001 [ 43.101745] </TASK> [ 43.101745] Modules linked in: rust_proc(E) [ 43.101745] CR2: 0000000000000002 [ 43.101745] ---[ end trace 0000000000000000 ]--- [ 43.101745] RIP: 0010:0x2 [ 43.101745] Code: Unable to access opcode bytes at 0xffffffffffffffd8. [ 43.101745] RSP: 0018:ffff88800573fc68 EFLAGS: 00010202 [ 43.101745] RAX: ffff8880057339c0 RBX: 0000000000000001 RCX: 0000000000000000 [ 43.101745] RDX: 0000000000000000 RSI: ffff888005729700 RDI: ffff888004f5e308 [ 43.101745] RBP: ffff88800573fca0 R08: ffff88800573fc28 R09: ffff8880056b5ac8 [ 43.101745] R10: 0000000031a4a4f0 R11: 0000000000000002 R12: ffff8880056b5ac8 [ 43.101745] R13: ffff888005729700 R14: ffff888005469480 R15: ffff888004f5e308 [ 43.101745] FS: 00000000020ee3c0(0000) GS:ffff888007a00000(0000) knlGS:0000000000000000 [ 43.101745] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 43.101745] CR2: ffffffffffffffd8 CR3: 000000000561e000 CR4: 00000000000006f0 [ 43.101745] note: cat[122] exited with irqs disabled Killed
- Loading branch information