AM_CONDITIONAL(SOLARIS_SPAWN_SYSCALL, test x$solaris_spawn_syscall = xyes)
+# Solaris-specific check determining if commands MODNVL_CTRLMAP through
+# MODDEVINFO_CACHE_TS for modctl() syscall are available (on newer Solaris).
+#
+# C-level symbol: SOLARIS_MODCTL_MODNVL
+# Automake-level symbol: SOLARIS_MODCTL_MODNVL
+#
+AC_MSG_CHECKING([for MODNVL_CTRLMAP through MODDEVINFO_CACHE_TS modctl(2) commands (Solaris-specific)])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/modctl.h>
+]], [[
+ return !(MODNVL_CTRLMAP && MODDEVINFO_CACHE_TS);
+]])], [
+solaris_modctl_modnvl=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([SOLARIS_MODCTL_MODNVL], 1,
+ [Define to 1 if you have the `MODNVL_CTRLMAP' through `MODDEVINFO_CACHE_TS' constants.])
+], [
+solaris_modctl_modnvl=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(SOLARIS_MODCTL_MODNVL, test x$solaris_modctl_modnvl = xyes)
+
+
# Solaris-specific check determining whether nscd (name switch cache daemon)
# attaches its door at /system/volatile/name_service_door (Solaris)
# or at /var/run/name_service_door (illumos).
sys/signal.h \
sys/signalfd.h \
sys/syscall.h \
+ sys/sysnvl.h \
sys/time.h \
sys/types.h \
])
DECL_TEMPLATE(solaris, sys_lwp_sema_post);
DECL_TEMPLATE(solaris, sys_lwp_sema_trywait);
DECL_TEMPLATE(solaris, sys_lwp_detach);
+DECL_TEMPLATE(solaris, sys_modctl);
DECL_TEMPLATE(solaris, sys_fchroot);
#if defined(SOLARIS_SYSTEM_STATS_SYSCALL)
DECL_TEMPLATE(solaris, sys_system_stats);
PRE_REG_READ1(long, "lwp_detach", vki_id_t, lwpid);
}
+PRE(sys_modctl)
+{
+ /* int modctl(int cmd, uintptr_t a1, uintptr_t a2, uintptr_t a3,
+ uintptr_t a4, uintptr_t a5); */
+ *flags |= SfMayBlock;
+
+ switch (ARG1 /*cmd*/) {
+ case VKI_MODLOAD:
+ /* int modctl_modload(int use_path, char *filename, int *rvp); */
+ PRINT("sys_modctl ( %ld, %ld, %#lx(%s), %#lx )",
+ SARG1, ARG2, ARG3, (HChar *) ARG3, ARG4);
+ PRE_REG_READ4(long, SC2("modctl", "modload"),
+ int, cmd, int, use_path, char *, filename, int *, rvp);
+ PRE_MEM_RASCIIZ("modctl(filaneme)", ARG3);
+ if (ARG4 != 0) {
+ PRE_MEM_WRITE("modctl(rvp)", ARG4, sizeof(int *));
+ }
+ break;
+ case VKI_MODUNLOAD:
+ /* int modctl_modunload(modid_t id); */
+ PRINT("sys_modctl ( %ld, %ld )", SARG1, SARG2);
+ PRE_REG_READ2(long, SC2("modctl", "modunload"),
+ int, cmd, vki_modid_t, id);
+ break;
+ case VKI_MODINFO: {
+ /* int modctl_modinfo(modid_t id, struct modinfo *umodi); */
+ PRINT("sys_modctl ( %ld, %ld, %#lx )", SARG1, SARG2, ARG3);
+ PRE_REG_READ3(long, SC2("modctl", "modinfo"),
+ int, cmd, vki_modid_t, id, struct modinfo *, umodi);
+
+ struct vki_modinfo *umodi = (struct vki_modinfo *) ARG3;
+ PRE_FIELD_READ("modctl(umodi->mi_info)", umodi->mi_info);
+ PRE_FIELD_READ("modctl(umodi->mi_id)", umodi->mi_id);
+ PRE_FIELD_READ("modctl(umodi->mi_nextid)", umodi->mi_nextid);
+ PRE_MEM_WRITE("modctl(umodi)", ARG3, sizeof(struct vki_modinfo));
+ break;
+ }
+
+#if defined(SOLARIS_MODCTL_MODNVL)
+ case VKI_MODNVL_DEVLINKSYNC:
+ /* int modnvl_devlinksync(sysnvl_op_t a1, uintptr_t a2, uintptr_t a3,
+ uintptr_t a4); */
+ switch (ARG2 /*op*/) {
+ case VKI_SYSNVL_OP_GET:
+ PRINT("sys_modctl ( %ld, %lu, %#lx, %#lx, %#lx )",
+ SARG1, ARG2, ARG3, ARG4, ARG5);
+ PRE_REG_READ5(long, SC3("modctl", "modnvl_devlinksync", "get"),
+ int, cmd, sysnvl_op_t, a1, char *, bufp,
+ uint64_t *, buflenp, uint64_t *, genp);
+
+ PRE_MEM_WRITE("modctl(buflenp)", ARG4, sizeof(vki_uint64_t));
+ if (ML_(safe_to_deref)((vki_uint64_t *) ARG4, sizeof(vki_uint64_t))) {
+ if (ARG3 != 0) {
+ PRE_MEM_WRITE("modctl(bufp)", ARG3, *(vki_uint64_t *) ARG4);
+ }
+ }
+ if (ARG5 != 0) {
+ PRE_MEM_WRITE("modctl(genp)", ARG5, sizeof(vki_uint64_t));
+ }
+ break;
+ case VKI_SYSNVL_OP_UPDATE:
+ PRINT("sys_modctl ( %ld, %lu, %#lx, %#lx )", SARG1, ARG2, ARG3, ARG4);
+ PRE_REG_READ4(long, SC3("modctl", "modnvl_devlinksync", "update"),
+ int, cmd, sysnvl_op_t, a1, char *, bufp,
+ uint64_t *, buflenp);
+
+ PRE_MEM_READ("modctl(buflenp)", ARG4, sizeof(vki_uint64_t));
+ if (ML_(safe_to_deref)((vki_uint64_t *) ARG4, sizeof(vki_uint64_t))) {
+ PRE_MEM_READ("modctl(bufp)", ARG3, *(vki_uint64_t *) ARG4);
+ }
+ break;
+ default:
+ VG_(unimplemented)("Syswrap of the modctl call with command "
+ "MODNVL_DEVLINKSYNC and op %ld.", ARG2);
+ /*NOTREACHED*/
+ break;
+ }
+ break;
+
+ case VKI_MODDEVINFO_CACHE_TS:
+ /* int modctl_devinfo_cache_ts(uint64_t *utsp); */
+ PRINT("sys_modctl ( %ld, %#lx )", SARG1, ARG2);
+ PRE_REG_READ2(long, SC2("modctl", "moddevinfo_cache_ts"),
+ int, cmd, uint64_t *, utsp);
+ PRE_MEM_WRITE("modctl(utsp)", ARG2, sizeof(vki_uint64_t));
+ break;
+#endif /* SOLARIS_MODCTL_MODNVL */
+
+ default:
+ VG_(unimplemented)("Syswrap of the modctl call with command %ld.", SARG1);
+ /*NOTREACHED*/
+ break;
+ }
+}
+
+POST(sys_modctl)
+{
+ switch (ARG1 /*cmd*/) {
+ case VKI_MODLOAD:
+ if (ARG4 != 0) {
+ POST_MEM_WRITE(ARG4, sizeof(int *));
+ }
+ break;
+ case VKI_MODUNLOAD:
+ break;
+ case VKI_MODINFO:
+ POST_MEM_WRITE(ARG3, sizeof(struct vki_modinfo));
+ break;
+#if defined(SOLARIS_MODCTL_MODNVL)
+ case VKI_MODNVL_DEVLINKSYNC:
+ switch (ARG2 /*op*/) {
+ case VKI_SYSNVL_OP_GET:
+ POST_MEM_WRITE(ARG4, sizeof(vki_uint64_t));
+ if (ARG3 != 0) {
+ POST_MEM_WRITE(ARG3, *(vki_uint64_t *) ARG4);
+ }
+ if (ARG5 != 0) {
+ POST_MEM_WRITE(ARG5, sizeof(vki_uint64_t));
+ }
+ break;
+ case VKI_SYSNVL_OP_UPDATE:
+ break;
+ default:
+ vg_assert(0);
+ break;
+ }
+ break;
+ case VKI_MODDEVINFO_CACHE_TS:
+ POST_MEM_WRITE(ARG2, sizeof(vki_uint64_t));
+ break;
+#endif /* SOLARIS_MODCTL_MODNVL */
+ default:
+ vg_assert(0);
+ break;
+ }
+}
+
PRE(sys_fchroot)
{
/* int fchroot(int fd); */
SOLXY(__NR_lwp_sema_post, sys_lwp_sema_post), /* 148 */
SOLXY(__NR_lwp_sema_trywait, sys_lwp_sema_trywait), /* 149 */
SOLX_(__NR_lwp_detach, sys_lwp_detach), /* 150 */
+ SOLXY(__NR_modctl, sys_modctl), /* 152 */
SOLX_(__NR_fchroot, sys_fchroot), /* 153 */
#if defined(SOLARIS_SYSTEM_STATS_SYSCALL)
SOLX_(__NR_system_stats, sys_system_stats), /* 154 */
#define __NR_lwp_sema_trywait SYS_lwp_sema_trywait
#define __NR_lwp_detach SYS_lwp_detach
//#define __NR_corectl SYS_corectl
-//#define __NR_modctl SYS_modctl
+#define __NR_modctl SYS_modctl
#define __NR_fchroot SYS_fchroot
#if defined(SOLARIS_SYSTEM_STATS_SYSCALL)
#define __NR_system_stats SYS_system_stats
#define vki_mnttab mnttab
+#include <sys/modctl.h>
+#define VKI_MODLOAD MODLOAD
+#define VKI_MODUNLOAD MODUNLOAD
+#define VKI_MODINFO MODINFO
+#if defined(SOLARIS_MODCTL_MODNVL)
+#define VKI_MODNVL_DEVLINKSYNC MODNVL_DEVLINKSYNC
+#define VKI_MODDEVINFO_CACHE_TS MODDEVINFO_CACHE_TS
+#endif /* SOLARIS_MODCTL_MODNVL */
+#define vki_modid_t int
+#define vki_modinfo modinfo
+
+
#include <sys/mount.h>
#define VKI_MS_DATA MS_DATA
#define VKI_MS_OPTIONSTR MS_OPTIONSTR
+#if defined(HAVE_SYS_SYSNVL_H)
+#include <sys/sysnvl.h>
+#define VKI_SYSNVL_OP_GET SYSNVL_OP_GET
+#define VKI_SYSNVL_OP_UPDATE SYSNVL_OP_UPDATE
+#endif /* HAVE_SYS_SYSNVL_H */
+
+
#include <sys/poll.h>
#define vki_pollfd pollfd
#define vki_pollfd_t pollfd_t
scalar_lwp_name.stderr.exp scalar_lwp_name.stdout.exp scalar_lwp_name.vgtest \
scalar_lwp_sigqueue.stderr.exp scalar_lwp_sigqueue.stdout.exp scalar_lwp_sigqueue.vgtest \
scalar_lwp_sigqueue_pid.stderr.exp scalar_lwp_sigqueue_pid.vgtest \
+ scalar_modctl_modnvl.stderr.exp scalar_modctl_modnvl.stdout.exp scalar_modctl_modnvl.vgtest \
scalar_obsolete.stderr.exp scalar_obsolete.stdout.exp scalar_obsolete.vgtest \
scalar_shm_new.stderr.exp scalar_shm_new.stdout.exp scalar_shm_new.vgtest \
scalar_spawn.stderr.exp scalar_spawn.stdout.exp scalar_spawn.vgtest \
check_PROGRAMS += scalar_lwp_name
endif
+if SOLARIS_MODCTL_MODNVL
+check_PROGRAMS += scalar_modctl_modnvl
+endif
+
if SOLARIS_LWP_SIGQUEUE_SYSCALL
if SOLARIS_LWP_SIGQUEUE_SYSCALL_TAKES_PID
check_PROGRAMS += scalar_lwp_sigqueue_pid
#include <sys/fstyp.h>
#include <sys/lwp.h>
#include <sys/mman.h>
+#include <sys/modctl.h>
#include <sys/mount.h>
#include <sys/port_impl.h>
#include <sys/priocntl.h>
return x;
}
+__attribute__((noinline))
+static void sys_modctl(void)
+{
+ GO(SYS_modctl, "(MODLOAD) 3s 1m");
+ SY(SYS_modctl, x0 + MODLOAD, x0 - 1, x0 + 1); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_modctl2(void)
+{
+ GO(SYS_modctl, "(MODUNLOAD) 2s 0m");
+ SY(SYS_modctl, x0 + MODUNLOAD, x0 + 1); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_modctl3(void)
+{
+ GO(SYS_modctl, "(MODINFO) 3s 4m");
+ SY(SYS_modctl, x0 + MODINFO, x0 + 1, x0 - 1); FAIL;
+}
+
__attribute__((noinline))
static void sys_rusagesys(void)
{
/* XXX Missing wrapper. */
/* SYS_modctl 152 */
- /* XXX Missing wrapper. */
+ sys_modctl();
+ sys_modctl2();
+ sys_modctl3();
/* SYS_fchroot 153 */
GO(SYS_fchroot, "1s 0m");
Syscall param lwp_detach(lwpid) contains uninitialised byte(s)
...
+---------------------------------------------------------
+152: SYS_modctl (MODLOAD) 3s 1m
+---------------------------------------------------------
+Syscall param modctl_modload(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modload(use_path) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modload(filename) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(filaneme) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+152: SYS_modctl (MODUNLOAD) 2s 0m
+---------------------------------------------------------
+Syscall param modctl_modunload(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modunload(id) contains uninitialised byte(s)
+ ...
+
+---------------------------------------------------------
+152: SYS_modctl (MODINFO) 3s 4m
+---------------------------------------------------------
+Syscall param modctl_modinfo(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modinfo(id) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modinfo(umodi) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(umodi->mi_info) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param modctl(umodi->mi_id) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param modctl(umodi->mi_nextid) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param modctl(umodi) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
---------------------------------------------------------
153: SYS_fchroot 1s 0m
---------------------------------------------------------
--- /dev/null
+/* Scalar test for new modctl syscall commands available on newer Solaris. */
+
+#include "scalar.h"
+
+#include <sys/modctl.h>
+#include <sys/sysnvl.h>
+
+__attribute__((noinline))
+static void sys_modctl(void)
+{
+ GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, GET) 5s 1m");
+ SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, x0 + SYSNVL_OP_GET,
+ x0, x0 + 1, x0); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_modctl2(void)
+{
+ uint64_t buflen = x0 + 10;
+
+ GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, GET) 4s 2m");
+ SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, x0 + SYSNVL_OP_GET,
+ x0 + 1, &buflen, x0 + 1); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_modctl3(void)
+{
+ GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, UPDATE) 4s 1m");
+ SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, x0 + SYSNVL_OP_UPDATE,
+ x0, x0 + 1); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_modctl4(void)
+{
+ uint64_t buflen = x0 + 10;
+
+ GO(SYS_modctl, "(MODNVL_DEVLINKSYNC, UPDATE) 4s 1m");
+ SY(SYS_modctl, x0 + MODNVL_DEVLINKSYNC, x0 + SYSNVL_OP_UPDATE,
+ x0 + 1, &buflen); FAIL;
+}
+
+__attribute__((noinline))
+static void sys_modctl5(void)
+{
+ GO(SYS_modctl, "(MODDEVINFO_CACHE_TS) 2s 1m");
+ SY(SYS_modctl, x0 + MODDEVINFO_CACHE_TS, x0 + 1); FAIL;
+}
+
+int main(void)
+{
+ /* Uninitialised, but we know px[0] is 0x0. */
+ long *px = malloc(sizeof(long));
+ x0 = px[0];
+
+ /* SYS_modctl 152 */
+ sys_modctl();
+ sys_modctl2();
+ sys_modctl3();
+ sys_modctl4();
+ sys_modctl5();
+
+ return 0;
+}
+
--- /dev/null
+---------------------------------------------------------
+152: SYS_modctl (MODNVL_DEVLINKSYNC, GET) 5s 1m
+---------------------------------------------------------
+Syscall param modctl_modnvl_devlinksync_get(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(a1) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(bufp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(buflenp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(genp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(buflenp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+152: SYS_modctl (MODNVL_DEVLINKSYNC, GET) 4s 2m
+---------------------------------------------------------
+Syscall param modctl_modnvl_devlinksync_get(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(a1) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(bufp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_get(genp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(bufp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+Syscall param modctl(genp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+152: SYS_modctl (MODNVL_DEVLINKSYNC, UPDATE) 4s 1m
+---------------------------------------------------------
+Syscall param modctl_modnvl_devlinksync_update(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_update(a1) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_update(bufp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_update(buflenp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(buflenp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+152: SYS_modctl (MODNVL_DEVLINKSYNC, UPDATE) 4s 1m
+---------------------------------------------------------
+Syscall param modctl_modnvl_devlinksync_update(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_update(a1) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_modnvl_devlinksync_update(bufp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(buflenp) points to uninitialised byte(s)
+ ...
+ Address 0x........ is on thread 1's stack
+ in frame #1, created by sys_modctl4 (scalar_modctl_modnvl.c:36)
+
+Syscall param modctl(bufp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
+---------------------------------------------------------
+152: SYS_modctl (MODDEVINFO_CACHE_TS) 2s 1m
+---------------------------------------------------------
+Syscall param modctl_moddevinfo_cache_ts(cmd) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl_moddevinfo_cache_ts(utsp) contains uninitialised byte(s)
+ ...
+
+Syscall param modctl(utsp) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+
--- /dev/null
+prereq: test -e scalar_modctl_modnvl
+prog: scalar_modctl_modnvl
+vgopts: -q
+stderr_filter_args: