├── .DS_Store ├── .gitignore ├── LICENSE ├── List.md ├── README.md ├── basic ├── Makefile2file │ ├── Makefile │ ├── hello1.c │ ├── hello2.c │ └── 运行结果.png ├── exnum │ ├── Makefile │ ├── exnum.c │ ├── maxnum.c │ ├── test │ │ ├── testmax.c │ │ ├── text_diff.c │ │ └── text_same.c │ └── 运行结果.png ├── hello │ ├── Makefile │ ├── README.md │ └── hello.c ├── kernel_param │ ├── Makefile │ ├── kernel_param.c │ ├── 查看结果.png │ └── 输入参数.png ├── lklist │ ├── .Makefile.swo │ ├── .Makefile.swp │ ├── Makefile │ ├── lklist.c │ ├── 删除10个节点.png │ ├── 插入100个节点.png │ └── 还有90个.png └── rbtree │ ├── Makefile │ ├── rbtree.c │ └── 运行结果.png ├── files └── ebpf_ping │ ├── pyLCC原理和开发手册.pdf │ └── 基于eBPF的ping探测.pdf ├── mm ├── alloc_mm │ ├── Makefile │ └── alloc_mm.c └── map_driver │ ├── Makefile │ ├── README.md │ ├── map_driver.c │ ├── mmap_read.c │ └── mmap_write.c ├── network └── drop_packet │ ├── step1 │ ├── .DS_Store │ ├── .cache.mk │ ├── Makefile │ ├── drop_packet.h │ └── main.c │ ├── step2 │ ├── .cache.mk │ ├── Makefile │ ├── drop_packet.h │ └── main.c │ ├── step3 │ ├── .cache.mk │ ├── Makefile │ ├── drop_packet.h │ ├── main.c │ └── misc.c │ ├── step4 │ ├── .cache.mk │ ├── Makefile │ ├── drop_packet.h │ ├── main.c │ └── misc.c │ ├── step5 │ ├── .cache.mk │ ├── Makefile │ ├── drop_packet.h │ ├── index.html │ ├── main.c │ └── misc.c │ └── step6 │ ├── .cache.mk │ ├── Makefile │ ├── drop_packet.h │ ├── index.html │ ├── main.c │ └── misc.c ├── process ├── fork_test │ ├── fork_test │ └── fork_test.c └── traverse_pcb │ ├── Makefile │ └── traverse_pcb.c └── vfs └── dentry ├── Makefile └── test_dentry.c /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | *.o 3 | *.dwo 4 | *.mod 5 | *.mod.c 6 | *.mod.o 7 | *.ko 8 | *.order 9 | *.symvers 10 | .*.cmd 11 | *.o.d 12 | .tmp_versions 13 | 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /List.md: -------------------------------------------------------------------------------- 1 | # Linux内核之旅实验代码 2 | 3 | # 基础实验 4 | 5 | | 实验目录 | 说明 | 6 | | --------------------------------------------------------------------------------------------------------- | ---------------------- | 7 | | [hello](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/basic/hello) | 经典的内核模块入门实验 | 8 | | [exnum](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/basic/exnum) | 使用内核中的函数求最大值和最小值 | 9 | | [lklist](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/basic/lklist) | 内核链表的创建、遍历,删除,并将数据打印出来 | 10 | | [kernel_param](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/basic/kernel_param) | 内核传参 | 11 | | [Makefile2file](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/basic/Makefile2file) | Makefile编译两个以上文件 | 12 | | [rbtree](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/basic/rbtree) | 红黑树的应用 | 13 | 14 | # 内存管理 15 | 16 | | 实验目录 | 说明 | 17 | | ----------------------------------------------------------------------------------------------------- | ----------- | 18 | | [alloc_mm](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/mm/alloc_mm) | 内核中内存的申请与释放 | 19 | | [map_driver](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/mm/map_driver) | map的应用 | 20 | 21 | # 进程管理 22 | 23 | | 实验目录 | 说明 | 24 | | --------------------------------------------------------------------------------------------------------- | ----------- | 25 | | [traverse_pcb](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/process/traverse_pcb) | 打印进程PCB中的字段 | 26 | | [fork_test](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/process/fork_test) | fork()的应用 | 27 | 28 | # 网络管理 29 | 30 | | 实验目录 | 说明 | 31 | | ------------------------------------------------------------------------------------------------------- | ------ | 32 | | [drop_packet](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/network/drop_packet) | 网络丢包实验 | 33 | 34 | # 虚拟文件系统 35 | 36 | | 实验目录 | 说明 | 37 | | ----------------------------------------------------------------------------------------- | --------- | 38 | | [dentry](https://github.com/linuxkerneltravel/LearningLinuxKernel/tree/master/vfs/dentry) | dentry的应用 | 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 学习Linux内核的实验代码仓库 2 | ## 仓库的作用 3 | * 在我们实验室学习Linux内核各子系统的过程中,写过许多实验代码。现在将这些代码整理在这里,并且会一直保持更新,欢迎所有的Linuxer一起来交流学习。 4 | 5 | ## 如何上传自己的代码 6 | * 您可以学习和分享开源社区中的内核试验代码,提交 Issues,可以将我们内核试验代码的git仓库fork到您的github,git pull 到本地后,您可以修改我们的内核试验代码,或者添加您的内核试验代码,需要按分类提交内核实验代码,也请给出对代码的简要说明,然后git push到您的git仓库后,再向我们的git主仓库提交 pull requests,我们的管理员看到后会 review 您的提交,如果没有问题的话,就可以 merge 到我们的git主仓库。 7 | * 每位同学需将自己的代码按类别上传到某个文件夹下,如写了一个关于fork的小实验,可以上传到“进程管理”文件夹下。 8 | * 如果一个实验涉及到多方面的内容,则需要上传至多个文件夹下。如关于网络驱动的小实验,需要上传到“设备驱动”和“网络”两个文件夹下各一份。 9 | * 提交代码时要附带代码说明文档,说明文档命名为README.md。 10 | * 管理员审核代码的正确性后通过“上传请求”,便完成上传。如果管理员拒绝请求,需向提交者写明原因。 11 | 12 | ## 如何维护已上传的代码 13 | * 所有人都可以提交Issues 和 Patch。 14 | * 提交 Patch 后经管理员审查通过,便完成维护。如果管理员拒绝请求,会向提交者写明原因。 15 | 16 | ## 代码目录 17 | * [详细目录](List.md) 18 | 19 | ## more 20 | 本仓库只是“Linux内核之旅开源社区”中“GitHub平台”的一个部分,关于“GitHub平台”的全部介绍,请浏览: 21 | https://github.com/linuxkerneltravel/community/blob/master/KernelCode.md 22 | 23 | 关于“Linux内核之旅开源社区”的总体介绍,请浏览: 24 | https://github.com/linuxkerneltravel/community 25 | 26 | -------------------------------------------------------------------------------- /basic/Makefile2file/Makefile: -------------------------------------------------------------------------------- 1 | 2 | hello-objs+=hello1.o hello2.o 3 | 4 | obj-m:=hello.o 5 | CU_PATH:=$(shell pwd) 6 | LK:=$(shell uname -r) 7 | LK_PATH:=/usr/src/linux-headers-$(LK) 8 | all: 9 | make -C $(LK_PATH) M=$(CU_PATH) modules 10 | clean: 11 | make -C $(LK_PATH) M=$(CU_PATH) clean 12 | -------------------------------------------------------------------------------- /basic/Makefile2file/hello1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int __init lk_hello1(void) 6 | { 7 | printk("hello,i am the first module!\n"); 8 | return 0; 9 | } 10 | void __exit lk_exit1(void) 11 | { 12 | printk("good bye,the first module !\n"); 13 | 14 | } 15 | //module_init(lk_hello1); 16 | //module_exit(lk_exit1); 17 | MODULE_LICENSE("GPL"); 18 | 19 | -------------------------------------------------------------------------------- /basic/Makefile2file/hello2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | extern int lk_hello1(void); 5 | extern void lk_exit1(void); 6 | static int __init lk_hello2(void) 7 | { 8 | lk_hello1(); 9 | printk("hello,i an the second module!\n"); 10 | return 0; 11 | } 12 | static void __exit lk_exit2(void) 13 | { 14 | lk_exit1(); 15 | printk("good bye,the second module!\n"); 16 | 17 | } 18 | module_init(lk_hello2); 19 | module_exit(lk_exit2); 20 | MODULE_LICENSE("GPL"); 21 | 22 | -------------------------------------------------------------------------------- /basic/Makefile2file/运行结果.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/Makefile2file/运行结果.png -------------------------------------------------------------------------------- /basic/exnum/Makefile: -------------------------------------------------------------------------------- 1 | #产生目标文件 2 | obj-m:=exnum.o 3 | #定义当前路径 4 | CURRENT_PATH:=$(shell pwd) 5 | #定义内核版本号 6 | LINUX_KERNEL:=$(shell uname -r) 7 | #定义内核源码绝对路径 8 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 9 | #编译模块 10 | all: 11 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules 12 | #清理模块 13 | clean: 14 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean 15 | 16 | 17 | -------------------------------------------------------------------------------- /basic/exnum/exnum.c: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | * Author : 梁金荣 3 | * Email : Liangjinrong111@163.com 4 | * Last modified : 2019-09-14 13:00 5 | * Filename : exnum.c 6 | * Description : 模块初始化函数中求最大数(使用内核中的代码) 7 | * *******************************************************/ 8 | 9 | //必要的头文件 10 | #include 11 | #include 12 | #include 13 | //模块的初始化函数,模块的入口函数,加载模块,需超级用户权限 14 | static int __init lk_exnum(void) 15 | { 16 | int x = 1, y = 2; 17 | 18 | printk("The module is starting here!\n"); 19 | printk("x = %d, y = %d\n", x, y); 20 | printk("max=%d\n", max(x++, y++)); 21 | printk("x = %d, y = %d\n", x, y); 22 | printk("min=%d\n", min(x++, y++)); 23 | 24 | return 0; 25 | } 26 | //出口函数,卸载模块,需超级用户权限 27 | static void __exit lk_exit(void) 28 | { 29 | printk("The maxnum moudle has exited!\n"); 30 | } 31 | 32 | module_init(lk_exnum); //内核入口点,调用初始化函数,包含在module.h中 33 | module_exit(lk_exit); //出口点 34 | MODULE_LICENSE("GPL"); //许可证 35 | MODULE_AUTHOR("ljr"); //作者(非必须) 36 | MODULE_DESCRIPTION("max and min number"); //模块描述(非必须) 37 | 38 | -------------------------------------------------------------------------------- /basic/exnum/maxnum.c: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | * Author : 梁金荣 3 | * Email : Liangjinrong111@163.com 4 | * Last modified : 2019-09-14 13:00 5 | * Filename : exnum.c 6 | * Description : 模块初始化函数中求最大数(使用内核中的代码) 7 | * *******************************************************/ 8 | 9 | //必要的头文件 10 | #include 11 | #include 12 | #include 13 | //模块的初始化函数,模块的入口函数,加载模块,需超级用户权限 14 | static int __init lk_exnum(void) 15 | { 16 | int x = 5, y = 8; 17 | printk("The module is starting here!\n"); 18 | printk("x = %d, y = %d\n", x, y); 19 | printk("max=%d\n", max(x++, y++)); 20 | printk("x = %d, y = %d\n", x, y); 21 | printk("min=%d\n", min(x++, y++)); 22 | return 0; 23 | } 24 | //出口函数,卸载模块,需超级用户权限 25 | static void __exit lk_exit(void) 26 | { 27 | printk("The maxnum moudle has exited!\n"); 28 | } 29 | 30 | module_init(lk_exnum); //内核入口点,调用初始化函数,包含在module.h中 31 | module_exit(lk_exit); //出口点 32 | MODULE_LICENSE("GPL"); //许可证 33 | MODULE_AUTHOR("ljr"); //作者(非必须) 34 | MODULE_DESCRIPTION("max and min number"); //模块描述(非必须) 35 | 36 | -------------------------------------------------------------------------------- /basic/exnum/test/testmax.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define max(a,b) ((a)>(b)?(a):(b)) 3 | int main() 4 | { 5 | 6 | int x = 1, y = 2; 7 | printf("max=%d\n", max(x++, y++)); 8 | printf("x = %d, y = %d\n", x, y); 9 | } 10 | -------------------------------------------------------------------------------- /basic/exnum/test/text_diff.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int x=1; 5 | double y=1; 6 | 7 | if((!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))==1) 8 | printf("表达式结果是1\n"); 9 | else 10 | printf("表达式结果不是1\n"); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /basic/exnum/test/text_same.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int x=1; 5 | int y=1; 6 | 7 | if((!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))==1) 8 | printf("表达式结果是1\n"); 9 | else 10 | printf("表达式结果不是1\n"); 11 | } 12 | -------------------------------------------------------------------------------- /basic/exnum/运行结果.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/exnum/运行结果.png -------------------------------------------------------------------------------- /basic/hello/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= hello.o 2 | CURRENT_PATH:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | 6 | all: 7 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules 8 | clean: 9 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean 10 | 11 | -------------------------------------------------------------------------------- /basic/hello/README.md: -------------------------------------------------------------------------------- 1 | # 经典的hello world入门代码 2 | -------------------------------------------------------------------------------- /basic/hello/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static int __init lk_hello(void) 6 | { 7 | printk("hello world!\n"); 8 | return 0; 9 | } 10 | static void __exit lk_exit(void) 11 | { 12 | printk("good bye!\n"); 13 | 14 | } 15 | module_init(lk_hello); 16 | module_exit(lk_exit); 17 | MODULE_LICENSE("GPL"); 18 | 19 | -------------------------------------------------------------------------------- /basic/kernel_param/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:=kernel_param.o 2 | CU_PATH:=$(shell pwd) 3 | LK:=$(shell uname -r) 4 | LK_PATH:=/usr/src/linux-headers-$(LK) 5 | all: 6 | make -C $(LK_PATH) M=$(CU_PATH) modules 7 | clean: 8 | make -C $(LK_PATH) M=$(CU_PATH) clean 9 | -------------------------------------------------------------------------------- /basic/kernel_param/kernel_param.c: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | * Author : 梁金荣 3 | * Email : Liangjinrong111@163.com 4 | * Last modified : 2019-09-14 13:00 5 | * Filename : exnum.c 6 | * Description : 模块初始化函数中求最大数(使用内核中的代码) 7 | * *******************************************************/ 8 | 9 | /** 10 | *必要的头文件 11 | */ 12 | #include 13 | #include 14 | #include 15 | 16 | static int a,b ; 17 | module_param(a, int, 0644); 18 | MODULE_PARM_DESC(a, "data of a"); 19 | module_param(b, int, 0644); 20 | MODULE_PARM_DESC(b, "data of b"); 21 | /** 22 | *模块的初始化函数,模块的入口函数,加载模块,需超级用户权限 23 | */ 24 | static int __init lk_exnum(void) 25 | { 26 | printk("Linux kernel param max number module is starting here!\n"); 27 | printk("a = %d, b = %d\n", a, b); 28 | printk("max=%d\n", max(a,b)); 29 | return 0; 30 | } 31 | 32 | /** 33 | *出口函数,卸载模块,需超级用户权限 34 | */ 35 | static void __exit lk_exit(void) 36 | { 37 | printk("Linux kernel param max number moudle has exited!\n"); 38 | } 39 | 40 | module_init(lk_exnum); //内核入口点,调用初始化函数,包含在module.h中 41 | module_exit(lk_exit); //出口点 42 | MODULE_LICENSE("GPL"); //许可证 43 | MODULE_AUTHOR("ljr"); //作者(非必须) 44 | MODULE_DESCRIPTION("Linux kernel param max number"); //模块描述(非必须) 45 | 46 | -------------------------------------------------------------------------------- /basic/kernel_param/查看结果.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/kernel_param/查看结果.png -------------------------------------------------------------------------------- /basic/kernel_param/输入参数.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/kernel_param/输入参数.png -------------------------------------------------------------------------------- /basic/lklist/.Makefile.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/lklist/.Makefile.swo -------------------------------------------------------------------------------- /basic/lklist/.Makefile.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/lklist/.Makefile.swp -------------------------------------------------------------------------------- /basic/lklist/Makefile: -------------------------------------------------------------------------------- 1 | #产生目标文件 2 | obj-m:=lklist.o 3 | #定义当前路径 4 | CURRENT_PATH:=$(shell pwd) 5 | #定义内核版本号 6 | LINUX_KERNEL:=$(shell uname -r) 7 | #定义内核源码绝对路径 8 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 9 | #编译模块 10 | all: 11 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules 12 | #清理模块 13 | clean: 14 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean 15 | 16 | -------------------------------------------------------------------------------- /basic/lklist/lklist.c: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | * Author : ljr 3 | * Email : Liangjinrong111@163.com 4 | * Last modified : 2019-09-15 12:41 5 | * Filename : lk_list 6 | * Description : The operation of Linux Kernel List 7 | * *******************************************************/ 8 | 9 | #include //包含了常用的内核函数 10 | #include //模块必备 11 | #include //包含了宏__init和__exit,它们允许释放内核占用的内存 12 | #include //包含双链表操作函数 13 | #include //包含了kmalloc等内存分配函数 14 | 15 | #define N 100 //链表节点数 16 | struct lklist{ 17 | int data; //数据 18 | struct list_head list; //指向双链表前后节点的指针 19 | }; 20 | struct lklist lk; //头节点 21 | 22 | /** 23 | *创建内核链表 24 | *指针和变量 25 | */ 26 | void creat_lklist(void) 27 | { 28 | struct lklist *node; //定义每次申请链表节点时所用的指针 29 | int i; 30 | 31 | INIT_LIST_HEAD(&lk.list); //初始化头节点 32 | printk("\nCreating linux kernel list!\n"); 33 | //建立N个节点,依次加到链表中 34 | for(i = 0; i < N; i++) 35 | { 36 | //GFP_KERNEL是linux内存分配器的标志,标识着内存分配器将要采取的行为 37 | node = (struct lklist *)kmalloc(sizeof(struct lklist), GFP_KERNEL); 38 | node -> data = i+1; 39 | list_add_tail(&node -> list, &lk.list); 40 | printk("Node %d has added to the lklist...\n ",i+1); 41 | } 42 | } 43 | 44 | /** 45 | * 遍历内核链表 46 | * 47 | */ 48 | void traversal_lklist(void) 49 | { 50 | struct lklist *p; 51 | struct list_head *pos; 52 | int i = 1; 53 | printk("\nTraveral linux kernel list!\n"); 54 | list_for_each(pos, &lk.list) 55 | { 56 | //通过结构体成员的指针来返回结构体的指针 57 | p = list_entry(pos, struct lklist, list); 58 | printk("Node %d's data: %d\n", i, p -> data); 59 | i++; 60 | } 61 | printk("\n\n"); 62 | } 63 | 64 | /** 65 | * 删除内核链表 66 | * 删除10个节点 67 | */ 68 | void del_lklist(void) 69 | { 70 | struct list_head *n, *pos; 71 | struct lklist *p; 72 | int i=10; 73 | printk("\nDelete linux kernel list!\n"); 74 | 75 | /* 76 | * 提供一个与pos同类型的指针n 77 | * 在for循环中暂存pos下一个节点的地址 78 | * 避免因pos节点被释放而造成的断链 79 | */ 80 | list_for_each_safe(pos, n, &lk.list) 81 | { 82 | p = list_entry(pos, struct lklist, list); 83 | list_del(pos); 84 | kfree(p); 85 | printk("\nThe node has removed from the lklist...\n"); 86 | i--; 87 | if(i==0) break; 88 | } 89 | } 90 | 91 | /** 92 | * 内核入口函数 93 | * 94 | */ 95 | static int __init lklist(void) 96 | { 97 | printk("\nLinux kernel list is starting...\n\n"); 98 | creat_lklist(); //调用创建内核链表函数 99 | traversal_lklist(); //调用遍历内核链表函数 100 | del_lklist(); //调用删除内核链表函数 101 | traversal_lklist(); //调用遍历内核链表函数 102 | return 0; 103 | } 104 | 105 | /** 106 | * 内核出口函数 107 | * 108 | */ 109 | static void __exit lklist_exit(void) 110 | { 111 | printk("\nlklist is exiting...\n"); 112 | } 113 | 114 | module_init(lklist); //入口点 115 | module_exit(lklist_exit); //出口点 116 | MODULE_LICENSE("GPL"); //许可证 117 | MODULE_AUTHOR("梁金荣"); //作者信息(非必要项) 118 | MODULE_DESCRIPTION("The operation of Linux Kernel List"); //模块描述(非必要项) 119 | -------------------------------------------------------------------------------- /basic/lklist/删除10个节点.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/lklist/删除10个节点.png -------------------------------------------------------------------------------- /basic/lklist/插入100个节点.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/lklist/插入100个节点.png -------------------------------------------------------------------------------- /basic/lklist/还有90个.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/lklist/还有90个.png -------------------------------------------------------------------------------- /basic/rbtree/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:=rbtree.o 2 | CU_PATH:=$(shell pwd) 3 | LK:=$(shell uname -r) 4 | LK_PATH:=/usr/src/linux-headers-$(LK) 5 | all: 6 | make -C $(LK_PATH) M=$(CU_PATH) modules 7 | clean: 8 | make -C $(LK_PATH) M=$(CU_PATH) clean 9 | -------------------------------------------------------------------------------- /basic/rbtree/rbtree.c: -------------------------------------------------------------------------------- 1 | /********************************************************** 2 | * Author : 梁金荣 3 | * Email : Liangjinrong111@163.com 4 | * Last modified : 2019-09-21 23:21 5 | * Filename : rbtree.c 6 | * Description : Using rbtree 7 | * *******************************************************/ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | MODULE_AUTHOR("ljr"); 18 | MODULE_DESCRIPTION("Using rbtree"); 19 | MODULE_LICENSE("GPL"); 20 | 21 | struct mytype { 22 | struct rb_node node; 23 | int key; 24 | }; 25 | 26 | struct rb_root mytree = RB_ROOT; 27 | 28 | struct mytype *my_search(struct rb_root *root, int new) 29 | { 30 | struct rb_node *node = root->rb_node; 31 | 32 | while (node) { 33 | struct mytype *data = container_of(node, struct mytype, node); 34 | 35 | if (data->key > new) 36 | node = node->rb_left; 37 | else if (data->key < new) 38 | node = node->rb_right; 39 | else 40 | return data; 41 | } 42 | return NULL; 43 | } 44 | 45 | int my_insert(struct rb_root *root, struct mytype *data) 46 | { 47 | struct rb_node **new = &(root->rb_node), *parent=NULL; 48 | 49 | /* Figure out where to put new node */ 50 | while (*new) { 51 | struct mytype *this = container_of(*new, struct mytype, node); 52 | 53 | parent = *new; 54 | if (this->key > data->key) 55 | new = &((*new)->rb_left); 56 | else if (this->key < data->key) { 57 | new = &((*new)->rb_right); 58 | } else 59 | return -1; 60 | } 61 | 62 | /* Add new node and rebalance tree. */ 63 | rb_link_node(&data->node, parent, new); 64 | rb_insert_color(&data->node, root); 65 | 66 | return 0; 67 | } 68 | 69 | 70 | static int __init my_init(void) 71 | { 72 | int i; 73 | struct mytype *data; 74 | struct rb_node *node; 75 | printk("The rbtree kernel is starting!\n"); 76 | for (i =0; i < 10; i++) { 77 | data = kmalloc(sizeof(struct mytype), GFP_KERNEL); 78 | data->key = i+1; 79 | my_insert(&mytree, data); 80 | } 81 | 82 | /*list all tree*/ 83 | for (node = rb_first(&mytree); node; node = rb_next(node)) 84 | printk("data=%d\n", rb_entry(node, struct mytype, node)->key); 85 | 86 | return 0; 87 | } 88 | 89 | static void __exit my_exit(void) 90 | { 91 | struct mytype *data; 92 | struct rb_node *node; 93 | printk("The rbtree kernel is exiting!\n"); 94 | for (node = rb_first(&mytree); node; node = rb_next(node)) { 95 | data = rb_entry(node, struct mytype, node); 96 | if (data) { 97 | rb_erase(&data->node, &mytree); 98 | kfree(data); 99 | } 100 | } 101 | } 102 | module_init(my_init); 103 | module_exit(my_exit); 104 | 105 | -------------------------------------------------------------------------------- /basic/rbtree/运行结果.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/basic/rbtree/运行结果.png -------------------------------------------------------------------------------- /files/ebpf_ping/pyLCC原理和开发手册.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/files/ebpf_ping/pyLCC原理和开发手册.pdf -------------------------------------------------------------------------------- /files/ebpf_ping/基于eBPF的ping探测.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/files/ebpf_ping/基于eBPF的ping探测.pdf -------------------------------------------------------------------------------- /mm/alloc_mm/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:=alloc_mm.o 2 | 3 | CURRENT_PATH:=$(shell pwd) 4 | LINUX_KERNEL:=$(shell uname -r) 5 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 6 | 7 | all: 8 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules 9 | 10 | clean: 11 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean 12 | -------------------------------------------------------------------------------- /mm/alloc_mm/alloc_mm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static int mem = 64; 7 | 8 | #define MB (1024*1024) 9 | 10 | static int __init my_init(void) 11 | { 12 | char *kbuf; 13 | unsigned long order; 14 | unsigned long size; 15 | char *vm_buff; 16 | 17 | /* try __get_free_pages__ */ 18 | for (size = PAGE_SIZE, order = 0; order < MAX_ORDER; 19 | order++, size *= 2) { 20 | pr_info(" order=%2lu, pages=%5lu, size=%8lu ", order, 21 | size / PAGE_SIZE, size); 22 | kbuf = (char *)__get_free_pages(GFP_ATOMIC, order); 23 | if (!kbuf) { 24 | pr_err("... __get_free_pages failed\n"); 25 | break; 26 | } 27 | pr_info("... __get_free_pages OK\n"); 28 | free_pages((unsigned long)kbuf, order); 29 | } 30 | 31 | /* try kmalloc */ 32 | for (size = PAGE_SIZE, order = 0; order < MAX_ORDER; 33 | order++, size *= 2) { 34 | pr_info(" order=%2lu, pages=%5lu, size=%8lu ", order, 35 | size / PAGE_SIZE, size); 36 | kbuf = kmalloc((size_t) size, GFP_ATOMIC); 37 | if (!kbuf) { 38 | pr_err("... kmalloc failed\n"); 39 | break; 40 | } 41 | pr_info("... kmalloc OK\n"); 42 | kfree(kbuf); 43 | } 44 | 45 | /* try vmalloc */ 46 | for (size = 4 * MB; size <= mem * MB; size += 4 * MB) { 47 | pr_info(" pages=%6lu, size=%8lu ", size / PAGE_SIZE, size / MB); 48 | vm_buff = vmalloc(size); 49 | if (!vm_buff) { 50 | pr_err("... vmalloc failed\n"); 51 | break; 52 | } 53 | pr_info("... vmalloc OK\n"); 54 | vfree(vm_buff); 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | static void __exit my_exit(void) 61 | { 62 | pr_info("Module exit\n"); 63 | } 64 | 65 | module_init(my_init); 66 | module_exit(my_exit); 67 | 68 | MODULE_LICENSE("GPL v2"); 69 | -------------------------------------------------------------------------------- /mm/map_driver/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | 13 | -------------------------------------------------------------------------------- /mm/map_driver/README.md: -------------------------------------------------------------------------------- 1 | # DEBUG 2 | 3 | ## Device or resource busy 4 | 1. cat /proc/devices 5 | 2. 找到所有的进程号. 6 | 3. 填写一个 512 以下的数字. 7 | -------------------------------------------------------------------------------- /mm/map_driver/map_driver.c: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | # include 4 | # include 5 | # include 6 | # include 7 | # include 8 | # include 9 | # include 10 | # include 11 | # include 12 | 13 | #define MAP_PAGE_COUNT 10 14 | #define MAPLEN (PAGE_SIZE * MAP_PAGE_COUNT) 15 | #define MAP_DEV_MAJOR 190 16 | #define MAP_DEV_NAME "mapnopage" 17 | 18 | extern struct mm_struct init_mm; 19 | void map_vopen(struct vm_area_struct *vma); 20 | void map_vclose(struct vm_area_struct *vma); 21 | 22 | /* device mmap */ 23 | static int mapdrv_mmap(struct file *file, struct vm_area_struct *vma); 24 | static int mapdrv_open(struct inode *inode, struct file *file); 25 | /* 26 | * vm area nopage 27 | * 教学视频里面的代码返回值是 int ,这返回值在 5 版本里面返回的是 vm_fault_t 28 | */ 29 | static vm_fault_t map_fault(struct vm_fault *vmf); 30 | 31 | /* 32 | from kernel, 一个 c 实现的接口. 33 | under mm.h 34 | 主要负责设备的读取,保存,写入等操作. 35 | */ 36 | static struct file_operations mapdrvo_fops = { 37 | .owner = THIS_MODULE, 38 | .mmap = mapdrv_mmap, 39 | .open = mapdrv_open, 40 | }; 41 | 42 | /* 43 | * from kernel 虚拟内存的接口 44 | * 打开, 关闭以及 unmapping 一个区域. 45 | * 本 module 当中主要用于缺页异常的处理. 46 | * map_fault 同样也是来自 kernel 的一个结构,主要用于处理缺页. 47 | */ 48 | static struct vm_operations_struct map_vm_ops = { 49 | .open = map_vopen, 50 | .close = map_vclose, 51 | .fault = map_fault, 52 | }; 53 | 54 | // 这个静态的 area 是 module 操作内存区域的关键。 55 | static char *vmalloc_area = NULL; 56 | 57 | static int __init mapdrv_init(void) 58 | { 59 | int result; 60 | unsigned long virt_addr; 61 | int i = 1; 62 | // 申请设备号, 如果小于0, 申请失败.,并注册实现了设备的接口 /dev/ 63 | result = register_chrdev(MAP_DEV_MAJOR, MAP_DEV_NAME, &mapdrvo_fops); 64 | if (result < 0) { 65 | return result; 66 | } 67 | // 申请一块内存区域, 问: 这块内存区域是如何被设备使用起来的? 68 | // 答: vmalloc_area 是一个 global 的变量, 将两个 operation 串接起来。 69 | vmalloc_area = vmalloc(MAPLEN); 70 | virt_addr = (unsigned long) vmalloc_area; 71 | for(virt_addr = (unsigned long) vmalloc_area; virt_addr < (unsigned long) vmalloc_area + MAPLEN; virt_addr+=PAGE_SIZE) { 72 | SetPageReserved(vmalloc_to_page((void*)virt_addr)); 73 | sprintf((char *)virt_addr, "test %d",i++); 74 | } 75 | 76 | printk("vmalloc_area at 0x%lx (phys 0x%lx)\n", (unsigned long) vmalloc_area,(unsigned long)vmalloc_to_pfn((void *)vmalloc_area) << PAGE_SHIFT); 77 | printk("vmalloc area apply complate!"); 78 | return 0; 79 | } 80 | 81 | static void __exit mapdrv_exit(void) 82 | { 83 | unsigned long virt_addr; 84 | /* unreserve all pages */ 85 | for(virt_addr = (unsigned long)vmalloc_area;virt_addr <(unsigned long)vmalloc_area + MAPLEN; virt_addr += PAGE_SIZE){ 86 | ClearPageReserved(vmalloc_to_page((void*) virt_addr)); 87 | } 88 | if (vmalloc_area) 89 | vfree(vmalloc_area); 90 | unregister_chrdev(MAP_DEV_MAJOR, MAP_DEV_NAME); 91 | } 92 | 93 | /* 实现 file_operation 的接口 */ 94 | static int mapdrv_mmap(struct file *file, struct vm_area_struct *vma) 95 | { 96 | unsigned long offset = vma -> vm_pgoff << PAGE_SHIFT; 97 | unsigned long size = vma -> vm_end - vma->vm_start; 98 | 99 | if(size > MAPLEN) { 100 | printk("size too big \n"); 101 | return -ENXIO; 102 | } 103 | /* only support shared mappings. */ 104 | if ((vma->vm_flags & VM_WRITE) && !(vma->vm_flags & VM_SHARED)) { 105 | printk("writeable mappings must be shared , ejecting \n"); 106 | return -EINVAL; 107 | } 108 | 109 | /* do not want to have this area swapped out, lock it */ 110 | vma->vm_flags |= VM_LOCKONFAULT; 111 | if(offset == 0) { 112 | vma->vm_ops = &map_vm_ops; 113 | } else { 114 | printk("offset out of range\n"); 115 | return -ENXIO; 116 | } 117 | return 0; 118 | } 119 | 120 | static int mapdrv_open(struct inode *inode, struct file *file) 121 | { 122 | printk("process: %s (%d) \n", current->comm, current -> pid); 123 | return 0; 124 | } 125 | 126 | void map_vopen(struct vm_area_struct *vma) 127 | { 128 | printk("mapping vma is opened..\n"); 129 | } 130 | 131 | void map_vclose(struct vm_area_struct *vma) 132 | { 133 | printk("mapping vma is closed...\n"); 134 | } 135 | 136 | static vm_fault_t map_fault(struct vm_fault *vmf) 137 | { 138 | struct page *page; 139 | void *page_ptr; 140 | unsigned long offset = vmf->address - vmf->vma->vm_start; 141 | unsigned long virt_start = (unsigned long)vmalloc_area + (unsigned long)(vmf->pgoff << PAGE_SHIFT); 142 | unsigned long pfn_start = (unsigned long)vmalloc_to_pfn((void *)virt_start); 143 | printk("\n"); 144 | //printk("%-25s %d\n","7)PAGE_SHIFT",PAGESHIFT); 145 | 146 | page_ptr = NULL; 147 | if((vmf->vma==NULL)||(vmalloc_area==NULL)) { 148 | printk("return VM_FAULT_SIGBUS!\n"); 149 | return VM_FAULT_SIGBUS; 150 | } 151 | if(offset >= MAPLEN) { 152 | printk("return VM_FAULT_SIGBUS"); 153 | return VM_FAULT_SIGBUS; 154 | } 155 | page_ptr = vmalloc_area + offset; 156 | page = vmalloc_to_page(page_ptr); 157 | get_page(page); 158 | vmf -> page = page; 159 | printk("%s: map 0x%lx (0x%16lx) to 0x%lx, size: 0x%lx, page: %ld\n", __func__, virt_start, pfn_start << PAGE_SHIFT, vmf->address, PAGE_SIZE, vmf->pgoff); 160 | return 0; 161 | } 162 | 163 | module_init(mapdrv_init); 164 | module_exit(mapdrv_exit); 165 | 166 | MODULE_LICENSE("GPL"); 167 | -------------------------------------------------------------------------------- /mm/map_driver/mmap_read.c: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | # include 4 | # include 5 | # include 6 | # include 7 | 8 | # define LEN (10*4096) 9 | 10 | int main(void) 11 | { 12 | int fd, loop; 13 | char * vadr; 14 | 15 | if((fd = open("/dev/mapnopage", O_RDWR)) < 0) { 16 | return 0; 17 | } 18 | vadr = (char *)mmap(0, LEN, PROT_READ, MAP_PRIVATE | MAP_LOCKED, fd, 0); 19 | for( loop=0;loop<2;loop++ ) { 20 | printf("[%-10s----%lx]\n", vadr + 4096 * loop, vadr + 4096 * loop); 21 | } 22 | while(1) { 23 | sleep(1); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mm/map_driver/mmap_write.c: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | # include 4 | # include 5 | # include 6 | # include 7 | 8 | #define LEN (10*4096) 9 | 10 | int main(void) 11 | { 12 | int fd; 13 | char *vadr; 14 | 15 | if((fd = open("/dev/mapnopage", O_RDWR)) < 0) { 16 | return 0; 17 | } 18 | 19 | vadr = (char *)mmap(0, LEN, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_LOCKED, fd, 0); 20 | 21 | sprintf( vadr, "write from userspace"); 22 | 23 | while(1){ 24 | sleep(1); 25 | } 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /network/drop_packet/step1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/network/drop_packet/step1/.DS_Store -------------------------------------------------------------------------------- /network/drop_packet/step1/.cache.mk: -------------------------------------------------------------------------------- 1 | __cached_gcc_-v_2>&1_|_grep_-q_"clang_version"_&&_echo_clang_||_echo_gcc := gcc 2 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-mretpoline-external-thunk_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mretpoline-external-thunk";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 3 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-mindirect-branch_thunk-extern_-mindirect-branch-register_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mindirect-branch_thunk-extern_-mindirect-branch-register";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mindirect-branch=thunk-extern -mindirect-branch-register 4 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-PIE";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-PIE 5 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-fno-PIE_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-PIE";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-PIE 6 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-Wmaybe-uninitialized_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-maybe-uninitialized";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-maybe-uninitialized 7 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE__-mpreferred-stack-boundary_4_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-mpreferred-stack-boundary_4";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mpreferred-stack-boundary=4 8 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE__-m16_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-m16";_else_echo_"_-m32_-Wa_./arch/x86/boot/code16gcc.h";_fi;_rm_-f_"_TMP"_"_TMPO" := -m16 9 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-m16_-g_-Os_-D__KERNEL___-DDISABLE_BRANCH_PROFILING_-Wall_-Wstrict-prototypes_-march_i386_-mregparm_3_-fno-strict-aliasing_-fomit-frame-pointer_-fno-pic_-mno-mmx_-mno-sse__-ffreestanding_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-ffreestanding";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -ffreestanding 10 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-m16_-g_-Os_-D__KERNEL___-DDISABLE_BRANCH_PROFILING_-Wall_-Wstrict-prototypes_-march_i386_-mregparm_3_-fno-strict-aliasing_-fomit-frame-pointer_-fno-pic_-mno-mmx_-mno-sse_-ffreestanding__-fno-stack-protector_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-fno-stack-protector";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-stack-protector 11 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-m16_-g_-Os_-D__KERNEL___-DDISABLE_BRANCH_PROFILING_-Wall_-Wstrict-prototypes_-march_i386_-mregparm_3_-fno-strict-aliasing_-fomit-frame-pointer_-fno-pic_-mno-mmx_-mno-sse_-ffreestanding_-fno-stack-protector__-mpreferred-stack-boundary_2_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-mpreferred-stack-boundary_2";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mpreferred-stack-boundary=2 12 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mno-avx";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mno-avx 13 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-falign-jumps_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -falign-jumps=1 14 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-falign-loops_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -falign-loops=1 15 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mno-80387";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mno-80387 16 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mno-fp-ret-in-387";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mno-fp-ret-in-387 17 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mpreferred-stack-boundary_3";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mpreferred-stack-boundary=3 18 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mskip-rax-setup";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mskip-rax-setup 19 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mtune_generic";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mtune=generic 20 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-funit-at-a-time";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -funit-at-a-time 21 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI__-mfentry_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"y";_else_echo_"n";_fi;_rm_-f_"_TMP"_"_TMPO" := y 22 | __cached_/bin/sh_./scripts/gcc-version.sh_-p_gcc := 050400 23 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_".cfi_startproc_n.cfi_rel_offset_rsp_0_n.cfi_endproc"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CFI_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CFI=1 24 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_".cfi_startproc_n.cfi_signal_frame_n.cfi_endproc"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CFI_SIGNAL_FRAME_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CFI_SIGNAL_FRAME=1 25 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_".cfi_sections_.debug_frame"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CFI_SECTIONS_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CFI_SECTIONS=1 26 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"fxsaveq__%rax_"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_FXSAVEQ_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_FXSAVEQ=1 27 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"pshufb_%xmm0_%xmm0"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_SSSE3_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_SSSE3=1 28 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"crc32l_%eax_%eax"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CRC32_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CRC32=1 29 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"vxorps_%ymm0_%ymm1_%ymm2"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_AVX_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_AVX=1 30 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"vpbroadcastb_%xmm0_%ymm1"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_AVX2_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_AVX2=1 31 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"vpmovm2b_%k1_%zmm5"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_AVX512_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_AVX512=1 32 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"sha1msg1_%xmm0_%xmm1"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_SHA1_NI_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_SHA1_NI=1 33 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___printf_"%b_n"_"sha256msg1_%xmm0_%xmm1"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_SHA256_NI_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_SHA256_NI=1 34 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-x_c_/dev/null_-c_-o_"_TMPO";_ld_-m_elf_x86_64__-z_max-page-size_0x200000_"_TMPO"_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-z_max-page-size_0x200000";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -z max-page-size=0x200000 35 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-delete-null-pointer-checks";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-delete-null-pointer-checks 36 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wframe-address_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-frame-address";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 37 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wformat-truncation_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-format-truncation";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 38 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wformat-overflow_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-format-overflow";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 39 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wint-in-bool-context_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-int-in-bool-context";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 40 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_-Wmaybe-uninitialized_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-maybe-uninitialized";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-maybe-uninitialized 41 | __cached_/bin/sh_./scripts/gcc-version.sh_gcc := 0504 42 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"--param_allow-store-data-races_0";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := --param=allow-store-data-races=0 43 | __cached_/bin/sh_./scripts/gcc-goto.sh_gcc_-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_____-O2__--param_allow-store-data-races_0 := y 44 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wframe-larger-than_1024";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wframe-larger-than=1024 45 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wunused-but-set-variable_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-unused-but-set-variable";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-unused-but-set-variable 46 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-Wunused-const-variable_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-unused-const-variable";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 47 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls__-fno-var-tracking-assignments_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-fno-var-tracking-assignments";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-var-tracking-assignments 48 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments__-mfentry_-DCC_USING_FENTRY_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-mfentry_-DCC_USING_FENTRY";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mfentry -DCC_USING_FENTRY 49 | __cached_gcc_-print-file-name_include := /usr/lib/gcc/x86_64-linux-gnu/5/include 50 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wdeclaration-after-statement";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wdeclaration-after-statement 51 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wpointer-sign_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-pointer-sign";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-pointer-sign 52 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-strict-overflow";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-strict-overflow 53 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-merge-all-constants";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-merge-all-constants 54 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fmerge-constants";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fmerge-constants 55 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-stack-check";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-stack-check 56 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fconserve-stack";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fconserve-stack 57 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_implicit-int";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=implicit-int 58 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_strict-prototypes";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=strict-prototypes 59 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_date-time";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=date-time 60 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-Werror_incompatible-pointer-types_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_incompatible-pointer-types";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=incompatible-pointer-types 61 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-Werror_incompatible-pointer-types_-Werror_designated-init_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_designated-init";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=designated-init 62 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___ar_rcD_"_TMP"__>/dev/null_2>&1;_then_echo_"D";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := D 63 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step1/.__.o";_if___gcc__-Wl_--build-id_-D__KERNEL_____-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-Werror_incompatible-pointer-types_-Werror_designated-init_-nostdlib_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-Wl_--build-id";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wl,--build-id 64 | -------------------------------------------------------------------------------- /network/drop_packet/step1/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | 13 | -------------------------------------------------------------------------------- /network/drop_packet/step1/drop_packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | -------------------------------------------------------------------------------- /network/drop_packet/step1/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | #include "drop_packet.h" 15 | 16 | static int drop_packet_init(void) 17 | { 18 | printk("drop-packet loaded.\n"); 19 | 20 | return 0; 21 | } 22 | 23 | static void drop_packet_exit(void) 24 | { 25 | printk("drop-packet unloaded.\n"); 26 | } 27 | 28 | module_init(drop_packet_init) 29 | module_exit(drop_packet_exit) 30 | 31 | MODULE_DESCRIPTION("Baoyou Xie's drop-packet module"); 32 | MODULE_AUTHOR("Baoyou Xie "); 33 | MODULE_LICENSE("GPL v2"); 34 | -------------------------------------------------------------------------------- /network/drop_packet/step2/.cache.mk: -------------------------------------------------------------------------------- 1 | __cached_gcc_-v_2>&1_|_grep_-q_"clang_version"_&&_echo_clang_||_echo_gcc := gcc 2 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-mretpoline-external-thunk_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mretpoline-external-thunk";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 3 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-mindirect-branch_thunk-extern_-mindirect-branch-register_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mindirect-branch_thunk-extern_-mindirect-branch-register";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mindirect-branch=thunk-extern -mindirect-branch-register 4 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-PIE";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-PIE 5 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-fno-PIE_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-PIE";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-PIE 6 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-Wmaybe-uninitialized_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-maybe-uninitialized";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-maybe-uninitialized 7 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE__-mpreferred-stack-boundary_4_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-mpreferred-stack-boundary_4";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mpreferred-stack-boundary=4 8 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE__-m16_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-m16";_else_echo_"_-m32_-Wa_./arch/x86/boot/code16gcc.h";_fi;_rm_-f_"_TMP"_"_TMPO" := -m16 9 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-m16_-g_-Os_-D__KERNEL___-DDISABLE_BRANCH_PROFILING_-Wall_-Wstrict-prototypes_-march_i386_-mregparm_3_-fno-strict-aliasing_-fomit-frame-pointer_-fno-pic_-mno-mmx_-mno-sse__-ffreestanding_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-ffreestanding";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -ffreestanding 10 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-m16_-g_-Os_-D__KERNEL___-DDISABLE_BRANCH_PROFILING_-Wall_-Wstrict-prototypes_-march_i386_-mregparm_3_-fno-strict-aliasing_-fomit-frame-pointer_-fno-pic_-mno-mmx_-mno-sse_-ffreestanding__-fno-stack-protector_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-fno-stack-protector";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-stack-protector 11 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-m16_-g_-Os_-D__KERNEL___-DDISABLE_BRANCH_PROFILING_-Wall_-Wstrict-prototypes_-march_i386_-mregparm_3_-fno-strict-aliasing_-fomit-frame-pointer_-fno-pic_-mno-mmx_-mno-sse_-ffreestanding_-fno-stack-protector__-mpreferred-stack-boundary_2_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-mpreferred-stack-boundary_2";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mpreferred-stack-boundary=2 12 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mno-avx";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mno-avx 13 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-falign-jumps_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -falign-jumps=1 14 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-falign-loops_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -falign-loops=1 15 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mno-80387";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mno-80387 16 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mno-fp-ret-in-387";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mno-fp-ret-in-387 17 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mpreferred-stack-boundary_3";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mpreferred-stack-boundary=3 18 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mskip-rax-setup";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mskip-rax-setup 19 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-mtune_generic";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mtune=generic 20 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-funit-at-a-time";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -funit-at-a-time 21 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI__-mfentry_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"y";_else_echo_"n";_fi;_rm_-f_"_TMP"_"_TMPO" := y 22 | __cached_/bin/sh_./scripts/gcc-version.sh_-p_gcc := 050400 23 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_".cfi_startproc_n.cfi_rel_offset_rsp_0_n.cfi_endproc"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CFI_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CFI=1 24 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_".cfi_startproc_n.cfi_signal_frame_n.cfi_endproc"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CFI_SIGNAL_FRAME_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CFI_SIGNAL_FRAME=1 25 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_".cfi_sections_.debug_frame"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CFI_SECTIONS_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CFI_SECTIONS=1 26 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"fxsaveq__%rax_"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_FXSAVEQ_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_FXSAVEQ=1 27 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"pshufb_%xmm0_%xmm0"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_SSSE3_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_SSSE3=1 28 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"crc32l_%eax_%eax"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_CRC32_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_CRC32=1 29 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"vxorps_%ymm0_%ymm1_%ymm2"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_AVX_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_AVX=1 30 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"vpbroadcastb_%xmm0_%ymm1"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_AVX2_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_AVX2=1 31 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"vpmovm2b_%k1_%zmm5"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_AVX512_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_AVX512=1 32 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"sha1msg1_%xmm0_%xmm1"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_SHA1_NI_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_SHA1_NI=1 33 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___printf_"%b_n"_"sha256msg1_%xmm0_%xmm1"_|_gcc_-D__ASSEMBLY___-fno-PIE_-m64_-DCONFIG_X86_X32_ABI_-c_-x_assembler_-o_"_TMP"_-__>/dev/null_2>&1;_then_echo_"-DCONFIG_AS_SHA256_NI_1";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -DCONFIG_AS_SHA256_NI=1 34 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-x_c_/dev/null_-c_-o_"_TMPO";_ld_-m_elf_x86_64__-z_max-page-size_0x200000_"_TMPO"_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-z_max-page-size_0x200000";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -z max-page-size=0x200000 35 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-delete-null-pointer-checks";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-delete-null-pointer-checks 36 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wframe-address_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-frame-address";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 37 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wformat-truncation_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-format-truncation";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 38 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wformat-overflow_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-format-overflow";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 39 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-Wint-in-bool-context_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-int-in-bool-context";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 40 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_-Wmaybe-uninitialized_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-maybe-uninitialized";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-maybe-uninitialized 41 | __cached_/bin/sh_./scripts/gcc-version.sh_gcc := 0504 42 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"--param_allow-store-data-races_0";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := --param=allow-store-data-races=0 43 | __cached_/bin/sh_./scripts/gcc-goto.sh_gcc_-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_____-O2__--param_allow-store-data-races_0 := y 44 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wframe-larger-than_1024";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wframe-larger-than=1024 45 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wunused-but-set-variable_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-unused-but-set-variable";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-unused-but-set-variable 46 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-Wunused-const-variable_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-unused-const-variable";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := 47 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls__-fno-var-tracking-assignments_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-fno-var-tracking-assignments";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-var-tracking-assignments 48 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments__-mfentry_-DCC_USING_FENTRY_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-mfentry_-DCC_USING_FENTRY";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -mfentry -DCC_USING_FENTRY 49 | __cached_gcc_-print-file-name_include := /usr/lib/gcc/x86_64-linux-gnu/5/include 50 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wdeclaration-after-statement";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wdeclaration-after-statement 51 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc_-Werror_-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wpointer-sign_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Wno-pointer-sign";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wno-pointer-sign 52 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-strict-overflow";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-strict-overflow 53 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-merge-all-constants";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-merge-all-constants 54 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fmerge-constants";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fmerge-constants 55 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fno-stack-check";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fno-stack-check 56 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-fconserve-stack";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -fconserve-stack 57 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_implicit-int";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=implicit-int 58 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_strict-prototypes";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=strict-prototypes 59 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_date-time";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=date-time 60 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-Werror_incompatible-pointer-types_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_incompatible-pointer-types";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=incompatible-pointer-types 61 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if____gcc_-Werror__-D__KERNEL___-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-Werror_incompatible-pointer-types_-Werror_designated-init_-c_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"-Werror_designated-init";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Werror=designated-init 62 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___ar_rcD_"_TMP"__>/dev/null_2>&1;_then_echo_"D";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := D 63 | __cached_set_-e;_TMP_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.tmp";_TMPO_"/home/xiebaoyou/study/陈老师/drop-packet/src/step2/.__.o";_if___gcc__-Wl_--build-id_-D__KERNEL_____-Wall_-Wundef_-Wstrict-prototypes_-Wno-trigraphs_-fno-strict-aliasing_-fno-common_-fshort-wchar_-Werror-implicit-function-declaration_-Wno-format-security_-std_gnu89_-fno-PIE_-mno-sse_-mno-mmx_-mno-sse2_-mno-3dnow_-mno-avx_-m64_-falign-jumps_1_-falign-loops_1_-mno-80387_-mno-fp-ret-in-387_-mpreferred-stack-boundary_3_-mskip-rax-setup_-mtune_generic_-mno-red-zone_-mcmodel_kernel_-funit-at-a-time_-DCONFIG_X86_X32_ABI_-DCONFIG_AS_CFI_1_-DCONFIG_AS_CFI_SIGNAL_FRAME_1_-DCONFIG_AS_CFI_SECTIONS_1_-DCONFIG_AS_FXSAVEQ_1_-DCONFIG_AS_SSSE3_1_-DCONFIG_AS_CRC32_1_-DCONFIG_AS_AVX_1_-DCONFIG_AS_AVX2_1_-DCONFIG_AS_AVX512_1_-DCONFIG_AS_SHA1_NI_1_-DCONFIG_AS_SHA256_NI_1_-pipe_-Wno-sign-compare_-fno-asynchronous-unwind-tables_-mindirect-branch_thunk-extern_-mindirect-branch-register_-DRETPOLINE_-fno-delete-null-pointer-checks_-O2_--param_allow-store-data-races_0_-DCC_HAVE_ASM_GOTO_-Wframe-larger-than_1024_-fstack-protector-strong_-Wno-unused-but-set-variable_-fno-omit-frame-pointer_-fno-optimize-sibling-calls_-fno-var-tracking-assignments_-pg_-mfentry_-DCC_USING_FENTRY_-Wdeclaration-after-statement_-Wno-pointer-sign_-fno-strict-overflow_-fno-merge-all-constants_-fmerge-constants_-fno-stack-check_-fconserve-stack_-Werror_implicit-int_-Werror_strict-prototypes_-Werror_date-time_-Werror_incompatible-pointer-types_-Werror_designated-init_-nostdlib_-x_c_/dev/null_-o_"_TMP"__>/dev/null_2>&1;_then_echo_"_-Wl_--build-id";_else_echo_"";_fi;_rm_-f_"_TMP"_"_TMPO" := -Wl,--build-id 64 | -------------------------------------------------------------------------------- /network/drop_packet/step2/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | 13 | -------------------------------------------------------------------------------- /network/drop_packet/step2/drop_packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | -------------------------------------------------------------------------------- /network/drop_packet/step2/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "drop_packet.h" 18 | 19 | static unsigned long drop_packet_activated; 20 | 21 | static int activate_drop_packet(void) 22 | { 23 | return 1; 24 | } 25 | 26 | static void deactivate_drop_packet(void) 27 | { 28 | } 29 | 30 | static int drop_packet_show(struct seq_file *m, void *v) 31 | { 32 | seq_printf(m, "settings:\n"); 33 | seq_printf(m, " activated: %s\n", drop_packet_activated ? "y" : "N"); 34 | 35 | return 0; 36 | } 37 | 38 | static int drop_packet_open(struct inode *inode, struct file *filp) 39 | { 40 | return single_open(filp, drop_packet_show, NULL); 41 | } 42 | 43 | static ssize_t drop_packet_write(struct file *file, 44 | const char __user *buf, size_t count, loff_t *offs) 45 | { 46 | int ret; 47 | char cmd[255]; 48 | char chr[255]; 49 | 50 | if (count < 1 || *offs) 51 | return -EINVAL; 52 | 53 | if (copy_from_user(chr, buf, 255)) 54 | return -EFAULT; 55 | 56 | ret = sscanf(chr, "%255s", cmd); 57 | if (ret <= 0) 58 | return -EINVAL; 59 | 60 | if (strcmp(cmd, "activate") == 0) { 61 | if (!drop_packet_activated) 62 | drop_packet_activated = activate_drop_packet(); 63 | } else if (strcmp(cmd, "deactivate") == 0) { 64 | if (drop_packet_activated) 65 | deactivate_drop_packet(); 66 | drop_packet_activated = 0; 67 | } 68 | 69 | return count; 70 | } 71 | 72 | const struct file_operations drop_packet_fops = { 73 | .open = drop_packet_open, 74 | .read = seq_read, 75 | .llseek = seq_lseek, 76 | .write = drop_packet_write, 77 | .release = single_release, 78 | }; 79 | 80 | static int drop_packet_init(void) 81 | { 82 | int ret; 83 | struct proc_dir_entry *pe; 84 | 85 | proc_mkdir("mooc", NULL); 86 | proc_mkdir("mooc/net", NULL); 87 | 88 | ret = -ENOMEM; 89 | pe = proc_create("mooc/net/drop-packet", 90 | S_IFREG | 0644, 91 | NULL, 92 | &drop_packet_fops); 93 | if (!pe) 94 | goto err_proc; 95 | 96 | printk("drop-packet loaded.\n"); 97 | 98 | return 0; 99 | 100 | err_proc: 101 | return ret; 102 | } 103 | 104 | static void drop_packet_exit(void) 105 | { 106 | remove_proc_entry("mooc/net/drop-packet", NULL); 107 | remove_proc_entry("mooc/net", NULL); 108 | remove_proc_entry("mooc", NULL); 109 | 110 | printk("drop-packet unloaded.\n"); 111 | } 112 | 113 | module_init(drop_packet_init) 114 | module_exit(drop_packet_exit) 115 | 116 | MODULE_DESCRIPTION("Baoyou Xie's drop-packet module"); 117 | MODULE_AUTHOR("Baoyou Xie "); 118 | MODULE_LICENSE("GPL v2"); 119 | -------------------------------------------------------------------------------- /network/drop_packet/step3/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | -------------------------------------------------------------------------------- /network/drop_packet/step3/drop_packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | #include 11 | 12 | int hook_kprobe(struct kprobe *kp, const char *name, 13 | kprobe_pre_handler_t pre, kprobe_post_handler_t post); 14 | void unhook_kprobe(struct kprobe *kp); 15 | int hook_tracepoint(const char *name, void *probe, void *data); 16 | int unhook_tracepoint(const char *name, void *probe, void *data); 17 | 18 | -------------------------------------------------------------------------------- /network/drop_packet/step3/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "drop_packet.h" 19 | 20 | static unsigned long drop_packet_activated; 21 | 22 | static struct kprobe kprobe_eth_type_trans; 23 | static struct kprobe kprobe_napi_gro_receive; 24 | static struct kprobe kprobe___netif_receive_skb_core; 25 | static struct kprobe kprobe_tcp_v4_rcv; 26 | static struct kprobe kprobe_dev_queue_xmit; 27 | 28 | static void trace_net_dev_xmit_hit(void *ignore, struct sk_buff *skb, 29 | int rc, struct net_device *dev, unsigned int skb_len) 30 | { 31 | printk("xby-debug in trace_net_dev_xmit_hit\n"); 32 | } 33 | 34 | static int kprobe_dev_queue_xmit_pre(struct kprobe *p, struct pt_regs *regs) 35 | { 36 | printk("xby-debug in kprobe_dev_queue_xmit_pre\n"); 37 | 38 | return 0; 39 | } 40 | 41 | static int kprobe_eth_type_trans_pre(struct kprobe *p, struct pt_regs *regs) 42 | { 43 | return 0; 44 | } 45 | 46 | static int kprobe_napi_gro_receive_pre(struct kprobe *p, struct pt_regs *regs) 47 | { 48 | return 0; 49 | } 50 | 51 | static int kprobe___netif_receive_skb_core_pre(struct kprobe *p, struct pt_regs *regs) 52 | { 53 | return 0; 54 | } 55 | 56 | static int kprobe_tcp_v4_rcv_pre(struct kprobe *p, struct pt_regs *regs) 57 | { 58 | return 0; 59 | } 60 | 61 | static int activate_drop_packet(void) 62 | { 63 | hook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 64 | hook_kprobe(&kprobe_dev_queue_xmit, "dev_queue_xmit", 65 | kprobe_dev_queue_xmit_pre, NULL); 66 | hook_kprobe(&kprobe_eth_type_trans, "eth_type_trans", 67 | kprobe_eth_type_trans_pre, NULL); 68 | hook_kprobe(&kprobe_napi_gro_receive, "napi_gro_receive", 69 | kprobe_napi_gro_receive_pre, NULL); 70 | hook_kprobe(&kprobe___netif_receive_skb_core, "__netif_receive_skb_core", 71 | kprobe___netif_receive_skb_core_pre, NULL); 72 | hook_kprobe(&kprobe_tcp_v4_rcv, "tcp_v4_rcv", 73 | kprobe_tcp_v4_rcv_pre, NULL); 74 | 75 | return 1; 76 | } 77 | 78 | static void deactivate_drop_packet(void) 79 | { 80 | unhook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 81 | unhook_kprobe(&kprobe_dev_queue_xmit); 82 | unhook_kprobe(&kprobe_eth_type_trans); 83 | unhook_kprobe(&kprobe_napi_gro_receive); 84 | unhook_kprobe(&kprobe___netif_receive_skb_core); 85 | unhook_kprobe(&kprobe_tcp_v4_rcv); 86 | } 87 | 88 | static int drop_packet_show(struct seq_file *m, void *v) 89 | { 90 | seq_printf(m, "settings:\n"); 91 | seq_printf(m, " activated: %s\n", drop_packet_activated ? "y" : "N"); 92 | 93 | return 0; 94 | } 95 | 96 | static int drop_packet_open(struct inode *inode, struct file *filp) 97 | { 98 | return single_open(filp, drop_packet_show, NULL); 99 | } 100 | 101 | static ssize_t drop_packet_write(struct file *file, 102 | const char __user *buf, size_t count, loff_t *offs) 103 | { 104 | int ret; 105 | char cmd[255]; 106 | char chr[255]; 107 | 108 | if (count < 1 || *offs) 109 | return -EINVAL; 110 | 111 | if (copy_from_user(chr, buf, 255)) 112 | return -EFAULT; 113 | 114 | ret = sscanf(chr, "%255s", cmd); 115 | if (ret <= 0) 116 | return -EINVAL; 117 | 118 | if (strcmp(cmd, "activate") == 0) { 119 | if (!drop_packet_activated) 120 | drop_packet_activated = activate_drop_packet(); 121 | } else if (strcmp(cmd, "deactivate") == 0) { 122 | if (drop_packet_activated) 123 | deactivate_drop_packet(); 124 | drop_packet_activated = 0; 125 | } 126 | 127 | return count; 128 | } 129 | 130 | const struct file_operations drop_packet_fops = { 131 | .open = drop_packet_open, 132 | .read = seq_read, 133 | .llseek = seq_lseek, 134 | .write = drop_packet_write, 135 | .release = single_release, 136 | }; 137 | 138 | static int drop_packet_init(void) 139 | { 140 | int ret; 141 | struct proc_dir_entry *pe; 142 | 143 | proc_mkdir("mooc", NULL); 144 | proc_mkdir("mooc/net", NULL); 145 | 146 | ret = -ENOMEM; 147 | pe = proc_create("mooc/net/drop-packet", 148 | S_IFREG | 0644, 149 | NULL, 150 | &drop_packet_fops); 151 | if (!pe) 152 | goto err_proc; 153 | 154 | printk("drop-packet loaded.\n"); 155 | 156 | return 0; 157 | 158 | err_proc: 159 | return ret; 160 | } 161 | 162 | static void drop_packet_exit(void) 163 | { 164 | remove_proc_entry("mooc/net/drop-packet", NULL); 165 | remove_proc_entry("mooc/net", NULL); 166 | remove_proc_entry("mooc", NULL); 167 | 168 | if (drop_packet_activated) 169 | deactivate_drop_packet(); 170 | drop_packet_activated = 0; 171 | 172 | printk("drop-packet unloaded.\n"); 173 | } 174 | 175 | module_init(drop_packet_init) 176 | module_exit(drop_packet_exit) 177 | 178 | MODULE_DESCRIPTION("Baoyou Xie's drop-packet module"); 179 | MODULE_AUTHOR("Baoyou Xie "); 180 | MODULE_LICENSE("GPL v2"); 181 | -------------------------------------------------------------------------------- /network/drop_packet/step3/misc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "drop_packet.h" 6 | 7 | int hook_kprobe(struct kprobe *kp, const char *name, 8 | kprobe_pre_handler_t pre, kprobe_post_handler_t post) 9 | { 10 | kprobe_opcode_t *addr; 11 | 12 | if (!name || strlen(name) >= 255) 13 | return -EINVAL; 14 | addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); 15 | if (!addr) 16 | return -EINVAL; 17 | 18 | memset(kp, 0, sizeof(struct kprobe)); 19 | kp->symbol_name = name; 20 | kp->pre_handler = pre; 21 | kp->post_handler = post; 22 | 23 | register_kprobe(kp); 24 | 25 | return 0; 26 | } 27 | 28 | void unhook_kprobe(struct kprobe *kp) 29 | { 30 | unregister_kprobe(kp); 31 | memset(kp, 0, sizeof(struct kprobe)); 32 | } 33 | 34 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) 35 | int hook_tracepoint(const char *name, void *probe, void *data) 36 | { 37 | return tracepoint_probe_register(name, probe); 38 | } 39 | 40 | int unhook_tracepoint(const char *name, void *probe, void *data) 41 | { 42 | return tracepoint_probe_unregister(name, probe); 43 | } 44 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) 45 | int hook_tracepoint(const char *name, void *probe, void *data) 46 | { 47 | return tracepoint_probe_register(name, probe, data); 48 | } 49 | 50 | int unhook_tracepoint(const char *name, void *probe, void *data) 51 | { 52 | return tracepoint_probe_unregister(name, probe, data); 53 | } 54 | #else 55 | static struct tracepoint *tp_ret; 56 | static void probe_tracepoint(struct tracepoint *tp, void *priv) 57 | { 58 | char *n = priv; 59 | 60 | if (strcmp(tp->name, n) == 0) 61 | tp_ret = tp; 62 | } 63 | 64 | static struct tracepoint *find_tracepoint(const char *name) 65 | { 66 | tp_ret = NULL; 67 | for_each_kernel_tracepoint(probe_tracepoint, (void *)name); 68 | 69 | return tp_ret; 70 | } 71 | 72 | int hook_tracepoint(const char *name, void *probe, void *data) 73 | { 74 | struct tracepoint *tp; 75 | 76 | tp = find_tracepoint(name); 77 | if (!tp) 78 | return 0; 79 | 80 | return tracepoint_probe_register(tp, probe, data); 81 | } 82 | 83 | int unhook_tracepoint(const char *name, void *probe, void *data) 84 | { 85 | struct tracepoint *tp; 86 | 87 | tp = find_tracepoint(name); 88 | if (!tp) 89 | return 0; 90 | 91 | return tracepoint_probe_unregister(tp, probe, data); 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /network/drop_packet/step4/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | -------------------------------------------------------------------------------- /network/drop_packet/step4/drop_packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | #include 11 | 12 | int hook_kprobe(struct kprobe *kp, const char *name, 13 | kprobe_pre_handler_t pre, kprobe_post_handler_t post); 14 | void unhook_kprobe(struct kprobe *kp); 15 | int hook_tracepoint(const char *name, void *probe, void *data); 16 | int unhook_tracepoint(const char *name, void *probe, void *data); 17 | 18 | -------------------------------------------------------------------------------- /network/drop_packet/step4/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "drop_packet.h" 22 | 23 | static unsigned long drop_packet_activated; 24 | 25 | static struct kprobe kprobe_eth_type_trans; 26 | static struct kprobe kprobe_napi_gro_receive; 27 | static struct kprobe kprobe___netif_receive_skb_core; 28 | static struct kprobe kprobe_tcp_v4_rcv; 29 | 30 | enum packet_footprint 31 | { 32 | ETH_RECV, 33 | GRO_RECV, 34 | RECV_SKB, 35 | TCP_V4_RCV, 36 | SEND_SKB, 37 | TRACK_COUNT, 38 | }; 39 | 40 | static void trace_packet(const struct sk_buff *skb, 41 | const struct iphdr *iphdr, enum packet_footprint fp) 42 | { 43 | unsigned int source = iphdr->saddr; 44 | unsigned int dest = iphdr->daddr; 45 | unsigned char *saddr = (void *)&source; 46 | unsigned char *daddr = (void *)&dest; 47 | 48 | printk("Source IP:%u.%u.%u.%u, Dest IP:%u.%u.%u.%u, fp: %d\n", 49 | saddr[0], saddr[1], saddr[2], saddr[3], 50 | daddr[0], daddr[1], daddr[2], daddr[3], fp); 51 | } 52 | 53 | static void trace_net_dev_xmit_hit(void *ignore, struct sk_buff *skb, 54 | int rc, struct net_device *dev, unsigned int skb_len) 55 | { 56 | struct iphdr *iphdr; 57 | 58 | if (!drop_packet_activated) 59 | return; 60 | 61 | if (rc != NETDEV_TX_OK) 62 | return; 63 | 64 | iphdr = ip_hdr(skb); 65 | trace_packet(skb, iphdr, SEND_SKB); 66 | } 67 | 68 | static int kprobe_eth_type_trans_pre(struct kprobe *p, struct pt_regs *regs) 69 | { 70 | struct sk_buff *skb = (void *)regs->di; 71 | struct iphdr *iphdr; 72 | 73 | if (!drop_packet_activated) 74 | return 0; 75 | 76 | iphdr = (struct iphdr *)(skb->data + ETH_HLEN); 77 | trace_packet(skb, iphdr, ETH_RECV); 78 | 79 | return 0; 80 | } 81 | 82 | static int kprobe_napi_gro_receive_pre(struct kprobe *p, struct pt_regs *regs) 83 | { 84 | struct sk_buff *skb = (void *)regs->si; 85 | struct iphdr *iphdr; 86 | 87 | if (!drop_packet_activated) 88 | return 0; 89 | 90 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 91 | return 0; 92 | 93 | iphdr = (struct iphdr *)skb->data; 94 | trace_packet(skb, iphdr, GRO_RECV); 95 | 96 | return 0; 97 | } 98 | 99 | static int kprobe___netif_receive_skb_core_pre(struct kprobe *p, struct pt_regs *regs) 100 | { 101 | struct sk_buff *skb = (void *)regs->di; 102 | struct iphdr *iphdr; 103 | 104 | if (!drop_packet_activated) 105 | return 0; 106 | 107 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 108 | return 0; 109 | 110 | iphdr = (struct iphdr *)skb->data; 111 | trace_packet(skb, iphdr, RECV_SKB); 112 | 113 | return 0; 114 | } 115 | 116 | static int kprobe_tcp_v4_rcv_pre(struct kprobe *p, struct pt_regs *regs) 117 | { 118 | struct sk_buff *skb = (void *)regs->di; 119 | struct iphdr *iphdr; 120 | 121 | if (!drop_packet_activated) 122 | return 0; 123 | 124 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 125 | return 0; 126 | 127 | iphdr = ip_hdr(skb); 128 | trace_packet(skb, iphdr, TCP_V4_RCV); 129 | 130 | return 0; 131 | } 132 | 133 | static int activate_drop_packet(void) 134 | { 135 | hook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 136 | hook_kprobe(&kprobe_eth_type_trans, "eth_type_trans", 137 | kprobe_eth_type_trans_pre, NULL); 138 | hook_kprobe(&kprobe_napi_gro_receive, "napi_gro_receive", 139 | kprobe_napi_gro_receive_pre, NULL); 140 | hook_kprobe(&kprobe___netif_receive_skb_core, "__netif_receive_skb_core", 141 | kprobe___netif_receive_skb_core_pre, NULL); 142 | hook_kprobe(&kprobe_tcp_v4_rcv, "tcp_v4_rcv", 143 | kprobe_tcp_v4_rcv_pre, NULL); 144 | 145 | return 1; 146 | } 147 | 148 | static void deactivate_drop_packet(void) 149 | { 150 | unhook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 151 | unhook_kprobe(&kprobe_eth_type_trans); 152 | unhook_kprobe(&kprobe_napi_gro_receive); 153 | unhook_kprobe(&kprobe___netif_receive_skb_core); 154 | unhook_kprobe(&kprobe_tcp_v4_rcv); 155 | } 156 | 157 | static int drop_packet_show(struct seq_file *m, void *v) 158 | { 159 | seq_printf(m, "settings:\n"); 160 | seq_printf(m, " activated: %s\n", drop_packet_activated ? "y" : "N"); 161 | 162 | return 0; 163 | } 164 | 165 | static int drop_packet_open(struct inode *inode, struct file *filp) 166 | { 167 | return single_open(filp, drop_packet_show, NULL); 168 | } 169 | 170 | static ssize_t drop_packet_write(struct file *file, 171 | const char __user *buf, size_t count, loff_t *offs) 172 | { 173 | int ret; 174 | char cmd[255]; 175 | char chr[255]; 176 | 177 | if (count < 1 || *offs) 178 | return -EINVAL; 179 | 180 | if (copy_from_user(chr, buf, 255)) 181 | return -EFAULT; 182 | 183 | ret = sscanf(chr, "%255s", cmd); 184 | if (ret <= 0) 185 | return -EINVAL; 186 | 187 | if (strcmp(cmd, "activate") == 0) { 188 | if (!drop_packet_activated) 189 | drop_packet_activated = activate_drop_packet(); 190 | } else if (strcmp(cmd, "deactivate") == 0) { 191 | if (drop_packet_activated) 192 | deactivate_drop_packet(); 193 | drop_packet_activated = 0; 194 | } 195 | 196 | return count; 197 | } 198 | 199 | const struct file_operations drop_packet_fops = { 200 | .open = drop_packet_open, 201 | .read = seq_read, 202 | .llseek = seq_lseek, 203 | .write = drop_packet_write, 204 | .release = single_release, 205 | }; 206 | 207 | static int drop_packet_init(void) 208 | { 209 | int ret; 210 | struct proc_dir_entry *pe; 211 | 212 | proc_mkdir("mooc", NULL); 213 | proc_mkdir("mooc/net", NULL); 214 | 215 | ret = -ENOMEM; 216 | pe = proc_create("mooc/net/drop-packet", 217 | S_IFREG | 0644, 218 | NULL, 219 | &drop_packet_fops); 220 | if (!pe) 221 | goto err_proc; 222 | 223 | printk("drop-packet loaded.\n"); 224 | 225 | return 0; 226 | 227 | err_proc: 228 | return ret; 229 | } 230 | 231 | static void drop_packet_exit(void) 232 | { 233 | remove_proc_entry("mooc/net/drop-packet", NULL); 234 | remove_proc_entry("mooc/net", NULL); 235 | remove_proc_entry("mooc", NULL); 236 | 237 | if (drop_packet_activated) 238 | deactivate_drop_packet(); 239 | drop_packet_activated = 0; 240 | 241 | printk("drop-packet unloaded.\n"); 242 | } 243 | 244 | module_init(drop_packet_init) 245 | module_exit(drop_packet_exit) 246 | 247 | MODULE_DESCRIPTION("Baoyou Xie's drop-packet module"); 248 | MODULE_AUTHOR("Baoyou Xie "); 249 | MODULE_LICENSE("GPL v2"); 250 | -------------------------------------------------------------------------------- /network/drop_packet/step4/misc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "drop_packet.h" 6 | 7 | int hook_kprobe(struct kprobe *kp, const char *name, 8 | kprobe_pre_handler_t pre, kprobe_post_handler_t post) 9 | { 10 | kprobe_opcode_t *addr; 11 | 12 | if (!name || strlen(name) >= 255) 13 | return -EINVAL; 14 | addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); 15 | if (!addr) 16 | return -EINVAL; 17 | 18 | memset(kp, 0, sizeof(struct kprobe)); 19 | kp->symbol_name = name; 20 | kp->pre_handler = pre; 21 | kp->post_handler = post; 22 | 23 | register_kprobe(kp); 24 | 25 | return 0; 26 | } 27 | 28 | void unhook_kprobe(struct kprobe *kp) 29 | { 30 | unregister_kprobe(kp); 31 | memset(kp, 0, sizeof(struct kprobe)); 32 | } 33 | 34 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) 35 | int hook_tracepoint(const char *name, void *probe, void *data) 36 | { 37 | return tracepoint_probe_register(name, probe); 38 | } 39 | 40 | int unhook_tracepoint(const char *name, void *probe, void *data) 41 | { 42 | return tracepoint_probe_unregister(name, probe); 43 | } 44 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) 45 | int hook_tracepoint(const char *name, void *probe, void *data) 46 | { 47 | return tracepoint_probe_register(name, probe, data); 48 | } 49 | 50 | int unhook_tracepoint(const char *name, void *probe, void *data) 51 | { 52 | return tracepoint_probe_unregister(name, probe, data); 53 | } 54 | #else 55 | static struct tracepoint *tp_ret; 56 | static void probe_tracepoint(struct tracepoint *tp, void *priv) 57 | { 58 | char *n = priv; 59 | 60 | if (strcmp(tp->name, n) == 0) 61 | tp_ret = tp; 62 | } 63 | 64 | static struct tracepoint *find_tracepoint(const char *name) 65 | { 66 | tp_ret = NULL; 67 | for_each_kernel_tracepoint(probe_tracepoint, (void *)name); 68 | 69 | return tp_ret; 70 | } 71 | 72 | int hook_tracepoint(const char *name, void *probe, void *data) 73 | { 74 | struct tracepoint *tp; 75 | 76 | tp = find_tracepoint(name); 77 | if (!tp) 78 | return 0; 79 | 80 | return tracepoint_probe_register(tp, probe, data); 81 | } 82 | 83 | int unhook_tracepoint(const char *name, void *probe, void *data) 84 | { 85 | struct tracepoint *tp; 86 | 87 | tp = find_tracepoint(name); 88 | if (!tp) 89 | return 0; 90 | 91 | return tracepoint_probe_unregister(tp, probe, data); 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /network/drop_packet/step5/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | -------------------------------------------------------------------------------- /network/drop_packet/step5/drop_packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | #include 11 | 12 | int hook_kprobe(struct kprobe *kp, const char *name, 13 | kprobe_pre_handler_t pre, kprobe_post_handler_t post); 14 | void unhook_kprobe(struct kprobe *kp); 15 | int hook_tracepoint(const char *name, void *probe, void *data); 16 | int unhook_tracepoint(const char *name, void *probe, void *data); 17 | 18 | unsigned int ipstr2int(const char *ipstr); 19 | char *int2ipstr(const unsigned int ip, char *ipstr, const unsigned int ip_str_len); 20 | -------------------------------------------------------------------------------- /network/drop_packet/step5/index.html: -------------------------------------------------------------------------------- 1 | 2 | 百度一下,你就知道

