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
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
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
//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
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
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
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
}
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));
}
}
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);
default:
VG_(message)(Vg_DebugMsg,
"Warning: unhandled %s opcode: %u\n",
- funtion_name,
+ function_name,
cb->aio_lio_opcode);
break;
}
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)
// 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)
//.. 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
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
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),
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 )
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),
//..
//.. // 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
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_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
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
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 */
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 */
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
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
//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
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
__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 ---*/
/*--------------------------------------------------------------------*/