]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add ARG4 checks for quotactl and quotactl_fd syswraps
authorMartin Cermak <mcermak@redhat.com>
Thu, 4 Dec 2025 13:00:59 +0000 (14:00 +0100)
committerMartin Cermak <mcermak@redhat.com>
Thu, 4 Dec 2025 13:00:59 +0000 (14:00 +0100)
ARG4 can point to different things of varion sizes based on the
cmd arg.  Handle all the possible options and provide missing
checks.

https://bugs.kde.org/show_bug.cgi?id=509634

14 files changed:
NEWS
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-arm-linux.c
coregrind/m_syswrap/syswrap-arm64-linux.c
coregrind/m_syswrap/syswrap-linux.c
coregrind/m_syswrap/syswrap-mips32-linux.c
coregrind/m_syswrap/syswrap-mips64-linux.c
coregrind/m_syswrap/syswrap-nanomips-linux.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-riscv64-linux.c
coregrind/m_syswrap/syswrap-s390x-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c
include/vki/vki-linux.h

diff --git a/NEWS b/NEWS
index 6068d611d4b84a00eea72369af2ed23931cea1bc..0731634f8c7ef7faebacebcfe77ca5cd95095c3d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -256,6 +256,7 @@ are not entered into bugzilla tend to get forgotten about or ignored.
 509572  s390x: Overhaul BFP testsuite
 509590  Run the LTP tests with LTP_QUIET
 509567  unhandled amd64-linux syscall: 443 (quotactl_fd)
+509634  Add ARG4 checks for quotactl and quotactl_fd syswraps
 509642  Add missing ppc64-linux syswraps
 509643  Add missing s390x-linux syswraps
 510169  Update the LTP version in valgrind testsuite to 20250930
index 5dccb47b3e71688bbe116ba50b635b8084a0dacf..a6e76690adaca3c10e4e31f76d39a6116b61257c 100644 (file)
@@ -684,7 +684,7 @@ static SyscallTableEntry syscall_table[] = {
    LINX_(__NR_delete_module,     sys_delete_module),  // 176 
    //   (__NR_get_kernel_syms,   sys_ni_syscall),     // 177 
    //   (__NR_query_module,      sys_ni_syscall),     // 178 
-   LINX_(__NR_quotactl,          sys_quotactl),       // 179 
+   LINXY(__NR_quotactl,          sys_quotactl),       // 179
 
    //   (__NR_nfsservctl,        sys_nfsservctl),     // 180 
    //   (__NR_getpmsg,           sys_ni_syscall),     // 181
@@ -896,7 +896,7 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_epoll_pwait2,      sys_epoll_pwait2),      // 441
    LINX_(__NR_mount_setattr,     sys_mount_setattr),     // 442
