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. 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. build_static_example.sh
  22. cacheflush.c
  23. capability.c
  24. caps0.h
  25. caps1.h
  26. ChangeLog-CVS
  27. chdir.c
  28. chmod.c
  29. clone.c
  30. configure.ac
  31. copy_file_range.c
  32. COPYING
  33. count.c
  34. CREDITS.in
  35. defs.h
  36. desc.c
  37. dirent.c
  38. dirent64.c
  39. empty.h
  40. epoll.c
  41. errnoent.sh
  42. evdev.c
  43. eventfd.c
  44. execve.c
  45. exit.c
  46. fadvise.c
  47. fallocate.c
  48. fanotify.c
  49. fchownat.c
  50. fcntl.c
  51. fetch_seccomp_fprog.c
  52. fetch_struct_flock.c
  53. file.c
  54. file_handle.c
  55. flock.c
  56. flock.h
  57. futex.c
  58. gcc_compat.h
  59. generate_mpers_am.sh
  60. generate_sen.sh
  61. generate_xlat_in.sh
  62. get_robust_list.c
  63. getcpu.c
  64. getcwd.c
  65. getrandom.c
  66. git-set-file-times
  67. git-version-gen
  68. gitlog-to-changelog
  69. HACKING-scripts
  70. hostname.c
  71. inotify.c
  72. INSTALL
  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. lookup_dcookie.c
  92. loop.c
  93. lseek.c
  94. make-dist
  95. Makefile.am
  96. mem.c
  97. membarrier.c
  98. memfd_create.c
  99. mknod.c
  100. mount.c
  101. mpers.awk
  102. mpers.sh
  103. mpers_test.sh
  104. mpers_type.h
  105. mq.c
  106. mtd.c
  107. native_defs.h
  108. net.c
  109. NEWS
  110. open.c
  111. or1k_atomic.c
  112. pathtrace.c
  113. perf.c
  114. personality.c
  115. poll.c
  116. prctl.c
  117. print_mq_attr.c
  118. print_msgbuf.c
  119. print_sigevent.c
  120. print_time.c
  121. print_timex.c
  122. printmode.c
  123. printrusage.c
  124. printsiginfo.c
  125. printsiginfo.h
  126. printstat.h
  127. process.c
  128. process_vm.c
  129. ptp.c
  130. ptrace.h
  131. quota.c
  132. readahead.c
  133. readlink.c
  134. README
  135. README-hacking
  136. README-linux-ptrace
  137. README-mpers
  138. README.md
  139. reboot.c
  140. regs.h
  141. renameat.c
  142. resource.c
  143. rtc.c
  144. sched.c
  145. scsi.c
  146. seccomp.c
  147. seccomp_fprog.h
  148. sendfile.c
  149. sigaltstack.c
  150. sigevent.h
  151. signal.c
  152. signalent.sh
  153. signalfd.c
  154. sigreturn.c
  155. sock.c
  156. socketutils.c
  157. sram_alloc.c
  158. statfs.c
  159. strace-graph
  160. strace-log-merge
  161. strace.1
  162. strace.c
  163. strace.spec
  164. swapon.c
  165. sync_file_range.c
  166. syscall.c
  167. syscallent.sh
  168. sysctl.c
  169. sysinfo.c
  170. syslog.c
  171. sysmips.c
  172. term.c
  173. time.c
  174. times.c
  175. travis-ci.sh
  176. truncate.c
  177. uid.c
  178. uid16.c
  179. umask.c
  180. umount.c
  181. uname.c
  182. unwind.c
  183. upeek.c
  184. userfaultfd.c
  185. util.c
  186. utime.c
  187. utimes.c
  188. v4l2.c
  189. vsprintf.c
  190. wait.c
  191. xattr.c
  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