• 内存的非法读写操作的检查


     

    valgrind什么的就不说了

    AddressSanitizer

    除了heap,stack的也可以

    https://en.wikipedia.org/wiki/AddressSanitizer#Stack-buffer-overflow

    http://developerblog.redhat.com/2014/12/02/address-and-thread-sanitizers-gcc/

    tcmalloc的page fence

    局限是只能对heap做越界读写的检查

    http://www.xuebuyuan.com/1466812.html

      http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz

        修改了代码,打开了内存越界检查的文件。修改如下:

        sed -i "s/EnvToBool("TCMALLOC_PAGE_FENCE", false)/EnvToBool("TCMALLOC_PAGE_FENCE", true)/g" src/debugallocation.cc
        意思是:
                src/debugallocation.cc: 101
                        DEFINE_bool(malloc_page_fence,
                                    EnvToBool("TCMALLOC_PAGE_FENCE", false),
                                    "Enables putting of memory allocations at page boundaries "
                                    "with a guard page following the allocation (to catch buffer "
                                    "overruns right when they happen).");
                将
                    EnvToBool("TCMALLOC_PAGE_FENCE", false)
                改成了
                    EnvToBool("TCMALLOC_PAGE_FENCE", true)

            cd gperftools-2.0 && ./configure --enable-frame-pointers && make

  • 相关阅读:
    WPF Get jiayuan outbox list(send mail box)
    Python中列表的各种方法
    Python中字符串拼接的三种方式
    Python2中input()、raw_input()和Python3中input()
    Python 中for...esle和while...else语法
    第 20 章 设置应用程序的样式并对其进行部署
    第 19 章 用户帐号
    第 18 章 Django 入门
    第 17 章 使用API
    安装requests
  • 原文地址:https://www.cnblogs.com/xuxm2007/p/4815950.html
Copyright © 2020-2023  润新知