-   LINX_(__NR_quotactl_fd,       sys_quotactl_fd),       // 443
+   LINXY(__NR_quotactl_fd,       sys_quotactl_fd),       // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
index af3ec18ddf4132a08217b5d8ea99a45f727dfc5e..b7860710c417e41f6c378ec2345c0fdedf0a4df3 100644 (file)
@@ -708,7 +708,7 @@ static SyscallTableEntry syscall_main_table[] = {
 //zz 
 //zz    // Nb: get_kernel_syms() was removed 2.4-->2.6
 //   GENX_(__NR_get_kernel_syms,   sys_ni_syscall),     // 130
-   LINX_(__NR_quotactl,          sys_quotactl),       // 131
+   LINXY(__NR_quotactl,          sys_quotactl),       // 131
    GENX_(__NR_getpgid,           sys_getpgid),        // 132
    GENX_(__NR_fchdir,            sys_fchdir),         // 133
 //zz    //   (__NR_bdflush,           sys_bdflush),        // 134 */Linux
@@ -1068,7 +1068,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINX_(__NR_faccessat2,        sys_faccessat2),        // 439
    LINXY(__NR_epoll_pwait2,      sys_epoll_pwait2),      // 441
    LINX_(__NR_mount_setattr,     sys_mount_setattr),     // 442
-   LINX_(__NR_quotactl_fd,       sys_quotactl_fd),       // 443
+   LINXY(__NR_quotactl_fd,       sys_quotactl_fd),       // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
index 05a39ed07f5805333f19469b74737ce010b04bfc..890bb7b8f9be697a71f5640b555f2e230f29bef5 100644 (file)
@@ -608,7 +608,7 @@ static SyscallTableEntry syscall_main_table[] = {
    GENX_(__NR_close,             sys_close),             // 57
    LINX_(__NR_vhangup,           sys_vhangup),           // 58
    LINXY(__NR_pipe2,             sys_pipe2),             // 59
-   LINX_(__NR_quotactl,          sys_quotactl),          // 60
+   LINXY(__NR_quotactl,          sys_quotactl),          // 60
    GENXY(__NR_getdents64,        sys_getdents64),        // 61
    LINX_(__NR_lseek,             sys_lseek),             // 62
    GENXY(__NR_read,              sys_read),              // 63
@@ -847,7 +847,7 @@ static SyscallTableEntry syscall_main_table[] = {
 
    LINXY(__NR_epoll_pwait2,      sys_epoll_pwait2),      // 441
    LINX_(__NR_mount_setattr,     sys_mount_setattr),     // 442
-   LINX_(__NR_quotactl_fd,       sys_quotactl_fd),       // 443
+   LINXY(__NR_quotactl_fd,       sys_quotactl_fd),       // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
index e17aff6a432cceaeab5b25d489302965435f4b9e..3bfbef761415726dab7b13523f7df0c1401aa5f5 100644 (file)
@@ -2655,19 +2655,19 @@ PRE(sys_io_destroy)
 }  
 
 static
-void common_pre_io_getevents(ThreadId tid, UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, UWord* flags, const HChar* funtion_name)
+void common_pre_io_getevents(ThreadId tid, UWord a1, UWord a2, UWord a3, UWord a4, UWord a5, UWord a6, UWord* flags, const HChar* function_name)
 {
    HChar buf[25];
    *flags |= SfMayBlock;
    PRINT("sys_%s ( %llu, %lld, %lld, %#" FMT_REGWORD "x, %#"
-         FMT_REGWORD "x )", funtion_name,
+         FMT_REGWORD "x )", function_name,
          (ULong)a1,(Long)a2,(Long)a3,a4,a5);
    if (a3 > 0) {
-      VG_(snprintf)(buf, 25, "%s(events)", funtion_name);
+      VG_(snprintf)(buf, 25, "%s(events)", function_name);
       PRE_MEM_WRITE( buf, a4, sizeof(struct vki_io_event)*a3 );
    }
    if (a5 != 0) {
-      VG_(snprintf)(buf, 25, "%s(timeout)", funtion_name);
+      VG_(snprintf)(buf, 25, "%s(timeout)", function_name);
       PRE_MEM_READ( buf, a5, sizeof(struct vki_timespec));
    }
 
@@ -2688,7 +2688,7 @@ PRE(sys_io_getevents)
 }
 
 static
-void common_post_sys_io_events(ThreadId tid, UWord a4, SyscallStatus* status, const HChar* funtion_name)
+void common_post_sys_io_events(ThreadId tid, UWord a4, SyscallStatus* status, const HChar* function_name)
 {
    Int i;
    vg_assert(SUCCESS);
@@ -2736,7 +2736,7 @@ void common_post_sys_io_events(ThreadId tid, UWord a4, SyscallStatus* status, co
          default:
             VG_(message)(Vg_DebugMsg,
                         "Warning: unhandled %s opcode: %u\n",
-                        funtion_name,
+                        function_name,
                         cb->aio_lio_opcode);
             break;
          }
@@ -4125,14 +4125,124 @@ POST(sys_dup3)
       ML_(record_fd_open_named)(tid, RES);
 }
 
+static
+void common_pre_quotactl_p4_check(ThreadId tid, Int subop, Int a4, SyscallStatus* status, const HChar* function_name)
+{
+   HChar buf[25];
+   VG_(snprintf)(buf, sizeof(buf), "%s(addr)", function_name);
+   switch (subop) {
+      case VKI_Q_QUOTAON:
+         // The addr argument points to the pathname of a file
+         // containing the quotas for the filesystem.
+         PRE_MEM_RASCIIZ( buf, a4 );
+         break;
+      case VKI_Q_QUOTAOFF:
+         // The addr and id arguments are ignored.
+         break;
+      case VKI_Q_GETQUOTA:
+         // Get disk quota limits and current usage for user or group id.  The
+         // addr argument is a pointer to a dqblk structure defined in
+         // <sys/quota.h> as follows:
+         if (a4 != 0)
+            PRE_MEM_WRITE(buf, a4, sizeof(struct vki_dqblk));
+         break;
+      case VKI_Q_GETNEXTQUOTA:
+         // The addr argument is a pointer to a nextdqblk structure
+         // whose fields are as for the dqblk, except for the addition
+         // of a dqb_id field that is used to return the ID for which
+         // quota information is being returned:
+         if (a4 != 0)
+            PRE_MEM_WRITE(buf, a4, sizeof(struct vki_nextdqblk));
+         break;
+      case VKI_Q_SETQUOTA:
+         // Set quota information for user or group id, using the
+         // information supplied in the dqblk structure pointed to by
+         // addr.
+         if (a4 != 0)
+            PRE_MEM_READ(buf, a4, sizeof(struct vki_dqblk));
+         break;
+      case VKI_Q_GETINFO:
+         // The addr argument should be a pointer to a dqinfo structure.
+         if (a4 != 0)
+            PRE_MEM_WRITE(buf, a4, sizeof(struct vki_dqinfo));
+         break;
+      case VKI_Q_SETINFO:
+         // The addr argument should be a pointer to a dqinfo structure
+         if (a4 != 0)
+            PRE_MEM_READ(buf, a4, sizeof(struct vki_dqinfo));
+         break;
+      case VKI_Q_GETFMT:
+         // The addr argument should be a pointer to a 4-byte buffer where the
+         // format number will be stored.
+         if (a4 != 0)
+            PRE_MEM_WRITE(buf, a4, 4);
+         break;
+      case VKI_Q_SYNC:
+         // The addr and id arguments are ignored.
+         break;
+      // case VKI_Q_GETSTATS: was only supported up to Linux 2.4.21 - skipping)
+      default:
+         return;
+   }
+}
+
+static
+void common_post_quotactl_p4_check(ThreadId tid, Int subop, Int a4, const HChar* function_name)
+{
+   switch (subop) {
+      case VKI_Q_GETQUOTA:
+         // Get disk quota limits and current usage for user or group id.  The
+         // addr argument is a pointer to a dqblk structure defined in
+         // <sys/quota.h> as follows:
+         if (a4 != 0)
+            POST_MEM_WRITE(a4, sizeof(struct vki_dqblk));
+         break;
+      case VKI_Q_GETNEXTQUOTA:
+         // The addr argument is a pointer to a nextdqblk structure
+         // whose fields are as for the dqblk, except for the addition
+         // of a dqb_id field that is used to return the ID for which
+         // quota information is being returned:
+         if (a4 != 0)
+            POST_MEM_WRITE(a4, sizeof(struct vki_nextdqblk));
+         break;
+      case VKI_Q_GETINFO:
+         // The addr argument should be a pointer to a dqinfo structure.
+         if (a4 != 0)
+            POST_MEM_WRITE(a4, sizeof(struct vki_dqinfo));
+         break;
+      case VKI_Q_GETFMT:
+         // The addr argument should be a pointer to a 4-byte buffer where the
+         // format number will be stored.
+         if (a4 != 0)
+            POST_MEM_WRITE(a4, 4);
+         break;
+      // case VKI_Q_GETSTATS: was only supported up to Linux 2.4.21 - skipping)
+      default:
+         return;
+   }
+}
+
+
 PRE(sys_quotactl)
 {
+   // SYSCALL_DEFINE4(quotactl,
+   //                 unsigned int, cmd,
+   //                 const char __user *, special,
+   //                 qid_t, id,
+   //                 void __user *, addr)
+   Int subop = ARG1 >> VKI_SUBCMDSHIFT;
    PRINT("sys_quotactl (0x%" FMT_REGWORD "x, %#" FMT_REGWORD "x, 0x%"
          FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4);
    PRE_REG_READ4(long, "quotactl",
                  unsigned int, cmd, const char *, special, vki_qid_t, id,
                  void *, addr);
    PRE_MEM_RASCIIZ( "quotactl(special)", ARG2 );
+   common_pre_quotactl_p4_check(tid, subop, ARG4, status, "quotactl");
+}
+POST(sys_quotactl)
+{
+   Int subop = ARG1 >> VKI_SUBCMDSHIFT;
+   common_post_quotactl_p4_check(tid, subop, ARG4, "quotactl");
 }
 
 PRE(sys_quotactl_fd)
@@ -4142,13 +4252,20 @@ PRE(sys_quotactl_fd)
    //     unsigned int, cmd,
    //     qid_t, id,
    //     void __user *, addr)
-   PRINT("sys_quotactl (0x%" FMT_REGWORD "x, 0x%#" FMT_REGWORD "x, 0x%"
+   Int subop = ARG2 >> VKI_SUBCMDSHIFT;
+   PRINT("sys_quotactl_fd (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, fd, unsigned int, cmd, vki_qid_t, id,
                  void *, addr);
    if (!ML_(fd_allowed)(ARG1, "quotactl_fd", tid, False))
       SET_STATUS_Failure( VKI_EBADF );
+   common_pre_quotactl_p4_check(tid, subop, ARG4, status, "quotactl_fd");
+}
+POST(sys_quotactl_fd)
+{
+   Int subop = ARG2 >> VKI_SUBCMDSHIFT;
+   common_post_quotactl_p4_check(tid, subop, ARG4, "quotactl_fd");
 }
 
 PRE(sys_waitid)
index 12624492502f9ac7b4c000e47ea5ac3cfe74d425..5541f4c7231295009519a16ec5da45d3ab5124f8 100644 (file)
@@ -896,7 +896,7 @@ static SyscallTableEntry syscall_main_table[] = {
    //..    GENX_(__NR_init_module,       sys_init_module),       // 128
    //..    //   (__NR_delete_module,     sys_delete_module),     // 129
    //..    GENX_(__NR_get_kernel_syms,   sys_ni_syscall),        // 130
-   //..    LINX_(__NR_quotactl,          sys_quotactl),          // 131
+   LINXY (__NR_quotactl,               sys_quotactl),                // 131
    GENX_ (__NR_getpgid,                sys_getpgid),                 // 132
    GENX_ (__NR_fchdir,                 sys_fchdir),                  // 133
    //..    //   (__NR_bdflush,           sys_bdflush),           // 134
@@ -1178,7 +1178,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY(__NR_epoll_pwait2,      sys_epoll_pwait2),      // 441
    LINX_(__NR_mount_setattr,     sys_mount_setattr),     // 442
 
-   LINX_(__NR_quotactl_fd,             sys_quotactl_fd),             // 443
+   LINXY(__NR_quotactl_fd,             sys_quotactl_fd),             // 443
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
    LINX_(__NR_landlock_restrict_self,  sys_landlock_restrict_self),  // 446
index f39bb58cc140053d4fe9245ba98c3cc68629e9c0..57a522d87a9e4614844f0ecd46cff35048c68632 100644 (file)
@@ -644,7 +644,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINX_ (__NR_delete_module, sys_delete_module),
    GENX_ (__NR_get_kernel_syms, sys_ni_syscall),
    GENX_ (__NR_query_module, sys_ni_syscall),
-   LINX_ (__NR_quotactl, sys_quotactl),
+   LINXY (__NR_quotactl, sys_quotactl),
    /* GENX_(__NR_nfsservctl,sys_nfsservctl), */
    GENXY (__NR_getpmsg, sys_getpmsg),
    GENX_ (__NR_putpmsg, sys_putpmsg),
@@ -799,9 +799,9 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY (__NR_listmount, sys_listmount),
    LINX_ (__NR_mseal, sys_mseal),
    LINX_ (__NR_futex_waitv, sys_futex_waitv),
-   LINX_ (__NR_quotactl_fd, sys_quotactl_fd),
-   LINXY(__NR_file_getattr, sys_file_getattr),
-   LINX_(__NR_file_setattr, sys_file_setattr),
+   LINXY (__NR_quotactl_fd, sys_quotactl_fd),
+   LINXY (__NR_file_getattr, sys_file_getattr),
+   LINX_ (__NR_file_setattr, sys_file_setattr),
 };
 
 SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno )
index 00bd2e756ed39e87b1e3b3efa31b9684f1fb664d..ac4d6aa7e6de5661b47a2ff8ecd8e1cbb152dd0d 100644 (file)
@@ -592,7 +592,7 @@ static SyscallTableEntry syscall_main_table[] = {
    GENX_ (__NR_close,                  sys_close),
    LINX_ (__NR_vhangup,                sys_vhangup),
    LINXY (__NR_pipe2,                  sys_pipe2),
-   LINX_ (__NR_quotactl,               sys_quotactl),
+   LINXY (__NR_quotactl,               sys_quotactl),
    GENXY (__NR_getdents64,             sys_getdents64),
    LINXY (__NR__llseek,                sys_llseek),
    GENXY (__NR_read,                   sys_read),
index 99f71b7a666f12d66a951b6c56f46b4610952ec0..d3b84a57d5a86c6f046b1339b465cebd4e036fb3 100644 (file)
@@ -770,7 +770,7 @@ static SyscallTableEntry syscall_table[] = {
 //.. 
 //..    // Nb: get_kernel_syms() was removed 2.4-->2.6
 //..    GENX_(__NR_get_kernel_syms,   sys_ni_syscall),        // 130
-//..    LINX_(__NR_quotactl,          sys_quotactl),          // 131
+   LINXY(__NR_quotactl,          sys_quotactl),          // 131
    GENX_(__NR_getpgid,           sys_getpgid),           // 132
    GENX_(__NR_fchdir,            sys_fchdir),            // 133
 //..    //   (__NR_bdflush,           sys_bdflush),           // 134 */Linux
@@ -1076,7 +1076,7 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY (__NR_epoll_pwait2,     sys_epoll_pwait2),      // 441
    LINX_ (__NR_mount_setattr,    sys_mount_setattr),     // 442
-   LINX_ (__NR_quotactl_fd,      sys_quotactl_fd),       // 443
+   LINXY (__NR_quotactl_fd,      sys_quotactl_fd),       // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
index e8996b6b7834fb119d1a027c15f5e6649095baed..56b16bb8fb7d235e077e613e2c74aac66ff8c583 100644 (file)
@@ -757,7 +757,7 @@ static SyscallTableEntry syscall_table[] = {
    LINX_(__NR_delete_module,     sys_delete_module),      // 129
 
 // _____(__NR_get_kernel_syms,   sys_get_kernel_syms),    // 130
-   LINX_(__NR_quotactl,          sys_quotactl),           // 131
+   LINXY(__NR_quotactl,          sys_quotactl),           // 131
    GENX_(__NR_getpgid,           sys_getpgid),            // 132
    GENX_(__NR_fchdir,            sys_fchdir),             // 133
 // _____(__NR_bdflush,           sys_bdflush),            // 134
@@ -1054,7 +1054,7 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY (__NR_epoll_pwait2,     sys_epoll_pwait2),      // 441
    LINX_ (__NR_mount_setattr,    sys_mount_setattr),     // 442
-   LINX_ (__NR_quotactl_fd,      sys_quotactl_fd),       // 443
+   LINXY (__NR_quotactl_fd,      sys_quotactl_fd),       // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
index 3dbae3cb67c4e0abffa0aa366568c60478b2239f..3774c797e8a729b4b820fe5662bfde7268549b61 100644 (file)
@@ -368,7 +368,7 @@ static SyscallTableEntry syscall_main_table[] = {
    GENX_(__NR_close, sys_close),                                   /* 57 */
    LINX_(__NR_vhangup, sys_vhangup),                               /* 58 */
    LINXY(__NR_pipe2, sys_pipe2),                                   /* 59 */
-   LINX_(__NR_quotactl, sys_quotactl),                             /* 60 */
+   LINXY(__NR_quotactl, sys_quotactl),                             /* 60 */
    GENXY(__NR_getdents64, sys_getdents64),                         /* 61 */
    LINX_(__NR_lseek, sys_lseek),                                   /* 62 */
    GENXY(__NR_read, sys_read),                                     /* 63 */
@@ -598,7 +598,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINX_(__NR_faccessat2, sys_faccessat2),                         /* 439 */
    LINXY(__NR_epoll_pwait2, sys_epoll_pwait2),                     /* 441 */
    LINX_(__NR_mount_setattr, sys_mount_setattr),                   /* 442 */
-   LINX_(__NR_quotactl_fd, sys_quotactl_fd),                       /* 443 */
+   LINXY(__NR_quotactl_fd, sys_quotactl_fd),                       /* 443 */
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), /* 444 */
    LINX_(__NR_landlock_add_rule, sys_landlock_add_rule),           /* 445 */
    LINX_(__NR_landlock_restrict_self, sys_landlock_restrict_self), /* 446 */
index d96adecde3092d3e02dc982157c11a822e84f559..8d45a55b1169af4faf98ec632124e64482ccb51d 100644 (file)
@@ -568,7 +568,7 @@ static SyscallTableEntry syscall_table[] = {
    LINX_(__NR_delete_module,  sys_delete_module),                     // 129
 
    GENX_(130, sys_ni_syscall), /* unimplemented (by the kernel) */    // 130
-   LINX_(__NR_quotactl, sys_quotactl),                                // 131
+   LINXY(__NR_quotactl, sys_quotactl),                                // 131
    GENX_(__NR_getpgid,  sys_getpgid),                                 // 132
    GENX_(__NR_fchdir,  sys_fchdir),                                   // 133
 // ?????(__NR_bdflush, ),                                             // 134
@@ -887,7 +887,7 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_epoll_pwait2, sys_epoll_pwait2),                        // 441
    LINX_(__NR_mount_setattr, sys_mount_setattr),                      // 442
-   LINX_(__NR_quotactl_fd, sys_quotactl_fd),                          // 443
+   LINXY(__NR_quotactl_fd, sys_quotactl_fd),                          // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset),  // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),        // 445
index a83c02b046ff3797d97575658ff07acc97180e85..b6224321f389f76ebbb0fa33c786ccdac6f749fb 100644 (file)
@@ -1316,7 +1316,7 @@ static SyscallTableEntry syscall_table[] = {
 //zz 
 //zz    // Nb: get_kernel_syms() was removed 2.4-->2.6
    GENX_(__NR_get_kernel_syms,   sys_ni_syscall),     // 130
-   LINX_(__NR_quotactl,          sys_quotactl),       // 131
+   LINXY(__NR_quotactl,          sys_quotactl),       // 131
    GENX_(__NR_getpgid,           sys_getpgid),        // 132
    GENX_(__NR_fchdir,            sys_fchdir),         // 133
 //zz    //   (__NR_bdflush,           sys_bdflush),        // 134 */Linux
@@ -1677,7 +1677,7 @@ static SyscallTableEntry syscall_table[] = {
 
    LINXY(__NR_epoll_pwait2,      sys_epoll_pwait2),     // 441
    LINX_(__NR_mount_setattr,     sys_mount_setattr),    // 442
-   LINX_(__NR_quotactl_fd,       sys_quotactl_fd),      // 443
+   LINXY(__NR_quotactl_fd,       sys_quotactl_fd),      // 443
 
    LINXY(__NR_landlock_create_ruleset, sys_landlock_create_ruleset), // 444
    LINX_(__NR_landlock_add_rule,       sys_landlock_add_rule),       // 445
index 48aacea22f75c56ac0a35151bbdc282cdf1d5bb7..e0636378c4731ce17dd5f5c103afd3d786f37cea 100644 (file)
@@ -5610,6 +5610,57 @@ struct vki_file_attr {
        __vki_u32 fa_cowextsize;        /* CoW extsize field value (get/set) */
 };
 
+//----------------------------------------------------------------------
+// From uapi/linux/mount.h
+//----------------------------------------------------------------------
+
+#define VKI_SUBCMDMASK  0x00ff
+#define VKI_SUBCMDSHIFT 8
+
+#define VKI_Q_SYNC     0x800001        /* sync disk copy of a filesystems quotas */
+#define VKI_Q_QUOTAON  0x800002        /* turn quotas on */
+#define VKI_Q_QUOTAOFF 0x800003        /* turn quotas off */
+#define VKI_Q_GETFMT   0x800004        /* get quota format used on given filesystem */
+#define VKI_Q_GETINFO  0x800005        /* get information about quota files */
+#define VKI_Q_SETINFO  0x800006        /* set information about quota files */
+#define VKI_Q_GETQUOTA 0x800007        /* get user quota structure */
+#define VKI_Q_SETQUOTA 0x800008        /* set user quota structure */
+#define VKI_Q_GETNEXTQUOTA 0x800009    /* get disk limits and usage >= ID */
+
+struct vki_dqblk
+  {
+    __vki_u64 dqb_bhardlimit;  /* absolute limit on disk quota blocks alloc */
+    __vki_u64 dqb_bsoftlimit;  /* preferred limit on disk quota blocks */
+    __vki_u64 dqb_curspace;    /* current quota block count */
+    __vki_u64 dqb_ihardlimit;  /* maximum # allocated inodes */
+    __vki_u64 dqb_isoftlimit;  /* preferred inode limit */
+    __vki_u64 dqb_curinodes;   /* current # allocated inodes */
+    __vki_u64 dqb_btime;       /* time limit for excessive disk use */
+    __vki_u64 dqb_itime;       /* time limit for excessive files */
+    __vki_u32 dqb_valid;       /* bitmask of QIF_* constants */
+  };
+
+
+struct vki_nextdqblk {
+       __vki_u64 dqb_bhardlimit;
+       __vki_u64 dqb_bsoftlimit;
+       __vki_u64 dqb_curspace;
+       __vki_u64 dqb_ihardlimit;
+       __vki_u64 dqb_isoftlimit;
+       __vki_u64 dqb_curinodes;
+       __vki_u64 dqb_btime;
+       __vki_u64 dqb_itime;
+       __vki_u32 dqb_valid;
+       __vki_u32 dqb_id;
+};
+
+struct vki_dqinfo {
+       __vki_u64 dqi_bgrace;
+       __vki_u64 dqi_igrace;
+       __vki_u32 dqi_flags;    /* DFQ_* */
+       __vki_u32 dqi_valid;
+};
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/