Bug 368791

Summary: unhandled amd64-linux syscall: 167 (swapon)
Product: [Developer tools] valgrind Reporter: Michael Yuniverg <umishko>
Component: generalAssignee: mcermak
Status: RESOLVED FIXED    
Severity: normal CC: mark, tom
Priority: NOR    
Version First Reported In: 3.11.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 506971    
Attachments: proposed patch

Description Michael Yuniverg 2016-09-14 08:14:07 UTC
as you asked reporting:
 Warning: noted but unhandled ioctl 0x4c01 with no size/direction hints.
(1) ==1149==    This could cause spurious value errors to appear.
(1) ==1149==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
(1) --1149-- WARNING: unhandled amd64-linux syscall: 167
(1) --1149-- You may be able to write your own handler.
(1) --1149-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
(1) --1149-- Nevertheless we consider this a bug.  Please report
(1) --1149-- it at http://valgrind.org/support/bug_reports.html.
(1) --1149-- WARNING: unhandled amd64-linux syscall: 167
(1) --1149-- You may be able to write your own handler.
(1) --1149-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
(1) --1149-- Nevertheless we consider this a bug.  Please report
(1) --1149-- it at http://valgrind.org/support/bug_reports.html.
Comment 1 Tom Hughes 2016-09-14 09:03:31 UTC
What platform (OS/architecture) is this?
Comment 2 Mark Wielaard 2016-09-14 11:05:17 UTC
amd64-linux syscall 167 is swapon for which valgrind only has an implementation for mip64, but no other arches apparently.
Comment 3 Julian Seward 2016-09-15 10:44:27 UTC
Hmm, we should pull those wrappers about of being mips64-linux specific
bucket and make them linux-general instead.  Also it looks like they are missing
a PRE_MEM_RASCIIZ call on the path arguments, assuming it's a normal zero
terminated C string.
Comment 4 Julian Seward 2016-09-15 10:45:06 UTC
s/about of being/out of the
Comment 5 mcermak 2025-10-08 13:48:25 UTC
Created attachment 185603 [details]
proposed patch

The attached patch handles both swapon and swapoff syscalls.
Comment 6 Mark Wielaard 2025-10-09 16:14:09 UTC
Looks good. Please push then close this bug with the commit id and message as comment.
Comment 7 mcermak 2025-10-10 07:32:34 UTC
commit c3f8f3ceb4ba6942993762f82911a670fa128789
Author: Martin Cermak <mcermak@redhat.com>
Date:   Wed Oct 8 10:07:30 2025 +0200

    Wrap swapon and swapoff syscalls on non-mips arches.
    
    Drop the mips-specific syswraps for swapon and swapoff syscalls.
    Instead, wrap these syscalls on all the arches.
    
    https://bugs.kde.org/show_bug.cgi?id=368791
Comment 8 mcermak 2025-10-10 16:14:55 UTC
Buildbot found a missing define on riscv64.  Add it:

commit 001f7439d6e20f3b117b5032070111fd701195bc
Author: Martin Cermak <mcermak@redhat.com>
Date:   Fri Oct 10 18:12:02 2025 +0200

    Define __NR_swapon and __NR_swapoff on riscv64
    
    Update commit c3f8f3ceb4ba6942993762f82911a670fa128789 adding
    a missing define.
    
    https://bugs.kde.org/show_bug.cgi?id=368791