Bug 440670

Summary: unhandled ppc64le-linux syscall: 252 and unhandled ppc64le-linux syscall:253
Product: [Developer tools] valgrind Reporter: Jesus Checa <jcheca>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: mark
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jesus Checa 2021-08-06 16:26:46 UTC
SUMMARY
Running valgrind with certain programs on Fedora Rawhide will trigger a message "WARNING: unhandled ppc64le-linux syscall:" for syscalls 252 (statfs64) and 253 (fstatfs64). Reproduced using glibc-2.34-1.fc35.ppc64le and systemd-249.2-1.fc35.ppc64le

STEPS TO REPRODUCE
1. valgrind --log-file=logfile /usr/bin/busctl --version </dev/null > /dev/null 2>&1
2. cat logfile

OBSERVED RESULT
==166394== Memcheck, a memory error detector
==166394== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==166394== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
==166394== Command: /usr/bin/busctl --version
==166394== Parent PID: 161493
==166394== 
--166394-- WARNING: unhandled ppc64le-linux syscall: 253
--166394-- You may be able to write your own handler.
--166394-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--166394-- Nevertheless we consider this a bug.  Please report
--166394-- it at http://valgrind.org/support/bug_reports.html.
--166394-- WARNING: unhandled ppc64le-linux syscall: 252
--166394-- You may be able to write your own handler.
--166394-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--166394-- Nevertheless we consider this a bug.  Please report
--166394-- it at http://valgrind.org/support/bug_reports.html.
--166394-- WARNING: unhandled ppc64le-linux syscall: 252
--166394-- You may be able to write your own handler.
--166394-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--166394-- Nevertheless we consider this a bug.  Please report
--166394-- it at http://valgrind.org/support/bug_reports.html.
--166394-- WARNING: unhandled ppc64le-linux syscall: 252
--166394-- You may be able to write your own handler.
--166394-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--166394-- Nevertheless we consider this a bug.  Please report
--166394-- it at http://valgrind.org/support/bug_reports.html.
==166394== 
==166394== HEAP SUMMARY:
==166394==     in use at exit: 0 bytes in 0 blocks
==166394==   total heap usage: 11 allocs, 11 frees, 13,189 bytes allocated
==166394== 
==166394== All heap blocks were freed -- no leaks are possible
==166394== 
==166394== For lists of detected and suppressed errors, rerun with: -s
==166394== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

EXPECTED RESULT
No warnings about unhandled syscalls should be printed.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Rawhide


ADDITIONAL INFORMATION
Comment 1 Mark Wielaard 2021-08-06 16:59:33 UTC
Thanks for finding this. This seems to come from this commit included in glibc 2.34:

 commit f6e616435d885afef1761a407ed0ae1256293bf8
 Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
 Date:   Fri Feb 5 21:26:57 2021 +0000

     linux: Consolidate statfs implementations

All other arches that have stat64/fstat64 (including ppc32) already had that syscall hooked up, it was just ppc64 that was missing it.

So luckily the fix is extremely simple:

diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
index 76610e142..f1a88f7ce 100644
--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
+++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
@@ -900,8 +900,8 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_tgkill,            sys_tgkill),             // 250
 // _____(__NR_utimes,            sys_utimes),             // 251
-// _____(__NR_statfs64,          sys_statfs64),           // 252
-// _____(__NR_fstatfs64,         sys_fstatfs64),          // 253
+   GENXY(__NR_statfs64,          sys_statfs64),           // 252
+   GENXY(__NR_fstatfs64,         sys_fstatfs64),          // 253
 // /* #define __NR_fadvise64_64    254     32bit only */
 
 // _____(__NR_rtas,              sys_rtas),               // 255
Comment 2 Mark Wielaard 2021-08-06 17:12:05 UTC
commit 44da99781e5bb954a0cd3c897b859012a125fec6
Author: Mark Wielaard <mark@klomp.org>
Date:   Fri Aug 6 19:08:17 2021 +0200

    unhandled ppc64le-linux syscall: 252 (statfs64) and 253 (fstatfs64)
    
    glibc 2.34 consolidated all statfs implementations. All other arches
    that have statfs64/fstat64 (including ppc32) already had that syscall
    hooked up, it was just ppc64 that was missing it.
    
    https://bugs.kde.org/show_bug.cgi?id=440670