关于百度 About Baidu

©2017 Baidu 使用百度前必读  意见反馈 京ICP证030173号 

3 | -------------------------------------------------------------------------------- /network/drop_packet/step5/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "drop_packet.h" 23 | 24 | static unsigned long drop_packet_activated; 25 | 26 | static unsigned int drop_patcket_saddr = 0; 27 | static unsigned int drop_patcket_sport = 0; 28 | static unsigned int drop_patcket_daddr = 0; 29 | static unsigned int drop_patcket_dport = 0; 30 | 31 | static struct rb_root drop_packet_tree = RB_ROOT; 32 | static LIST_HEAD(drop_packet_list); 33 | static DEFINE_SPINLOCK(drop_packet_lock); 34 | 35 | static struct kprobe kprobe_eth_type_trans; 36 | static struct kprobe kprobe_napi_gro_receive; 37 | static struct kprobe kprobe___netif_receive_skb_core; 38 | static struct kprobe kprobe_tcp_v4_rcv; 39 | 40 | enum packet_footprint 41 | { 42 | ETH_RECV, 43 | GRO_RECV, 44 | RECV_SKB, 45 | TCP_V4_RCV, 46 | SEND_SKB, 47 | TRACK_COUNT, 48 | }; 49 | 50 | static char *packet_footprint_str[TRACK_COUNT] = { 51 | "ETH_RECV", 52 | "GRO_RECV", 53 | "RECV_SKB", 54 | "TCP_V4_RCV", 55 | "SEND_SKB", 56 | }; 57 | 58 | struct conn_desc 59 | { 60 | int protocol; 61 | int saddr; 62 | int sport; 63 | int daddr; 64 | int dport; 65 | 66 | atomic64_t packages[TRACK_COUNT]; 67 | 68 | struct rb_node rb_node; 69 | struct list_head list; 70 | }; 71 | 72 | __maybe_unused int compare_conn(__u8 protocol, 73 | unsigned int saddr, 74 | unsigned int sport, 75 | unsigned int daddr, 76 | unsigned int dport, 77 | struct conn_desc *conn) 78 | { 79 | if (protocol < conn->protocol) 80 | return -1; 81 | if (protocol > conn->protocol) 82 | return 1; 83 | if (saddr < conn->saddr) 84 | return -1; 85 | if (saddr > conn->saddr) 86 | return 1; 87 | if (sport < conn->sport) 88 | return -1; 89 | if (sport > conn->sport) 90 | return 1; 91 | if (daddr < conn->daddr) 92 | return -1; 93 | if (daddr > conn->daddr) 94 | return 1; 95 | if (dport < conn->dport) 96 | return -1; 97 | if (dport > conn->dport) 98 | return 1; 99 | 100 | return 0; 101 | } 102 | 103 | __maybe_unused static struct conn_desc *__find_alloc_desc(struct rb_root *root, 104 | __u8 protocol, 105 | unsigned int saddr, 106 | unsigned int sport, 107 | unsigned int daddr, 108 | unsigned int dport) 109 | { 110 | struct rb_node **node, *parent; 111 | struct conn_desc *conn_desc = NULL; 112 | 113 | node = &root->rb_node; 114 | parent = NULL; 115 | while (*node != NULL) { 116 | struct conn_desc *this; 117 | int ret = 0; 118 | 119 | parent = *node; 120 | this = container_of(parent, struct conn_desc, rb_node); 121 | ret = compare_conn(protocol, saddr, sport, daddr, dport, this); 122 | 123 | if (ret < 0) 124 | node = &parent->rb_left; 125 | else if (ret > 0) 126 | node = &parent->rb_right; 127 | else 128 | return this; 129 | } 130 | 131 | conn_desc = kmalloc(sizeof(struct conn_desc), GFP_ATOMIC | __GFP_ZERO); 132 | if (conn_desc) { 133 | conn_desc->protocol = protocol; 134 | conn_desc->saddr = saddr; 135 | conn_desc->sport = sport; 136 | conn_desc->daddr = daddr; 137 | conn_desc->dport = dport; 138 | 139 | INIT_LIST_HEAD(&conn_desc->list); 140 | list_add_tail(&conn_desc->list, &drop_packet_list); 141 | rb_link_node(&conn_desc->rb_node, parent, node); 142 | rb_insert_color(&conn_desc->rb_node, root); 143 | } 144 | 145 | return conn_desc; 146 | } 147 | 148 | __maybe_unused static struct conn_desc *find_alloc_desc(__u8 protocol, 149 | unsigned int saddr, 150 | unsigned int sport, 151 | unsigned int daddr, 152 | unsigned int dport) 153 | { 154 | unsigned long flags; 155 | struct conn_desc *ret; 156 | 157 | spin_lock_irqsave(&drop_packet_lock, flags); 158 | ret = __find_alloc_desc(&drop_packet_tree, protocol, 159 | saddr, sport, daddr, dport); 160 | spin_unlock_irqrestore(&drop_packet_lock, flags); 161 | 162 | return ret; 163 | } 164 | 165 | static void trace_packet(const struct sk_buff *skb, 166 | const struct iphdr *iphdr, enum packet_footprint fp) 167 | { 168 | int source = 0; 169 | int dest = 0; 170 | struct conn_desc *conn_desc; 171 | 172 | if (fp >= TRACK_COUNT) 173 | return; 174 | 175 | if (iphdr->protocol == IPPROTO_UDP) 176 | { 177 | struct udphdr *uh; 178 | 179 | uh = (void *)iphdr + iphdr->ihl * 4; 180 | source = be16_to_cpu(uh->source); 181 | dest = be16_to_cpu(uh->dest); 182 | } 183 | else if (iphdr->protocol == IPPROTO_TCP) 184 | { 185 | struct tcphdr *th; 186 | 187 | th = (void *)iphdr + iphdr->ihl * 4; 188 | source = be16_to_cpu(th->source); 189 | dest = be16_to_cpu(th->dest); 190 | } else 191 | return; 192 | 193 | conn_desc = find_alloc_desc(iphdr->protocol, 194 | iphdr->saddr, source, iphdr->daddr, dest); 195 | if (!conn_desc) 196 | return; 197 | 198 | atomic64_inc(&conn_desc->packages[fp]); 199 | } 200 | 201 | static void trace_net_dev_xmit_hit(void *ignore, struct sk_buff *skb, 202 | int rc, struct net_device *dev, unsigned int skb_len) 203 | { 204 | struct iphdr *iphdr; 205 | 206 | if (!drop_packet_activated) 207 | return; 208 | 209 | if (rc != NETDEV_TX_OK) 210 | return; 211 | 212 | iphdr = ip_hdr(skb); 213 | trace_packet(skb, iphdr, SEND_SKB); 214 | } 215 | 216 | static int kprobe_eth_type_trans_pre(struct kprobe *p, struct pt_regs *regs) 217 | { 218 | struct sk_buff *skb = (void *)regs->di; 219 | struct iphdr *iphdr; 220 | 221 | if (!drop_packet_activated) 222 | return 0; 223 | 224 | iphdr = (struct iphdr *)(skb->data + ETH_HLEN); 225 | trace_packet(skb, iphdr, ETH_RECV); 226 | 227 | return 0; 228 | } 229 | 230 | static int kprobe_napi_gro_receive_pre(struct kprobe *p, struct pt_regs *regs) 231 | { 232 | struct sk_buff *skb = (void *)regs->si; 233 | struct iphdr *iphdr; 234 | 235 | if (!drop_packet_activated) 236 | return 0; 237 | 238 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 239 | return 0; 240 | 241 | iphdr = (struct iphdr *)skb->data; 242 | trace_packet(skb, iphdr, GRO_RECV); 243 | 244 | return 0; 245 | } 246 | 247 | static int kprobe___netif_receive_skb_core_pre(struct kprobe *p, struct pt_regs *regs) 248 | { 249 | struct sk_buff *skb = (void *)regs->di; 250 | struct iphdr *iphdr; 251 | 252 | if (!drop_packet_activated) 253 | return 0; 254 | 255 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 256 | return 0; 257 | 258 | iphdr = (struct iphdr *)skb->data; 259 | trace_packet(skb, iphdr, RECV_SKB); 260 | 261 | return 0; 262 | } 263 | 264 | static int kprobe_tcp_v4_rcv_pre(struct kprobe *p, struct pt_regs *regs) 265 | { 266 | struct sk_buff *skb = (void *)regs->di; 267 | struct iphdr *iphdr; 268 | 269 | if (!drop_packet_activated) 270 | return 0; 271 | 272 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 273 | return 0; 274 | 275 | iphdr = ip_hdr(skb); 276 | trace_packet(skb, iphdr, TCP_V4_RCV); 277 | 278 | return 0; 279 | } 280 | 281 | static int activate_drop_packet(void) 282 | { 283 | hook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 284 | hook_kprobe(&kprobe_eth_type_trans, "eth_type_trans", 285 | kprobe_eth_type_trans_pre, NULL); 286 | hook_kprobe(&kprobe_napi_gro_receive, "napi_gro_receive", 287 | kprobe_napi_gro_receive_pre, NULL); 288 | hook_kprobe(&kprobe___netif_receive_skb_core, "__netif_receive_skb_core", 289 | kprobe___netif_receive_skb_core_pre, NULL); 290 | hook_kprobe(&kprobe_tcp_v4_rcv, "tcp_v4_rcv", 291 | kprobe_tcp_v4_rcv_pre, NULL); 292 | 293 | return 1; 294 | } 295 | 296 | static void deactivate_drop_packet(void) 297 | { 298 | unhook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 299 | unhook_kprobe(&kprobe_eth_type_trans); 300 | unhook_kprobe(&kprobe_napi_gro_receive); 301 | unhook_kprobe(&kprobe___netif_receive_skb_core); 302 | unhook_kprobe(&kprobe_tcp_v4_rcv); 303 | } 304 | 305 | static int drop_packet_show(struct seq_file *m, void *v) 306 | { 307 | struct conn_desc *this; 308 | unsigned long flags; 309 | struct list_head header; 310 | int i; 311 | 312 | seq_printf(m, "settings:\n"); 313 | seq_printf(m, " activated: %s\n", drop_packet_activated ? "y" : "N"); 314 | 315 | INIT_LIST_HEAD(&header); 316 | spin_lock_irqsave(&drop_packet_lock, flags); 317 | drop_packet_tree = RB_ROOT; 318 | list_splice_init(&drop_packet_list, &header); 319 | spin_unlock_irqrestore(&drop_packet_lock, flags); 320 | 321 | synchronize_sched(); 322 | 323 | list_for_each_entry(this, &header, list) 324 | { 325 | unsigned char *saddr = (void *)&this->saddr; 326 | unsigned char *daddr = (void *)&this->daddr; 327 | 328 | seq_printf(m, 329 | "protocol:%s, Source IP: %u.%u.%u.%u, Source Port: %d, " 330 | "Dest IP: %u.%u.%u.%u, Dest Port: %d\n", 331 | this->protocol == IPPROTO_UDP ? "UDP" : "TCP", 332 | saddr[0], saddr[1], saddr[2], saddr[3], this->sport, 333 | daddr[0], daddr[1], daddr[2], daddr[3], this->dport); 334 | for (i = 0; i < TRACK_COUNT; i++) { 335 | seq_printf(m, 336 | " %s: %lu\n", 337 | packet_footprint_str[i], 338 | atomic64_read(&this->packages[i])); 339 | } 340 | } 341 | 342 | while (!list_empty(&header)) 343 | { 344 | struct conn_desc *this = list_first_entry(&header, 345 | struct conn_desc, list); 346 | 347 | list_del_init(&this->list); 348 | kfree(this); 349 | } 350 | 351 | return 0; 352 | } 353 | 354 | static int drop_packet_open(struct inode *inode, struct file *filp) 355 | { 356 | return single_open(filp, drop_packet_show, NULL); 357 | } 358 | 359 | static ssize_t drop_packet_write(struct file *file, 360 | const char __user *buf, size_t count, loff_t *offs) 361 | { 362 | int ret; 363 | char cmd[255]; 364 | char chr[255]; 365 | 366 | if (count < 1 || *offs) 367 | return -EINVAL; 368 | 369 | if (copy_from_user(chr, buf, 255)) 370 | return -EFAULT; 371 | 372 | ret = sscanf(chr, "%255s", cmd); 373 | if (ret <= 0) 374 | return -EINVAL; 375 | 376 | if (strcmp(cmd, "activate") == 0) { 377 | if (!drop_packet_activated) 378 | drop_packet_activated = activate_drop_packet(); 379 | } else if (strcmp(cmd, "deactivate") == 0) { 380 | if (drop_packet_activated) 381 | deactivate_drop_packet(); 382 | drop_packet_activated = 0; 383 | } else if (strcmp(cmd, "source-addr") == 0) { 384 | char addr[255]; 385 | 386 | ret = sscanf(chr, "%255s %255s", cmd, addr); 387 | if (ret == 2) { 388 | drop_patcket_saddr = ipstr2int(addr); 389 | } else if (ret == 1) { 390 | drop_patcket_saddr = 0; 391 | } 392 | } else if (strcmp(cmd, "source-port") == 0) { 393 | unsigned int port; 394 | 395 | ret = sscanf(chr, "%255s %255d", cmd, &port); 396 | if (ret == 2) { 397 | drop_patcket_sport = port; 398 | } else if (ret == 1) { 399 | drop_patcket_sport = 0; 400 | } 401 | } else if (strcmp(cmd, "dest-addr") == 0) { 402 | char addr[255]; 403 | 404 | ret = sscanf(chr, "%255s %255s", cmd, addr); 405 | if (ret == 2) { 406 | drop_patcket_daddr = ipstr2int(addr); 407 | } else if (ret == 1) { 408 | drop_patcket_daddr = 0; 409 | } 410 | } else if (strcmp(cmd, "dest-port") == 0) { 411 | unsigned int port; 412 | 413 | ret = sscanf(chr, "%255s %255d", cmd, &port); 414 | if (ret == 2) { 415 | drop_patcket_dport = port; 416 | } else if (ret == 1) { 417 | drop_patcket_dport = 0; 418 | } 419 | } 420 | 421 | return count; 422 | } 423 | 424 | const struct file_operations drop_packet_fops = { 425 | .open = drop_packet_open, 426 | .read = seq_read, 427 | .llseek = seq_lseek, 428 | .write = drop_packet_write, 429 | .release = single_release, 430 | }; 431 | 432 | static int drop_packet_init(void) 433 | { 434 | int ret; 435 | struct proc_dir_entry *pe; 436 | 437 | proc_mkdir("mooc", NULL); 438 | proc_mkdir("mooc/net", NULL); 439 | 440 | ret = -ENOMEM; 441 | pe = proc_create("mooc/net/drop-packet", 442 | S_IFREG | 0644, 443 | NULL, 444 | &drop_packet_fops); 445 | if (!pe) 446 | goto err_proc; 447 | 448 | printk("drop-packet loaded.\n"); 449 | 450 | return 0; 451 | 452 | err_proc: 453 | return ret; 454 | } 455 | 456 | static void drop_packet_exit(void) 457 | { 458 | remove_proc_entry("mooc/net/drop-packet", NULL); 459 | remove_proc_entry("mooc/net", NULL); 460 | remove_proc_entry("mooc", NULL); 461 | 462 | if (drop_packet_activated) 463 | deactivate_drop_packet(); 464 | drop_packet_activated = 0; 465 | 466 | printk("drop-packet unloaded.\n"); 467 | } 468 | 469 | module_init(drop_packet_init) 470 | module_exit(drop_packet_exit) 471 | 472 | MODULE_DESCRIPTION("Baoyou Xie's drop-packet module"); 473 | MODULE_AUTHOR("Baoyou Xie "); 474 | MODULE_LICENSE("GPL v2"); 475 | -------------------------------------------------------------------------------- /network/drop_packet/step5/misc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "drop_packet.h" 6 | 7 | int hook_kprobe(struct kprobe *kp, const char *name, 8 | kprobe_pre_handler_t pre, kprobe_post_handler_t post) 9 | { 10 | kprobe_opcode_t *addr; 11 | 12 | if (!name || strlen(name) >= 255) 13 | return -EINVAL; 14 | addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); 15 | if (!addr) 16 | return -EINVAL; 17 | 18 | memset(kp, 0, sizeof(struct kprobe)); 19 | kp->symbol_name = name; 20 | kp->pre_handler = pre; 21 | kp->post_handler = post; 22 | 23 | register_kprobe(kp); 24 | 25 | return 0; 26 | } 27 | 28 | void unhook_kprobe(struct kprobe *kp) 29 | { 30 | unregister_kprobe(kp); 31 | memset(kp, 0, sizeof(struct kprobe)); 32 | } 33 | 34 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) 35 | int hook_tracepoint(const char *name, void *probe, void *data) 36 | { 37 | return tracepoint_probe_register(name, probe); 38 | } 39 | 40 | int unhook_tracepoint(const char *name, void *probe, void *data) 41 | { 42 | return tracepoint_probe_unregister(name, probe); 43 | } 44 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) 45 | int hook_tracepoint(const char *name, void *probe, void *data) 46 | { 47 | return tracepoint_probe_register(name, probe, data); 48 | } 49 | 50 | int unhook_tracepoint(const char *name, void *probe, void *data) 51 | { 52 | return tracepoint_probe_unregister(name, probe, data); 53 | } 54 | #else 55 | static struct tracepoint *tp_ret; 56 | static void probe_tracepoint(struct tracepoint *tp, void *priv) 57 | { 58 | char *n = priv; 59 | 60 | if (strcmp(tp->name, n) == 0) 61 | tp_ret = tp; 62 | } 63 | 64 | static struct tracepoint *find_tracepoint(const char *name) 65 | { 66 | tp_ret = NULL; 67 | for_each_kernel_tracepoint(probe_tracepoint, (void *)name); 68 | 69 | return tp_ret; 70 | } 71 | 72 | int hook_tracepoint(const char *name, void *probe, void *data) 73 | { 74 | struct tracepoint *tp; 75 | 76 | tp = find_tracepoint(name); 77 | if (!tp) 78 | return 0; 79 | 80 | return tracepoint_probe_register(tp, probe, data); 81 | } 82 | 83 | int unhook_tracepoint(const char *name, void *probe, void *data) 84 | { 85 | struct tracepoint *tp; 86 | 87 | tp = find_tracepoint(name); 88 | if (!tp) 89 | return 0; 90 | 91 | return tracepoint_probe_unregister(tp, probe, data); 92 | } 93 | #endif 94 | 95 | #define IP_STR_LEN 18 96 | #define MAC_STR_LEN 18 97 | #define MAC_BIT_LEN 6 98 | #define LITTLE_ENDIAN 0 99 | #define BIG_ENDIAN 1 100 | 101 | int big_little_endian(void) 102 | { 103 | int data = 0x1; 104 | 105 | if (*((char *)&data) == 0x1) 106 | return LITTLE_ENDIAN; 107 | 108 | return BIG_ENDIAN; 109 | } 110 | 111 | unsigned int ipstr2int(const char *ipstr) 112 | { 113 | unsigned int a, b, c, d; 114 | unsigned int ip = 0; 115 | int count; 116 | 117 | count = sscanf(ipstr, "%u.%u.%u.%u", &a, &b, &c, &d); 118 | if (count == 4) { 119 | a = (a << 24); 120 | b = (b << 16); 121 | c = (c << 8); 122 | d = (d << 0); 123 | ip = a | b | c | d; 124 | 125 | return ip; 126 | } else { 127 | return 0; 128 | } 129 | } 130 | 131 | char *int2ipstr(const unsigned int ip, char *ipstr, const unsigned int ip_str_len) 132 | { 133 | int len; 134 | 135 | if (big_little_endian() == LITTLE_ENDIAN) 136 | len = snprintf(ipstr, ip_str_len, "%u.%u.%u.%u", 137 | (unsigned char) * ((char *)(&ip) + 3), 138 | (unsigned char) * ((char *)(&ip) + 2), 139 | (unsigned char) * ((char *)(&ip) + 1), 140 | (unsigned char) * ((char *)(&ip) + 0)); 141 | else 142 | len = snprintf(ipstr, ip_str_len, "%u.%u.%u.%u", 143 | (unsigned char) * ((char *)(&ip) + 0), 144 | (unsigned char) * ((char *)(&ip) + 1), 145 | (unsigned char) * ((char *)(&ip) + 2), 146 | (unsigned char) * ((char *)(&ip) + 3)); 147 | 148 | if (len < ip_str_len) 149 | return ipstr; 150 | else 151 | return NULL; 152 | } 153 | -------------------------------------------------------------------------------- /network/drop_packet/step6/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:= map_driver.o 2 | PWD:=$(shell pwd) 3 | LINUX_KERNEL:=$(shell uname -r) 4 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 5 | KERNELDIR:=/lib/modules/$(shell uname -r)/build 6 | 7 | all: 8 | make -C $(KERNELDIR) M=$(PWD) modules 9 | 10 | clean: 11 | @rm -rf *.o *.mod.c *.mod.o *.ko *.order *.symvers .*.cmd .tmp_versions *.mod *.dwo 12 | -------------------------------------------------------------------------------- /network/drop_packet/step6/drop_packet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | #include 11 | 12 | int hook_kprobe(struct kprobe *kp, const char *name, 13 | kprobe_pre_handler_t pre, kprobe_post_handler_t post); 14 | void unhook_kprobe(struct kprobe *kp); 15 | int hook_tracepoint(const char *name, void *probe, void *data); 16 | int unhook_tracepoint(const char *name, void *probe, void *data); 17 | 18 | unsigned int ipstr2int(const char *ipstr); 19 | char *int2ipstr(const unsigned int ip, char *ipstr, const unsigned int ip_str_len); 20 | -------------------------------------------------------------------------------- /network/drop_packet/step6/index.html: -------------------------------------------------------------------------------- 1 | 2 | 百度一下,你就知道

