Bug 462830

Summary: WARNING: unhandled amd64-freebsd syscall: 474
Product: [Developer tools] valgrind Reporter: cmfitch1
Component: generalAssignee: Paul Floyd <pjfloyd>
Status: RESOLVED FIXED    
Severity: normal CC: pjfloyd
Priority: NOR    
Version First Reported In: 3.17.0   
Target Milestone: ---   
Platform: FreeBSD Ports   
OS: FreeBSD   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch to add sctp_generic_sendmsg/recvmsg handlers

Description cmfitch1 2022-12-09 21:40:18 UTC
I have a FreeBSD application that calls sctp_recvmsg() and sctp_sendx(). Attempting to run this application under valgrind results in an endless loop of the following and a non-functioning program:
> sctp_recvmsg error: Function not implemented
> --86035-- WARNING: unhandled amd64-freebsd syscall: 474
> --86035-- You may be able to write your own handler.
> --86035-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
> --86035-- Nevertheless we consider this a bug.  Please report
> --86035-- it at http://valgrind.org/support/bug_reports.html.
Implementing a handler for 474 results in a similar spew for syscall: 472, which is the sctp_sendmsg variant.
Comment 1 cmfitch1 2022-12-09 21:43:25 UTC
I attempted to implement handlers for both syscalls, resulting in the program running successfully without any errors or warnings. What is the best way to submit my patch for your consideration? I can attach a diff, but the attachment instructions pointed me to gitlab for merge requests, where I couldn't find the valgrind project.
Comment 2 Paul Floyd 2022-12-10 08:21:33 UTC
You nan just click on “add attachment” on this page.
Comment 3 Paul Floyd 2022-12-10 08:24:39 UTC
Valgrind does not use gitlab, it uses sourceware.org as its central repo, so the comment on the upload patch page does not apply.
Comment 4 cmfitch1 2022-12-12 01:03:35 UTC
Created attachment 154519 [details]
Patch to add sctp_generic_sendmsg/recvmsg handlers
Comment 5 Paul Floyd 2022-12-12 08:43:19 UTC
My initial impression is that this looks good. I'll have a go at finding a testcase and adding these syscalls to scalar.
Comment 6 Paul Floyd 2022-12-15 08:19:06 UTC
I tried running one of the sctp stress tests (though not as a stress test) from /usr/src but it failed.

I need to investigate more.
Comment 7 Paul Floyd 2022-12-22 22:18:11 UTC
Should be fixed with

commit 5b524084061b9d6d40d30cf41e2da70bce4682e0 (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Thu Dec 22 23:08:45 2022 +0100

    Bug 462830 - WARNING: unhandled amd64-freebsd syscall: 474
    
    Add syscall wrappers for sctp_generic_recvmsg and sctp_generic_sendmsg
    on FreeBSD.

Can you confirm that this works?
Comment 8 cmfitch1 2023-01-09 02:37:22 UTC
I updated my valgrind-devel port to reference GH_TAGNAME=5b524084 and ran the application under valgrind. No complaints about the unhandled syscalls. Comparing the changes, I see that my patch wasn't quite right. Thank you for doing the additional work necessary to get this fixed properly upstream!