c++ - 未初始化的值是由库代码上的堆栈分配错误创建的

标签 c++ valgrind ioctl

您好,我目前正在修复我的 valgrind 错误,它们是:

==11925== ERROR SUMMARY: 9 errors from 1 contexts (suppressed: 0 from 0)
==11925== 
==11925== 9 errors in context 1 of 1:
==11925== Syscall param ioctl(generic) points to uninitialised byte(s)
==11925==    at 0xF8B7F47: ioctl (syscall-template.S:84)
==11925==    by 0x1F770DAD: drmIoctl (in /opt/amdgpu/lib/x86_64-linux-gnu/libdrm.so.2.4.0)
==11925==    by 0x1F7756E8: drmCommandWriteRead (in /opt/amdgpu/lib/x86_64-linux-gnu/libdrm.so.2.4.0)
==11925==    by 0x3332C6AC: amdgpu_create_bo_from_user_mem (in /opt/amdgpu/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0)
==11925==    by 0x32A479F2: ??? (in /usr/lib/x86_64-linux-gnu/gallium-pipe/pipe_radeonsi.so)
==11925==    by 0x32A6E6B3: ??? (in /usr/lib/x86_64-linux-gnu/gallium-pipe/pipe_radeonsi.so)
==11925==    by 0x2D8E8BD6: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==11925==    by 0x2D8E05D4: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==11925==    by 0x2D8DE2D4: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==11925==    by 0x2D8DD2E7: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==11925==    by 0x2D8DD940: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==11925==    by 0x2D8D8875: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==11925==  Address 0xffeffed64 is on thread 1's stack
==11925==  in frame #3, created by amdgpu_create_bo_from_user_mem (???:)
==11925==  Uninitialised value was created by a stack allocation
==11925==    at 0x329770B0: ??? (in /usr/lib/x86_64-linux-gnu/gallium-pipe/pipe_radeonsi.so)

在我的程序中,我与错误代码中提到的文件无关。我已经阅读了很多关于这个问题的帖子,但就我而言,提到的代码行甚至不在我的代码中(我想它在我使用的某个库中)。

感谢任何帮助!

最佳答案

将未初始化的缓冲区传递给 ioctl 是很常见的。

valgrind 中甚至有一个选项可以忽略它们:

--sim-hints=lax-ioctls

请参阅文档 http://valgrind.org/docs/manual/manual-core.html

lax-ioctls: Be very lax about ioctl handling; the only assumption is that the size is correct. Doesn't require the full buffer to be initialised when writing. Without this, using some device drivers with a large number of strange ioctl commands becomes very tiresome.

简而言之,您的错误(很可能)是误报。

关于c++ - 未初始化的值是由库代码上的堆栈分配错误创建的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50899811/

相关文章:

c++ - 套接字 - 使用选择超时

C : Valgring warns about "Invalid write/read of size 8" & close syscall

linux - 将自定义结构类型添加到 strace

c++ - qt/c++ 动态命名变量

c++ - OpenGL 'deprecated' 功能可能不受支持吗?

c++ - 如何告诉 valgrind 对 fork 进程进行 memcheck?

c - Valgrind 错误 : conditional jump or move depends on uninitialised value(s) - C

c++ - 一般如何查明客户端是否分配了静态IP或者它是dhcp客户端

c - 错误: unable to handle kernel paging request at ffffffffffffffff

c++ - 比较 double