Valgrind Error: failed in UME with error 22
Asked Answered
P

3

13

I am playing around with tool development in Valgrind and am getting the following error:

valgrind: mmap(0x8048000, 4096) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data or bss segments.

but my executable has nothing but simple variable assignments. I am not able to understand how to fix this problem. Any suggestions?

Puttier answered 20/11, 2010 at 2:3 Comment(1)
Were you able to resolve this?Kathlenekathlin
K
4

I solved this for my case and submitted a patch:

https://bugs.kde.org/show_bug.cgi?id=290061

If you or anyone else having this problem are building your executable with -pie, this might help you too.

Kathlenekathlin answered 7/5, 2012 at 23:44 Comment(0)
B
8

I don't have an answer, but there is an open bug on this issue.

http://bugs.kde.org/show_bug.cgi?id=138424

Burhans answered 8/2, 2011 at 2:42 Comment(1)
+1 ouch - afaict, this bug still lives in Ubuntu 12.10 (amd64), valgrind 3.7.0 when I did an mmap read on a 4.3GB file.Sinciput
K
4

I solved this for my case and submitted a patch:

https://bugs.kde.org/show_bug.cgi?id=290061

If you or anyone else having this problem are building your executable with -pie, this might help you too.

Kathlenekathlin answered 7/5, 2012 at 23:44 Comment(0)
S
0

I encountered this error as well. In my situation, the program I was analyzing contained huge statically-allocated arrays, which caused the .bss segment size to blow up (over 2 GiB):

$ size ./MyExe
   text    data     bss          dec          hex      filename
  50324    2480     2338486216   2338539020   8b63460c MyExe.exe

The large arrays were only necessary for testing under heavy loads, so I defined the arrays to be much smaller in the code and recompiled. This shrunk the .bss segment down to something more reasonable, and allowed me to run the program normally with Valgrind.

Note: It seemed I needed to get the .bss segment under 932000000 in order for Valgrind to run without the error, although this threshold seemed somewhat arbitrary.

Surgery answered 3/3, 2020 at 23:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.