Bug 467087

Summary: Unable to start Valgrind due to error (MMAP)
Product: [Developer tools] valgrind Reporter: varun.yeturu
Component: memcheckAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: major CC: pjfloyd, varun.yeturu
Priority: NOR    
Version First Reported In: 3.21 GIT   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: attachment-227165-0.html
attachment-229496-0.html
attachment-356465-0.html

Description varun.yeturu 2023-03-09 02:01:30 UTC
SUMMARY
Upon initiating mmap i see the below error:
valgrind: mmap(0x59e3000, 2280464384) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data or bss segments.

Additional Info:
[root@ran6 scripts_lte_21.07]# uname -ra
Linux ran6 3.10.0-1160.53.1.rt56.1193.el7.x86_64 #1 SMP PREEMPT RT Wed Jan 12 09:47:47 CET 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@ran6 scripts_lte_21.07]# uname -m
x86_64

I saw a similar issue for which there is a patch at "https://bugsfiles.kde.org/attachment.cgi?id=105560". I am suspecting somehow above platform is not handled in the case statements. Can you please check in that direction?


***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Paul Floyd 2023-03-09 09:19:00 UTC
That's not a lot to go on. Can you give more details of the application that you are testing?

The patch has been applied. Your application is trying to use more memory than the threshold.
Comment 2 varun.yeturu 2023-03-11 15:55:01 UTC
Created attachment 157189 [details]
attachment-227165-0.html

Hi Paul,

Can you please let me know what kind of details are required?
This is a proprietary application that is compiled with Intel ICC compiler and run on a centos platform.
My only doubt is that somehow it is unable to recognize the centos platform properly.

Let me know if you need any additional information.

Regards,
Varun

From: Paul Floyd <bugzilla_noreply@kde.org>
Date: Thursday, March 9, 2023 at 1:19 AM
To: Varun Reddy Yeturu <varun.yeturu@cohere-technologies.com>
Subject: [valgrind] [Bug 467087] Unable to start Valgrind due to error (MMAP)
https://bugs.kde.org/show_bug.cgi?id=467087

Paul Floyd <pjfloyd@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pjfloyd@wanadoo.fr

--- Comment #1 from Paul Floyd <pjfloyd@wanadoo.fr> ---
That's not a lot to go on. Can you give more details of the application that
you are testing?

The patch has been applied. Your application is trying to use more memory than
the threshold.

--
You are receiving this mail because:
You reported the bug.
Comment 3 Paul Floyd 2023-03-11 15:59:48 UTC
Centos is unlikely to be the problem  - it is one of the best supported platforms.

ICC is a lot less well supported - not sure if any Valgrind devs use it regularly.

One quick thing that you can do is give use the output of 'size' on your executable. For instance

paulf> size `which dolphin`
    text     data   bss       dec        hex   filename
  967740   114080   501   1082321   0x1083d1   /usr/local/bin/dolphin

That's just some random KDE app, but it tells us how big the code is (text), global data (data) and static data (bss).
Comment 4 varun.yeturu 2023-03-11 16:25:15 UTC
Created attachment 157192 [details]
attachment-229496-0.html

Sure.
I compile with “-debug -O0 -g” flags.

[yeturva@ran6 source]$ size ../bin/cpcc
   text        data        bss         dec        hex    filename
87956828            383888                13069709208     13158049924     31047e884          ../bin/cpcc

Regards,
Varun

From: Paul Floyd <bugzilla_noreply@kde.org>
Date: Saturday, March 11, 2023 at 7:59 AM
To: Varun Reddy Yeturu <varun.yeturu@cohere-technologies.com>
Subject: [valgrind] [Bug 467087] Unable to start Valgrind due to error (MMAP)
https://bugs.kde.org/show_bug.cgi?id=467087

--- Comment #3 from Paul Floyd <pjfloyd@wanadoo.fr> ---
Centos is unlikely to be the problem  - it is one of the best supported
platforms.

ICC is a lot less well supported - not sure if any Valgrind devs use it
regularly.

