aboutsummaryrefslogtreecommitdiff
path: root/tests/ipc_msg.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-06-15 13:11:40 -0700
committerElliott Hughes <enh@google.com>2018-06-15 13:11:40 -0700
commit03a418ed8025a9c0517bc9e40e8ade6272a2cc53 (patch)
treed50190add4ebcf68f9927f680014cbd0e5fd7d17 /tests/ipc_msg.c
parent970e204a5e059ba47c5d3b35af8d6cad3f326dba (diff)
downloadstrace-03a418ed8025a9c0517bc9e40e8ade6272a2cc53.tar.gz
Update strace to 4.23.
Noteworthy changes in release 4.23 (2018-06-14) =============================================== * Changes in behaviour * On x32 personality, 64-bit syscalls (such as readv) are now shown with "#64" suffix instead of "64:" prefix. Unlike the old names, these new names can be used in syscall qualification expressions. * Changed error number output format: error numbers are consistently printed as "-1 ECONST (Error description)" for known errors and as "-1 (errno 123)" for unknown errors, regardless of -e raw qualification settings. One can specify -X raw for displaying raw error numbers unconditionally. * Unfetchable addresses inside arrays are now printed as comments. * Obsolete IA-32 mode syscall names are no longer printed on ia64. * Improvements * Implemented libdw backend for -k option, configured at build time using --with-libdw option. Whether -k option is compiled is now configured at build time using --enable-stacktrace option. * Added -X option for configuring xlat output formatting (addresses Debian bug #692915). * Added support for personality designation ("64", "32", or "x32") to syscall qualifications in -e trace expressions. * Implemented injection of syscalls with no side effects as an alternative to injection of an invalid syscall (-e inject=SET:syscall= expression). * Improved support for reproducible builds (addresses Debian bug #896016). * Implemented decoding of BPF_PROG_QUERY and BPF_RAW_TRACEPOINT_OPEN bpf syscall commands. * Implemented decoding of INOTIFY_IOC_SETNEXTWD and PERF_EVENT_IOC_* ioctl commands. * Implemented decoding of PR_GET_SPECULATION_CTRL and PR_SET_SPECULATION_CTRL prctl syscall options. * Enhanced decoding of bpf, getsockopt, setsockopt, and socket syscalls. * Enhanced decoding of NETLINK_KOBJECT_UEVENT and NETLINK_ROUTE protocols. * Enhanced decoding of *_DIAG_MEMINFO netlink attributes. * Enhanced decoding of BTRFS_*, FS_IOC_*, SIOCGIFHWADDR, and SIOCSIFHWADDR ioctl commands. * Enhanced decoding of AF_BLUETOOTH socket addresses. * Implemented decoding of io_pgetevent syscall. * Wired up rseq syscall. * Updated lists of ADJ_*, BPF_*, BPF_F_*, BPF_PROG_TYPE_*, ETH_P_*, FPE_*, IFF_*, IPPROTO_*, MAP_*, MS_*, MSG_*, NETLINK_*, PACKET_*, PROT_*, SCTP_*, SECCOMP_FILTER_FLAG_*, SEGV_*, SEM_*, SHM_*, SW_*, V4L2_CID_*, V4L2_CTRL_CLASS_*, and V4L2_PIX_FMT_* constants. * Updated lists of ioctl commands from Linux 4.17. * Bug fixes * Fixed decoding of msgtyp argument of msgrcv syscall. * Fixed fallback definitions for F_*, MCL_*, MSG_ZEROCOPY, SI_*, and SOL_SOCKET constants. * Fixed -e trace=%pure expression on mips. Bug: N/A Test: strace -f date Change-Id: I9eff306cca99b239815284a366315fb04686667a
Diffstat (limited to 'tests/ipc_msg.c')
-rw-r--r--tests/ipc_msg.c91
1 files changed, 68 insertions, 23 deletions
diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
index b4938439..a74dba51 100644
--- a/tests/ipc_msg.c
+++ b/tests/ipc_msg.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
* Copyright (c) 2015-2016 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2015-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +36,10 @@
#include "xlat.h"
#include "xlat/resource_flags.h"
+#ifndef MSG_STAT_ANY
+# define MSG_STAT_ANY 13
+#endif
+
/*
* Before glibc-2.22-122-gbe48165, ppc64 code tried to retrieve data
* provided in third argument of msgctl call (in case of IPC_SET cmd)
@@ -52,13 +57,50 @@
# define TEST_MSGCTL_BOGUS_ADDR 1
#endif
+#if XLAT_RAW
+# define str_ipc_excl_nowait "0xface1c00"
+# define str_ipc_private "0"
+# define str_ipc_rmid "0"
+# define str_ipc_set "0x1"
+# define str_ipc_stat "0x2"
+# define str_msg_stat "0xb"
+# define str_msg_info "0xc"
+# define str_msg_stat_any "0xd"
+# define str_ipc_64 "0x100"
+# define str_bogus_cmd "0xdeadbeef"
+#elif XLAT_VERBOSE
+# define str_ipc_excl_nowait \
+ "0xface1c00 /\\* IPC_EXCL\\|IPC_NOWAIT\\|0xface1000 \\*/"
+# define str_ipc_private "0 /\\* IPC_PRIVATE \\*/"
+# define str_ipc_rmid "0 /\\* IPC_RMID \\*/"
+# define str_ipc_set "0x1 /\\* IPC_SET \\*/"
+# define str_ipc_stat "0x2 /\\* IPC_STAT \\*/"
+# define str_msg_stat "0xb /\\* MSG_STAT \\*/"
+# define str_msg_info "0xc /\\* MSG_INFO \\*/"
+# define str_msg_stat_any "0xd /\\* MSG_STAT_ANY \\*/"
+# define str_ipc_64 "0x100 /\\* IPC_64 \\*/"
+# define str_bogus_cmd "0xdeadbeef /\\* MSG_\\?\\?\\? \\*/"
+#else
+# define str_ipc_excl_nowait "IPC_EXCL\\|IPC_NOWAIT\\|0xface1000"
+# define str_ipc_private "IPC_PRIVATE"
+# define str_ipc_rmid "IPC_RMID"
+# define str_ipc_set "IPC_SET"
+# define str_ipc_stat "IPC_STAT"
+# define str_msg_stat "MSG_STAT"
+# define str_msg_info "MSG_INFO"
+# define str_msg_stat_any "MSG_STAT_ANY"
+# define str_ipc_64 "IPC_64"
+# define str_bogus_cmd "0xdeadbeef /\\* MSG_\\?\\?\\? \\*/"
+#endif
+
static int id = -1;
static void
cleanup(void)
{
msgctl(id, IPC_RMID, NULL);
- printf("msgctl\\(%d, (IPC_64\\|)?IPC_RMID, NULL\\) += 0\n", id);
+ printf("msgctl\\(%d, (%s\\|)?%s, NULL\\) += 0\n",
+ id, str_ipc_64, str_ipc_rmid);
id = -1;
}
@@ -67,7 +109,7 @@ main(void)
{
static const key_t private_key =
(key_t) (0xffffffff00000000ULL | IPC_PRIVATE);
- static const key_t bogus_key = (key_t) 0xeca86420fdb97531ULL;
+ static const key_t bogus_key = (key_t) 0xeca86420fdb9f531ULL;
static const int bogus_msgid = 0xfdb97531;
static const int bogus_cmd = 0xdeadbeef;
#if TEST_MSGCTL_BOGUS_ADDR
@@ -79,37 +121,36 @@ main(void)
struct msqid_ds ds;
rc = msgget(bogus_key, bogus_flags);
- printf("msgget\\(%#llx, %s%s%s%#x\\|%#04o\\) += %s\n",
+ printf("msgget\\(%#llx, %s\\|%#04o\\) = %s\n",
zero_extend_signed_to_ull(bogus_key),
- IPC_CREAT & bogus_flags ? "IPC_CREAT\\|" : "",
- IPC_EXCL & bogus_flags ? "IPC_EXCL\\|" : "",
- IPC_NOWAIT & bogus_flags ? "IPC_NOWAIT\\|" : "",
- bogus_flags & ~(0777 | IPC_CREAT | IPC_EXCL | IPC_NOWAIT),
+ str_ipc_excl_nowait,
bogus_flags & 0777, sprintrc_grep(rc));
id = msgget(private_key, 0600);
if (id < 0)
perror_msg_and_skip("msgget");
- printf("msgget\\(IPC_PRIVATE, 0600\\) += %d\n", id);
+ printf("msgget\\(%s, 0600\\) = %d\n", str_ipc_private, id);
atexit(cleanup);
rc = msgctl(bogus_msgid, bogus_cmd, NULL);
- printf("msgctl\\(%d, (IPC_64\\|)?%#x /\\* MSG_\\?\\?\\? \\*/, NULL\\)"
- " += %s\n", bogus_msgid, bogus_cmd, sprintrc_grep(rc));
+ printf("msgctl\\(%d, (%s\\|)?%s, NULL\\) = %s\n",
+ bogus_msgid, str_ipc_64, str_bogus_cmd, sprintrc_grep(rc));
#if TEST_MSGCTL_BOGUS_ADDR
rc = msgctl(bogus_msgid, IPC_SET, bogus_addr);
- printf("msgctl\\(%d, (IPC_64\\|)?IPC_SET, %p\\) += %s\n",
- bogus_msgid, bogus_addr, sprintrc_grep(rc));
+ printf("msgctl\\(%d, (%s\\|)?%s, %p\\) = %s\n",
+ bogus_msgid, str_ipc_64, str_ipc_set, bogus_addr,
+ sprintrc_grep(rc));
#endif
if (msgctl(id, IPC_STAT, &ds))
perror_msg_and_skip("msgctl IPC_STAT");
- printf("msgctl\\(%d, (IPC_64\\|)?IPC_STAT, \\{msg_perm=\\{uid=%u"
+ printf("msgctl\\(%d, (%s\\|)?%s, \\{msg_perm=\\{uid=%u"
", gid=%u, mode=%#o, key=%u, cuid=%u, cgid=%u\\}, msg_stime=%u"
", msg_rtime=%u, msg_ctime=%u, msg_qnum=%u, msg_qbytes=%u"
- ", msg_lspid=%u, msg_lrpid=%u\\}\\) += 0\n",
- id, (unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
+ ", msg_lspid=%u, msg_lrpid=%u\\}\\) = 0\n",
+ id, str_ipc_64, str_ipc_stat,
+ (unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
(unsigned) ds.msg_perm.mode, (unsigned) ds.msg_perm.__key,
(unsigned) ds.msg_perm.cuid, (unsigned) ds.msg_perm.cgid,
(unsigned) ds.msg_stime, (unsigned) ds.msg_rtime,
@@ -119,18 +160,22 @@ main(void)
if (msgctl(id, IPC_SET, &ds))
perror_msg_and_skip("msgctl IPC_SET");
- printf("msgctl\\(%d, (IPC_64\\|)?IPC_SET, \\{msg_perm=\\{uid=%u"
- ", gid=%u, mode=%#o\\}, ...\\}\\) += 0\n",
- id, (unsigned) ds.msg_perm.uid, (unsigned) ds.msg_perm.gid,
- (unsigned) ds.msg_perm.mode);
+ printf("msgctl\\(%d, (%s\\|)?%s, \\{msg_perm=\\{uid=%u"
+ ", gid=%u, mode=%#o\\}, ...\\}\\) = 0\n",
+ id, str_ipc_64, str_ipc_set, (unsigned) ds.msg_perm.uid,
+ (unsigned) ds.msg_perm.gid, (unsigned) ds.msg_perm.mode);
rc = msgctl(0, MSG_INFO, &ds);
- printf("msgctl\\(0, (IPC_64\\|)?MSG_INFO, %p\\) += %s\n",
- &ds, sprintrc_grep(rc));
+ printf("msgctl\\(0, (%s\\|)?%s, %p\\) = %s\n",
+ str_ipc_64, str_msg_info, &ds, sprintrc_grep(rc));
rc = msgctl(id, MSG_STAT, &ds);
- printf("msgctl\\(%d, (IPC_64\\|)?MSG_STAT, %p\\) += %s\n",
- id, &ds, sprintrc_grep(rc));
+ printf("msgctl\\(%d, (%s\\|)?%s, %p\\) = %s\n",
+ id, str_ipc_64, str_msg_stat, &ds, sprintrc_grep(rc));
+
+ rc = msgctl(id, MSG_STAT_ANY, &ds);
+ printf("msgctl\\(%d, (%s\\|)?%s, %p\\) = %s\n",
+ id, str_ipc_64, str_msg_stat_any, &ds, sprintrc_grep(rc));
return 0;
}