Bug 359503 - Add missing syscalls for aarch64 (arm64)
Summary: Add missing syscalls for aarch64 (arm64)
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: 2016-02-17 14:55 UTC by Marcin Juszkiewicz
Modified: 2016-09-14 11:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Add all aarch64 syscalls (30.52 KB, patch)
2016-02-17 14:57 UTC, Marcin Juszkiewicz
Details
add all missing syscalls for aarch64 - rebased to svn HEAD (28.19 KB, patch)
2016-02-17 15:43 UTC, Marcin Juszkiewicz
Details
add all missing syscalls for aarch64 - rebased to svn HEAD, fixed, build tested (28.21 KB, patch)
2016-03-04 20:51 UTC, Marcin Juszkiewicz
Details
Use correct syscall numbers on arm64 (7.20 KB, patch)
2016-03-08 10:52 UTC, Mark Wielaard
Details
Use correct syscall numbers on arm64 (fix rename, dup2, getpgrp and fork) (7.96 KB, patch)
2016-03-08 12:57 UTC, Mark Wielaard
Details
Add arm64 scalar test. Enable tested syscalls. (148.40 KB, patch)
2016-03-09 13:23 UTC, Mark Wielaard
Details
Add more missing syscalls (7.12 KB, patch)
2016-03-09 16:13 UTC, Mark Wielaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Juszkiewicz 2016-02-17 14:55:37 UTC
There is a huge amount of syscalls not handled on AArch64 architecture.

https://bugs.kde.org/show_bug.cgi?id=356678 wants one, https://bugs.kde.org/show_bug.cgi?id=356676 wants another.

I wanted another ones. So instead of adding few I decided to add all of them.

Reproducible: Always
Comment 1 Marcin Juszkiewicz 2016-02-17 14:57:20 UTC
Created attachment 97262 [details]
Add all aarch64 syscalls

This patch adds all syscalls. LINX_/LINXY etc was based on commented versions and on amd64-linux ones.

Not built yet with this code.
Comment 2 Marcin Juszkiewicz 2016-02-17 15:43:46 UTC
Created attachment 97263 [details]
add all missing syscalls for aarch64 - rebased to svn HEAD

Ops, previous version was done against older valgrind tree...
Comment 3 Tom Hughes 2016-02-17 15:57:27 UTC
How many of these have you actually tested though?

The point of leaving them commented out rather than just enabling them all is to wait until people find something that is actually using them so that we can get some sort of view of whether they work when we enable them.
Comment 4 Marcin Juszkiewicz 2016-02-17 16:18:53 UTC
So far few of them - hawkey needed 107, 110, 111 ones.

I am fine with adding them in commented form so if someone will need one then all they will have to do is uncomment needed one, rebuild and report does it works.

If there is a way to test support for all syscalls then I can run it on aarch64.
Comment 5 Marcin Juszkiewicz 2016-03-04 20:51:21 UTC
Created attachment 97685 [details]
add all missing syscalls for aarch64 - rebased to svn HEAD, fixed, build tested

Mark Wielaard pointed that previous patch does not build. Checked, fixed few syscall names, disabled few.
Comment 6 Mark Wielaard 2016-03-08 10:52:28 UTC
Created attachment 97762 [details]
Use correct syscall numbers on arm64

While testing some of these newly hooked system calls I noticed that valgrind uses some wrong system call numbers on arm64. This also affects our own dup2 and rename implementations (arm64 only has dup3 and renameat). Which causes callgrind to sometimes be unable to rename dump files on arm64.

Fixed the syscall numbers using the overview given by Marcin:
https://marcin.juszkiewicz.com.pl/2016/03/05/from-a-diary-of-aarch64-porter-system-calls/
Comment 7 Mark Wielaard 2016-03-08 12:57:16 UTC
Created attachment 97763 [details]
Use correct syscall numbers on arm64 (fix rename, dup2, getpgrp and fork)

Same as the previous patch, but also fixed getpgrp, which doesn't exist on arm64 and is just getpgid(0).
Comment 8 Mark Wielaard 2016-03-09 13:23:53 UTC
Created attachment 97787 [details]
Add arm64 scalar test. Enable tested syscalls.

This adds a new memcheck/tests/arm64-linux/scalar test which 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.
Comment 9 Mark Wielaard 2016-03-09 16:13:15 UTC
Created attachment 97794 [details]
Add more missing syscalls

This adds most of the missing syscalls from the original patch for which I could do a quick test on an arm64 machine. ioprio_set, ioprio_get, preadv, pwritev, vmsplice, splice, tee, waitid, clock_nanosleep and perf_event_open.
Comment 10 Mark Wielaard 2016-03-09 16:22:57 UTC
valgrind svn r15824 r15825 r15826

This adds most of the syscalls from the original patch. But only those that I could (very quickly) test. There are still some missing.

It would be nice (not just for arm64) to run something like the LTP Linux Test Project http://linux-test-project.github.io/ under valgrind. That should be able to catch most things still missing (and maybe even bad corner cases in the valgrind syswrappers.

https://archive.fosdem.org/2015/schedule/event/valgrind_easy_hack/attachments/slides/731/export/events/attachments/valgrind_easy_hack/slides/731/valgrind_easy_hacks.html#slide25
Comment 11 Marcin Juszkiewicz 2016-09-14 08:26:50 UTC
tag=adjtimex01_valgrind_memory_leak_check stime=1473840632
cmdline=" valgrind -q --leak-check=full --trace-children=yes adjtimex01"
contacts=""
analysis=exit
<<<test_output>>>
--7168-- WARNING: unhandled arm64-linux syscall: 171
--7168-- You may be able to write your own handler.
--7168-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--7168-- Nevertheless we consider this a bug.  Please report
--7168-- it at http://valgrind.org/support/bug_reports.html.
adjtimex01    1  TBROK  :  adjtimex01.c:107: failed to save current parameters: errno=ENOSYS(38): Function not implemented
adjtimex01    2  TBROK  :  adjtimex01.c:107: Remaining cases broken
Comment 12 Mark Wielaard 2016-09-14 11:49:22 UTC
Added adjtimex for arm64 and fixed a bug in the syscall wrapper.
valgrind svn r15953.

Please open a new bug for missing syscalls next time instead of reusing this one.