One quick thing that you can do is give use the output of 'size' on your
executable. For instance

paulf> size `which dolphin`
    text     data   bss       dec        hex   filename
  967740   114080   501   1082321   0x1083d1   /usr/local/bin/dolphin

That's just some random KDE app, but it tells us how big the code is (text),
global data (data) and static data (bss).

--
You are receiving this mail because:
You reported the bug.
Comment 5 Paul Floyd 2023-03-11 20:44:11 UTC
(In reply to varun.yeturu from comment #4)
> Created attachment 157192 [details]
> attachment-229496-0.html
> 
> Sure.
> I compile with “-debug -O0 -g” flags.
> 
> [yeturva@ran6 source]$ size ../bin/cpcc
>    text        data        bss         dec        hex    filenameTyp
> 87956828            383888                13069709208     13158049924    
> 31047e884          ../bin/cpcc

13 Gbytes of BSS, could be the problem

Can you see where you are creating that? It's probably a file static array.

If you run "nm -f sysv -e" on your executable there will be a column with the size, and look for something that is Class d and Type OBJECT/

Can you reduce the size of that static object?
Comment 6 varun.yeturu 2023-03-12 22:06:42 UTC
Created attachment 157222 [details]
attachment-356465-0.html

Thanks Paul.

There seems to be a lot of such objects with small size.
nm -f sysv -e ../bin/cpcc > sym_info.txt
[yeturva@ran6 source]$ cat sym_info.txt | grep "d  |" | wc -l
2415

For reference, one of them is as follows:
aead_des_ede3_cbc_sha1_tls_implicit_iv|00000000059f2cc0|   d  |            OBJECT|0000000000000048|     |.data.rel.ro

Are you referring to the above?

Regards,
Varun

From: Paul Floyd <bugzilla_noreply@kde.org>
Date: Saturday, March 11, 2023 at 12:44 PM
To: Varun Reddy Yeturu <varun.yeturu@cohere-technologies.com>
Subject: [valgrind] [Bug 467087] Unable to start Valgrind due to error (MMAP)
https://bugs.kde.org/show_bug.cgi?id=467087

--- Comment #5 from Paul Floyd <pjfloyd@wanadoo.fr> ---
(In reply to varun.yeturu from comment #4)
> Created attachment 157192 [details]
> attachment-229496-0.html
>
> Sure.
> I compile with “-debug -O0 -g” flags.
>
> [yeturva@ran6 source]$ size ../bin/cpcc
>    text        data        bss         dec        hex    filenameTyp
> 87956828            383888                13069709208     13158049924
> 31047e884          ../bin/cpcc

13 Gbytes of BSS, could be the problem

Can you see where you are creating that? It's probably a file static array.

If you run "nm -f sysv -e" on your executable there will be a column with the
size, and look for something that is Class d and Type OBJECT/

Can you reduce the size of that static object?

--
You are receiving this mail because:
You reported the bug.
Comment 7 varun yeturu 2023-03-20 17:14:00 UTC
Recently my email domain name has been changed within the org. Going forward, I will use the below new email to communicate:
varun.yeturu@cohere-tech.com
Comment 8 varun yeturu 2023-03-20 17:16:55 UTC
Thanks Paul.
 
There seems to be a lot of such objects with small size.
nm -f sysv -e ../bin/cpcc > sym_info.txt
[yeturva@ran6 source]$ cat sym_info.txt | grep "d  |" | wc -l
2415
 
For reference, one of them is as follows:
aead_des_ede3_cbc_sha1_tls_implicit_iv|00000000059f2cc0|   d  |            OBJECT|0000000000000048|     |.data.rel.ro
 
Are you referring to the above?
 
Regards,
Varun
Comment 9 Paul Floyd 2023-03-21 10:45:06 UTC
> For reference, one of them is as follows:
> aead_des_ede3_cbc_sha1_tls_implicit_iv|00000000059f2cc0|   d  |           
> OBJECT|0000000000000048|     |.data.rel.ro
>  
> Are you referring to the above?

Yes, though the above example is quite small - 48 is the size.