Bug 423929 - shmat() fails in x86 32-bit mode on valgrind 3.16.0 & 3.16.1
Summary: shmat() fails in x86 32-bit mode on valgrind 3.16.0 & 3.16.1
Status: RESOLVED DUPLICATE of bug 410743
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-06 14:27 UTC by Byron Stanoszek
Modified: 2021-02-04 16:55 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Workaround patch (564 bytes, patch)
2020-07-06 14:27 UTC, Byron Stanoszek
Details
Compile log (371.61 KB, text/x-log)
2020-07-06 14:28 UTC, Byron Stanoszek
Details
Valgrind and strace log (5.92 KB, text/x-log)
2020-07-06 14:28 UTC, Byron Stanoszek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Byron Stanoszek 2020-07-06 14:27:11 UTC
Created attachment 129936 [details]
Workaround patch

shmat() appears to send the wrong syscall arguments for shmctl() during ML_(generic_PRE_sys_shmat) in get_shm_size() (file coregrind/m_syswrap/syswrap-generic.c) when run in x86 32-bit mode. This fails on both a 32-bit or 64-bit kernel.

The attached patch allows for a workaround for this specific issue (but not tested in other environments or systems; this is only intended to pinpoint the problem). The workaround is to remove the VKI_IPC_64 (IPC_64) flag in the sysctl() syscall. This issue was observed when compiling 32-bit valgrind, versions 3.16.0 or 3.16.1, on both RedHat Enterprise Linux 4 and Gentoo (latest version). valgrind 3.15.0 works OK.

Linux - 5.5.2 #2 SMP Fri Feb 7 15:47:00 EST 2020 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Byron Stanoszek 2020-07-06 14:28:05 UTC
Created attachment 129937 [details]
Compile log
Comment 2 Byron Stanoszek 2020-07-06 14:28:56 UTC
Created attachment 129938 [details]
Valgrind and strace log
Comment 3 Mark Wielaard 2021-02-04 16:55:15 UTC

*** This bug has been marked as a duplicate of bug 410743 ***