Fix corner cases of rt_sigpending syscall decoder

* signal (print_sigset_addr_len_limit): New function, cloned from
print_sigset_addr_len with added minimal length argument.
Treat length less than minimal length or greater than NSIG/8 as invalid.
Do not align length to 4-byte boundary.  Align destination buffer
to 4-byte boundary and initialize it with zeroes so that subsequent
call to sprintsigmask_n will not access uninitialized data.
(print_sigset_addr_len): Turn into a wrapper around
print_sigset_addr_len_limit with current_wordsize
as a minimal length argument.
(SYS_FUNC(rt_sigpending)): Call print_sigset_addr_len_limit
instead of print_sigset_addr_len with 1 as a minimal length argument.
* tests/rt_sigpending.c: New file.
* tests/rt_sigpending.test: New test.
* tests/.gitignore: Add rt_sigpending.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(TESTS): Add rt_sigpending.test.
5 files changed
tree: 37b012b221ca2d9ab5a0b7efaccfdc8b3b971d20
  1. .gitignore
  2. .mailmap
  3. .travis.yml
  4. AUTHORS
  5. COPYING
  6. CREDITS.in
  7. ChangeLog-CVS
  8. HACKING-scripts
  9. INSTALL
  10. Makefile.am
  11. NEWS
  12. README
  13. README-hacking
  14. README-linux-ptrace
  15. README-mpers
  16. README.md
  17. access.c
  18. affinity.c
  19. aio.c
  20. alpha.c
  21. bjm.c
  22. block.c
  23. bootstrap
  24. bpf.c
  25. build_static_example.sh
  26. cacheflush.c
  27. capability.c
  28. caps0.h
  29. caps1.h
  30. chdir.c
  31. chmod.c
  32. clone.c
  33. configure.ac
  34. copy_file_range.c
  35. count.c
  36. debian/
  37. defs.h
  38. desc.c
  39. dirent.c
  40. dirent64.c
  41. empty.h
  42. epoll.c
  43. errnoent.sh
  44. evdev.c
  45. eventfd.c
  46. execve.c
  47. exit.c
  48. fadvise.c
  49. fallocate.c
  50. fanotify.c
  51. fchownat.c
  52. fcntl.c
  53. fetch_seccomp_fprog.c
  54. fetch_struct_flock.c
  55. file.c
  56. file_handle.c
  57. flock.c
  58. flock.h
  59. futex.c
  60. gcc_compat.h
  61. generate_mpers_am.sh
  62. generate_sen.sh
  63. generate_xlat_in.sh
  64. get_robust_list.c
  65. getcpu.c
  66. getcwd.c
  67. getrandom.c
  68. git-set-file-times
  69. git-version-gen
  70. gitlog-to-changelog
  71. hostname.c
  72. inotify.c
  73. io.c
  74. ioctl.c
  75. ioctlsort.c
  76. ioperm.c
  77. iopl.c
  78. ioprio.c
  79. ipc_defs.h
  80. ipc_msg.c
  81. ipc_msgctl.c
  82. ipc_sem.c
  83. ipc_shm.c
  84. ipc_shmctl.c
  85. kcmp.c
  86. kernel_types.h
  87. kexec.c
  88. keyctl.c
  89. ldt.c
  90. link.c
  91. linux/
  92. lookup_dcookie.c
  93. loop.c
  94. lseek.c
  95. m4/
  96. maint/
  97. make-dist
  98. mem.c
  99. membarrier.c
  100. memfd_create.c
  101. mknod.c
  102. mount.c
  103. mpers.awk
  104. mpers.sh
  105. mpers_test.sh
  106. mpers_type.h
  107. mq.c
  108. mtd.c
  109. native_defs.h
  110. net.c
  111. open.c
  112. or1k_atomic.c
  113. pathtrace.c
  114. perf.c
  115. personality.c
  116. poll.c
  117. prctl.c
  118. print_mq_attr.c
  119. print_msgbuf.c
  120. print_sigevent.c
  121. print_time.c
  122. print_timex.c
  123. printmode.c
  124. printrusage.c
  125. printsiginfo.c
  126. printsiginfo.h
  127. printstat.h
  128. process.c
  129. process_vm.c
  130. ptp.c
  131. ptrace.h
  132. qemu_multiarch_testing/
  133. quota.c
  134. readahead.c
  135. readlink.c
  136. reboot.c
  137. regs.h
  138. renameat.c
  139. resource.c
  140. rtc.c
  141. sched.c
  142. scsi.c
  143. seccomp.c
  144. seccomp_fprog.h
  145. sendfile.c
  146. sigaltstack.c
  147. sigevent.h
  148. signal.c
  149. signalent.sh
  150. signalfd.c
  151. sigreturn.c
  152. sock.c
  153. socketutils.c
  154. sram_alloc.c
  155. statfs.c
  156. strace-graph
  157. strace-log-merge
  158. strace.1
  159. strace.c
  160. strace.spec
  161. swapon.c
  162. sync_file_range.c
  163. syscall.c
  164. syscallent.sh
  165. sysctl.c
  166. sysinfo.c
  167. syslog.c
  168. sysmips.c
  169. term.c
  170. test/
  171. tests/
  172. time.c
  173. times.c
  174. travis-ci.sh
  175. truncate.c
  176. uid.c
  177. uid16.c
  178. umask.c
  179. umount.c
  180. uname.c
  181. unwind.c
  182. upeek.c
  183. userfaultfd.c
  184. util.c
  185. utime.c
  186. utimes.c
  187. v4l2.c
  188. vsprintf.c
  189. wait.c
  190. xattr.c
  191. xlat/
  192. xlate.el
  193. 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