Bug 509567 - WARNING: unhandled amd64-linux syscall: 443 (quotactl_fd)
Summary: WARNING: unhandled amd64-linux syscall: 443 (quotactl_fd)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.25 GIT
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: mcermak
URL:
Keywords:
Depends on:
Blocks: 506971
  Show dependency treegraph
 
Reported: 2025-09-16 20:27 UTC by Mark Wielaard
Modified: 2025-09-18 20:27 UTC (History)
0 users

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


Attachments
proposed patch (13.94 KB, patch)
2025-09-17 14:16 UTC, mcermak
Details
updated patch (1.09 KB, patch)
2025-09-18 11:09 UTC, mcermak
Details
updated patch (10.99 KB, patch)
2025-09-18 18:26 UTC, mcermak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2025-09-16 20:27:04 UTC
LTP testcase kernel/syscalls/quotactl/quotactl09

--444783-- WARNING: unhandled amd64-linux syscall: 443
--444783-- You may be able to write your own handler.
--444783-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--444783-- Nevertheless we consider this a bug.  Please report
--444783-- it at http://valgrind.org/support/bug_reports.html.

Note, needs root.
Comment 1 mcermak 2025-09-17 14:16:52 UTC
Created attachment 185009 [details]
proposed patch
Comment 2 Mark Wielaard 2025-09-17 21:28:12 UTC
(In reply to mcermak from comment #1)
> Created attachment 185009 [details]
> proposed patch

It looks like the new syscall number is 443 for all linux arches, so maybe it can be defined once in include/vki/vki-scnums-shared-linux.h ?

> +PRE(sys_quotactl_fd)
> +{
> +   PRINT("sys_quotactl (0x%" FMT_REGWORD "x, 0x%#" FMT_REGWORD "x, 0x%"
> +         FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4);
> +   PRE_REG_READ4(long, "quotactl_fd",
> +                 unsigned int, cmd, unsigned int, cmd, vki_qid_t, id,
> +                 void *, addr);
> +}

The first argument is a file descriptor which we normally check specially so no valgrind internal file descriptor are used and to track file descriptors with --track-fds. Something like:

   if (!ML_(fd_allowed)(ARG1, "quotactl_fd", tid, False))
      SET_STATUS_Failure( VKI_EBADF );

Checking of the addr argument is a little tricky. Depending on the cmd it can point to various things of different sizes (or be totally ignored).
It might require a POST handler if some datastructure is set by the syscall. It looks like the quotactl wrapper also doesn't handle the addr pointer. They should be handled similarly so. You could do this as a followup bug/patch. If you decide not to handle it now then please file a bug report so we won't forget.
Comment 3 mcermak 2025-09-18 11:09:18 UTC
Created attachment 185042 [details]
updated patch

Thank you for the review.  I've filed https://bugs.kde.org/show_bug.cgi?id=509634 and attached updated patch.  Please check.
Comment 4 mcermak 2025-09-18 18:26:43 UTC
Created attachment 185059 [details]
updated patch

Forgot to squash the previous partial patch to its predecesor.  Please check this updated patch.
Comment 5 Mark Wielaard 2025-09-18 20:27:59 UTC
(In reply to mcermak from comment #4)
> Created attachment 185059 [details]
> updated patch
> 
> Forgot to squash the previous partial patch to its predecesor.  Please check
> this updated patch.

Looks good. Pushed as:

commit 553ada14844625f43a1ec445addfa1ab88ee0e26
Author: Martin Cermak <mcermak@redhat.com>
Date:   Wed Sep 17 16:08:05 2025 +0200

    Wrap the quotactl_fd syscall
    
    SYSCALL_DEFINE4(quotactl_fd,
        unsigned int, fd,
        unsigned int, cmd,
        qid_t, id,
        void __user *, addr)
    
    The quotactl_fd works in a similar way to quotactl.  They both manipulate
    disk quotas.  They differ in how the target file system is specified.
    While quotactl takes path, quotactl_fd takes a file descriptor.
    
    Declare a quotactl_fd wrapper in priv_syswrap-linux.h and hook it for
    {amd64,arm,arm64,mips64,ppc32,ppc64,riscv64,s390x,x86}-linux using
    LINX_ with PRE handler in syswrap-linux.c
    
    https://bugs.kde.org/show_bug.cgi?id=509567