RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2157662 - Cannot execute valgrind due to lack of memory (which is not true)
Summary: Cannot execute valgrind due to lack of memory (which is not true)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: valgrind
Version: 8.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Mark Wielaard
QA Contact: Jesus Checa
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-02 14:52 UTC by Renaud Métrich
Modified: 2023-11-14 16:46 UTC (History)
5 users (show)

Fixed In Version: valgrind-3.21.0-2.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-14 15:32:03 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
KDE Software Compilation 464680 0 NOR UNCONFIRMED Show issues caused by memory policies like selinux deny_execmem 2023-03-30 22:51:58 UTC
Red Hat Issue Tracker RHELPLAN-143433 0 None None None 2023-01-02 15:01:00 UTC
Red Hat Product Errata RHBA-2023:6953 0 None None None 2023-11-14 15:32:13 UTC

Description Renaud Métrich 2023-01-02 14:52:55 UTC
Description of problem:

When SELinux "deny_execmem" boolean is enabled, Valgrind always dies with not being able to allocate 32GB, e.g.:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# /usr/bin/valgrind --tool=memcheck --leak-check=yes --trace-children=yes --track-origins=yes /usr/sbin/rsyslogd -n
[...]
==54482==     Valgrind's memory management: out of memory:
==54482==        newSuperblock's request for 4194304 bytes failed.
==54482==           27,475,968 bytes have already been mmap-ed ANONYMOUS.
==54482==     Valgrind cannot continue.  Sorry.
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Version-Release number of selected component (if applicable):

valgrind-3.19.0-1.el8

How reproducible:

Always

Comment 1 Mark Wielaard 2023-01-02 21:51:51 UTC
It looks like deny_execmem is off by default. At least on my setup:
$ getsebool deny_execmem
deny_execmem --> off

If I enable it my desktop crashes... both gnome-shell and firefox dump core.
Apparently both use a javascript JIT runtime.

Is this a supported setup?
valgrind needs a executable memory for its VEX jit.

Comment 2 Renaud Métrich 2023-01-03 07:32:52 UTC
It is supported, at least on non-GUI systems.
The issue here is more with dying with another message that not being able to allocate memory (it would be not being able to *execute* memory instead).

Comment 3 Mark Wielaard 2023-01-09 11:40:13 UTC
(In reply to Renaud Métrich from comment #2)
> It is supported, at least on non-GUI systems.
> The issue here is more with dying with another message that not being able
> to allocate memory (it would be not being able to *execute* memory instead).

Aha, ok, so it is about giving a better error message if deny_execmem is on. That should be doable.

Comment 4 Mark Wielaard 2023-01-23 09:04:30 UTC
Submitted a patch upstream https://bugs.kde.org/show_bug.cgi?id=464680
With that the error message will show Permission denied and includes a hint about selinux deny_execmem:

==509341== 
==509341==     Valgrind's memory management: out of memory: Permission denied
==509341==        newSuperblock's request for 4194304 bytes failed.
==509341==           27,480,064 bytes have already been mmap-ed ANONYMOUS.
==509341==     Valgrind cannot continue.  Sorry.
==509341== 
==509341==     There are several possible reasons for this.
==509341==     - You have some kind of memory limit in place.  Look at the
==509341==       output of 'ulimit -a'.  Is there a limit on the size of
==509341==       virtual memory or address space?
==509341==     - You have run out of swap space.
==509341==     - You have some policy enabled that denies memory to be
==509341==       executable (for example selinux deny_execmem) that causes
==509341==       mmap to fail with Permission denied.
==509341==     - Valgrind has a bug.  If you think this is the case or you are
==509341==     not sure, please let us know and we'll try to fix it.
==509341==     Please note that programs can take substantially more memory than
==509341==     normal when running under Valgrind tools, eg. up to twice or
==509341==     more, depending on the tool.  On a 64-bit machine, Valgrind
==509341==     should be able to make use of up 32GB memory.  On a 32-bit
==509341==     machine, Valgrind should be able to use all the memory available
==509341==     to a single process, up to 4GB if that's how you have your
==509341==     kernel configured.  Most 32-bit Linux setups allow a maximum of
==509341==     3GB per process.
==509341== 
==509341==     Whatever the reason, Valgrind cannot continue.  Sorry.

Comment 5 Renaud Métrich 2023-01-23 09:43:08 UTC
Thanks a lot, it's more explanatory now.

Comment 13 errata-xmlrpc 2023-11-14 15:32:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (valgrind bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6953


Note You need to log in before you can comment on or make changes to this bug.