Fix decoding of struct msghdr.msg_name* arguments of recvmsg syscall

As the msghdr.msg_namelen argument of recvmsg syscall has the same
read-write semantics as the address length argument of recvfrom syscall,
parser of recvmsg syscall needs a similar fix.

* defs.h (fetch_msghdr_namelen): New prototype.
(decode_msghdr): Add "int *" argument.
* msghdr.c (print_msghdr): Likewise.  Treat it as a pointer to struct
msghdr.msg_namelen passed to the kernel.  Pass to decode_sockaddr
the size of socket address actually returned by the kernel.
Print both user and kernel address lengths when the value changes.
(decode_msghdr, decode_mmsghdr): Add "int *" argument,
forward it to print_msghdr.
(decode_mmsgvec): Update decode_mmsghdr invocation.
(fetch_msghdr_namelen): New function.
* net.c (SYS_FUNC(sendmsg)): Update decode_msghdr invocation.
(SYS_FUNC(recvmsg)): Use fetch_msghdr_namelen on entering to save
struct msghdr.msg_namelen.  On exiting, pass the saved value
to decode_msghdr.
3 files changed
tree: b695b95222c6beda89bc96fc6bb61507d8e66769
  1. debian/
  2. linux/
  3. m4/
  4. maint/
  5. qemu_multiarch_testing/
  6. test/
  7. tests/
  8. xlat/
  9. .gitignore
  10. .mailmap
  11. .travis.yml
  12. access.c
  13. affinity.c
  14. aio.c
  15. alpha.c
  16. AUTHORS
  17. bjm.c
  18. block.c
  19. bootstrap
  20. bpf.c
  21. btrfs.c
  22. build_static_example.sh
  23. cacheflush.c
  24. capability.c
  25. caps0.h
  26. caps1.h
  27. ChangeLog-CVS
  28. chdir.c
  29. chmod.c
  30. clone.c
  31. configure.ac
  32. copy_file_range.c
  33. COPYING
  34. count.c
  35. CREDITS.in
  36. defs.h
  37. desc.c
  38. dirent.c
  39. dirent64.c
  40. empty.h
  41. epoll.c
  42. errnoent.sh
  43. evdev.c
  44. eventfd.c
  45. execve.c
  46. exit.c
  47. fadvise.c
  48. fallocate.c
  49. fanotify.c
  50. fchownat.c
  51. fcntl.c
  52. fetch_seccomp_fprog.c
  53. fetch_struct_flock.c
  54. fetch_struct_mmsghdr.c
  55. fetch_struct_msghdr.c
  56. fetch_struct_statfs.c
  57. file.c
  58. file_handle.c
  59. file_ioctl.c
  60. flock.c
  61. flock.h
  62. fs_x_ioctl.c
  63. fstatfs.c
  64. fstatfs64.c
  65. futex.c
  66. gcc_compat.h
  67. generate_mpers_am.sh
  68. generate_sen.sh
  69. generate_xlat_in.sh
  70. get_robust_list.c
  71. getcpu.c
  72. getcwd.c
  73. getrandom.c
  74. git-set-file-times
  75. git-version-gen
  76. gitlog-to-changelog
  77. HACKING-scripts
  78. hdio.c
  79. hostname.c
  80. inotify.c
  81. INSTALL
  82. io.c
  83. ioctl.c
  84. ioctlsort.c
  85. ioperm.c
  86. iopl.c
  87. ioprio.c
  88. ipc_defs.h
  89. ipc_msg.c
  90. ipc_msgctl.c
  91. ipc_sem.c
  92. ipc_shm.c
  93. ipc_shmctl.c
  94. kcmp.c
  95. kernel_types.h
  96. kexec.c
  97. keyctl.c
  98. ldt.c
  99. link.c
  100. lookup_dcookie.c
  101. loop.c
  102. lseek.c
  103. make-dist
  104. make-dsc
  105. Makefile.am
  106. mem.c
  107. membarrier.c
  108. memfd_create.c
  109. mknod.c
  110. mount.c
  111. mpers.awk
  112. mpers.sh
  113. mpers_test.sh
  114. mpers_type.h
  115. mq.c
  116. msghdr.c
  117. msghdr.h
  118. mtd.c
  119. native_defs.h
  120. net.c
  121. netlink.c
  122. NEWS
  123. numa.c
  124. open.c
  125. or1k_atomic.c
  126. pathtrace.c
  127. perf.c
  128. personality.c
  129. poll.c
  130. prctl.c
  131. print_mq_attr.c
  132. print_msgbuf.c
  133. print_sigevent.c
  134. print_statfs.c
  135. print_time.c
  136. print_timex.c
  137. printmode.c
  138. printrusage.c
  139. printsiginfo.c
  140. printsiginfo.h
  141. printstat.h
  142. process.c
  143. process_vm.c
  144. ptp.c
  145. ptrace.h
  146. quota.c
  147. readahead.c
  148. readlink.c
  149. README
  150. README-hacking
  151. README-linux-ptrace
  152. README-mpers
  153. README.md
  154. reboot.c
  155. regs.h
  156. renameat.c
  157. resource.c
  158. rtc.c
  159. sched.c
  160. scsi.c
  161. seccomp.c
  162. seccomp_fprog.h
  163. sendfile.c
  164. sigaltstack.c
  165. sigevent.h
  166. signal.c
  167. signalent.sh
  168. signalfd.c
  169. sigreturn.c
  170. sock.c
  171. sockaddr.c
  172. socketutils.c
  173. sram_alloc.c
  174. statfs.c
  175. statfs.h
  176. statfs64.c
  177. strace-graph
  178. strace-log-merge
  179. strace.1
  180. strace.c
  181. strace.spec.in
  182. swapon.c
  183. sync_file_range.c
  184. sync_file_range2.c
  185. syscall.c
  186. syscallent.sh
  187. sysctl.c
  188. sysinfo.c
  189. syslog.c
  190. sysmips.c
  191. term.c
  192. time.c
  193. times.c
  194. travis-build.sh
  195. travis-install.sh
  196. travis-success.sh
  197. truncate.c
  198. ubi.c
  199. uid.c
  200. uid16.c
  201. umask.c
  202. umount.c
  203. uname.c
  204. unwind.c
  205. upeek.c
  206. userfaultfd.c
  207. util.c
  208. utime.c
  209. utimes.c
  210. v4l2.c
  211. vsprintf.c
  212. wait.c
  213. xattr.c
  214. xlat.h
  215. xlate.el
  216. xmalloc.c
README.md

This is strace -- a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as ptrace.

strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file COPYING for details.

See the file NEWS for information on what has changed in recent versions.

Please send bug reports and enhancements to the strace mailing list.

Build Status Code Coverage