Valgrind showing error calling pr_set_ptracer, vgdb might block

我的梦境 提交于 2020-05-14 19:10:53

问题


I am using Valgrind to find memory leaks of my C program and although it looks like it is running fine and showing allocated and freed memory. But, I want to know why it is throwing this error and what are its consequences.

Here the snippet of error:

==483== Memcheck, a memory error detector
==483== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==483== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==483== Command: ./main ../old\ projects
==483== 
==483== error calling PR_SET_PTRACER, vgdb might block

回答1:


The vgdb executable (part of valgrind) is used to 'connect' to valgrind to either launch monitor commands or make the link between gdb and your process running under valgrind. If your process is blocked in a syscall, vgdb needs to 'wake up' your process and for this must be able to 'ptrace' your process. Depending on how the security is configured on your system, valgrind might have to tell the kernel that ptrace itself is ok. This is done using the syscall prctl (PR_SET_PTRACER). If this syscall fails, then you see this message. The consequence is that vgdb cannot connect to your process as long as your process is blocked in a syscall. So, unless you have a critical need to debug your process when blocked in a syscall, or launch a monitor command when blocked in a syscall, there is no consequences.

This error is however not expected. So, please report a bug on valgrind bugzilla. Attach the output of: cat /proc/sys/kernel/yama/ptrace_scope Also, it would be nice if you could use strace -f valgrind and extract the reason why the syscall prctl (PR_SET_PTRACER) is failing (in particular the errno).



来源:https://stackoverflow.com/questions/57206233/valgrind-showing-error-calling-pr-set-ptracer-vgdb-might-block

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!