nginx下使用asan和valgrind两个静态检查工具
wegit:http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2
tar -jxvf valgrind-3.12.0.tar.bz2
cd valgrind-3.12.0
./configure
make
sudo make install
输入valgrind–h显示valgrind的参数及提示,说明安装成功
sudo valgrind --tool=memcheck --leak-check=full /usr/local/nginx-1.4.2/sbin/nginx
==41400== Memcheck, a memory error detector
==41400== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==41400== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==41400== Command: /usr/local/nginx-1.4.2/sbin/nginx
==41400==
==41400== Warning: set address range perms: large range [0x957a040, 0x2e45f7e2) (undefined)
==41400== Warning: set address range perms: large range [0x957b040, 0x2e45f040) (defined)
nginx: [error] failed to initialize Lua VM in /usr/local/nginx-1.4.2/conf/nginx.conf:125
==41400==
==41400== HEAP SUMMARY:
==41400== in use at exit: 619,703,912 bytes in 3,285 blocks
==41400== total heap usage: 20,476 allocs, 17,191 frees, 626,783,730 bytes allocated
==41400==
==41400== 128 bytes in 1 blocks are possibly lost in loss record 583 of 650
==41400== at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==41400== by 0x431D0A: ngx_alloc (ngx_alloc.c:22)
==41400== by 0x4222CE: ngx_crc32_table_init (ngx_crc32.c:117)
==41400== by 0x41A20B: main (nginx.c:320)
==41400==
==41400== 1,024 bytes in 1 blocks are definitely lost in loss record 626 of 650
==41400== at 0x4C2D136: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==41400== by 0x4C2D251: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==41400== by 0x431DBB: ngx_memalign (ngx_alloc.c:57)
==41400== by 0x41B5C2: ngx_create_pool (ngx_palloc.c:21)
==41400== by 0x419F52: main (nginx.c:299)
==41400==
==41400== LEAK SUMMARY:
==41400== definitely lost: 1,024 bytes in 1 blocks
==41400== indirectly lost: 0 bytes in 0 blocks
==41400== possibly lost: 128 bytes in 1 blocks
==41400== still reachable: 619,702,760 bytes in 3,283 blocks
==41400== suppressed: 0 bytes in 0 blocks
==41400== Reachable blocks (those to which a pointer was found) are not shown.
==41400== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==41400==
==41400== For counts of detected and suppressed errors, rerun with: -v
==41400== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
解决的办法是使用 openresty 的 luajit 仓库的 v2.1-agentzh 分支重新: https://github.com/openresty/luajit2/tree/v2.1-agentzh ,然后,重新编译一个特殊版本的 LuaJIT,强制它使用系统的分配器,即在编译 LuaJIT 时使用类似下面的命令: make CCDEBUG=-g Q= XCFLAGS='-DLUAJIT_USE_VALGRIND -DLUAJIT_USE_SYSMALLOC'
worker_processes 1;
daemon off;
master_process off;
或者使用在valgrind中使用–trace-children=yes 选项跟踪子进程信息
--fsanitize=address -fno-omit-frame-pointer -static-libasan
--with-ld-opt="-fsanitize=address -static-libasan"
modified: libs/protobuf/Makefile
modified: src/core/nginx.h
modified: src/core/ngx_array.c
modified: src/core/ngx_array.h
modified: src/core/ngx_palloc.c
modified: src/core/ngx_palloc.h
nginx下使用asan和valgrind两个静态检查工具的更多相关文章
- C++ 两款静态检查工具
pclint(收费) http://www.gimpel.com/html/pcl.htmpc-lint是资格最老,最强力的代码检查工具,但是是收费软件,并且配置起来有一点点麻烦. ccpchecke ...
- 安全防范:nginx下git引发的隐私泄露问题
安全防范:nginx下git引发的隐私泄露问题 1 安全事件 最近阿里云服务器后台管理系统中收到一条安全提示消息,系统配置信息泄露: http://my.domain.com/.git/confi ...
- nginx下目录浏览及其验证功能配置记录
工作中常常有写不能有网页下载东西的需求,在Apache下搭建完成后直接导入文件即可达到下载/显示文件的效果;而Nginx的目录列表功能默认是关闭的,如果需要打开Nginx的目录列表功能,需要手动配置, ...
- Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持
前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...
- CentOS 下用的是lnmp 的包配置Nginx 下的CI伪静态(搞爽了)
server { listen ; server_name cy.com; index index.html index.htm index.php default.html default.htm ...
- 新秀nginx源代码分析数据结构篇(两) 双链表ngx_queue_t
nginx源代码分析数据结构篇(两) 双链表ngx_queue_t Author:Echo Chen(陈斌) Email:chenb19870707@gmail.com Blog:Blog.csdn. ...
- nginx下目录浏览及其验证功能、版本隐藏等配置记录
工作中常常有写不能有网页下载东西的需求,在Apache下搭建完成后直接导入文件即可达到下载/显示文件的效果;而Nginx的目录列表功能默认是关闭的,如果需要打开Nginx的目录列表功能,需要手动配置, ...
- Nginx 下部署 HTTPS 与安全调优
什么是 HTTPS?# HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的 ...
- Nginx下HTTP强制重定向至HTTPS
Nginx下HTTP强制重定向至HTTPS 对于nginx来说,配置http强制重定向至https有多种多样的写法.可以直接rewrite,也可以用301重定向.但是直接拷贝网上的配置往往会出现问题, ...
随机推荐
- UvaLive 6664 Clock Hands
链接:http://vjudge.net/problem/viewProblem.action?id=49409 题意:给一个奇怪的能够记录N小时内时间的表(生活中的表是12小时计时的). 而且给出一 ...
- 剑指offer-平衡二叉树-python
题目描述 输入一棵二叉树,判断该二叉树是否是平衡二叉树. 思路: 平衡二叉树 (AVL)平衡二叉树是一种二叉排序树,其中每个结点的左子树和右子树的高度差至多等于1.它是一种高度平衡的二叉排序树.意思是 ...
- 2019 湖湘杯 Reverse WP
0x01 arguement 下载链接:https://www.lanzous.com/i7atyhc 1.准备 获取到信息: 32位的文件 upx加密文件 在控制台打开文件 使用"upx ...
- c++ Socket客户端和服务端示例版本一
客户端 #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <sys/soc ...
- Spring基础11——Bean的作用域
1.Bean的作用域种类 Spring中的bean的作用域分为四种:singleton.prototype.session.request,后两种很少使用,下面我们主要来学习前两种 2.singlet ...
- 隐藏系统和 Apache 的版本信息
方法一: ※首先修改源文件,再进行 make && make install 编译安装 编辑源文件/usr/local/apache2/include/ap_release.h 文件 ...
- Candidate Generation and LUNA16 preprocessing
在这个kernel中,我们将讨论有助于更好地理解问题陈述和数据可视化的方法. 我还将提供有用的资源和信息的链接. 此脚本是用Python编写的. 我建议人们在桌面上安装anaconda,因为here提 ...
- Codeforces 957 水位标记思维题
A #include <bits/stdc++.h> #define PI acos(-1.0) #define mem(a,b) memset((a),b,sizeof(a)) #def ...
- Qt带参数的信号和槽
在Qt的开发过程中,信号带参数是很常见的,在使用带参数的信号槽时,有以下几点需要注意. 当信号和槽函数的参数数量相同时,它们的参数类型要完全一致. 信号和槽函数的声明: signals: void i ...
- mysql 在查字符串字段中 条件参数传为数字0查到与实际数据不匹配问题
比如: CREATE TABLE `e` ( `id` int(11) DEFAULT NULL, `status` varchar(255) DEFAULT NULL, `b` varchar(25 ...