Bug 419054 - Unhandled syscall getcpu on arm32
Summary: Unhandled syscall getcpu on arm32
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.15 SVN
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-20 17:18 UTC by Igor Nunes
Modified: 2023-04-19 21:56 UTC (History)
1 user (show)

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


Attachments
Patch: enabling getcpu on arm32 (1.35 KB, application/mbox)
2020-03-20 17:18 UTC, Igor Nunes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Nunes 2020-03-20 17:18:38 UTC
Created attachment 126911 [details]
Patch: enabling getcpu on arm32

SUMMARY


STEPS TO REPRODUCE
1. 

run the following code on an arm-32 platform (in my case, a raspberry pi).

#include ....

int main () {
  printf("getcpu = %d\n", sched_getcpu());
  return 0;
}

OBSERVED RESULT

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


EXPECTED RESULT

==19525== Memcheck, a memory error detector
==19525== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==19525== Using Valgrind-3.16.0.GIT and LibVEX; rerun with -h for copyright info
==19525== Command: ./getcpu
==19525== 
getcpu = 0
==19525== 
==19525== HEAP SUMMARY:
==19525==     in use at exit: 0 bytes in 0 blocks
==19525==   total heap usage: 1 allocs, 1 frees, 4,096 bytes allocated
==19525== 
==19525== All heap blocks were freed -- no leaks are possible
==19525== 
==19525== For lists of detected and suppressed errors, rerun with: -s
==19525== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)


ADDITIONAL INFORMATION


I reached this situation while debugging a dotnet application.

The patch is attached. By just simply uncommenting the syscall on syswrap-arm-linux.c, it was possible to make it work and return the correct output.

Regards.
Comment 1 Mark Wielaard 2023-04-19 21:56:22 UTC
Thanks for the patch, works. Applied as:

commit b8a9da078b21be2d110adbd563e1c07fc3f8d74b (HEAD -> master)
Author: Igor Nunes <igor.snunes@gmail.com>
Date:   Fri Mar 20 17:12:13 2020 +0000

    Enable getcpu on arm 32
    
    https://bugs.kde.org/show_bug.cgi?id=419054