msghdr.c: limit output when printing excessively large messages

Limit output of struct msghdr.msg_control when
struct msghdr.msg_controllen is greater than the maximum ancillary
buffer size specified in /proc/sys/net/core/optmem_max file.

* configure.ac (AC_CHECK_FUNCS): Add open64.
* defs.h (read_int_from_file): New prototype.
* util.c (read_int_from_file): New function.
* msghdr.c (get_optmem_max): New function based on read_int_from_file.
(decode_msg_control): Use it to check control_len argument.
* tests/msg_control.c (test_big_len): New function.
(main): Use it to test printing of excessively large messages.
5 files changed
tree: d8f6e163fd673d997039cb930234fe5b94ccfd88
  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. NEWS
  122. numa.c
  123. open.c
  124. or1k_atomic.c
  125. pathtrace.c
  126. perf.c
  127. personality.c
  128. poll.c
  129. prctl.c
  130. print_mq_attr.c
  131. print_msgbuf.c
  132. print_sigevent.c
  133. print_statfs.c
  134. print_time.c
  135. print_timex.c
  136. printmode.c
  137. printrusage.c
  138. printsiginfo.c
  139. printsiginfo.h
  140. printstat.h
  141. process.c
  142. process_vm.c
  143. ptp.c
  144. ptrace.h
  145. quota.c
  146. readahead.c
  147. readlink.c
  148. README
  149. README-hacking
  150. README-linux-ptrace
  151. README-mpers
  152. README.md
  153. reboot.c
  154. regs.h
  155. renameat.c
  156. resource.c
  157. rtc.c
  158. sched.c
  159. scsi.c
  160. seccomp.c
  161. seccomp_fprog.h
  162. sendfile.c
  163. sigaltstack.c
  164. sigevent.h
  165. signal.c
  166. signalent.sh
  167. signalfd.c
  168. sigreturn.c
  169. sock.c
  170. sockaddr.c
  171. socketutils.c
  172. sram_alloc.c
  173. statfs.c
  174. statfs.h
  175. statfs64.c
  176. strace-graph
  177. strace-log-merge
  178. strace.1
  179. strace.c
  180. strace.spec.in
  181. swapon.c
  182. sync_file_range.c
  183. sync_file_range2.c
  184. syscall.c
  185. syscallent.sh
  186. sysctl.c
  187. sysinfo.c
  188. syslog.c
  189. sysmips.c
  190. term.c
  191. time.c
  192. times.c
  193. travis-build.sh
  194. travis-install.sh
  195. travis-success.sh
  196. truncate.c
  197. ubi.c
  198. uid.c
  199. uid16.c
  200. umask.c
  201. umount.c
  202. uname.c
  203. unwind.c
  204. upeek.c
  205. userfaultfd.c
  206. util.c
  207. utime.c
  208. utimes.c
  209. v4l2.c
  210. vsprintf.c
  211. wait.c
  212. xattr.c
  213. xlat.h
  214. xlate.el
  215. 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