Bug 1316512

Summary: aarch64: Missing and wrong syscalls on arm64
Product: Red Hat Enterprise Linux 7 Reporter: Mark Wielaard <mjw>
Component: valgrindAssignee: Mark Wielaard <mjw>
Status: CLOSED ERRATA QA Contact: Miloš Prchlík <mprchlik>
Severity: unspecified Docs Contact: Tomas Capek <tcapek>
Priority: unspecified    
Version: 7.3CC: jakub, jcm, mbenitez, mcermak, mjuszkie, mprchlik, ohudlick
Target Milestone: rc   
Target Release: 7.3   
Hardware: aarch64   
OS: Linux   
Whiteboard:
Fixed In Version: valgrind-3.11.0-20.el7 Doc Type: Bug Fix
Doc Text:
Improved *valgrind* functionality on AArch64 *Valgrind* support for the 64-bit ARM architecture (AArch64) has been improved significantly by implementing new system call wrappers and instructions.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 02:56:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mark Wielaard 2016-03-10 11:29:50 UTC
Valgrind was using a wrong syscall number list on aarch64. And not all system calls were intercepted. This caused some small issues (callgrind couldn't rename some files, core files generated by valgrind could have bogus prstatus values). And it meant that various programs running under valgrind on aarch64 would generate errors about unsupported system calls.

This was fixed upstream by the following commits, which contain a new testcase for various system calls on arm64:

From fe31b9a6fe9aad1a83c996032717f4757ff21f75 Mon Sep 17 00:00:00 2001
From: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed, 9 Mar 2016 16:18:34 +0000
Subject: [PATCH 1/3] Use correct syscall numbers on arm64. Fix rename, dup2
 and getpgrp.

We were using some wrong syscall numbers in vki-scnums-arm64-linux.h
arm64 doesn't implement a couple of old deprecated system calls like
rename, dup2, getpgrp and fork. Adjust m_libcfile.c rename and dup2
functions to use renameat (also on tilegx) and dup3 (with fcntl fallback
for bad oldfd). And in m_libcproc.c implement getpgrp as getpgid(0).
Also don't compile the fork syswrap on arm64 (it only supports clone).

In practice this only affected callgrind which was unable to rename
dump files in some cases and ELF core dumps might have contained some
bogus prstatus fields.

Related to bug #359503 - Add missing syscalls for aarch64 (arm64)
Reported by Marcin Juszkiewicz who also posted a nice overview
of system calls on different linux architectures:
https://marcin.juszkiewicz.com.pl/2016/03/05/from-a-diary-of-aarch64-porter-system-calls/

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15824 a5019735-40e9-0310-863c-91ae7b9d1cf9

From a4070ecdf2b2ade10ccf77518e97cc8a8280fd34 Mon Sep 17 00:00:00 2001
From: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Wed, 9 Mar 2016 16:18:36 +0000
Subject: [PATCH 2/3] Add arm64 scalar test. Enable tested syscalls.

The new memcheck/tests/arm64-linux/scalar test is based on the
memcheck/tests/x86-linux/scalar test and contains all syscalls
that are also available on arm64. To make comparison of exp results
easier the order of the tested syscalls is the same as on x86.
This enables a couple extra arm64 syscalls. Part of the fix for
bug #359503 - Add missing syscalls for aarch64 (arm64).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15825 a5019735-40e9-0310-863c-91ae7b9d1cf9

Subject: [PATCH 3/3] Bug 359503 - Add missing syscalls for aarch64 (arm64)

Enable more arm64 syscalls. ioprio_set, ioprio_get, preadv, pwritev,
vmsplice, splice, tee, waitid, clock_nanosleep and perf_event_open.
Reported and patch (mostly) by Marcin Juszkiewicz.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15826 a5019735-40e9-0310-863c-91ae7b9d1cf9

commit 366319c50f4d80b33c286f37b0228b3c0e626ffa
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date:   Thu Mar 10 07:59:33 2016 +0000

    Add arm64-linux to tests/platform_test.
    
    Prevent executing arm64-linux specific tests on other arches.
    
    git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15827 a5019735-40e9-0310-863c-91ae7b9d1cf9

These patches are already backported to the fedora valgrind package (valgrind-3.11.0-16.fc25).

Comment 2 Miloš Prchlík 2016-06-08 12:52:43 UTC
Changes are present in the SRPM, test case have been ran as a part of test suite, and as far as I can tell, its output looks reasonable to me, many syscalls supported by valgrind. Also, no other test @ aarch64 failed with "unhandled syscall N" error message, so I'd say no apparent regressions in sight.

Comment 4 errata-xmlrpc 2016-11-04 02:56:01 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, 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://rhn.redhat.com/errata/RHEA-2016-2297.html