|
From: Martin C. <mc...@so...> - 2025-12-04 13:01:56
|
https://sourceware.org/cgit/valgrind/commit/?id=37d9e2085e0ac28a3fa807670c1055bdadb5f773 commit 37d9e2085e0ac28a3fa807670c1055bdadb5f773 Author: Martin Cermak <mc...@re...> Date: Thu Dec 4 14:00:59 2025 +0100 Add ARG4 checks for quotactl and quotactl_fd syswraps 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 Diff: --- NEWS | 1 + coregrind/m_syswrap/syswrap-amd64-linux.c | 4 +- coregrind/m_syswrap/syswrap-arm-linux.c | 4 +- coregrind/m_syswrap/syswrap-arm64-linux.c | 4 +- coregrind/m_syswrap/syswrap-linux.c | 131 +++++++++++++++++++++++++-- coregrind/m_syswrap/syswrap-mips32-linux.c | 4 +- coregrind/m_syswrap/syswrap-mips64-linux.c | 8 +- coregrind/m_syswrap/syswrap-nanomips-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc32-linux.c | 4 +- coregrind/m_syswrap/syswrap-ppc64-linux.c | 4 +- coregrind/m_syswrap/syswrap-riscv64-linux.c | 4 +- coregrind/m_syswrap/syswrap-s390x-linux.c | 4 +- coregrind/m_syswrap/syswrap-x86-linux.c | 4 +- include/vki/vki-linux.h | 51 +++++++++++ 14 files changed, 199 insertions(+), 30 deletions(-) diff --git a/NEWS b/NEWS index 6068d611d4..0731634f8c 100644 --- 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 diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index 5dccb47b3e..a6e76690ad 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index af3ec18ddf..b7860710c4 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 05a39ed07f..890bb7b8f9 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index e17aff6a43..3bfbef7614 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -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) diff --git a/coregrind/m_syswrap/syswrap-mips32-linux.c b/coregrind/m_syswrap/syswrap-mips32-linux.c index 1262449250..5541f4c723 100644 --- a/coregrind/m_syswrap/syswrap-mips32-linux.c +++ b/coregrind/m_syswrap/syswrap-mips32-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index f39bb58cc1..57a522d87a 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -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 ) diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 00bd2e756e..ac4d6aa7e6 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -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), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 99f71b7a66..d3b84a57d5 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index e8996b6b78..56b16bb8fb 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 3dbae3cb67..3774c797e8 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -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 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index d96adecde3..8d45a55b11 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -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 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index a83c02b046..b6224321f3 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -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 diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h index 48aacea22f..e0636378c4 100644 --- a/include/vki/vki-linux.h +++ b/include/vki/vki-linux.h @@ -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 ---*/ /*--------------------------------------------------------------------*/ |