我是调试自己加的代码时候出现的,这个opps很简单,主要是自己写代码时候不认真导致的。
1 [ 1030.637990] BUG: unable to handle page fault for address: ffffffffc157b910 2 [ 1030.637997] #PF: supervisor read access in kernel mode 3 [ 1030.638001] #PF: error_code(0x0000) - not-present page 4 [ 1030.638004] PGD 7da0e067 P4D 7da0e067 PUD 7da10067 PMD 0 5 [ 1030.638013] Oops: 0000 [#1] SMP PTI 6 [ 1030.638019] CPU: 1 PID: 6383 Comm: cat Tainted: G OE 5.3.18 #1 7 [ 1030.638022] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/13/2018 8 [ 1030.638034] RIP: 0010:MatchFireWallRule+0x53/0xc0 [wrapfs] 9 [ 1030.638040] Code: 00 48 83 c7 01 01 c2 0f be 07 84 c0 75 ed 89 d0 25 ff ff ff 7f 48 8d 14 c5 80 c4 86 c0 49 c7 45 00 00 00 00 00 41 c6 45 08 00 <48> 8b 1a b8 fe ff ff ff 48 85 db 74 48 48 83 eb 40 75 14 eb 40 48 10 [ 1030.638044] RSP: 0018:ffffbb71c09c78b0 EFLAGS: 00010202 11 [ 1030.638048] RAX: 00000000001a1e92 RBX: ffffbb71c09c7ac9 RCX: 0000000000000000 12 [ 1030.638051] RDX: ffffffffc157b910 RSI: ffffbb71c09c79e0 RDI: ffff8f2e9c9e2233 13 [ 1030.638054] RBP: ffffbb71c09c78c8 R08: ffffbb71c09c7890 R09: ffffbb71c09c7888 14 [ 1030.638057] R10: ffff8f2eb473a840 R11: ffffbb71c09c7884 R12: ffffbb71c09c79e0 15 [ 1030.638060] R13: ffffbb71c09c78d8 R14: ffff8f2e99ce5500 R15: 0000000000000000 16 [ 1030.638064] FS: 00007f9256d05540(0000) GS:ffff8f2eb8440000(0000) knlGS:0000000000000000 17 [ 1030.638068] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 18 [ 1030.638071] CR2: ffffffffc157b910 CR3: 000000000c458005 CR4: 00000000003606e0 19 [ 1030.638162] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 20 [ 1030.638166] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 21 [ 1030.638169] Call Trace: 22 [ 1030.638183] isolation_open+0x94/0x1d0 [wrapfs] 23 [ 1030.638194] ? get_page_from_freelist+0x145b/0x1470 24 [ 1030.638200] ? prep_new_page+0x130/0x160 25 [ 1030.638206] ? get_page_from_freelist+0x145b/0x1470 26 [ 1030.638213] ? xas_load+0xc/0x80 27 [ 1030.638221] ? pagecache_get_page+0x2c/0x2b0 28 [ 1030.638227] ? prep_new_page+0x90/0x160 29 [ 1030.638234] ? sched_clock+0x9/0x10 30 [ 1030.638238] ? sched_clock+0x9/0x10 31 [ 1030.638243] ? sched_clock_cpu+0x11/0xb0 32 [ 1030.638251] ? log_store.constprop.30+0x226/0x270 33 [ 1030.638257] ? _cond_resched+0x19/0x40 34 [ 1030.638262] ? dput+0x36/0x2f0 35 [ 1030.638269] ? dquot_file_open+0x17/0x40 36 [ 1030.638274] ? ext4_file_open+0x91/0x200 37 [ 1030.638279] ? ext4_file_read_iter+0xf0/0xf0 38 [ 1030.638286] ? wrapfs_dir_open+0x2c0/0x2c0 [wrapfs] 39 [ 1030.638292] ? wrapfs_dir_open+0x2c0/0x2c0 [wrapfs] 40 [ 1030.638297] wrapfs_open+0xf2/0x170 [wrapfs] 41 [ 1030.638304] do_dentry_open+0x1f8/0x3a0 42 [ 1030.638310] vfs_open+0x2f/0x40 43 [ 1030.638315] path_openat+0x2fb/0x1700 44 [ 1030.638361] ? unlock_page_memcg+0x12/0x20 45 [ 1030.638367] ? page_add_file_rmap+0x5e/0x150 46 [ 1030.638374] ? filemap_map_pages+0x18f/0x380 47 [ 1030.638380] do_filp_open+0x9b/0x110 48 [ 1030.638386] ? cp_new_stat+0x152/0x180 49 [ 1030.638392] ? __check_object_size+0xdb/0x1b0 50 [ 1030.638399] ? __alloc_fd+0x46/0x170 51 [ 1030.638405] do_sys_open+0x1ba/0x2e0 52 [ 1030.638411] ? do_sys_open+0x1ba/0x2e0 53 [ 1030.638498] ? __audit_syscall_exit+0x1e8/0x2a0 54 [ 1030.638516] __x64_sys_openat+0x20/0x30 55 [ 1030.638525] do_syscall_64+0x5a/0x130 56 [ 1030.638534] entry_SYSCALL_64_after_hwframe+0x44/0xa9 57 [ 1030.638540] RIP: 0033:0x7f9256817d9e 58 [ 1030.638547] Code: 25 00 00 41 00 3d 00 00 41 00 74 48 48 8d 05 71 0b 2e 00 8b 00 85 c0 75 69 89 f2 b8 01 01 00 00 48 89 fe bf 9c ff ff ff 0f 05 <48> 3d 00 f0 ff ff 0f 87 a6 00 00 00 48 8b 4c 24 28 64 48 33 0c 25 59 [ 1030.638551] RSP: 002b:00007ffe1d88d250 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 60 [ 1030.638557] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007f9256817d9e 61 [ 1030.638560] RDX: 0000000000000000 RSI: 00007ffe1d88f2a3 RDI: 00000000ffffff9c 62 [ 1030.638563] RBP: 000055614b69eb80 R08: 0000000000000000 R09: 0000000000000000 63 [ 1030.638565] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 64 [ 1030.638568] R13: 00007ffe1d88d520 R14: 00007ffe1d88d528 R15: 0000000000020000 65 [ 1030.638573] Modules linked in: wrapfs(OE) vmw_vsock_vmci_transport vsock snd_ens1371 snd_ac97_codec gameport ac97_bus intel_rapl_msr snd_pcm intel_rapl_common crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 crypto_simd cryptd snd_seq_midi vmw_balloon snd_seq_midi_event glue_helper snd_rawmidi intel_rapl_perf vmwgfx snd_seq joydev input_leds serio_raw snd_seq_device ttm snd_timer drm_kms_helper drm snd soundcore vmw_vmci fb_sys_fops syscopyarea sysfillrect sysimgblt mac_hid binfmt_misc sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 vmw_pvscsi vmxnet3 hid_generic usbhid hid psmouse mptspi mptscsih mptbase ahci e1000 libahci scsi_transport_spi i2c_piix4 pata_acpi [last unloaded: wrapfs] 66 [ 1030.638635] CR2: ffffffffc157b910 67 [ 1030.638641] ---[ end trace c142af6a1de7a962 ]--- 68 [ 1030.638650] RIP: 0010:MatchFireWallRule+0x53/0xc0 [wrapfs] 69 [ 1030.638655] Code: 00 48 83 c7 01 01 c2 0f be 07 84 c0 75 ed 89 d0 25 ff ff ff 7f 48 8d 14 c5 80 c4 86 c0 49 c7 45 00 00 00 00 00 41 c6 45 08 00 <48> 8b 1a b8 fe ff ff ff 48 85 db 74 48 48 83 eb 40 75 14 eb 40 48 70 [ 1030.638658] RSP: 0018:ffffbb71c09c78b0 EFLAGS: 00010202 71 [ 1030.638662] RAX: 00000000001a1e92 RBX: ffffbb71c09c7ac9 RCX: 0000000000000000 72 [ 1030.638665] RDX: ffffffffc157b910 RSI: ffffbb71c09c79e0 RDI: ffff8f2e9c9e2233 73 [ 1030.638667] RBP: ffffbb71c09c78c8 R08: ffffbb71c09c7890 R09: ffffbb71c09c7888 74 [ 1030.638670] R10: ffff8f2eb473a840 R11: ffffbb71c09c7884 R12: ffffbb71c09c79e0 75 [ 1030.638672] R13: ffffbb71c09c78d8 R14: ffff8f2e99ce5500 R15: 0000000000000000 76 [ 1030.638677] FS: 00007f9256d05540(0000) GS:ffff8f2eb8440000(0000) knlGS:0000000000000000 77 [ 1030.638680] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 78 [ 1030.638683] CR2: ffffffffc157b910 CR3: 000000000c458005 CR4: 00000000003606e0 79 [ 1030.638761] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 80 [ 1030.638764] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
看到opps不要慌,内核栈回溯都出现了,就慢慢排查
首先看到这里 : isolation_open+0x94/0x1d0 [wrapfs]
发现wrapfs驱动有问题,那咋整,肯定是这样
objdump -S wrapfs.ko > wrapfs.s
先反汇编下来,慢慢找到对应那一行代码
拷贝wrapfs.s 里面的 isolation_open 反汇编的函数
1 int isolation_open(struct inode *inode, struct file *file) 2 { 3 39c0: e8 00 00 00 00 callq 39c5 <isolation_open+0x5> 4 39c5: 55 push %rbp 5 39c6: 48 89 e5 mov %rsp,%rbp 6 39c9: 41 56 push %r14 7 39cb: 41 55 push %r13 8 39cd: 41 54 push %r12 9 39cf: 53 push %rbx 10 39d0: 65 4c 8b 24 25 00 00 mov %gs:0x0,%r12 11 39d7: 00 00 12 39d9: 48 81 ec 10 03 00 00 sub $0x310,%rsp 13 char combine_path[256]; 14 char *path_ptr; 15 struct wrapfs_file_info *fileinfo; 16 FileRule Rule; 17 struct file *filep; 18 struct file *lower_file = wrapfs_lower_file(file); 19 39e0: 4c 8b ae c8 00 00 00 mov 0xc8(%rsi),%r13 20 { 21 39e7: 65 48 8b 04 25 28 00 mov %gs:0x28,%rax 22 39ee: 00 00 23 39f0: 48 89 45 d8 mov %rax,-0x28(%rbp) 24 39f4: 31 c0 xor %eax,%eax 25 low_path[0] = 0; 26 combine_path[0] = 0; 27 28 fileinfo = (struct wrapfs_file_info *)file->private_data; 29 30 if (current->fs == NULL) { 31 39f6: 49 83 bc 24 b0 0a 00 cmpq $0x0,0xab0(%r12) 32 39fd: 00 00 33 39ff: 4d 8b 75 00 mov 0x0(%r13),%r14 34 low_path[0] = 0; 35 3a03: c6 85 d8 fd ff ff 00 movb $0x0,-0x228(%rbp) 36 combine_path[0] = 0; 37 3a0a: c6 85 d8 fe ff ff 00 movb $0x0,-0x128(%rbp) 38 if (current->fs == NULL) { 39 3a11: 0f 84 49 01 00 00 je 3b60 <isolation_open+0x1a0> 40 pr_info("current->fs == NULL, current task name:%s\n", current->comm); 41 goto out_err; 42 } 43 44 path_ptr = file_path(lower_file, low_path, 256); 45 3a17: 48 8d b5 d8 fd ff ff lea -0x228(%rbp),%rsi 46 3a1e: ba 00 01 00 00 mov $0x100,%edx 47 3a23: 4c 89 f7 mov %r14,%rdi 48 3a26: e8 00 00 00 00 callq 3a2b <isolation_open+0x6b> 49 50 if (!path_ptr) { 51 3a2b: 48 85 c0 test %rax,%rax 52 path_ptr = file_path(lower_file, low_path, 256); 53 3a2e: 48 89 c3 mov %rax,%rbx 54 if (!path_ptr) { 55 3a31: 0f 84 46 01 00 00 je 3b7d <isolation_open+0x1bd> 56 } 57 58 // 59 // 从防火墙中匹配 60 // 61 err = MatchFireWallRule(current->comm, low_path, &Rule); 62 3a37: 49 81 c4 70 0a 00 00 add $0xa70,%r12 63 3a3e: 48 8d 95 d0 fc ff ff lea -0x330(%rbp),%rdx 64 3a45: 48 8d b5 d8 fd ff ff lea -0x228(%rbp),%rsi 65 3a4c: 4c 89 e7 mov %r12,%rdi 66 3a4f: e8 00 00 00 00 callq 3a54 <isolation_open+0x94> 67 68 fileinfo->flag = Rule.flag; 69 3a54: 8b 95 d0 fc ff ff mov -0x330(%rbp),%edx 70 fileinfo->WriteBack = Rule.WriteBack; 71 72 73 if (IS_ERR_VALUE((void *)err)) { 74 3a5a: 3d 00 f0 ff ff cmp $0xfffff000,%eax 75 fileinfo->flag = Rule.flag; 76 3a5f: 41 89 55 10 mov %edx,0x10(%r13) 77 fileinfo->WriteBack = Rule.WriteBack; 78 3a63: 8b 95 d4 fc ff ff mov -0x32c(%rbp),%edx 79 3a69: 41 89 55 14 mov %edx,0x14(%r13) 80 if (IS_ERR_VALUE((void *)err)) { 81 3a6d: 0f 87 a8 00 00 00 ja 3b1b <isolation_open+0x15b> 82 goto out_err; 83 } 84 85 86 pr_info("taks : %s, open file : %s\n", current->comm, path_ptr); 87 3a73: 48 89 da mov %rbx,%rdx 88 3a76: 4c 89 e6 mov %r12,%rsi 89 3a79: 48 c7 c7 00 00 00 00 mov $0x0,%rdi 90 3a80: e8 00 00 00 00 callq 3a85 <isolation_open+0xc5> 91 if (strlcat(p, q, p_size) >= p_size) 92 3a85: 48 8d 85 d0 fc ff ff lea -0x330(%rbp),%rax 93 3a8c: 48 8d bd d8 fe ff ff lea -0x128(%rbp),%rdi 94 3a93: ba 00 01 00 00 mov $0x100,%edx 95 3a98: 48 8d 70 08 lea 0x8(%rax),%rsi 96 3a9c: e8 00 00 00 00 callq 3aa1 <isolation_open+0xe1> 97 3aa1: 48 3d ff 00 00 00 cmp $0xff,%rax 98 3aa7: 0f 87 a7 00 00 00 ja 3b54 <isolation_open+0x194> 99 3aad: 48 8d bd d8 fe ff ff lea -0x128(%rbp),%rdi 100 3ab4: ba 00 01 00 00 mov $0x100,%edx 101 3ab9: 48 89 de mov %rbx,%rsi 102 3abc: e8 00 00 00 00 callq 3ac1 <isolation_open+0x101> 103 3ac1: 48 3d ff 00 00 00 cmp $0xff,%rax 104 3ac7: 0f 87 87 00 00 00 ja 3b54 <isolation_open+0x194> 105 // 拷贝映射后的路径 106 // 107 strcat(combine_path, Rule.MapPath); 108 strcat(combine_path, path_ptr); 109 110 pr_info("taks : %s, full file : %s\n", current->comm, combine_path); 111 3acd: 48 8d 95 d8 fe ff ff lea -0x128(%rbp),%rdx 112 3ad4: 4c 89 e6 mov %r12,%rsi 113 3ad7: 48 c7 c7 00 00 00 00 mov $0x0,%rdi 114 3ade: e8 00 00 00 00 callq 3ae3 <isolation_open+0x123> 115 116 filep = must_create_mkfile( combine_path, 117 3ae3: 48 8d bd d8 fe ff ff lea -0x128(%rbp),%rdi 118 3aea: ba ff 01 00 00 mov $0x1ff,%edx 119 3aef: be 42 02 00 00 mov $0x242,%esi 120 3af4: e8 00 00 00 00 callq 3af9 <isolation_open+0x139> 121 //O_TRUNC | O_RDWR | O_CREAT | file->f_flags, 122 O_TRUNC | O_RDWR | O_CREAT, 123 S_IRWXG | S_IRWXU | S_IRWXO); 124 if (IS_ERR(filep)) { 125 3af9: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax 126 filep = must_create_mkfile( combine_path, 127 3aff: 48 89 c3 mov %rax,%rbx 128 if (IS_ERR(filep)) { 129 3b02: 77 36 ja 3b3a <isolation_open+0x17a> 130 pr_info("taks : %s, open file :%s fail!!!\n", current->comm, combine_path); 131 err = PTR_ERR(filep); 132 goto out_err; 133 } 134 135 lower_file->f_mode |= (FMODE_WRITE | FMODE_CAN_WRITE | FMODE_READ | FMODE_CAN_READ); 136 3b04: 41 81 4e 44 03 00 06 orl $0x60003,0x44(%r14) 137 3b0b: 00 138 fileinfo->wrapfs_file = filep; 139 140 err = copy_file(filep, lower_file); 141 3b0c: 4c 89 f6 mov %r14,%rsi 142 fileinfo->wrapfs_file = filep; 143 3b0f: 49 89 45 08 mov %rax,0x8(%r13) 144 err = copy_file(filep, lower_file); 145 3b13: 48 89 c7 mov %rax,%rdi 146 3b16: e8 65 f9 ff ff callq 3480 <copy_file> 147 148 out_err: 149 return err; 150 151 }
先进行简单计算: isolation_open+0x94, isolation_open = 0x39c0
那么: isolation_open+0x94 = 0x3a54
这个0x3a54恰好是callq 3a54 <isolation_open+0x94> 这的下面一行,说明调用个函数,应该调用了
MatchFireWallRule(current->comm, low_path, &Rule);这个函数,好继续分析这个函数,
[ 1030.638034] RIP: 0010:MatchFireWallRule+0x53/0xc0 [wrapfs]
最后暴露问题是这个函数:
MatchFireWallRule+0x53
1 extern int MatchFireWallRule(char *ProcessName, char *Path, PFileRule Rule) 2 { 3 32f0: e8 00 00 00 00 callq 32f5 <MatchFireWallRule+0x5> 4 32f5: 55 push %rbp 5 32f6: 48 89 e5 mov %rsp,%rbp 6 32f9: 41 55 push %r13 7 32fb: 41 54 push %r12 8 32fd: 53 push %rbx 9 while (*str) { 10 32fe: 0f be 07 movsbl (%rdi),%eax 11 { 12 3301: 49 89 d5 mov %rdx,%r13 //rdx -> Rule, rdi -> ProcessName, rsi -> Path 13 3304: 49 89 f4 mov %rsi,%r12 14 3307: 48 c7 c2 00 00 00 00 mov $0x0,%rdx 15 while (*str) { 16 330e: 84 c0 test %al,%al 17 3310: 74 24 je 3336 <MatchFireWallRule+0x46> 18 unsigned int hash = 0; 19 3312: 31 d2 xor %edx,%edx 20 hash = hash * seed + (*str++); 21 3314: 69 d2 83 00 00 00 imul $0x83,%edx,%edx 22 331a: 48 83 c7 01 add $0x1,%rdi 23 331e: 01 c2 add %eax,%edx 24 while (*str) { 25 3320: 0f be 07 movsbl (%rdi),%eax 26 3323: 84 c0 test %al,%al 27 3325: 75 ed jne 3314 <MatchFireWallRule+0x24> 28 3327: 89 d0 mov %edx,%eax 29 3329: 25 ff ff ff 7f and $0x7fffffff,%eax 30 332e: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx 31 3335: 00 32 // ProcessName hash 33 // 34 hash1 = BKDRHash(ProcessName); 35 head1 = &FireWallByProcess[hash1]; 36 37 Rule->flag = FILE_RULE_NOTWORK; 38 3336: 49 c7 45 00 00 00 00 movq $0x0,0x0(%r13) 39 333d: 00 40 Rule->WriteBack = FIREWALL_NOT_WRITE_BACK; 41 333e: 41 c6 45 08 00 movb $0x0,0x8(%r13) 42 3343: 48 8b 1a mov (%rdx),%rbx 43 int status = -ENOENT; 44 3346: b8 fe ff ff ff mov $0xfffffffe,%eax 45 // 46 // 打开RCU Lock 开始读,完事 47 // 48 rcu_read_lock(); 49 50 hlist_for_each_entry_rcu(pFireWallRule, head1, ProcessNameHashNode) { 51 334b: 48 85 db test %rbx,%rbx 52 334e: 74 48 je 3398 <MatchFireWallRule+0xa8> 53 3350: 48 83 eb 40 sub $0x40,%rbx 54 3354: 75 14 jne 336a <MatchFireWallRule+0x7a> 55 3356: eb 40 jmp 3398 <MatchFireWallRule+0xa8> 56 3358: 48 8b 43 40 mov 0x40(%rbx),%rax 57 335c: 48 85 c0 test %rax,%rax 58 335f: 74 3e je 339f <MatchFireWallRule+0xaf> 59 3361: 48 83 e8 40 sub $0x40,%rax 60 3365: 48 89 c3 mov %rax,%rbx 61 3368: 74 35 je 339f <MatchFireWallRule+0xaf> 62 if (Match(Path, pFireWallRule->FileType)) { 63 336a: 48 8d 73 24 lea 0x24(%rbx),%rsi 64 336e: 4c 89 e7 mov %r12,%rdi 65 3371: e8 00 00 00 00 callq 3376 <MatchFireWallRule+0x86> 66 3376: 85 c0 test %eax,%eax 67 3378: 74 de je 3358 <MatchFireWallRule+0x68> 68 status = 0; 69 Rule->flag = FILE_RULE_WORK; 70 337a: 41 c7 45 00 01 00 00 movl $0x1,0x0(%r13) 71 3381: 00 72 Rule->WriteBack = pFireWallRule->WriteBack; 73 3382: 8b 43 3c mov 0x3c(%rbx),%eax 74 return __underlying_strcat(p, q); 75 3385: 49 8d 7d 08 lea 0x8(%r13),%rdi 76 3389: 41 89 45 04 mov %eax,0x4(%r13) 77 338d: 48 8b 73 30 mov 0x30(%rbx),%rsi 78 3391: e8 00 00 00 00 callq 3396 <MatchFireWallRule+0xa6> 79 status = 0; 80 3396: 31 c0 xor %eax,%eax 81 // 82 out : 83 rcu_read_unlock(); 84 85 return status; 86 }
1 // 2 // 这个字符串hash不知道效果怎么样,听说不错,"针不戳" 3 // 4 static unsigned int BKDRHash(char *str) 5 { 6 unsigned int seed = 131; // 31 131 1313 13131 131313 etc.. 7 unsigned int hash = 0; 8 9 while (*str) { 10 hash = hash * seed + (*str++); 11 } 12 // 13 // 此处自己挖了个坑,最后结果忘记 and ((1 << HASH_TABLE_BITS) - 1)),造成溢出,参见 oops1 和 oops2 14 // 15 return ((hash) //((1 << HASH_TABLE_BITS) - 1)); 16 } 17 extern int MatchFireWallRule(char *ProcessName, char *Path, PFileRule Rule) 18 { 19 int hash1; 20 struct hlist_head *head1; 21 int status = -ENOENT; 22 PFireWallRule pFireWallRule = NULL; 23 // 24 // ProcessName hash 25 // 26 hash1 = BKDRHash(ProcessName); 27 head1 = &FireWallByProcess[hash1]; 28 29 Rule->flag = FILE_RULE_NOTWORK; 30 Rule->WriteBack = FIREWALL_NOT_WRITE_BACK; 31 Rule->MapPath[0] = 0; 32 33 // 34 // 打开RCU Lock 开始读,完事 35 // 36 rcu_read_lock(); 37 38 hlist_for_each_entry_rcu(pFireWallRule, head1, ProcessNameHashNode) { 39 // 40 // mark for debug 41 // pr_err("Match pre: processName : %s, path : %s, filetype: %s\n", ProcessName, Path, pFireWallRule->FileType); 42 // 43 if (Match(Path, pFireWallRule->FileType)) { 44 // 45 // mark for debug 46 // pr_err("Match OK: path : %s, filetype: %s\n", Path, pFireWallRule->FileType); 47 // 48 status = 0; 49 Rule->flag = FILE_RULE_WORK; 50 Rule->WriteBack = pFireWallRule->WriteBack; 51 strcat(Rule->MapPath, pFireWallRule->MapPath); 52 goto out; 53 } 54 } 55 // 56 // 关闭 RCU Lock ,回家,返回 57 // 58 out : 59 rcu_read_unlock(); 60 61 return status; 62 }
配合反汇编和源代码,好像gcc把BKDRHash给inline了,
哎呦,突然发现,我忘了给hash 取模 了,妈的,超出hash 表范围了,取模后好了,
所有说这就很憨