关于百度 About Baidu

©2017 Baidu 使用百度前必读  意见反馈 京ICP证030173号 

3 | -------------------------------------------------------------------------------- /network/drop_packet/step6/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * Baoyou Xie's drop-packet module 3 | * 4 | * Copyright (C) 2018 Baoyou Xie. 5 | * 6 | * Author: Baoyou Xie 7 | * 8 | * License terms: GNU General Public License (GPL) version 2 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "drop_packet.h" 23 | 24 | static unsigned long drop_packet_activated; 25 | 26 | static unsigned int drop_patcket_saddr = 0; 27 | static unsigned int drop_patcket_sport = 0; 28 | static unsigned int drop_patcket_daddr = 0; 29 | static unsigned int drop_patcket_dport = 0; 30 | 31 | static struct rb_root drop_packet_tree = RB_ROOT; 32 | static LIST_HEAD(drop_packet_list); 33 | static DEFINE_SPINLOCK(drop_packet_lock); 34 | 35 | static struct kprobe kprobe_eth_type_trans; 36 | static struct kprobe kprobe_napi_gro_receive; 37 | static struct kprobe kprobe___netif_receive_skb_core; 38 | static struct kprobe kprobe_tcp_v4_rcv; 39 | 40 | enum packet_footprint 41 | { 42 | ETH_RECV, 43 | GRO_RECV, 44 | RECV_SKB, 45 | TCP_V4_RCV, 46 | SEND_SKB, 47 | TRACK_COUNT, 48 | }; 49 | 50 | static char *packet_footprint_str[TRACK_COUNT] = { 51 | "ETH_RECV", 52 | "GRO_RECV", 53 | "RECV_SKB", 54 | "TCP_V4_RCV", 55 | "SEND_SKB", 56 | }; 57 | 58 | struct conn_desc 59 | { 60 | int protocol; 61 | int saddr; 62 | int sport; 63 | int daddr; 64 | int dport; 65 | 66 | atomic64_t packages[TRACK_COUNT]; 67 | 68 | struct rb_node rb_node; 69 | struct list_head list; 70 | }; 71 | 72 | __maybe_unused static void clean_data(void) 73 | { 74 | unsigned long flags; 75 | struct list_head header; 76 | 77 | INIT_LIST_HEAD(&header); 78 | spin_lock_irqsave(&drop_packet_lock, flags); 79 | drop_packet_tree = RB_ROOT; 80 | list_splice_init(&drop_packet_list, &header); 81 | spin_unlock_irqrestore(&drop_packet_lock, flags); 82 | 83 | synchronize_sched(); 84 | 85 | while (!list_empty(&header)) 86 | { 87 | struct conn_desc *this = list_first_entry(&header, struct conn_desc, list); 88 | 89 | list_del_init(&this->list); 90 | kfree(this); 91 | } 92 | } 93 | 94 | __maybe_unused int compare_conn(__u8 protocol, 95 | unsigned int saddr, 96 | unsigned int sport, 97 | unsigned int daddr, 98 | unsigned int dport, 99 | struct conn_desc *conn) 100 | { 101 | if (protocol < conn->protocol) 102 | return -1; 103 | if (protocol > conn->protocol) 104 | return 1; 105 | if (saddr < conn->saddr) 106 | return -1; 107 | if (saddr > conn->saddr) 108 | return 1; 109 | if (sport < conn->sport) 110 | return -1; 111 | if (sport > conn->sport) 112 | return 1; 113 | if (daddr < conn->daddr) 114 | return -1; 115 | if (daddr > conn->daddr) 116 | return 1; 117 | if (dport < conn->dport) 118 | return -1; 119 | if (dport > conn->dport) 120 | return 1; 121 | 122 | return 0; 123 | } 124 | 125 | __maybe_unused static struct conn_desc *__find_alloc_desc(struct rb_root *root, 126 | __u8 protocol, 127 | unsigned int saddr, 128 | unsigned int sport, 129 | unsigned int daddr, 130 | unsigned int dport) 131 | { 132 | struct rb_node **node, *parent; 133 | struct conn_desc *conn_desc = NULL; 134 | 135 | node = &root->rb_node; 136 | parent = NULL; 137 | while (*node != NULL) { 138 | struct conn_desc *this; 139 | int ret = 0; 140 | 141 | parent = *node; 142 | this = container_of(parent, struct conn_desc, rb_node); 143 | ret = compare_conn(protocol, saddr, sport, daddr, dport, this); 144 | 145 | if (ret < 0) 146 | node = &parent->rb_left; 147 | else if (ret > 0) 148 | node = &parent->rb_right; 149 | else 150 | return this; 151 | } 152 | 153 | conn_desc = kmalloc(sizeof(struct conn_desc), GFP_ATOMIC | __GFP_ZERO); 154 | if (conn_desc) { 155 | conn_desc->protocol = protocol; 156 | conn_desc->saddr = saddr; 157 | conn_desc->sport = sport; 158 | conn_desc->daddr = daddr; 159 | conn_desc->dport = dport; 160 | 161 | INIT_LIST_HEAD(&conn_desc->list); 162 | list_add_tail(&conn_desc->list, &drop_packet_list); 163 | rb_link_node(&conn_desc->rb_node, parent, node); 164 | rb_insert_color(&conn_desc->rb_node, root); 165 | } 166 | 167 | return conn_desc; 168 | } 169 | 170 | __maybe_unused static struct conn_desc *find_alloc_desc(__u8 protocol, 171 | unsigned int saddr, 172 | unsigned int sport, 173 | unsigned int daddr, 174 | unsigned int dport) 175 | { 176 | unsigned long flags; 177 | struct conn_desc *ret; 178 | 179 | spin_lock_irqsave(&drop_packet_lock, flags); 180 | ret = __find_alloc_desc(&drop_packet_tree, protocol, 181 | saddr, sport, daddr, dport); 182 | spin_unlock_irqrestore(&drop_packet_lock, flags); 183 | 184 | return ret; 185 | } 186 | 187 | static void trace_packet(const struct sk_buff *skb, 188 | const struct iphdr *iphdr, enum packet_footprint fp) 189 | { 190 | int source = 0; 191 | int dest = 0; 192 | struct conn_desc *conn_desc; 193 | 194 | if (fp >= TRACK_COUNT) 195 | return; 196 | 197 | if (iphdr->protocol == IPPROTO_UDP) 198 | { 199 | struct udphdr *uh; 200 | 201 | uh = (void *)iphdr + iphdr->ihl * 4; 202 | source = be16_to_cpu(uh->source); 203 | dest = be16_to_cpu(uh->dest); 204 | } 205 | else if (iphdr->protocol == IPPROTO_TCP) 206 | { 207 | struct tcphdr *th; 208 | 209 | th = (void *)iphdr + iphdr->ihl * 4; 210 | source = be16_to_cpu(th->source); 211 | dest = be16_to_cpu(th->dest); 212 | } else 213 | return; 214 | 215 | conn_desc = find_alloc_desc(iphdr->protocol, 216 | iphdr->saddr, source, iphdr->daddr, dest); 217 | if (!conn_desc) 218 | return; 219 | 220 | atomic64_inc(&conn_desc->packages[fp]); 221 | } 222 | 223 | static void trace_net_dev_xmit_hit(void *ignore, struct sk_buff *skb, 224 | int rc, struct net_device *dev, unsigned int skb_len) 225 | { 226 | struct iphdr *iphdr; 227 | 228 | if (!drop_packet_activated) 229 | return; 230 | 231 | if (rc != NETDEV_TX_OK) 232 | return; 233 | 234 | iphdr = ip_hdr(skb); 235 | trace_packet(skb, iphdr, SEND_SKB); 236 | } 237 | 238 | static int kprobe_eth_type_trans_pre(struct kprobe *p, struct pt_regs *regs) 239 | { 240 | struct sk_buff *skb = (void *)regs->di; 241 | struct iphdr *iphdr; 242 | 243 | if (!drop_packet_activated) 244 | return 0; 245 | 246 | iphdr = (struct iphdr *)(skb->data + ETH_HLEN); 247 | trace_packet(skb, iphdr, ETH_RECV); 248 | 249 | return 0; 250 | } 251 | 252 | static int kprobe_napi_gro_receive_pre(struct kprobe *p, struct pt_regs *regs) 253 | { 254 | struct sk_buff *skb = (void *)regs->si; 255 | struct iphdr *iphdr; 256 | 257 | if (!drop_packet_activated) 258 | return 0; 259 | 260 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 261 | return 0; 262 | 263 | iphdr = (struct iphdr *)skb->data; 264 | trace_packet(skb, iphdr, GRO_RECV); 265 | 266 | return 0; 267 | } 268 | 269 | static int kprobe___netif_receive_skb_core_pre(struct kprobe *p, struct pt_regs *regs) 270 | { 271 | struct sk_buff *skb = (void *)regs->di; 272 | struct iphdr *iphdr; 273 | 274 | if (!drop_packet_activated) 275 | return 0; 276 | 277 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 278 | return 0; 279 | 280 | iphdr = (struct iphdr *)skb->data; 281 | trace_packet(skb, iphdr, RECV_SKB); 282 | 283 | return 0; 284 | } 285 | 286 | static int kprobe_tcp_v4_rcv_pre(struct kprobe *p, struct pt_regs *regs) 287 | { 288 | struct sk_buff *skb = (void *)regs->di; 289 | struct iphdr *iphdr; 290 | 291 | if (!drop_packet_activated) 292 | return 0; 293 | 294 | if (skb->protocol != cpu_to_be16(ETH_P_IP)) 295 | return 0; 296 | 297 | iphdr = ip_hdr(skb); 298 | trace_packet(skb, iphdr, TCP_V4_RCV); 299 | 300 | return 0; 301 | } 302 | 303 | static int activate_drop_packet(void) 304 | { 305 | clean_data(); 306 | 307 | hook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 308 | hook_kprobe(&kprobe_eth_type_trans, "eth_type_trans", 309 | kprobe_eth_type_trans_pre, NULL); 310 | hook_kprobe(&kprobe_napi_gro_receive, "napi_gro_receive", 311 | kprobe_napi_gro_receive_pre, NULL); 312 | hook_kprobe(&kprobe___netif_receive_skb_core, "__netif_receive_skb_core", 313 | kprobe___netif_receive_skb_core_pre, NULL); 314 | hook_kprobe(&kprobe_tcp_v4_rcv, "tcp_v4_rcv", 315 | kprobe_tcp_v4_rcv_pre, NULL); 316 | 317 | return 1; 318 | } 319 | 320 | static void deactivate_drop_packet(void) 321 | { 322 | unhook_tracepoint("net_dev_xmit", trace_net_dev_xmit_hit, NULL); 323 | unhook_kprobe(&kprobe_eth_type_trans); 324 | unhook_kprobe(&kprobe_napi_gro_receive); 325 | unhook_kprobe(&kprobe___netif_receive_skb_core); 326 | unhook_kprobe(&kprobe_tcp_v4_rcv); 327 | 328 | clean_data(); 329 | } 330 | 331 | static int drop_packet_show(struct seq_file *m, void *v) 332 | { 333 | struct conn_desc *this; 334 | unsigned long flags; 335 | struct list_head header; 336 | int i; 337 | 338 | seq_printf(m, "settings:\n"); 339 | seq_printf(m, " activated: %s\n", drop_packet_activated ? "y" : "N"); 340 | 341 | INIT_LIST_HEAD(&header); 342 | spin_lock_irqsave(&drop_packet_lock, flags); 343 | drop_packet_tree = RB_ROOT; 344 | list_splice_init(&drop_packet_list, &header); 345 | spin_unlock_irqrestore(&drop_packet_lock, flags); 346 | 347 | synchronize_sched(); 348 | 349 | list_for_each_entry(this, &header, list) 350 | { 351 | unsigned char *saddr = (void *)&this->saddr; 352 | unsigned char *daddr = (void *)&this->daddr; 353 | 354 | seq_printf(m, 355 | "protocol:%s, Source IP: %u.%u.%u.%u, Source Port: %d, " 356 | "Dest IP: %u.%u.%u.%u, Dest Port: %d\n", 357 | this->protocol == IPPROTO_UDP ? "UDP" : "TCP", 358 | saddr[0], saddr[1], saddr[2], saddr[3], this->sport, 359 | daddr[0], daddr[1], daddr[2], daddr[3], this->dport); 360 | for (i = 0; i < TRACK_COUNT; i++) { 361 | seq_printf(m, 362 | " %s: %lu\n", 363 | packet_footprint_str[i], 364 | atomic64_read(&this->packages[i])); 365 | } 366 | } 367 | 368 | while (!list_empty(&header)) 369 | { 370 | struct conn_desc *this = list_first_entry(&header, 371 | struct conn_desc, list); 372 | 373 | list_del_init(&this->list); 374 | kfree(this); 375 | } 376 | 377 | return 0; 378 | } 379 | 380 | static int drop_packet_open(struct inode *inode, struct file *filp) 381 | { 382 | return single_open(filp, drop_packet_show, NULL); 383 | } 384 | 385 | static ssize_t drop_packet_write(struct file *file, 386 | const char __user *buf, size_t count, loff_t *offs) 387 | { 388 | int ret; 389 | char cmd[255]; 390 | char chr[255]; 391 | 392 | if (count < 1 || *offs) 393 | return -EINVAL; 394 | 395 | if (copy_from_user(chr, buf, 255)) 396 | return -EFAULT; 397 | 398 | ret = sscanf(chr, "%255s", cmd); 399 | if (ret <= 0) 400 | return -EINVAL; 401 | 402 | if (strcmp(cmd, "activate") == 0) { 403 | if (!drop_packet_activated) 404 | drop_packet_activated = activate_drop_packet(); 405 | } else if (strcmp(cmd, "deactivate") == 0) { 406 | if (drop_packet_activated) 407 | deactivate_drop_packet(); 408 | drop_packet_activated = 0; 409 | } else if (strcmp(cmd, "source-addr") == 0) { 410 | char addr[255]; 411 | 412 | ret = sscanf(chr, "%255s %255s", cmd, addr); 413 | if (ret == 2) { 414 | drop_patcket_saddr = ipstr2int(addr); 415 | } else if (ret == 1) { 416 | drop_patcket_saddr = 0; 417 | } 418 | } else if (strcmp(cmd, "source-port") == 0) { 419 | unsigned int port; 420 | 421 | ret = sscanf(chr, "%255s %255d", cmd, &port); 422 | if (ret == 2) { 423 | drop_patcket_sport = port; 424 | } else if (ret == 1) { 425 | drop_patcket_sport = 0; 426 | } 427 | } else if (strcmp(cmd, "dest-addr") == 0) { 428 | char addr[255]; 429 | 430 | ret = sscanf(chr, "%255s %255s", cmd, addr); 431 | if (ret == 2) { 432 | drop_patcket_daddr = ipstr2int(addr); 433 | } else if (ret == 1) { 434 | drop_patcket_daddr = 0; 435 | } 436 | } else if (strcmp(cmd, "dest-port") == 0) { 437 | unsigned int port; 438 | 439 | ret = sscanf(chr, "%255s %255d", cmd, &port); 440 | if (ret == 2) { 441 | drop_patcket_dport = port; 442 | } else if (ret == 1) { 443 | drop_patcket_dport = 0; 444 | } 445 | } 446 | 447 | return count; 448 | } 449 | 450 | const struct file_operations drop_packet_fops = { 451 | .open = drop_packet_open, 452 | .read = seq_read, 453 | .llseek = seq_lseek, 454 | .write = drop_packet_write, 455 | .release = single_release, 456 | }; 457 | 458 | static int drop_packet_init(void) 459 | { 460 | int ret; 461 | struct proc_dir_entry *pe; 462 | 463 | proc_mkdir("mooc", NULL); 464 | proc_mkdir("mooc/net", NULL); 465 | 466 | ret = -ENOMEM; 467 | pe = proc_create("mooc/net/drop-packet", 468 | S_IFREG | 0644, 469 | NULL, 470 | &drop_packet_fops); 471 | if (!pe) 472 | goto err_proc; 473 | 474 | printk("drop-packet loaded.\n"); 475 | 476 | return 0; 477 | 478 | err_proc: 479 | return ret; 480 | } 481 | 482 | static void drop_packet_exit(void) 483 | { 484 | remove_proc_entry("mooc/net/drop-packet", NULL); 485 | remove_proc_entry("mooc/net", NULL); 486 | remove_proc_entry("mooc", NULL); 487 | 488 | if (drop_packet_activated) 489 | deactivate_drop_packet(); 490 | drop_packet_activated = 0; 491 | 492 | printk("drop-packet unloaded.\n"); 493 | } 494 | 495 | module_init(drop_packet_init) 496 | module_exit(drop_packet_exit) 497 | 498 | MODULE_DESCRIPTION("Baoyou Xie's drop-packet module"); 499 | MODULE_AUTHOR("Baoyou Xie "); 500 | MODULE_LICENSE("GPL v2"); 501 | -------------------------------------------------------------------------------- /network/drop_packet/step6/misc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "drop_packet.h" 6 | 7 | int hook_kprobe(struct kprobe *kp, const char *name, 8 | kprobe_pre_handler_t pre, kprobe_post_handler_t post) 9 | { 10 | kprobe_opcode_t *addr; 11 | 12 | if (!name || strlen(name) >= 255) 13 | return -EINVAL; 14 | addr = (kprobe_opcode_t *)kallsyms_lookup_name(name); 15 | if (!addr) 16 | return -EINVAL; 17 | 18 | memset(kp, 0, sizeof(struct kprobe)); 19 | kp->symbol_name = name; 20 | kp->pre_handler = pre; 21 | kp->post_handler = post; 22 | 23 | register_kprobe(kp); 24 | 25 | return 0; 26 | } 27 | 28 | void unhook_kprobe(struct kprobe *kp) 29 | { 30 | unregister_kprobe(kp); 31 | memset(kp, 0, sizeof(struct kprobe)); 32 | } 33 | 34 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) 35 | int hook_tracepoint(const char *name, void *probe, void *data) 36 | { 37 | return tracepoint_probe_register(name, probe); 38 | } 39 | 40 | int unhook_tracepoint(const char *name, void *probe, void *data) 41 | { 42 | return tracepoint_probe_unregister(name, probe); 43 | } 44 | #elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) 45 | int hook_tracepoint(const char *name, void *probe, void *data) 46 | { 47 | return tracepoint_probe_register(name, probe, data); 48 | } 49 | 50 | int unhook_tracepoint(const char *name, void *probe, void *data) 51 | { 52 | return tracepoint_probe_unregister(name, probe, data); 53 | } 54 | #else 55 | static struct tracepoint *tp_ret; 56 | static void probe_tracepoint(struct tracepoint *tp, void *priv) 57 | { 58 | char *n = priv; 59 | 60 | if (strcmp(tp->name, n) == 0) 61 | tp_ret = tp; 62 | } 63 | 64 | static struct tracepoint *find_tracepoint(const char *name) 65 | { 66 | tp_ret = NULL; 67 | for_each_kernel_tracepoint(probe_tracepoint, (void *)name); 68 | 69 | return tp_ret; 70 | } 71 | 72 | int hook_tracepoint(const char *name, void *probe, void *data) 73 | { 74 | struct tracepoint *tp; 75 | 76 | tp = find_tracepoint(name); 77 | if (!tp) 78 | return 0; 79 | 80 | return tracepoint_probe_register(tp, probe, data); 81 | } 82 | 83 | int unhook_tracepoint(const char *name, void *probe, void *data) 84 | { 85 | struct tracepoint *tp; 86 | 87 | tp = find_tracepoint(name); 88 | if (!tp) 89 | return 0; 90 | 91 | return tracepoint_probe_unregister(tp, probe, data); 92 | } 93 | #endif 94 | 95 | #define IP_STR_LEN 18 96 | #define MAC_STR_LEN 18 97 | #define MAC_BIT_LEN 6 98 | #define LITTLE_ENDIAN 0 99 | #define BIG_ENDIAN 1 100 | 101 | int big_little_endian(void) 102 | { 103 | int data = 0x1; 104 | 105 | if (*((char *)&data) == 0x1) 106 | return LITTLE_ENDIAN; 107 | 108 | return BIG_ENDIAN; 109 | } 110 | 111 | unsigned int ipstr2int(const char *ipstr) 112 | { 113 | unsigned int a, b, c, d; 114 | unsigned int ip = 0; 115 | int count; 116 | 117 | count = sscanf(ipstr, "%u.%u.%u.%u", &a, &b, &c, &d); 118 | if (count == 4) { 119 | a = (a << 24); 120 | b = (b << 16); 121 | c = (c << 8); 122 | d = (d << 0); 123 | ip = a | b | c | d; 124 | 125 | return ip; 126 | } else { 127 | return 0; 128 | } 129 | } 130 | 131 | char *int2ipstr(const unsigned int ip, char *ipstr, const unsigned int ip_str_len) 132 | { 133 | int len; 134 | 135 | if (big_little_endian() == LITTLE_ENDIAN) 136 | len = snprintf(ipstr, ip_str_len, "%u.%u.%u.%u", 137 | (unsigned char) * ((char *)(&ip) + 3), 138 | (unsigned char) * ((char *)(&ip) + 2), 139 | (unsigned char) * ((char *)(&ip) + 1), 140 | (unsigned char) * ((char *)(&ip) + 0)); 141 | else 142 | len = snprintf(ipstr, ip_str_len, "%u.%u.%u.%u", 143 | (unsigned char) * ((char *)(&ip) + 0), 144 | (unsigned char) * ((char *)(&ip) + 1), 145 | (unsigned char) * ((char *)(&ip) + 2), 146 | (unsigned char) * ((char *)(&ip) + 3)); 147 | 148 | if (len < ip_str_len) 149 | return ipstr; 150 | else 151 | return NULL; 152 | } 153 | -------------------------------------------------------------------------------- /process/fork_test/fork_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxkerneltravel/LearningLinuxKernel/5c868fc7f62d4da19e2229d4fb5055394ddf3c8e/process/fork_test/fork_test -------------------------------------------------------------------------------- /process/fork_test/fork_test.c: -------------------------------------------------------------------------------- 1 | #define _GNU_SOURCE 2 | #include //clone()相关 3 | #include 4 | #include 5 | #include 6 | #include //fork()相关 7 | #include 8 | #include 9 | #include 10 | 11 | int param = 0; 12 | 13 | int thread_fn(void *data) 14 | { 15 | int j; 16 | printf("starting child thread_fn, pid=%d\n", getpid()); 17 | for (j = 0; j < 10; j++) { 18 | param = j + 1000; 19 | sleep(1); 20 | printf("child thread running: j=%d, param=%d secs\n", j,param); 21 | } 22 | printf("child thread_fn exit\n"); 23 | return 0; 24 | } 25 | 26 | int main(int argc, char **argv) 27 | { 28 | int j, tid, pagesize, stacksize; 29 | void *stack; 30 | 31 | printf("starting parent process, pid=%d\n", getpid()); 32 | 33 | pagesize = getpagesize(); 34 | stacksize = 4 * pagesize; 35 | 36 | posix_memalign(&stack, pagesize, stacksize); 37 | 38 | printf("Setting a clone child thread with stacksize = %d....", stacksize); 39 | tid = clone(thread_fn, (char *)stack + stacksize, CLONE_VM | SIGCHLD, 0); 40 | printf(" with tid=%d\n", tid); 41 | if (tid < 0) 42 | exit(EXIT_FAILURE); 43 | 44 | for (j = 0; j < 6; j++) { 45 | param = j; 46 | sleep(1); 47 | printf("parent running: j=%d, param=%d secs\n", j,param); 48 | } 49 | printf("parent killitself\n"); 50 | exit(EXIT_SUCCESS); 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /process/traverse_pcb/Makefile: -------------------------------------------------------------------------------- 1 | obj-m:=traverse_pcb.o 2 | 3 | CURRENT_PATH:=$(shell pwd) 4 | LINUX_KERNEL:=$(shell uname -r) 5 | LINUX_KERNEL_PATH:=/usr/src/linux-headers-$(LINUX_KERNEL) 6 | 7 | all: 8 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules 9 | 10 | clean: 11 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean 12 | -------------------------------------------------------------------------------- /process/traverse_pcb/traverse_pcb.c: -------------------------------------------------------------------------------- 1 | # include 2 | # include 3 | # include 4 | # include 5 | # include 6 | # include 7 | # include 8 | # include 9 | 10 | //内核模块初始化函数 11 | static int __init traverse_pcb(void) 12 | { 13 | struct task_struct *task, *p;//定义指向task_struct类型的指针 14 | struct list_head *pos;//定义双向链表指针 15 | int count=0;//定义统计系统进程个数的变量 16 | printk("Printf process'message begin:\n");//提示模块开始运行 17 | task = &init_task;//指向0号进程的PCB 18 | 19 | list_for_each(pos,&task->tasks)//使用list_for_each宏来遍历进程链表 20 | { 21 | p = list_entry(pos,struct task_struct,tasks);//指向当前进程的task_struct结构 22 | count++;//统计系统进程个数 23 | printk("\n\n");//方便查看后续打印信息 24 | /* 25 | 打印task_struct中的字段,其中pid:进程的pid号;state:进程的状态; 26 | prio:动态优先级;static_prio:静态优先级; parent'pid:父进程的pid号; 27 | count:文件系统信息,文件被使用的次数; umask:进程权限位的默认设置; 28 | 使用atomic_read原子操作是为了(p->files)->count字段计数不被打断 29 | */ 30 | printk("pid:%d; state:%lx; prio:%d; static_prio:%d; parent'pid:%d; count:%d; umask:%d;", \ 31 | p->pid,p->state,p->prio,p->static_prio,(p->parent)->pid, \ 32 | atomic_read((&(p->files)->count)),(p->fs)->umask); 33 | //打印进程地址空间的信息 34 | if((p->mm)!=NULL) 35 | printk("total_vm:%ld;",(p->mm)->total_vm);//total_vm:线性区总的页数 36 | } 37 | printk("进程的个数:%d\n",count);//打印进程个数 38 | return 0; 39 | } 40 | 41 | //内核模块退出函数 42 | static void __exit end_pcb(void) 43 | { 44 | printk("traverse pcb is end."); 45 | } 46 | module_init(traverse_pcb);//入口 47 | module_exit(end_pcb);//出口 48 | MODULE_LICENSE("GPL");//许可证 -------------------------------------------------------------------------------- /vfs/dentry/Makefile: -------------------------------------------------------------------------------- 1 | obj-m += test_dentry.o 2 | #generate the path 3 | CURRENT_PATH:=$(shell pwd) 4 | #the current kernel version number 5 | LINUX_KERNEL:=$(shell uname -r) 6 | #the absolute path 7 | LINUX_KERNEL_PATH:=/usr/src/kernels/$(LINUX_KERNEL) 8 | #complie object 9 | all: 10 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules 11 | #clean 12 | clean: 13 | make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean 14 | -------------------------------------------------------------------------------- /vfs/dentry/test_dentry.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | //模块许可证声明(必须) 11 | MODULE_LICENSE("GPL"); 12 | //模块加载函数(必须) 13 | static int test_dentry_init(void) 14 | { 15 | //获取当前文件的入口目录 16 | struct dentry *dentry_pwd = current->fs->pwd.dentry; 17 | 18 | // 获取当前文件的上一级入口目录 19 | struct dentry *dentry_parent = current->fs->pwd.dentry->d_parent; 20 | 21 | // 获取当前文件的入口目录名结构体 22 | struct qstr name = current->fs->pwd.dentry->d_name; 23 | 24 | 25 | //显示父目录名称 26 | printk("The name of dentry_parent is %s\n", dentry_parent->d_name.name); 27 | 28 | //判断父子目录项对应super_block是否一样 29 | printk("dentry_parent->d_sb = %p, dentry_pwd->d_sb = %p\n", dentry_parent->d_sb, dentry_pwd->d_sb); 30 | 31 | struct dentry *dentry=NULL; 32 | // 分配一个目录项缓存结构体 33 | dentry = d_alloc(dentry_parent, &name); 34 | 35 | // 显示当前文件名 36 | printk("The name of current dentry is %s\n", dentry_pwd->d_name.name); 37 | 38 | // 显示返回结果文件名 39 | printk("After \"d_alloc\" the name of the dentry is %s\n", dentry->d_name.name); 40 | 41 | //判断d_alloc是否有对dentry的d_hash项和d_lru项进行初始化 42 | printk("dentry.d_hash is unhashed: %d, dentry.d_lru is NULL: %d\n", d_unhashed(dentry), dentry->d_lru.next == NULL); 43 | 44 | 45 | //遍历current dentry的子目录项链表 46 | struct dentry *tmp = NULL; 47 | int i = 0; 48 | if(!spin_trylock(&dentry_parent->d_lockref.lock)){ 49 | printk("try lock fail\n"); 50 | return 1; 51 | } 52 | list_for_each_entry(tmp, &dentry_parent->d_subdirs, d_child){ 53 | /*排除掉负状态的dentry,未添加这个判读的时候 54 | 会将很多inode为空的dentry name打印出来数量有 55 | 上千个甚至更多个,所以就可以理解为什么dentry 56 | 在路径查找的时候会借助dentry_hashtable了*/ 57 | if(tmp->d_inode == NULL) 58 | continue; 59 | if(!spin_trylock(&tmp->d_lockref.lock)){ 60 | printk("try lock fail\n"); 61 | return 1; 62 | } 63 | 64 | printk("dentry_parent's child%d name is: %s\n", i++, tmp->d_name.name); 65 | 66 | spin_unlock(&tmp->d_lockref.lock); 67 | } 68 | spin_unlock(&dentry_parent->d_lockref.lock); 69 | 70 | return 0; 71 | } 72 | //模块卸载函数(必须) 73 | static void test_dentry_exit(void) 74 | { 75 | printk(KERN_INFO "Hello World exit/n"); 76 | } 77 | 78 | module_init(test_dentry_init); 79 | module_exit(test_dentry_exit); 80 | --------------------------------------------------------------------------------