Bug 376611 - ppc64 and arm64 don't know about prlimit64 syscall
Summary: ppc64 and arm64 don't know about prlimit64 syscall
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.12 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-18 13:18 UTC by Mark Wielaard
Modified: 2017-02-18 13:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2017-02-18 13:18:37 UTC
Running prlimit on either arm64 or ppc64[le] gets this WARNING:

==19848== Command: prlimit
==19848== 
--19848-- WARNING: unhandled arm64-linux syscall: 261
--19848-- You may be able to write your own handler.
--19848-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--19848-- Nevertheless we consider this a bug.  Please report
--19848-- it at http://valgrind.org/support/bug_reports.html.
prlimit: failed to get the AS resource limit: Function not implemented

==14990== Command: prlimit
==14990== 
--14990-- WARNING: unhandled ppc64le-linux syscall: 325
--14990-- You may be able to write your own handler.
--14990-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--14990-- Nevertheless we consider this a bug.  Please report
--14990-- it at http://valgrind.org/support/bug_reports.html.
prlimit: failed to get the AS resource limit: Function not implemented


The fix is simply to hook both syscalls to the already existing wrapper:

diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c
index 1be6629..f8b5b7c 100644
--- a/coregrind/m_syswrap/syswrap-arm64-linux.c
+++ b/coregrind/m_syswrap/syswrap-arm64-linux.c
@@ -868,6 +868,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY(__NR_recvmmsg,          sys_recvmmsg),          // 243
 
    GENXY(__NR_wait4,             sys_wait4),             // 260
+   LINXY(__NR_prlimit64,         sys_prlimit64),         // 261
 
    LINXY(__NR_name_to_handle_at, sys_name_to_handle_at), // 264
    LINXY(__NR_open_by_handle_at, sys_open_by_handle_at), // 265
diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index f90140d..ce5cbbb 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -905,6 +905,7 @@ static SyscallTableEntry syscall_table[] = {
    LINX_(__NR_pwritev,           sys_pwritev),          // 321
    LINXY(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo),// 322
 
+   LINXY(__NR_prlimit64,         sys_prlimit64),        // 325
    LINXY(__NR_socket,            sys_socket),           // 326
    LINX_(__NR_bind,              sys_bind),             // 327
    LINX_(__NR_connect,           sys_connect),          // 328
Comment 1 Mark Wielaard 2017-02-18 13:20:33 UTC
valgrind svn r16228