access.c \
affinity.c \
aio.c \
+ alpha.c \
bjm.c \
block.c \
bpf.c \
* Improvements
* Enhanced decoding of personality, sched_getaffinity,
and sched_setaffinity syscalls.
+ * Enhanced decoding of getxpid, getxuid, and getxgid syscalls on alpha.
* Bug fixes
* Fixed build on arc, metag, nios2, or1k, and tile architectures.
--- /dev/null
+/*
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+
+#ifdef ALPHA
+
+static int
+decode_getxxid(struct tcb *tcp, const char *what)
+{
+ if (entering(tcp))
+ return 0;
+
+ long rval = getrval2(tcp);
+ if (rval == -1)
+ return 0;
+ static const char const fmt[] = "%s %ld";
+ static char outstr[sizeof(fmt) + 3 * sizeof(rval)];
+ snprintf(outstr, sizeof(outstr), fmt, what, rval);
+ tcp->auxstr = outstr;
+ return RVAL_STR;
+}
+
+SYS_FUNC(getxpid)
+{
+ return decode_getxxid(tcp, "ppid");
+}
+
+SYS_FUNC(getxuid)
+{
+ return decode_getxxid(tcp, "euid");
+}
+
+SYS_FUNC(getxgid)
+{
+ return decode_getxxid(tcp, "egid");
+}
+
+#endif /* ALPHA */
[ 17] = { 1, TM|SI, SEN(brk), "brk" },
[ 18] = { 5, 0, SEN(printargs), "osf_getfsstat" }, /*not implemented */
[ 19] = { 3, TD, SEN(lseek), "lseek" },
-[ 20] = { 0, NF, SEN(getpid), "getxpid" },
+[ 20] = { 0, NF, SEN(getxpid), "getxpid" },
[ 21] = { 4, 0, SEN(printargs), "osf_mount" },
[ 22] = { 2, TF, SEN(umount2), "umount" },
[ 23] = { 1, 0, SEN(setuid), "setuid" },
-[ 24] = { 0, NF, SEN(getuid), "getxuid" },
+[ 24] = { 0, NF, SEN(getxuid), "getxuid" },
[ 25] = { 5, 0, SEN(printargs), "exec_with_loader" }, /*not implemented */
[ 26] = { 4, 0, SEN(ptrace), "ptrace" },
[ 27] = { 5, 0, SEN(printargs), "osf_nrecvmsg" }, /*not implemented */
[ 44] = { 5, 0, SEN(printargs), "osf_profil" }, /*not implemented */
[ 45] = { 3, TD|TF, SEN(open), "open" },
[ 46] = { 5, 0, SEN(printargs), "osf_old_sigaction" }, /*not implemented */
-[ 47] = { 1, NF, SEN(getgid), "getxgid" },
+[ 47] = { 1, NF, SEN(getxgid), "getxgid" },
[ 48] = { 2, TS, SEN(sigprocmask), "osf_sigprocmask" },
[ 49] = { 5, 0, SEN(printargs), "osf_getlogin" }, /*not implemented */
[ 50] = { 5, 0, SEN(printargs), "osf_setlogin" }, /*not implemented */
getdents
getdents64
getrandom
+getxxid
inet-accept-connect-send-recv
inet-cmsg
ioctl
getdents \
getdents64 \
getrandom \
+ getxxid \
inet-accept-connect-send-recv \
inet-cmsg \
ioctl \
getdents.test \
getdents64.test \
getrandom.test \
+ getxxid.test \
inet-cmsg.test \
ioctl.test \
ip_mreq.test \
--- /dev/null
+/*
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_getxpid && defined __NR_getxuid && defined __NR_getxgid
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+ long id;
+ pid_t ppid;
+
+ id = syscall(__NR_getxpid);
+ ppid = getppid();
+ printf("getxpid() = %ld (ppid %ld)\n", id, (long) ppid);
+ printf("getxpid() = %ld (ppid %ld)\n", id, (long) ppid);
+
+ id = syscall(__NR_getxuid);
+ printf("getxuid() = %ld (euid %ld)\n", id, id);
+
+ id = syscall(__NR_getxgid);
+ printf("getxgid() = %ld (egid %ld)\n", id, id);
+
+ puts("+++ exited with 0 +++");
+ return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_getxpid && __NR_getxuid && __NR_getxgid")
+
+#endif
--- /dev/null
+#!/bin/sh
+
+# Check getxpid, getxuid, and getxgid syscalls decoding.
+
+. "${srcdir=.}/init.sh"
+
+run_prog > /dev/null
+OUT="$LOG.out"
+run_strace -a10 -egetxpid,getxuid,getxgid $args > "$OUT"
+match_diff "$LOG" "$OUT"
+rm -f "$OUT"
+
+exit 0
BEGIN {
r_uint = "(0|[1-9][0-9]*)"
- regexp = "^getx?uid" suffix "\\(\\)[[:space:]]+= " r_uint "$"
+ r_getuid = "getuid" suffix "\\(\\)[[:space:]]+= " r_uint
+ r_getxuid = "getxuid" suffix "\\(\\)[[:space:]]+= " r_uint " \\(euid " r_uint "\\)"
+ regexp = "^(" r_getuid "|" r_getxuid ")$"
expected = "getuid"
fail = 0
}
{
if (match($0, regexp, a)) {
if (expected == "getuid") {
- uid = a[1]
+ if ("" != a[2])
+ uid = a[2]
+ else
+ uid = a[3]
expected = "setuid"
regexp = "^setuid" suffix "\\(" uid "\\)[[:space:]]+= 0$"
} else if (expected == "setuid") {
run_prog ./uid$s$w
-syscalls=
-for n in "getuid$s" "getxuid$s"; do
- if $STRACE -e "$n" -h > /dev/null; then
- syscalls="$n"
- break
- fi
-done
-test -n "$syscalls" ||
- fail_ "neither getuid$s nor getxuid$s is supported on this architecture"
-
-syscalls="$syscalls,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s"
+case "$STRACE_ARCH" in
+ alpha) getuid=getxuid ;;
+ *) getuid=getuid ;;
+esac
+
+syscalls="$getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s"
run_strace -e trace="$syscalls" $args
AWK=gawk