• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
12017-02-14  Dmitry V. Levin  <ldv@altlinux.org>
2
3	Prepare for 4.16 release.
4	* NEWS: Update for 4.16 release.
5
62017-02-13  Dmitry V. Levin  <ldv@altlinux.org>
7
8	.mailmap: add addresses of JingPiao Chen.
9	* .mailmap: Add both addresses of JingPiao Chen here to avoid
10	duplications in CREDITS file.
11
12	tests: skip scno tampering tests on compat mips abi.
13	* tests/scno_tampering.sh: In case of mips abi, skip the test
14	unless it is the native abi.
15
162017-02-12  Dmitry V. Levin  <ldv@altlinux.org>
17
18	Fix -Werror=duplicate-decl-specifier compilation issues.
19	capability.c:82:28: error: duplicate "const" declaration specifier
20	capability.c:110:33: error: duplicate "const" declaration specifier
21	rt_tgsigqueueinfo.c:42:61: error: duplicate "const" declaration specifier
22	utime.c:66:23: error: duplicate "const" declaration specifier
23	waitid.c:147:20: error: duplicate "const" declaration specifier
24
25	* capability.c (cap_user_header_t, cap_user_data_t): Remove.
26	(get_cap_header): Change return type
27	to "const struct user_cap_header_struct *".
28	(print_cap_header, print_cap_data): Change the type of last argument
29	to "const struct user_cap_header_struct * const".
30	(SYS_FUNC(capget)): Change type of "h" variable
31	to "const struct user_cap_header_struct *".
32	(SYS_FUNC(capset)): Change type of "h" variable
33	to "const struct user_cap_header_struct * const".
34	* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Change the type of last
35	argument to "const void *const".
36	* tests/utime.c (main): Change the type of "tail_u" variable
37	to "const struct utimbuf *const".
38	* tests/waitid.c (do_waitid): Change the type of 3rd argument
39	to "const siginfo_t *const".
40
412017-02-12  Dmitry V. Levin  <ldv@altlinux.org>
42
43	tests: rewrite pipe syscall decoding check from match_grep to match_diff
44	* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
45	* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
46	instead of [!HAVE_PIPE2].
47	(main): Do not call pipe2.
48	* tests/pipe.test: Skip the test if libc pipe wrapper does not use
49	pipe syscall, rewrite from match_grep to match_diff.
50	* tests/pipe.expected: Update expected output.
51
522017-02-11  Dmitry V. Levin  <ldv@altlinux.org>
53
54	tests: rewrite pipe2 syscall decoding check from match_grep to match_diff
55	Unlike pipe.test that is based on match_grep, the new test
56	is based on match_diff and does more rigorous testing.
57
58	* tests/pipe2.c: New file.
59	* tests/pipe2.test: New test.
60	* tests/.gitignore: Add pipe2.
61	* tests/Makefile.am (check_PROGRAMS): Likewise.
62	(DECODER_TESTS): Add pipe2.test.
63
642017-02-10  Dmitry V. Levin  <ldv@altlinux.org>
65
66	tests: rewrite mq.test from match_grep to match_diff.
67	Unlike the previous edition of the test that was based on match_grep,
68	the new one is match_diff based and does more rigorous testing.
69
70	* tests/mq.c: Include <stdio.h>.
71	(NAME): New macro.
72	(main): Use it.  Print expected output.
73	* tests/mq.expected: Remove.
74	* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
75	* tests/mq.test: Use run_strace_match_diff.
76
772017-02-09  Dmitry V. Levin  <ldv@altlinux.org>
78
79	Simplify struct inject_opts.rval semantics.
80	Drop use of INJECT_OPTS_RVAL_DISABLE special inject_opts.rval value,
81	INJECT_OPTS_RVAL_DEFAULT is enough.
82
83	* defs.h (INJECT_OPTS_RVAL_DISABLE): Remove.
84	* qualify.c (qualify_inject_common): Do not replace
85	INJECT_OPTS_RVAL_DEFAULT with INJECT_OPTS_RVAL_DISABLE
86	in inject_opts.rval.
87	* syscall.c (tamper_with_syscall_entering): Check
88	for INJECT_OPTS_RVAL_DEFAULT instead of INJECT_OPTS_RVAL_DISABLE.
89
902017-02-09  Dmitry V. Levin  <ldv@altlinux.org>
91
92	tests: check signal injection along with fault injection.
93	* tests/qual_inject-error-signal.c: New file.
94	* tests/qual_inject-error-signal.expected: Likewise.
95	* tests/qual_inject-error-signal.test: New test.
96	* tests/.gitignore: Add qual_inject-error-signal.
97	* tests/Makefile.am (check_PROGRAMS): Likewise.
98	(MISC_TESTS): Add qual_inject-error-signal.test.
99	(EXTRA_DIST): Add qual_inject-error-signal.expected.
100
101	tests: simplify qual_inject-signal.test.
102	* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.
103
1042017-02-09  Dmitry V. Levin  <ldv@altlinux.org>
105
106	Make symbolic errno values match case-insensitive.
107	Follow the example of case-insensitive symbolic signal values in signal
108	and inject expressions and make symbolic errno values in inject
109	expressions case-insensitive.
110
111	* qualify.c (find_errno_by_name): Use strcasecmp instead of strcmp
112	to match symbolic errno values.
113	* tests/qual_fault.c (main): Likewise.
114	* tests/qual_fault.test: Test case-insensitive symbolic errno match.
115
1162017-02-09  Dmitry V. Levin  <ldv@altlinux.org>
117
118	tests: check case-insensitive symbolic signal match.
119	* tests/qual_signal.test: Test case-insensitive symbolic signal match.
120
1212017-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>
122
123	Update NEWS.
124
1252017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
126
127	Update NEWS.
128
1292017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
130
131	strace.spec.in: fix dist version checks.
132	* strace.spec.in: Fix libunwind availability check.
133
134	Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
135
1362017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
137
138	tests: update ipc_sem.test for new glibc.
139	Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
140	address to semctl like other libcs.
141
142	* tests/ipc_sem.c (main) [__GLIBC__]: Remove.
143
1442017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
145
146	tests: fix typo in bpf.test.
147	* tests/bpf.c (main): Add missing semicolon.
148
149	Fixes: ad427721 ("tests: rewrite bpf.test from match_grep to match_diff")
150
1512017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
152
153	tests: check signal injection.
154	* tests/qual_inject-signal.c: New file.
155	* tests/qual_inject-signal.expected: Likewise.
156	* tests/qual_inject-signal.test: New test.
157	* tests/.gitignore: Add qual_inject-signal.
158	* tests/Makefile.am (check_PROGRAMS): Likewise.
159	(MISC_TESTS): Add qual_inject-signal.test.
160	(EXTRA_DIST): Add qual_inject-signal.expected.
161
1622017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
163
164	Implement -e inject= option.
165	Introduce -e inject= as a general injection option,
166	limit -e fault= option to syscall fault injection.
167
168	Change default return code of syscall fault injection to ENOSYS.
169
170	* qualify.c (parse_inject_token): Add fault_tokens_only argument,
171	do not accept retval= and signal= tokens when fault_tokens_only
172	is set to true.
173	(parse_inject_expression): Add fault_tokens_only argument,
174	forward it to parse_inject_token.
175	(qualify_inject_common): New function.
176	(qualify_fault): Use it.
177	(qualify_inject): New function.
178	(qual_options): New entry.
179	* strace.1: Describe -e inject= option.
180	* NEWS: Mention -e inject= option.
181	* tests/qual_fault-syntax.test: Test that -e fault= option does not
182	support retval=, signal=, and multiple error= tokens.
183	* tests/qual_fault.c (DEFAULT_ERRNO): Set to ENOSYS unconditionally.
184	* tests/qual_inject-retval.test: Replace -e fault= option
185	with -e inject= option.
186	* tests/qual_inject-syntax.test: New test.
187	* tests/Makefile.am (MISC_TESTS): Add it.
188
1892017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
190
191	tests: prepare for introduction of -e inject= option.
192	Rename files related to fault injection to avoid further confusion.
193
194	* tests/fault_injection-exit_group.expected: Rename
195	to tests/qual_fault-exit_group.expected.
196	* tests/fault_injection-exit_group.test: Rename
197	to tests/qual_fault-exit_group.test.
198	* tests/fault_syntax.test: Rename to tests/qual_fault-syntax.test.
199	* tests/fault_injection.c: Rename to tests/qual_fault.c.
200	* tests/fault_injection.test: Rename to tests/qual_fault.test.
201	* tests/fault_injection-retval.c: Rename to tests/qual_inject-retval.c.
202	* tests/fault_injection-retval.test: Rename
203	to tests/qual_inject-retval.test.
204	* tests/fault_injection.sh: Rename to tests/scno_tampering.sh.
205	* tests/.gitignore: Update.
206	* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
207	EXTRA_DIST): Update.
208
2092017-02-08  Dmitry V. Levin  <ldv@altlinux.org>
210
211	Prepare for introduction of -e inject= option.
212	As -e fault= injection syntax has been extended to configure various
213	kinds of injections besides fault injection, the original option name
214	bacame too narrow.
215
216	This change renames internal constants, types, and functions from
217	"fault" to more generic inject/tamper ones.
218
219	* defs.h (fault_opts): Rename to inject_opts.
220	(FAULT_OPTS_RVAL_DEFAULT): Rename to INJECT_OPTS_RVAL_DEFAULT.
221	(FAULT_OPTS_RVAL_DISABLE): Rename to INJECT_OPTS_RVAL_DISABLE.
222	(struct tcb): Rename fault_vec field to inject_vec.
223	(TCB_FAULT_INJ): Rename to TCB_TAMPERED.
224	(QUAL_FAULT): Rename to QUAL_INJECT.
225	(fault_vec): Rename to inject_vec.
226	All users changed.
227	* qualify.c (fault_set): Rename to inject_set.
228	(parse_fault_token): Rename to parse_inject_token.
229	(parse_fault_expression): Rename to parse_inject_expression.
230	All callers changed.
231	* syscall.c (fault_vec): Rename to inject_vec.
232	(tcb_fault_opts): Rename to tcb_inject_opts.
233	(inject_syscall_fault_entering): Rename to tamper_with_syscall_entering.
234	(update_syscall_fault_exiting): Rename to tamper_with_syscall_exiting.
235	(syscall_fault_injected): Rename to syscall_tampered.
236	All callers changed.
237
2382017-02-07  Dmitry V. Levin  <ldv@altlinux.org>
239
240	tests: make Makefile.am lists sorted in C locale.
241	* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
242	EXTRA_DIST): Make sorted in C locale.
243
2442017-02-07  Dmitry V. Levin  <ldv@altlinux.org>
245
246	tests: use ARG_STR in msg_control.test.
247	Drop local VAL_STR macro in favour of ARG_STR macro from tests/tests.h.
248
249	* tests/msg_control.c (VAL_STR): Remove.
250	(test_sol_socket, test_sol_ip): Replace VAL_STR with ARG_STR.
251
2522017-02-07  Dmitry V. Levin  <ldv@altlinux.org>
253
254	powerpc, powerpc64: wire up new syscalls.
255	* linux/powerpc/syscallent.h [382]: Add kexec_file_load entry.
256	* linux/powerpc64/syscallent.h [382]: Likewise.
257
258	microblaze: wire up new syscalls.
259	* linux/microblaze/syscallent.h [392..397]: New entries.
260
261	avr32: wire up new syscalls.
262	* linux/avr32/syscallent.h [328..330]: New entries.
263
2642017-02-06  Dmitry V. Levin  <ldv@altlinux.org>
265
266	Update IPV6_* constants.
267	* xlat/sockipv6options.in: Add IPV6_RECVFRAGSIZE introduced
268	by linux kernel commit v4.10-rc1~202^2~340^2~1.
269
270	Update IP_* constants.
271	* xlat/sockipoptions.in: Add IP_RECVFRAGSIZE introduced
272	by linux kernel commit v4.10-rc1~202^2~340^2~2.
273
2742017-02-06  Jacob Goense  <dugo@xs4all.nl>
275
276	or1k: fix build.
277	This fixes a typo in the arch_set_success for the or1k architecture.
278
279	* linux/or1k/set_error.c (arch_setsuccess): Rename to arch_set_success.
280
281	Fixes: 41d647c ("Implement success injection")
282	Closes: https://github.com/strace/strace/pull/6
283
2842017-02-04  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
285
286	Update ioctl entries from linux 4.10.
287	* linux/32/ioctls_inc_align16.h: Update from linux v4.10 using ioctls_gen.sh.
288	* linux/32/ioctls_inc_align32.h: Likewise.
289	* linux/32/ioctls_inc_align64.h: Likewise.
290	* linux/64/ioctls_inc.h: Likewise.
291	* linux/x32/ioctls_inc0.h: Likewise.
292	* NEWS: Mention this.
293
294	maint: update for linux 4.10.
295	* maint/ioctls_sym.sh: Update workaround for linux/if_pppox.h file.
296
297	maint: add workaround for m68k.
298	* maint/ioctls_sym.sh: Skip asm/amigayle.h.
299
3002017-01-31  Dmitry V. Levin  <ldv@altlinux.org>
301
302	tests: check decoding of bpf corner cases.
303	* tests/bpf.c (bogus_bpf): New function.
304	(BOGUS_BPF): New macro.
305	(main): Use them.
306	* tests/bpf.test: Add -a option.
307
3082017-01-29  Dmitry V. Levin  <ldv@altlinux.org>
309
310	tests: rewrite bpf.test from match_grep to match_diff.
311	* tests/bpf.c (errstr): New variable.
312	(sys_bpf): New function.
313	(map_create, map_any, prog_load, obj_manage, prog_cgroup): Use it.
314	(main): Update expected output.
315	* tests/bpf.test: Use run_strace_match_diff.
316
317	bpf: move common code to a separate function.
318	* bpf.c (bpf_prog_attach_detach): New function.
319	(bpf_prog_attach, bpf_prog_detach): Use it.
320
3212017-01-29  Quentin Monnet  <quentin.monnet@6wind.com>
322
323	Update bpf syscall decoding.
324	Implement decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
325	and BPF_PROG_DETACH commands.
326
327	* bpf.c: Include "xlat/bpf_attach_type.h".
328	(bpf_obj_manage, bpf_prog_attach, bpf_prog_detach): New functions.
329	(SYS_FUNC(bpf)): Use them.
330	* configure.ac: Check for union bpf_attr.bpf_fd and union
331	bpf_attr.attach_type.
332	* xlat/bpf_attach_type.in: New file.
333	* xlat/bpf_commands.in: Update list of BPF_* command constants.
334	* xlat/bpf_map_types.in: Update list of BPF_MAP_TYPE_* constants.
335	* xlat/bpf_prog_types.in: Update list of BPF_PROG_TYPE_* constants.
336	* tests/bpf.c [HAVE_UNION_BPF_ATTR_BPF_FD] (obj_manage): New function.
337	[HAVE_UNION_BPF_ATTR_ATTACH_TYPE] (prog_cgroup): Likewise.
338	(main): Use them.
339
3402017-01-28  Elvira Khabirova  <lineprinter0@gmail.com>
341
342	tests: check success injection.
343	* tests/fault_injection-retval.c: New file.
344	* tests/fault_injection-retval.test: New test.
345	* tests/.gitignore: Add fault_injection-retval.
346	* tests/Makefile.am (check_PROGRAMS): Likewise.
347	(MISC_TESTS): Add fault_injection-retval.test.
348
3492017-01-28  Elvira Khabirova  <lineprinter0@gmail.com>
350
351	Implement success injection.
352	This extends fault injection syntax with :retval= option.
353	When :retval=VALUE is specified, the syscall number is replaced by -1
354	and a bogus success VALUE is returned to the callee.
355
356	* defs.h (fault_opts): Remove err field, add rval field.
357	(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
358	New macros.
359	* qualify.c (parse_fault_token): Handle retval= token.
360	(qualify_fault): Update fault_opts initialization after the move
361	from struct fault_opts.err to struct fault_opts.rval.
362	* syscall.c (arch_set_success): New prototype.
363	(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
364	(update_syscall_fault_exiting): Implement retval injection.
365	* strace.1: Update the section on fault injection.
366	* NEWS: Mention retval= option.
367	* linux/aarch64/set_error.c (arch_set_success): New function.
368	* linux/alpha/set_error.c: Likewise.
369	* linux/arc/set_error.c: Likewise.
370	* linux/arm/set_error.c: Likewise.
371	* linux/avr32/set_error.c: Likewise.
372	* linux/bfin/set_error.c: Likewise.
373	* linux/crisv10/set_error.c: Likewise.
374	* linux/hppa/set_error.c: Likewise.
375	* linux/i386/set_error.c: Likewise.
376	* linux/ia64/set_error.c: Likewise.
377	* linux/m68k/set_error.c: Likewise.
378	* linux/metag/set_error.c: Likewise.
379	* linux/microblaze/set_error.c: Likewise.
380	* linux/mips/set_error.c: Likewise.
381	* linux/nios2/set_error.c: Likewise.
382	* linux/or1k/set_error.c: Likewise.
383	* linux/powerpc/set_error.c: Likewise.
384	* linux/riscv/set_error.c: Likewise.
385	* linux/s390/set_error.c: Likewise.
386	* linux/sh/set_error.c: Likewise.
387	* linux/sh64/set_error.c: Likewise.
388	* linux/sparc/set_error.c: Likewise.
389	* linux/sparc64/set_error.c: Likewise.
390	* linux/tile/set_error.c: Likewise.
391	* linux/x86_64/set_error.c: Likewise.
392	* linux/xtensa/set_error.c: Likewise.
393
394	Closes: https://github.com/strace/strace/issues/3
395
3962017-01-26  Dmitry V. Levin  <ldv@altlinux.org>
397
398	mips: rewrite configure check without sgidefs.h.
399	Use builtin macros provided by gcc >= 3.4 instead of sgidefs.h macros.
400
401	* configure.ac <mips>: Do not include <asm/sgidefs.h>, use _ABIO32
402	instead of _MIPS_SIM_ABI32, _ABIN32 instead of _MIPS_SIM_NABI32,
403	and _ABI64 instead of _MIPS_SIM_ABI64.
404
4052017-01-20  Elvira Khabirova  <lineprinter0@gmail.com>
406
407	.gitignore: add missing files that should be ignored.
408	* .gitignore: Add /ioctl_iocdef.[ih].
409
410	Fixes: 5679fad ("ioctlsort: get ioctl definitions from host, not build")
411
4122017-01-20  Andre McCurdy  <armccurdy@gmail.com>
413
414	mips: use <asm/sgidefs.h>
415	Build fix for MIPS with musl libc.
416
417	The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
418	but not by musl. Regardless of the libc, the kernel headers provide
419	<asm/sgidefs.h> which provides the same definitions, so use that
420	instead.
421
422	* configure.ac: Replace <sgidefs.h> with <asm/sgidefs.h>.
423
4242017-01-20  JingPiao Chen  <chenjingpiao@gmail.com>
425
426	Implement decoding of ustat syscall.
427	* configure.ac (AC_CHECK_HEADERS): Add ustat.h.
428	* ustat.c: New file.
429	* Makefile.am (strace_SOURCES): Add it.
430	* linux/dummy.h: Remove sys_ustat.
431	* tests/ustat.c: New file.
432	* tests/ustat.test: New test.
433	* tests/.gitignore: Add ustat.
434	* tests/Makefile.am (check_PROGRAMS): Likewise.
435	(DECODER_TESTS): Add ustat.test.
436
437	Makefile.am: allow indented DEF_MPERS_TYPE includes.
438	* Makefile.am (m%_type_defs.h): Change sed regular expression to allow
439	arbitrary number of whitespace characters between "#" symbol
440	and "include" directive.
441
442	strace.1: fix formatting.
443	* strace.1: Remove misplaced .TP macros.
444
4452017-01-13  Dmitry V. Levin  <ldv@altlinux.org>
446
447	tests: drop non-USE_ASM_STAT case support.
448	With the switch of fstatat family tests to USE_ASM_STAT variant,
449	there are no non-USE_ASM_STAT users left.  Remove support of unused
450	non-USE_ASM_STAT case.
451
452	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_mtim.tv_nsec.
453	* tests/fstatat.c (USE_ASM_STAT): Remove.
454	* tests/fstatx.c: Likewise.
455	* tests/lstatx.c: Likewise.
456	* tests/xstatx.c: Assume USE_ASM_STAT.
457	[!USE_ASM_STAT]: Remove.
458
4592017-01-13  Dmitry V. Levin  <ldv@altlinux.org>
460
461	tests: call newfstatat and fstatat64 syscalls directly.
462	Do not use glibc wrappers to call newfstatat and fstatat64.
463	These wrappers have various problems, e.g. they segfault on sparc64
464	and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
465	conversion of timestamps on mips64.
466
467	* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
468	directly.
469	(USE_ASM_STAT): Define.
470	* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
471	(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.
472
473	Based on patch by James Cowgill <james410@cowgill.org.uk>.
474
4752017-01-13  Dmitry V. Levin  <ldv@altlinux.org>
476
477	tests: remove redundant SAMPLE_SIZE definitions.
478	Remove all definitions of SAMPLE_SIZE that are identical to the fallback
479	definition in tests/xstatx.c.
480
481	* tests/fstat64.c (SAMPLE_SIZE): Remove.
482	* tests/lstat64.c (SAMPLE_SIZE): Remove.
483	* tests/stat64.c (SAMPLE_SIZE): Remove.
484
4852017-01-13  Dmitry V. Levin  <ldv@altlinux.org>
486
487	tests: change SAMPLE_SIZE type to libc_off_t.
488	As ftruncate libc function and our create_sample function that calls
489	ftruncate both take size argument of type libc_off_t, change the type
490	of SAMPLE_SIZE constant to libc_off_t.
491
492	* tests/fstat.c (SAMPLE_SIZE): Cast to libc_off_t.
493	* tests/lstat.c (SAMPLE_SIZE): Likewise.
494	* tests/oldfstat.c (SAMPLE_SIZE): Likewise.
495	* tests/oldlstat.c (SAMPLE_SIZE): Likewise.
496	* tests/oldstat.c (SAMPLE_SIZE): Likewise.
497	* tests/stat.c (SAMPLE_SIZE): Likewise.
498	* tests/xstatx.c (SAMPLE_SIZE): Likewise.
499
5002017-01-13  Alexey Neyman  <stilor@att.net>
501
502	ioctlsort: get ioctl definitions from host, not build.
503	When cross-compiling, ioctlsort must obtain _IOC_* values from the
504	host, build's values may be incompatible.
505
506	* ioctl_iocdef.c: New file.
507	* Makefile.am (EXTRA_DIST): Add it.
508	(ioctl_iocdef.i, ioctl_iocdef.h): New rules.
509	(ioctlsort%.o): Depend on ioctl_iocdef.h.
510	(CLEANFILES): Add ioctl_iocdef.h and ioctl_iocdef.i.
511	* ioctlsort.c: Include "ioctl_iocdef.h" instead of <linux/ioctl.h>.
512
5132017-01-13  Dmitry V. Levin  <ldv@altlinux.org>
514
515	tests: treat struct stat mismatch as an error.
516	If the test detects struct stat mismatch, this is likely an error
517	in definitions of a stat structure that might affect strace as well.
518	Fail the test instead of skipping it to attract more attention.
519
520	* tests/xstatx.c (main): Return 1 instead of 77
521	in case of struct stat mismatch.
522
5232017-01-12  Dmitry V. Levin  <ldv@altlinux.org>
524
525	tests: rewrite diagnostics about struct stat mismatch.
526	* tests/xstatx.c (LOG_STAT_OFFSETOF_SIZEOF): New macro.
527	(main): Use it to print struct stat mismatch details.
528
529	tests: fix typo in tests/xstatx.c.
530	* tests/xstatx.c [!IS_FSTAT]: Define IS_FSTAT instead of IS_STAT.
531
5322017-01-12  JingPiao Chen  <chenjingpiao@gmail.com>
533
534	tests: fix typo in mlock.c.
535	* tests/mlock.c [!(__NR_mlock && __NR_munlock)]: Fix spelling
536	of SKIP_MAIN_UNDEFINED.
537
5382017-01-12  JingPiao Chen  <chenjingpiao@gmail.com>
539
540	strace: move description of -k option to the appropriate place.
541	Follow the example of strace.1 and put the description of -k option
542	into the  output format group.
543
544	* strace.c (usage): Move description of -k option to the output
545	format group.
546
5472017-01-11  Dmitry V. Levin  <ldv@altlinux.org>
548
549	Remove redundant commas at the end of structure initializers.
550	Automatically remove redundant commas using the following
551	sed expression:
552
553	git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'
554
555	* linux/32/syscallent.h: Remove redundant commas at the end of structure
556	initializers.
557	* linux/64/syscallent.h: Likewise.
558	* linux/alpha/syscallent.h: Likewise.
559	* linux/arm/syscallent.h: Likewise.
560	* linux/avr32/syscallent.h: Likewise.
561	* linux/bfin/syscallent.h: Likewise.
562	* linux/crisv10/syscallent.h: Likewise.
563	* linux/hppa/syscallent.h: Likewise.
564	* linux/i386/syscallent.h: Likewise.
565	* linux/ia64/syscallent.h: Likewise.
566	* linux/m68k/syscallent.h: Likewise.
567	* linux/microblaze/syscallent.h: Likewise.
568	* linux/microblaze/userent.h: Likewise.
569	* linux/mips/syscallent-n32.h: Likewise.
570	* linux/mips/syscallent-n64.h: Likewise.
571	* linux/mips/syscallent-o32.h: Likewise.
572	* linux/powerpc/syscallent.h: Likewise.
573	* linux/powerpc64/syscallent.h: Likewise.
574	* linux/s390/syscallent.h: Likewise.
575	* linux/s390x/syscallent.h: Likewise.
576	* linux/sh/syscallent.h: Likewise.
577	* linux/sh64/syscallent.h: Likewise.
578	* linux/sparc/syscallent.h: Likewise.
579	* linux/sparc64/syscallent.h: Likewise.
580	* linux/x32/syscallent.h: Likewise.
581	* linux/x86_64/syscallent.h: Likewise.
582	* linux/xtensa/syscallent.h: Likewise.
583	* tests/kexec_file_load.c: Likewise.
584
585	Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
586
5872017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
588
589	tests: check decoding of scsi ioctl commands.
590	* tests/ioctl_scsi.c: New file.
591	* tests/ioctl_scsi.test: New test.
592	* tests/.gitignore: Add ioctl_scsi.
593	* tests/Makefile.am (check_PROGRAMS): Likewise.
594	(DECODER_TESTS): Add ioctl_scsi.test.
595
596	scsi: implement decoding of all SG_* ioctl commands.
597	* print_sg_req_info.c: New file.
598	* Makefile.am (strace_SOURCES): Add it.
599	* xlat/sg_scsi_reset.in: New file.
600	* scsi.c: Include "xlat/sg_scsi_reset.h".
601	(scsi_ioctl): Implement decoding of all SG_* ioctl commands.
602
603	scsi: prepare for decoding of other SG_* ioctl commands.
604	* scsi.c (scsi_ioctl): Introduce a switch statement.
605
606	tests: check decoding of ioctl SG_IO v3 commands.
607	* tests/ioctl_sg_io_v3.c: New file.
608	* tests/ioctl_sg_io_v3.test: New test.
609	* tests/.gitignore: Add ioctl_sg_io_v3.
610	* tests/Makefile.am (check_PROGRAMS): Likewise.
611	(DECODER_TESTS): Add ioctl_sg_io_v3.test.
612
613	tests: check decoding of ioctl SG_IO v4 commands.
614	* tests/ioctl_sg_io_v4.c: New file.
615	* tests/ioctl_sg_io_v4.test: New test.
616	* tests/.gitignore: Add ioctl_sg_io_v4.
617	* tests/Makefile.am (check_PROGRAMS): Likewise.
618	(DECODER_TESTS): Add ioctl_sg_io_v4.test.
619
6202017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
621
622	scsi: add fallback definitions for SG_* ioctl command constants.
623	Unfortunately, <scsi/sg.h> from libc does not provide all constants
624	recognized by the kernel.
625
626	* xlat/scsi_sg_commands.in: New file.
627	* scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing
628	a fallback definition of SG_IO.
629
6302017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
631
632	xlat: provide fallback definitions for BSG_FLAG_* constants.
633	BSG_FLAG_* constants were introduced later than the header file where
634	they are defined.
635
636	* xlat/bsg_flags.in: Add default values for constants.
637
6382017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
639
640	xlat: provide fallback definitions for SG_FLAG_* constants.
641	Unfortunately, <scsi/sg.h> from libc does not provide all constants
642	recognized by the kernel.
643
644	* xlat/sg_io_flags.in: Add default values for constants.
645
6462017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
647
648	sg_io_v4: print din_resid and dout_resid fields as signed integers.
649	* sg_io_v4.c (decode_response): Print din_resid and dout_resid fields
650	using %d format.
651
6522017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
653
654	sg_io: cleanup printing of sg_io buffers.
655	Turn print_sg_io_buffer into a universal sg_io buffer printer.
656
657	* sg_io_v3.c (print_sg_io_buffer): Add iovec_count argument.
658	Call tprint_iov_upto when iovec_count is non-zero.
659	(decode_request, decode_response): Do not call tprint_iov_upto directly,
660	use print_sg_io_buffer instead.
661	* sg_io_v4.c: Likewise.
662
6632017-01-10  Dmitry V. Levin  <ldv@altlinux.org>
664
665	sg_io: decode structures on exiting syscall in case of syserror.
666	The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78,
667	translates its "struct request.errors" to ioctl errors after
668	filling in all the output members of the SG_IO header structure.
669
670	As there is no easy way to tell SCSI layer errors from other syscall
671	errors, decode the structure on exiting syscall in case of syserror,
672	too.
673
674	* scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use
675	get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io
676	unconditionally.
677	* sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using
678	set_tcb_priv_data.
679	(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
680	fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
681	unconditionally.
682	* sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using
683	set_tcb_priv_data.
684	(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
685	fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
686	unconditionally.
687
6882017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
689
690	sg_io: reorder printing of fields to follow structure order.
691	* sg_io_v4.c (decode_request): Print timeout, flags, and usr_ptr fields
692	after dout_xferp field.
693
694	sg_io_v3: print sg_io_hdr.duration field as unsigned integer.
695	* sg_io_v3.c (decode_response): Print duration field using %u format.
696
697	sg_io_v3: print msg_status field.
698	* sg_io_v3.c (decode_response): Print msg_status field.
699
700	sg_io: print names of array fields and corresponding length fields.
701	* sg_io_v3.c (decode_request): Print names of cmd_len, cmdp,
702	and dxferp fields.
703	(decode_response): Print names of dxferp, sb_len_wr, and sbp fields.
704	* sg_io_v4.c (decode_request): Print names of request_len, request,
705	dout_xfer_len, and dout_xferp fields.
706	(decode_response): Print names of response_len, response,
707	and din_xferp fields.
708
7092017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
710
711	sg_io_v3: print status fields using %#x format specifier.
712	The formerly used format string %02x led to misleading output as there
713	was no clear indication sometimes whether the printed integer was
714	decimal or hexadecimal.
715
716	* sg_io_v3.c (decode_response): Print status and masked_status fields
717	using %#x format specifier instead of %02x.
718
7192017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
720
721	sg_io_v4: print status fields in a hexadecimal form.
722	The tradition is to print scsi status codes in a hexadecimal form.
723
724	* sg_io_v4.c (decode_response): Print driver_status, transport_status,
725	and device_status fields using %#x format specifier instead of %u.
726
7272017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
728
729	sg_io_v4: print request_tag and generated_tag fields in hex.
730	The tradition is to print scsi tags in a hexadecimal form.
731
732	* sg_io_v4.c (decode_request): Print request_tag field
733	using ("%#" PRI__x64) format string.
734	(decode_response): Print generated_tag field using ("%#" PRI__x64)
735	format string.
736
7372017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
738
739	sg_io_v4: print usr_ptr field in a hexadecimal form.
740	As the nature of this field is pointer-like, print it
741	in a hexadecimal form.
742
743	* sg_io_v4.c (decode_request): Print usr_ptr field
744	using ("%#" PRI__x64) format string.
745
7462017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
747
748	sg_io_v4: do not print spare_in and spare_out fields.
749	As the kernel does not touch these fields, there is no use
750	to print them.
751
752	* sg_io_v4.c (decode_request): Do not print spare_in field.
753	(decode_response): Do not print spare_out field.
754
7552017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
756
757	sg_io: decode struct sg_io_hdr.info and struct sg_io_v4.info.
758	Print struct sg_io_hdr.info and struct sg_io_v4.info using printflags.
759
760	* xlat/sg_io_info.in: New file.
761	* defs.h (sg_io_info): New xlat prototype.
762	* sg_io_v3.c: Include "xlat/sg_io_info.h".
763	(decode_response): Print struct_sg_io_hdr.info using printflags.
764	* sg_io_v4.c: (decode_response): Print struct sg_io_v4.info
765	using printflags.
766
7672017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
768
769	sg_io: decode struct sg_io_hdr.flags and struct sg_io_v4.flags.
770	Print struct sg_io_hdr.flags and struct sg_io_v4.flags using printflags.
771
772	* xlat/sg_io_flags.in: New file.
773	* sg_io_v3.c: Include "xlat/sg_io_flags.h".
774	(decode_request): Print struct_sg_io_hdr.flags using printflags.
775	* xlat/bsg_flags.in: New file.
776	* sg_io_v4.c: Include "xlat/bsg_flags.h".
777	(decode_request): Print struct sg_io_v4.flags using printflags.
778
7792017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
780
781	Mpersify struct sg_io_hdr.
782	struct sg_io_hdr contains pointers and therefore has to be mpersified.
783
784	* defs.h (decode_sg_io_v3): Remove prototype.
785	* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
786	Mpersify it.
787	(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.
788
7892017-01-08  Dmitry V. Levin  <ldv@altlinux.org>
790
791	Split scsi.c.
792	Move decoders of SG_IO v3 and v4 APIs into separate files,
793	compile generic SG_IO decoder unconditionally.
794
795	* sg_io_v3.c: New file.
796	* sg_io_v4.c: Likewise.
797	* Makefile.am (strace_SOURCES): Add them.
798	* defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes.
799	* ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition.
800	* scsi.c: (print_sg_io_res): Remove.
801	(print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req
802	with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4,
803	compile uncoditionally.
804	(scsi_ioctl): Replace print_sg_io_req and print_sg_io_res
805	with decode_sg_io, compile uncoditionally.
806	Move [HAVE_SCSI_SG_H] code to sg_io_v3.c.
807	Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.
808
8092017-01-07  Dmitry V. Levin  <ldv@altlinux.org>
810
811	scsi: detect and print changes of interface id.
812	* scsi.c (print_sg_io_v3_res): Detect and print changes
813	of struct sg_io_hdr.interface_id field between entering and exiting
814	syscall.
815	(print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard
816	field between entering and exiting syscall.
817
818	scsi: print field names of all fields being printed.
819	* scsi.c (print_sg_io_v3_req): Always print the name
820	of struct sg_io_hdr.interface_id field.
821	(print_sg_io_v4_req): Always print the name of struct sg_io_v4.guard
822	field.
823	(print_sg_io_req): Print unknown interface id as an integer.
824	(scsi_ioctl): Save interface id on entering syscall and use it
825	on exiting syscall.
826
827	scsi: print struct sg_io_hdr.dxfer_direction field name.
828	* scsi.c (print_sg_io_v3_req): Print struct sg_io_hdr.dxfer_direction
829	field name.
830
831	scsi: print "protocol" and "subprotocol" field names of struct sg_io_v4.
832	* scsi.c (print_sg_io_v4_req): Print field names
833	of struct sg_io_v4.protocol and struct sg_io_v4.subprotocol.
834
8352017-01-07  Dmitry V. Levin  <ldv@altlinux.org>
836
837	Print hexadecimal integer in error diagnostics using %#x.
838	The formerly used format string %x led to misleading output as there was
839	no clear indication sometimes whether the printed integer was decimal or
840	hexadecimal.
841
842	* aio.c (startup_child, test_ptrace_seize): Print status
843	using %#x format specifier instead of %x.
844
8452017-01-07  Dmitry V. Levin  <ldv@altlinux.org>
846
847	aio: print hexadecimal integer using %#x.
848	The formerly used format string %x led to misleading output as there was
849	no clear indication sometimes whether the printed integer was decimal or
850	hexadecimal.
851
852	* aio.c (print_common_flags): Print struct iocb.aio_flags using %#x
853	format specifier instead of %x.
854	* tests/aio.c (main): Likewise.
855
8562017-01-06  Dmitry V. Levin  <ldv@altlinux.org>
857
858	scsi: rewrite print_sg_io_buffer using printstr_ex(QUOTE_FORCE_HEX)
859	As printstr_ex has got QUOTE_FORCE_HEX flag support, there is no need
860	to implement it manually any longer.
861
862	* scsi.c (print_uchar): Remove.
863	(print_sg_io_buffer): Rewrite using printstr_ex(QUOTE_FORCE_HEX).
864
8652017-01-06  Eugene Syromyatnikov  <evgsyr@gmail.com>
866
867	getrandom: print string as hex-escaped.
868	Since there is no reason to interpret the value returned by getrandom as
869	ASCII string, it makes sense to always print it as a hex-escaped string.
870
871	* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
872	of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
873	to force hex-escaped string formatting.
874	* tests/getrandom.test: Remove no longer needed -xx flag as the string
875	is always printed in hexadecimal format now.
876
877	Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>
878
8792017-01-06  Eugene Syromyatnikov  <evgsyr@gmail.com>
880
881	util: add support for forcing printing string as hex-escaped.
882	This could be useful in cases when some binary data should not be
883	interpreted as an ASCII string, but rather as an array of byte values.
884
885	* defs.h (QUOTE_FORCE_HEX): New macro constant.
886	* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
887	in user_style parameter.
888
8892017-01-06  Eugene Syromyatnikov  <evgsyr@gmail.com>
890
891	term: do not abort decoding in case of non-verbose output.
892	The case of unset verbose is handled by umoven_or_printaddr, moreover,
893	exiting at this point is plain wrong and leads to last argument not
894	being printed while it should be.
895
896	* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
897	decode_modem_flags): Do not check verbose flags explicitly and do not
898	exit early if it is not set.
899
9002017-01-05  Dmitry V. Levin  <ldv@altlinux.org>
901
902	tests: skip fault injection tests on hppa if the kernel is too old.
903	* tests/fault_injection.sh: Add the minimal kernel version for hppa.
904
9052017-01-05  Dmitry V. Levin  <ldv@altlinux.org>
906
907	tests: skip readahead.test on MIPS n64 when built with glibc < 2.25.
908	Due to a bug in glibc readahead syscall wrapper on MIPS n64,
909	this wrapper cannot be used in readahead.test.
910
911	* tests/readahead.c [HAVE_READAHEAD && LINUX_MIPSN64 && glibc < 2.25]:
912	Undefine HAVE_READAHEAD.
913
914	Reported-by: James Cowgill <james410@cowgill.org.uk>
915
9162017-01-05  Dmitry V. Levin  <ldv@altlinux.org>
917
918	tests: replace init_magic with fill_memory.
919	Use the same fill_memory/fill_memory_ex interface in all affected tests.
920
921	* tests/ioctl_block.c (init_magic): Remove.
922	(main): Replace init_magic with fill_memory.
923	* tests/ioctl_evdev.c: Likewise.
924	* tests/ioctl_v4l2.c: Likewise.
925	* tests/ioctl_mtd.c (magic, init_magic): Remove.
926	(main): Replace init_magic with fill_memory.
927	* tests/ioctl_rtc.c: Likewise.
928
9292017-01-05  Dmitry V. Levin  <ldv@altlinux.org>
930
931	tests: rewrite ioctl_v4l2 test without reliance on init_magic.
932	* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros.
933	(main): Use them.  Rewrite expected output without assumptions
934	on any particular magic data.
935
9362017-01-04  Dmitry V. Levin  <ldv@altlinux.org>
937
938	tests: remove redundant casts in fill_memory{,_ex} invocations.
939	* tests/ioctl_loop.c (main): Remove redundant casts of fill_memory
940	first argument.
941	* tests/kexec_load.c (main): Likewise.
942	* tests/perf_event_open.c (main): Likewise.
943	* tests/quotactl.c (main): Likewise.
944	* tests/mq_sendrecv.c (main): Remove redundant casts of fill_memory_ex
945	first argument.
946	* tests/quotactl-xfs.c (main): Likewise.
947
9482017-01-04  Dmitry V. Levin  <ldv@altlinux.org>
949
950	tests: change the type of fill_memory{,_ex} first argument to void *
951	As these functions behave like memset, it's more convenient to have
952	the first argument of type void * like memset.
953
954	* tests/fill_memory.c (fill_memory, fill_memory_ex): Change the type
955	of first argument from "char *" to "void *".
956	* tests/tests.h (fill_memory, fill_memory_ex): Likewise.
957
9582017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
959
960	tests: check non-verbose decoding of LOOP_* ioctls.
961	* tests/ioctl_loop-nv.c: New file.
962	* tests/ioctl_loop-nv.test: New test.
963	* tests/ioctl_loop.c [!ABBREV] (ABBREV): Define to 0.
964	(print_loop_info, print_loop_info64): Handle [ABBREV != 0] case.
965	* tests/.gitignore: Add ioctl_loop-nv.
966	* tests/Makefile.am (check_PROGRAMS): Likewise.
967
968	tests: add more checks of LOOP_* ioctls decoding.
969	* tests/ioctl_loop.c: Include <linux/ioctl.h>.
970	(magic, lmagic): Move static constants ...
971	(main): ... here.  Change types of magic constants to kernel_ulong_t.
972	Add more checks.
973
9742017-01-04  JingPiao Chen  <chenjingpiao@gmail.com>
975	    Eugene Syromyatnikov  <evgsyr@gmail.com>
976
977	tests: check decoding of LOOP_* ioctls.
978	* tests/ioctl_loop.c: New file.
979	* tests/ioctl_loop-v.c: Likewise.
980	* tests/ioctl_loop.test: New test.
981	* tests/ioctl_loop-v.test: Likewise.
982	* tests/.gitignore: Add ioctl_loop and ioctl_loop-v.
983	* tests/Makefile.am (check_PROGRAMS): Likewise.
984	(DECODER_TESTS): Add ioctl_loop.test and ioctl_loop-v.test.
985
9862017-01-04  Dmitry V. Levin  <ldv@altlinux.org>
987
988	Drop vsprintf.c.
989	Drop custom vfprintf implementation that was disabled by default.
990	Apparently nobody tests strace with this vfprintf enabled, otherwise
991	multiple uses of format specifiers not supported by this custom vfprintf
992	would not left unnoticed.
993
994	The GNU C library is not the only libc available, so those who want
995	faster implementations of libc functions are encouraged to try building
996	strace with other libc implementations.
997
998	* vsprintf.c: Remove.
999	* Makefile.am (strace_SOURCES): Remove vsprintf.c.
1000	* defs.h (USE_CUSTOM_PRINTF, strace_vfprintf): Remove.
1001	* strace.c (tprintf): Replace strace_vfprintf with vfprintf.
1002
10032017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1004
1005	loop: remove unnecessary verbose check.
1006	The verbose flag is responsible for dereferencing of addresses, and it
1007	is perfectly handled by umove_or_printaddr; moreover, this early exit
1008	leads to incorrect formatting of last argument.
1009
1010	* loop.c (loop_ioctl): Do not check verbose flag explicitly and do not
1011	exit early if it is not set.
1012
10132017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1014
1015	loop: fix lo_encrypt_key field output.
1016	lo_encrypt_key is a sized string with its size specified by
1017	lo_encrypt_key_size field, so take lo_encrypt_key_size into account.
1018
1019	* loop.c (decode_loop_info, decode_loop_info64): Use minimum of
1020	LO_KEY_SIZE and lo_encrypt_key_size field value as lo_encrypt_key size.
1021
10222017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1023
1024	loop: print lo_encrypt_key_size field of struct loop_info as unsigned.
1025	It is converted to an unsigned value in kernel (see loop_info64_from_old
1026	in drivers/block/loop.c), so let's print it that way despite its type.
1027
1028	* loop.c (decode_loop_info): Print lo_encrypt_key_size as an uint32_t
1029	value.
1030
10312017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1032
1033	tests: add more checks of unknown ioctl command formatting.
1034	* tests/ioctl.c (main): Additional check for unknown ioctl command
1035	decoding.
1036	* tests/ioctl_evdev.c (main): Likewise.
1037	* tests/ioctl_dm.c: Include <linux/ioctl.h> for _IOC_SIZE and _IOC_NR.
1038	(main) <dummy_dm_ioctl1, dummy_dm_ioctl2, dummy_dm_arg>: New constants.
1039	Add more checks for unknown command formatting.
1040
10412017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1042
1043	ioctl: do not print explicit 0x prefix and do not specify minimum width.
1044	Specifying output width for size argument is rather misleading - it can
1045	be up to 14 bits in size.  The use of explicit "0x" prefix is
1046	discouraged because 0x0 looks ugly.  Usage of width specification along
1047	with alternate form flag leads to inconsistent output for 0.
1048	Let's use just plain %#x qualifiers instead.
1049
1050	* ioctl.c (ioctl_print_code): Change printf qualifiers for ioctl command
1051	type, number and size to "%#x".
1052	* tests/ioctl.c (main): Update expected test output.
1053	* tests/ioctl_dm.c (main): Likewise.
1054	* tests/ioctl_evdev.c (main): Likewise.
1055
10562017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1057
1058	loop: fix printing of the reserved field array items.
1059	They are of char type, so "hh" length modifier should be used (otherwise
1060	they are printed incorrectly as they are sign extended implicitly when
1061	passed as printf arguments in case char is a signed type which is true
1062	for most compilers).
1063
1064	* loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx"
1065	in printing routine for array elements of the "reserved" field of
1066	loop_info structure.
1067
10682017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
1069
1070	tests: check ioctl(SIOCGIFCONF) decoding.
1071	* tests/ioctl_sock_gifconf.c: New file.
1072	* tests/ioctl_sock_gifconf.test: New test.
1073	* tests/.gitignore: Add ioctl_sock_gifconf.
1074	* tests/Makefile.am (check_PROGRAMS): Likewise.
1075	(DECODER_TESTS): Add ioctl_sock_gifconf.test.
1076
1077	dm.c: add copyright notice.
1078
10792017-01-04  Dmitry V. Levin  <ldv@altlinux.org>
1080
1081	Add scno.h and syscallent.i to .gitignore files.
1082	* .gitignore: Add /scno.h and /syscallent.i.
1083	* tests/.gitignore: Add scno.h and syscallent.i.
1084
10852017-01-04  JingPiao Chen  <chenjingpiao@gmail.com>
1086
1087	tests/.gitignore: add generated files that should be ignored.
1088	* tests/.gitignore: Replace addkey with add_key, add attach-f-p-cmd.
1089
10902017-01-03  Dmitry V. Levin  <ldv@altlinux.org>
1091
1092	Remove checks of __NR_* availability from strace source code.
1093	* strace.c: Remove __NR_tkill checks, assume it is always defined.
1094	* util.c: Remove __NR_process_vm_readv checks and fallback definitions,
1095	assume it is always defined.
1096
1097	Include "scno.h" in files that check __NR_* constants.
1098	* strace.c: Include "scno.h".
1099	* util.c: Likewise.
1100
1101	Generate scno.h for use during the build of strace itself.
1102	* Makefile.am: Include scno.am.
1103	($(strace_OBJECTS)): New rule.
1104
11052017-01-01  Dmitry V. Levin  <ldv@altlinux.org>
1106
1107	Generate scno.h without invoking a generated executable helper.
1108	Generate scno.h using only those tools that are available for cross
1109	build.  This allows to use scno.h during the build of strace itself.
1110
1111	* scno.am: New file.
1112	* scno.head: New file.
1113	* Makefile.am (EXTRA_DIST): Add it.
1114	* tests/generate_scno.c: Remove.
1115	* tests/.gitignore: Remove generate_scno.
1116	* tests/Makefile.am (check_PROGRAMS): Likewise.
1117	(CLEANFILES): Remove scno.h.
1118	(scno.h, $(scno_dependants)): Remove rules.
1119	(scno_dependants): Remove.
1120	($(objects)): New rule.
1121	Include ../scno.am.
1122
11232017-01-01  Dmitry V. Levin  <ldv@altlinux.org>
1124
1125	Update all publicly shown copyright year number ranges.
1126	* COPYING: Update copyright year number range.
1127	* configure.ac: Likewise.
1128	* strace.c: Likewise.
1129	* tests/strace-V.test: Use the current year for the check.
1130
11312016-12-31  Dmitry V. Levin  <ldv@altlinux.org>
1132
1133	defs.h: stop including <asm/unistd.h>
1134	Limit the number of files where <asm/unistd.h> is included
1135	to only those few that need it.
1136
1137	* defs.h: Do not include <asm/unistd.h>.
1138	* clone.c: Include <asm/unistd.h>.
1139	* strace.c: Likewise.
1140	* syscall.c: Likewise.
1141	* util.c: Likewise.
1142
11432016-12-30  Dmitry V. Levin  <ldv@altlinux.org>
1144
1145	tests: do not use BUILT_SOURCES.
1146	* tests/Makefile.am (ksysent.$(OBJEXT)): New rule.
1147	(BUILT_SOURCES): Remove.
1148
11492016-12-30  Dmitry V. Levin  <ldv@altlinux.org>
1150
1151	Fix cross build.
1152	This fixes cross build regression introduced by commit
1153	v4.15-39-g605a705a63d533dceb3c2d489468fcd3aed3963c.
1154
1155	* tests/Makefile.am (BUILT_SOURCES): Remove scno.h
1156	(objects, scno_dependants): New variables.
1157	($(scno_dependants)): New rule.
1158
1159	Reported-by: Joakim Bech <joakim.bech@linaro.org>
1160
11612016-12-30  Dmitry V. Levin  <ldv@altlinux.org>
1162
1163	tests: do not use defs.h and syscall.h.
1164	* tests/generate_scno.c: Include "tests.h", "sysent.h", <stdio.h>,
1165	<string.h>, and <asm/unistd.h> instead of "defs.h" and "syscall.h".
1166	* tests/ksysent.c: Likewise.
1167	* tests/nsyscalls.c: Include "tests.h", "sysent.h", <errno.h>,
1168	<stdio.h>, and <unistd.h> instead of "defs.h" and "syscall.h".
1169
1170	Move definition of struct sysent and trace flags to a separate file.
1171	* sysent.h: New file.
1172	* Makefile.am (strace_SOURCES): Add it.
1173	* defs.h: Include it.
1174	(struct sysent, TRACE_FILE, TRACE_IPC, TRACE_NETWORK, TRACE_PROCESS,
1175	TRACE_SIGNAL, TRACE_DESC, TRACE_MEMORY, SYSCALL_NEVER_FAILS,
1176	STACKTRACE_INVALIDATE_CACHE, STACKTRACE_CAPTURE_ON_ENTER,
1177	TRACE_INDIRECT_SUBCALL, COMPAT_SYSCALL_TYPES): Remove.
1178
11792016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1180
1181	Mpersify SIOC* ioctls.
1182	struct ifreq and struct ifconf are ABI-dependent and should have been
1183	mpersified.
1184
1185	* defs.h (sock_ioctl): Remove prototype.
1186	* sock.c (struct_ifconf, struct_ifreq): New typedefs.
1187	(DEF_MPERS_TYPE(struct_ifconf), DEF_MPERS_TYPE(struct_ifreq),
1188	MPERS_DEFS): New includes.
1189	(print_ifreq, print_ifc_len, print_ifconf_ifreq): Replace struct ifreq
1190	with struct_ifreq.
1191	(decode_ifconf): Replace struct ifconf with struct_ifconf, struct ifreq
1192	with struct_fireq.
1193	(sock_ioctl): Wrap into MPERS_PRINTER_DECL.
1194
11952016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1196	    Dmitry V. Levin  <ldv@altlinux.org>
1197
1198	sock: rewrite decode_ifconf.
1199	* sock.c (decode_ifconf): Rewrite.
1200
12012016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1202
1203	xlat: update LOOP_* ioctl flags constants.
1204	* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_USE_AOPS
1205	and LO_FLAGS_DIRECT_IO.
1206	* xlat/loop_flags_options.in: Likewise.  Add default values
1207	for constants.
1208
12092016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1210
1211	loop: add fallback definitions for LOOP_* ioctl command constants.
1212	Since these are architecture-independent and have been added over the
1213	kernel's lifetime, it makes sense to have these definitions in strace
1214	itself.
1215
1216	* xlat/loop_cmds.in: New file.
1217	* loop.c: Include "xlat/loop_cmds.h".
1218	(loop_ioctl): Eliminate conditional compilation based on availability
1219	of LOOP_* constant definitions.
1220
12212016-12-29  Dmitry V. Levin  <ldv@altlinux.org>
1222
1223	xlat: extend syntax.
1224	* xlat/gen.sh: Implement #stop directive that stops preprocessor
1225	at the line it has been encountered during the first pass.  This could
1226	be used, for example, to provide fallback definitions for constants
1227	without defining xlat tables.
1228
12292016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1230	    Dmitry V. Levin  <ldv@altlinux.org>
1231
1232	loop: mpersify struct loop_info and loop_ioctl function.
1233	struct loop_info contains fields of type long, so it definitely should
1234	have been mpersified.
1235
1236	* defs.h (loop_ioctl): Remove prototype.
1237	* loop.c (struct_loop_info): New typedef.
1238	Include DEF_MPERS_TYPE(struct_loop_info) and MPERS_DEFS.
1239	(decode_loop_info): Replace struct loop_info with struct_loop_info.
1240	Cast lo_inode, lo_init[0], and lo_init[1] to kernel_ulong_t and print
1241	them using appropriate format specifiers.
1242	(loop_ioctl): Wrap into MPERS_PRINTER_DECL.
1243
12442016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1245
1246	loop: print lo_device and lo_rdevice fields using print_dev_t.
1247	* loop.c (decode_loop_info, decode_loop_info64): Use print_dev_t
1248	for printing lo_device and lo_rdevice fields.
1249
12502016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
1251	    Dmitry V. Levin  <ldv@altlinux.org>
1252
1253	Move device number printing code into a separate routine.
1254	* print_dev_t.c: New file.
1255	* Makefile.am (strace_SOURCES): Add it.
1256	* defs.h (print_dev_t): New prototype.
1257	* dm.c: Do not include <sys/sysmacros.h>.
1258	(dm_decode_device, dm_print_dev, dm_decode_dm_name_list): Use
1259	print_dev_t function for printing device numbers.
1260	* mknod.c: Do not include <sys/sysmacros.h>.
1261	(decode_mknod): Use print_dev_t function for printing device number.
1262	* print_struct_stat.c: Do not include <sys/sysmacros.h>.
1263	(print_struct_stat): Use print_dev_t function for printing device
1264	numbers.
1265
12662016-12-28  Dmitry V. Levin  <ldv@altlinux.org>
1267
1268	tests: enhance invalid address decoding check in seccomp-strict.test.
1269	* tests/seccomp-strict.c (main): Change the type of addr variable
1270	containg the invalid address from unsigned long to kernel_ulong_t,
1271	print it using %#llx format.
1272
12732016-12-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
1274
1275	tests: check decoding of prctl PR_GET_TID_ADDRESS operation.
1276	* tests/prctl-tid_address.c: New file.
1277	* tests/prctl-tid_address.test: New test.
1278	* tests/.gitignore: Add prctl-tid_address.
1279	* tests/Makefile.am (check_PROGRAMS): Likewise.
1280	(DECODER_TESTS): Add prctl-tid_address.test.
1281
12822016-12-28  Dmitry V. Levin  <ldv@altlinux.org>
1283
1284	Update the publicly shown copyright information.
1285	Set the publicly shown copyright holder to "The strace developers.".
1286
1287	* COPYING: Update copyright information.
1288	* configure.ac: Add AC_COPYRIGHT.
1289	* strace.c (print_version): New function.
1290	(init): Use it.
1291	* tests/strace-V.test: Update expected output.
1292
12932016-12-28  Dmitry V. Levin  <ldv@altlinux.org>
1294
1295	configure: specify project URL.
1296	* configure.ac (AC_INIT): Add URL.
1297
12982016-12-28  Seraphime Kirkovski  <kirkseraph@gmail.com>
1299
1300	Document signal injection.
1301	* strace.1: Describe :signal=SIG option of the fault injection syntax.
1302	* NEWS: Mention signal injection.
1303
13042016-12-28  Seraphime Kirkovski  <kirkseraph@gmail.com>
1305
1306	Implement signal injection.
1307	This extends the fault injection capability with :signal=SIG option
1308	which injects a signal on entering each syscall from the specified set.
1309
1310	:signal and :error options are complementary, if they are both specified
1311	the syscall will be fault injected as usual and the specified signal
1312	will be delivered to the tracee.
1313
1314	* defs.h (struct fault_opts): Change the type of err field to int16_t,
1315	add signo field.
1316	(trace_syscall): Add a pointer argument.
1317	* qualify.c: Include "nsig.h".
1318	(parse_fault_token): Handle signal= option.
1319	(qualify_fault): Update default fault_opts.
1320	* strace.c (trace): Forward signal number from trace_syscall
1321	to ptrace_restart(PTRACE_SYSCALL).
1322	* syscall.c (inject_syscall_fault_entering): Add pointer argument,
1323	save there the signal number specified by fault options.  Do not inject
1324	a syscall fault unless instructed by fault options.
1325	(update_syscall_fault_exiting): Update the error code injection check.
1326	(trace_syscall_entering): Add pointer argument, forward it to
1327	inject_syscall_fault_entering.
1328	(trace_syscall): Add pointer argument, forward it to
1329	trace_syscall_entering.
1330
13312016-12-28  Dmitry V. Levin  <ldv@altlinux.org>
1332
1333	Update README.md.
1334	* README.md: Update homepage URL, mention command-line interface
1335	and tampering capabilities in the description.
1336
13372016-12-28  Dmitry V. Levin  <ldv@altlinux.org>
1338
1339	tests: robustify prctl-arg2-intptr.test.
1340	Robustify prctl-arg2-intptr.test against unrelated prctl invocations.
1341
1342	* tests/prctl-arg2-intptr.test: Filter out unrelated PR_GET_*
1343	and PR_SET_* prctl calls.
1344
13452016-12-27  Dmitry V. Levin  <ldv@altlinux.org>
1346
1347	signal: remove redundant checks around NSIG.
1348	* signal.c (struct old_sigaction, struct new_sigaction,
1349	struct new_sigaction32): Remove safety checks for NSIG >= sizeof(long).
1350
1351	Introduce NSIG_BYTES.
1352	* nsig.h (NSIG_BYTES): New macro.
1353	* desc.c: Use it in comments instead of NSIG.
1354	* epoll.c: Likewise.
1355	* poll.c: Likewise.
1356	* signalfd.c: Likewise.
1357	* signal.c: Likewise.
1358	(sprintsigmask_n, print_sigset_addr_len_limit): Use it instead of NSIG.
1359	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Likewise.
1360	* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
1361	* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
1362	* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
1363	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
1364	* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
1365	* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
1366	* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
1367	* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
1368	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
1369	* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
1370	* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
1371	* tests/pselect6.c (main): Likewise.
1372
1373	Move NSIG ifdefery to a separate header file.
1374	* nsig.h: New file.
1375	* Makefile.am (strace_SOURCES): Add it.
1376	* signal.c: Include "nsig.h" instead of <signal.h>, remove
1377	NSIG workarounds.
1378	* sigreturn.c: Likewise.
1379	* syscall.c: Likewise.
1380	* tests/pselect6.c: Likewise.
1381
1382	Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro.
1383	* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
1384	(truncate_klong_to_current_wordsize,
1385	truncate_kulong_to_current_wordsize): Use it.
1386	* mem.c (SYS_FUNC(old_mmap)): Likewise.
1387	* util.c (umoven, umovestr, dumpiov_upto): Likewise.
1388	* syscall.c (trace_syscall_exiting): Likewise.
1389
1390	Simplify personality checks in msghdr.c and signal.c.
1391	* msghdr.c: Check for [!current_wordsize] instead
1392	of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
1393	* signal.c: Likewise.
1394
13952016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1396
1397	Replace widen_to_long with truncate_klong_to_current_wordsize.
1398	* defs.h (widen_to_long): Remove.
1399	(truncate_klong_to_current_wordsize): New static inline function.
1400	* aio.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents): Use it
1401	instead of widen_to_long.
1402	* linux/sparc64/get_syscall_args.c (get_syscall_args): Update comment.
1403	* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
1404
1405	Replace widen_to_ulong with truncate_kulong_to_current_wordsize.
1406	* defs.h (widen_to_ulong): Remove.
1407	(truncate_kulong_to_current_wordsize): New static inline function.
1408	* io.c (do_preadv, do_pwritev): Use it instead of widen_to_ulong.
1409
14102016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1411
1412	Simplify print_lld_from_low_high_val ifdefery.
1413	The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
1414	implementation.
1415
1416	* io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4
1417	&& SIZEOF_LONG == SIZEOF_LONG_LONG]
1418	and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
1419	into a single [SIZEOF_KERNEL_LONG_T > 4] case.
1420	[SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long
1421	instead of zero_extend_signed_to_ull.
1422
14232016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1424
1425	Simplify getllval ifdefery.
1426	The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
1427	implementation.
1428
1429	* util.c (getllval): Merge [SIZEOF_LONG > 4
1430	&& SIZEOF_LONG == SIZEOF_LONG_LONG]
1431	and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
1432	into a single [SIZEOF_KERNEL_LONG_T > 4] case.
1433
14342016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
1435
1436	prctl: print pointer returned by PR_GET_TID_ADDRESS as kernel long.
1437	Since there is no compat handler for x32/n32, kernel returns kernel's
1438	long as a result of the call.
1439
1440	Interesting, does any callee out there actually care to have enough room
1441	allocated for kernel long?
1442
1443	* prctl.c (SYS_FUNC(prctl)): Use printnum_kptr instead of printnum_ptr
1444	to print the value stored at address pointed by addr2 argument
1445	of PR_GET_TID_ADDRESS operation.
1446
14472016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
1448
1449	Add functions for printing pointers of kernel_ulong_t size.
1450	In cases where no compat for x32/n32 is implemented, pointer is of
1451	kernel's long size, so it should be printed appropriately.
1452
1453	* defs.h [!current_klongsize] (printnum_addr_klong_int): New prototype.
1454	(printnum_kptr): New macro.
1455	* util.c [!current_klongsize] (printnum_addr_klong_int): New function.
1456
14572016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
1458	    Dmitry V. Levin  <ldv@altlinux.org>
1459
1460	Print indirect pointers as pointers.
1461	Originally, printnum_long_int was used, but it prints NULL incorrectly.
1462
1463	* defs.h (DECL_PRINTNUM_ADDR): New macro.
1464	(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
1465	[!current_wordsize] (printnum_addr_long_int): New prototype.
1466	[!current_wordsize] (printnum_ptr): Use it.
1467	[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
1468	[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
1469	* util.c (DEF_PRINTNUM_ADDR): New macro.
1470	(DEF_PRINTNUM_ADDR(int, unsigned int),
1471	DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
1472	provide printnum_addr_int and printnum_addr_int64, accordingly.
1473	[!current_wordsize] (printnum_addr_long_int): New function.
1474	* xet_robust_list.c (sprintaddr): New function.
1475	(main): Use it, update expected output.
1476	* tests/ipc_sem.c (main): Update expected output.
1477
14782016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
1479
1480	ipc_sem: print 4th argument of semctl syscall as an address.
1481	* ipc_sem.c (SYS_FUNC(semctl)): Print 4th argument using printaddr.
1482	* tests/ipc_sem.c (cleanup): Update expected output.
1483
14842016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1485
1486	Do not define printnum_long_int on systems with constant current_wordsize
1487	* defs.h: Check [!current_wordsize] instead
1488	of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to select
1489	definitions of printnum_slong, printnum_ulong, and printnum_ptr.
1490	* util.c: Check [!current_wordsize] instead
1491	of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to decide
1492	whether to compile printnum_long_int.
1493
14942016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1495
1496	umoven: detect invalid addresses.
1497	Do not silently truncate tracee addresses to current_wordsize.
1498	After transition from long to kernel_ulong_t there should be no sign
1499	extension issues with tracee addresses, and invalid addresses should
1500	be printed properly.
1501
1502	* util.c (umoven): Check [SIZEOF_KERNEL_LONG_T > 4] instead
1503	of [SIZEOF_LONG > 4], reject addresses that do not fit into
1504	current_wordsize.
1505	* tests/umoven-illptr.c: New file.
1506	* tests/umoven-illptr.test: New test.
1507	* tests/.gitignore: Add umoven-illptr.
1508	* tests/Makefile.am (check_PROGRAMS): Likewise.
1509	(DECODER_TESTS): Add umoven-illptr.test.
1510
15112016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1512
1513	umovestr: detect invalid addresses.
1514	Do not silently truncate tracee addresses to current_wordsize.
1515	After transition from long to kernel_ulong_t there should be no sign
1516	extension issues with tracee addresses, and invalid addresses should
1517	be printed properly.
1518
1519	* util.c (umovestr): Check [SIZEOF_KERNEL_LONG_T > 4] instead
1520	of [SIZEOF_LONG > 4], reject addresses that do not fit into
1521	current_wordsize.
1522	* tests/umovestr-illptr.c: New file.
1523	* tests/umovestr-illptr.test: New test.
1524	* tests/.gitignore: Add umovestr-illptr.
1525	* tests/Makefile.am (check_PROGRAMS): Likewise.
1526	(DECODER_TESTS): Add umovestr-illptr.test.
1527
15282016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1529
1530	lseek: simplify _llseek syscall decoder.
1531	After transition from long to kernel_ulong_t the implementation
1532	could be made a bit simpler.
1533
1534	* lseek.c (SYS_FUNC(llseek)): Use direct cast to long long instead
1535	of zero_extend_signed_to_ull.
1536
15372016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1538
1539	lseek: merge two different implementations of lseek syscall decoder.
1540	After transition from long to kernel_ulong_t there are no mo
1541	complications that required to keep a separate implementation
1542	for x32 and mips n32.
1543
1544	* lseek.c (SYS_FUNC(lseek)): Merge two different implementations
1545	into a single one.
1546
15472016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1548
1549	Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval.
1550	After transition from long to kernel_ulong_t these fields
1551	are no longer needed.
1552
1553	* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
1554	(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
1555	[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
1556	(RVAL_MASK): Update.
1557	* io.c (print_lld_from_low_high_val): Check
1558	[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
1559	instead of [HAVE_STRUCT_TCB_EXT_ARG].
1560	Use u_arg instead of ext_arg.
1561	* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
1562	* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
1563	Remove.
1564	[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
1565	* linux/x86_64/get_error.c (get_error) [X32]: Remove.
1566	* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
1567	* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
1568	instead of [HAVE_STRUCT_TCB_EXT_ARG].
1569	[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
1570	instead of ext_arg.  Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
1571	* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
1572	to print_mmap.
1573	* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
1574	* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
1575	of RVAL_LUDECIMAL.
1576	* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
1577	instead of [HAVE_STRUCT_TCB_EXT_ARG].  Use u_arg instead of ext_arg.
1578
15792016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1580
1581	Remove getarg_klu.
1582	After transition from long to kernel_ulong_t we no longer need
1583	tcp->ext_arg, and therefore a function to access it is also no longer
1584	needed.
1585
1586	* defs.h (getarg_klu): Remove prototype.
1587	* util.c (getarg_klu): Remove.
1588	(printargs): Access tcp->u_arg directly
1589	* bjm.c (SYS_FUNC(init_module)): Likewise.
1590	* clone.c (SYS_FUNC(unshare)): Likewise.
1591	* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
1592	* kcmp.c (SYS_FUNC(kcmp)): Likewise.
1593	* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
1594	* keyctl.c (SYS_FUNC(keyctl)): Likewise.
1595	* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
1596	* mem.c (do_mprotect): Likewise.
1597	* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
1598	* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
1599	* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
1600	Likewise.
1601
16022016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1603
1604	Remove printaddr_klu.
1605	After transition from long to kernel_ulong_t we no longer need
1606	two versions of printaddr function.
1607
1608	* defs.h (printaddr): Remove.
1609	(printaddr_klu): Rename to printaddr.
1610	* util.c (printaddr_klu): Likewise.
1611	* bjm.c (SYS_FUNC(init_module)): Replace printaddr_klu with printaddr.
1612	* mem.c (do_mprotect): Likewise.
1613
16142016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
1615
1616	tests: check decoding of a subset of prctl operations.
1617	Check decoding of prctl operations that take the second syscall argument
1618	as a pointer to an integer.
1619
1620	* tests/prctl-arg2-intptr.c: New file.
1621	* tests/prctl-arg2-intptr.test: New test.
1622	* tests/.gitignore: Add prctl-arg2-intptr.
1623	* tests/Makefile.am (check_PROGRAMS): Likewise.
1624	(DECODER_TESTS): Add prctl-arg2-intptr.test.
1625
16262016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1627
1628	Automatically replace PRI_kr[dux] with PRI_kl[dux]
1629	Remove temporary macros created for transition from long
1630	to kernel_ulong_t.
1631
1632	Automatically replace PRI_kr[dux] with PRI_kl[dux] using
1633	$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'
1634
1635	* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.
1636
16372016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1638
1639	Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t.
1640	Remove temporary types created for transition from long
1641	to kernel_ulong_t.
1642
1643	Automatically replace kernel_scno_t and kernel_ureg_t with
1644	kernel_ulong_t using
1645	$ git grep -El 'kernel_(scno|ureg)_t' |
1646	  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'
1647
1648	* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
1649	All users updated.
1650
16512016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1652
1653	Redirect kernel_ureg_t and kernel_scno_t from unsigned long to kernel_ulong_t
1654	* defs.h (struct tcb): Change u_rval type from long to kernel_long_t.
1655	(PRI_krd, PRI_kru, PRI_krx): Redirect to PRI_kld, PRI_klu, and PRI_klx.
1656	* kernel_types.h (kernel_scno_t, kernel_ureg_t): Redirect
1657	to kernel_ulong_t.
1658
16592016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1660
1661	Print kernel_ureg_t and kernel_scno_t using dedicated format strings.
1662	Prepare for the change of kernel_ureg_t and kernel_scno_t from
1663	unsigned long to kernel_ulong_t.
1664
1665	* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
1666	All users updated.
1667
16682016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1669
1670	vm_read_mem: detect address truncation.
1671	When sizeof(kernel_ureg_t) > sizeof(long), the tracee address passed
1672	to vm_read_mem could be silently truncated.  Detect this situation
1673	and return EIO when the tracee address does not fit into unsigned long.
1674
1675	* util.c (vm_read_mem): Save raddr argument into a temporary variable
1676	truncated_raddr of type unsigned long.  Set errno to EIO and return -1
1677	when truncated_raddr does not equal to raddr.
1678
16792016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1680
1681	trace_syscall_exiting: prepare personality check for u_rval type change.
1682	* syscall.c (trace_syscall_exiting): Check for sizeof(tcp->u_rval)
1683	instead of sizeof(long) when deciding how to print tcp->u_rval.
1684
16852016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1686
1687	Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
1688	Direct casts to kernel_ureg_t will not work after the change
1689	of kernel_ureg_t from unsigned long to kernel_ulong_t.
1690
1691	* defs.h (ptr_to_kulong): New macro.
1692	* block.c (print_blkpg_req): Use it instead of explicit casts
1693	to kernel_ureg_t.
1694	* btrfs.c (btrfs_ioctl): Likewise.
1695	* evdev.c (ff_effect_ioctl): Likewise.
1696	* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
1697	* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
1698	* mtd.c (decode_mtd_oob_buf): Likewise.
1699	* printsiginfo.c (printsigval, print_si_info): Likewise.
1700	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
1701	* sigaltstack.c (print_stack_t): Likewise.
1702	* sock.c (decode_ifconf): Likewise.
1703	* sysctl.c (SYS_FUNC(sysctl)): Likewise.
1704	* util.c (dumpiov_upto): Likewise.
1705	* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
1706	print_v4l2_ext_controls): Likewise.
1707
17082016-12-26  Dmitry V. Levin  <ldv@altlinux.org>
1709
1710	umove*: remove redundant casts.
1711	* util.c (umoven, umovestr): Remove casts from unsigned long to pointer.
1712
1713	upoke: remove redundant casts.
1714	* upoke.c (upoke): Remove casts from unsigned long to pointer.
1715
17162016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1717
1718	signal: cleanup decoding of sa_handler and sa_restorer.
1719	Change type of sa_handler and sa_restorer fields from function pointers
1720	to unsigned long.  This saves the code from a lot of casts between
1721	pointers and integers.
1722
1723	Rename __sa_handler to sa_handler__ as names starting with underscore
1724	symbol are reserved and should not be used.
1725
1726	* signal.c (old_sigaction): Rename __sa_handler to sa_handler__,
1727	all users updated.  Change the type of sa_handler__ and sa_restorer
1728	from pointer to unsigned long.
1729	(old_sigaction32): Rename __sa_handler to sa_handler__, all users
1730	updated.
1731	(decode_old_sigaction): Remove now redundant casts from
1732	old_sigaction32.sa_handler__ to old_sigaction.sa_handler__,
1733	from old_sigaction32.sa_restorer to old_sigaction.sa_restorer,
1734	and from old_sigaction.sa_handler__ to unsigned long.  Print
1735	old_sigaction.sa_restorer using printaddr.
1736	* signal.c (new_sigaction): Rename __sa_handler to sa_handler__,
1737	all users updated.  Change the type of sa_handler__ and sa_restorer
1738	from pointer to unsigned long.
1739	(new_sigaction32): Rename __sa_handler to sa_handler__, all users
1740	updated.
1741	(decode_new_sigaction): Remove now redundant casts from
1742	new_sigaction32.sa_handler__ to new_sigaction.sa_handler__,
1743	from new_sigaction32.sa_restorer to new_sigaction.sa_restorer,
1744	and from new_sigaction.sa_handler__ to unsigned long.  Print
1745	new_sigaction.sa_restorer using printaddr.
1746
17472016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1748
1749	signal: change signal handler address type from unsigned long to kernel_ureg_t
1750	* signal.c (get_sa_handler_str, print_sa_handler): Change handler type
1751	from unsigned long to kernel_ureg_t.
1752
1753	quota: change address argument type from unsigned long to kernel_ureg_t.
1754	* quota.c (decode_cmd_data): Change the type of data argument
1755	from unsigned long to kernel_ureg_t.
1756
1757	execve: prepare for handling big pointers.
1758	* execve.c (printargv): Change cp.p64 type from unsigned long
1759	to kernel_ulong_t so it could handle wordsize > sizeof(long) properly.
1760
17612016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1762
1763	clone: print clone flags without truncation.
1764	The flags argument is defined in kernel as unsigned long,
1765	so change its decoding to avoid truncation.
1766
1767	* clone.c (SYS_FUNC(clone)): Change flags type from unsigned long
1768	to kernel_ureg_t, print it using printflags64 instead of printflags.
1769
17702016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1771
1772	Use printxval64 instead of printxval_long.
1773	After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
1774	to stop using printxval_long proxy and pass syscall arguments directly
1775	to printxval64.
1776
1777	* defs.h (printxval_long): Remove.
1778	* fcntl.c (print_fcntl): Replace printxval_long with printxval64.
1779	* mtd.c (mtd_ioctl): Likewise.
1780	* numa.c (SYS_FUNC(mbind)): Likewise.
1781	* or1k_atomic.c [OR1K] (SYS_FUNC(or1k_atomic)): Likewise.
1782	* sysmips.c [MIPS] (SYS_FUNC(sysmips)): Likewise.
1783	* term.c (term_ioctl): Likewise.
1784
17852016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1786
1787	Use printflags64 instead of printflags_long.
1788	After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
1789	to stop using printflags_long proxy and pass syscall arguments directly
1790	to printflags64.
1791
1792	* defs.h (printflags_long): Remove.
1793	* fcntl.c (print_fcntl): Replace printflags_long with printflags64.
1794	* numa.c (SYS_FUNC(get_mempolicy)): Likewise.
1795	* perf.c (SYS_FUNC(perf_event_open)): Likewise.
1796	* sram_alloc.c [BFIN] (SYS_FUNC(sram_alloc)): Likewise.
1797
17982016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1799
1800	upeek, upoke: change argument types from long to unsigned long.
1801	* defs.h (upeek, upoke): Change offset argument type from long
1802	to unsigned long.  Change res argument type from long to kernel_ureg_t.
1803	* upeek.c (upeek): Likewise.
1804	* upoke.c (upoke.c): Likewise.
1805	* syscall.c (print_pc) [ARCH_PC_PEEK_ADDR]: Change pc type from long
1806	to kernel_ureg_t.
1807	* linux/aarch64/arch_regs.c (arm_sp_ptr): Remove redundant cast.
1808	* linux/metag/get_syscall_args.c (get_syscall_args): Likewise.
1809	* linux/sh/get_syscall_result.c (get_syscall_result_regs): Likewise.
1810	* linux/sh64/get_syscall_result.c (get_syscall_result_regs): Likewise.
1811	* linux/powerpc/getregs_old.c (getregs_old): Remove redundant casts.
1812	* linux/alpha/arch_getrval2.c (getrval2): Change r20 type from long
1813	to unsigned long.
1814	* linux/alpha/arch_regs.c (alpha_r0, alpha_a3): Change type from long
1815	to unsigned long.
1816	* linux/bfin/arch_regs.c (bfin_r0): Likewise.
1817	* linux/crisv10/arch_regs.c (cris_r10): Likewise.
1818	* linux/hppa/arch_regs.c (hppa_r28): Likewise.
1819	* linux/ia64/arch_regs.c (IA64_PSR_IS): Likewise.
1820	* linux/microblaze/arch_regs.c (microblaze_r3): Likewise.
1821	* linux/sh/arch_regs.c (sh_r0): Likewise.
1822	* linux/sh64/arch_regs.c (sh64_r9): Likewise.
1823	* linux/xtensa/arch_regs.c (xtensa_a2): Likewise.
1824	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Change addr type
1825	from long to unsigned long.
1826	* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
1827	* linux/alpha/get_scno.c (arch_get_scno): Update for the change
1828	of signedness.
1829	* linux/arc/get_syscall_args.c (get_syscall_args): Change arc_args type
1830	from pointer to long to pointer to unsigned long.
1831	* linux/arm/arch_regs.c (arm_sp_ptr): Change type from pointer to long
1832	to pointer to unsigned long.
1833	* linux/arm/arch_regs.h (arm_sp_ptr): Likewise.
1834	* linux/i386/arch_regs.c (i386_esp_ptr): Likewise.
1835	* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
1836	* linux/m68k/arch_regs.c (m68k_usp_ptr): Likewise.
1837	* linux/m68k/arch_regs.h (m68k_usp_ptr): Likewise.
1838	* linux/ia64/get_syscall_args.c (get_syscall_args): Use umove
1839	instead of umoven.
1840	* linux/sh/arch_getrval2.c (getrval2): Change val type from long
1841	to unsigned long.
1842
1843	arch_sigreturn: change tracee address type from long to unsigned long.
1844	* linux/arm/arch_sigreturn.c (arch_sigreturn): Change addr variable
1845	type from long to unsigned long.
1846	* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
1847	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
1848	* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
1849	* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
1850	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
1851	* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
1852	* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Change the type
1853	of addr and regs variables from long to unsigned long.
1854	* linux/mips/arch_sigreturn.c (arch_sigreturn): Change addr variable
1855	type from long to kernel_ureg_t.
1856	* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Change the type
1857	of offset and addr variables from long to kernel_ureg_t.
1858
1859	kexec: change flags type from unsigned long to kernel_ureg_t.
1860	* kexec.c (SYS_FUNC(kexec_load)): Change n variable type
1861	from unsigned long to kernel_ureg_t.  Use printxval64 instead
1862	of printxval_long.  Use printflags64 instead of printflags_long.
1863
1864	kexec: change types of pointers and sizes to kernel_ureg_t.
1865	* kexec.c (print_seg): Change the type of *seg and seg_buf variables
1866	from unsigned long to kernel_ureg_t.
1867	(print_kexec_segments): Change len argument type from unsigned long
1868	to kernel_ureg_t.  Change seg variable type from unsigned long
1869	to kernel_ureg_t.
1870
1871	printsiginfo: change len argument type from unsigned long to kernel_ureg_t
1872	* printsiginfo.c (print_siginfo_array): Change len argument type
1873	from unsigned long to kernel_ureg_t.
1874
1875	signal: change address argument type from unsigned long to kernel_ureg_t
1876	* signal.c (print_sigqueueinfo): Change address argument type
1877	from unsigned long to kernel_ureg_t.
1878
1879	statfs64: change size argument type from unsigned long to kernel_ureg_t.
1880	* defs.h (print_struct_statfs64): Change size argument type
1881	from unsigned long to kernel_ureg_t.
1882	* print_statfs.c (print_struct_statfs64): Likewise.
1883	* fetch_struct_statfs.c (fetch_struct_statfs64): Likewise.
1884	* fstatfs64.c (SYS_FUNC(fstatfs64)): Pass size argument directly
1885	to print_struct_statfs64.
1886	* statfs64.c (SYS_FUNC(statfs64)): Likewise.
1887
1888	Cast tcp->u_rval to kernel_ureg_t instead of unsigned long.
1889	* fcntl.c (print_fcntl): Cast tcp->u_rval to kernel_ureg_t instead
1890	of unsigned long.
1891	* membarrier.c (SYS_FUNC(membarrier)): Likewise.
1892	* prctl.c (SYS_FUNC(prctl)): Likewise.
1893	* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
1894	* time.c (do_adjtimex): Likewise.
1895
1896	decode_sockbuf: change addrlen argument type from long to kernel_ureg_t.
1897	* net.c (decode_sockbuf): Change addrlen argument type from long
1898	to kernel_ureg_t.
1899
1900	netlink: change size types from unsigned long to kernel_ureg_t.
1901	* defs.h (decode_netlink): Change len argument type from unsigned long
1902	to kernel_ureg_t.
1903	* netlink.c (fetch_nlmsghdr): Likewise.
1904	(decode_nlmsghdr_with_payload): Likewise.  Change nlmsg_len variable
1905	type from unsigned long to unsigned int.
1906	(decode_netlink): Change the type of len argument and next_len variable
1907	from unsigned long to kernel_ureg_t.  Change nlmsg_len variable type
1908	from unsigned long to unsigned int.
1909
1910	ipc_msg: change size types from unsigned long to kernel_ureg_t.
1911	* ipc_msg.c (tprint_msgsnd): Change count argument type
1912	from unsigned long to kernel_ureg_t.  Change flags argument type
1913	from unsigned long to unsigned int.
1914	(tprint_msgrcv): Change the type of count and msgtyp arguments
1915	from unsigned long to kernel_ureg_t.
1916	(fetch_msgrcv_args): Change *pair type from unsigned long
1917	to kernel_ureg_t.
1918	(SYS_FUNC(msgrcv)): Change pair type from unsigned long
1919	to kernel_ureg_t.
1920	* print_msgbuf.c (tprint_msgbuf): Change count argument type
1921	from unsigned long to kernel_ureg_t.
1922
1923	dumpiov_upto: change size types from unsigned long to kernel_ureg_t.
1924	* defs.h (dumpiov_upto): Change data_size argument type
1925	from unsigned long to kernel_ureg_t.
1926	* util.c (dumpiov_upto): Change the type of data_size argument
1927	and iov_len variable from unsigned long to kernel_ureg_t.
1928
19292016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1930
1931	msghdr: change cmsghdr size types from size_t to unsigned int.
1932	As the kernel does not accept control messages longer than the value
1933	of int sysctl_optmem_max kernel variable exported as
1934	/proc/sys/net/core/optmem_max, we do not print them either.
1935
1936	Since unsigned int has enough room to contain any valid control message
1937	size, change all internal cmsghdr size types from size_t
1938	to unsigned int.
1939
1940	* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
1941	print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_uint8_t,
1942	print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr,
1943	cmsg_printer, print_cmsg_type_data): Change data_len argument type
1944	from size_t to unsigned int.
1945	(cmsg_socket_printers): Change min_len type from size_t to unsigned int.
1946	(decode_msg_control): Change the type of in_control_len argument,
1947	cmsg_len, and len variables from size_t to kernel_ureg_t.
1948	Change the type of cmsg_size, control_len, and buf_len variables
1949	from size_t to unsigned int.
1950
19512016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
1952
1953	msghdr: change register based size types from unsigned long to kernel_ureg_t
1954	* defs.h (dumpiov_in_msghdr): Change data_size argument type
1955	from unsigned long to kernel_ureg_t.
1956	* msghdr.h (print_struct_msghdr): Likewise.
1957	* msghdr.c (print_struct_msghdr): Likewise.  Cast msghdr.msg_iovlen
1958	and msghdr.msg_controllen to kernel_ureg_t instead of unsigned long.
1959	(decode_msghdr, dumpiov_in_msghdr): Change data_size argument type
1960	from unsigned long to kernel_ureg_t.
1961	(SYS_FUNC(sendmsg)): Pass -1 instead of -1UL as data_size argument
1962	to decode_msghdr.
1963	* mmsghdr.c (print_struct_mmsghdr): Pass (kernel_ureg_t) -1 instead
1964	of -1UL as data_size argument to print_struct_msghdr.
1965	(dumpiov_in_mmsghdr): Cast msghdr.msg_iovlen to kernel_ureg_t instead
1966	of unsigned long.
1967	* syscall.c (dumpio): Pass -1 instead of -1UL as data_size argument
1968	to dumpiov_in_msghdr
1969
1970	mq: remove redundant u_rval check.
1971	* mq.c (SYS_FUNC(mq_timedreceive)): Do not check for tcp->u_rval < 0,
1972	syserror(tcp) is enough, and printstrn can handle len < 0 anyway.
1973
1974	io: change size types from unsigned long to kernel_ureg_t.
1975	* defs.h (tprint_iov_upto): Change the type of len and data_size
1976	arguments from unsigned long to kernel_ureg_t.
1977	(tprint_iov): Change the type of len argument from unsigned long
1978	to kernel_ureg_t.
1979	* io.c (print_iovec_config): Change data_size type from unsigned long
1980	to kernel_ureg_t.
1981	(print_iovec): Change the type of *iov, iov_buf, and len variables
1982	from unsigned long to kernel_ureg_t.
1983	(tprint_iov_upto): Change the type of len and data_size arguments, and
1984	the type of iov variable from unsigned long to kernel_ureg_t.
1985
1986	mount: change flags type from unsigned long to kernel_ureg_t.
1987	* mount.c (SYS_FUNC(mount)): Change the type of flags from unsigned long
1988	to kernel_ureg_t, use printflags64 instead of printflags_long
1989	to print it.
1990
1991	mem: change mmap arguments type from unsigned long to kernel_ureg_t.
1992	* mem.c (print_mmap): Change the type of len, prot, and flags
1993	from unsigned long to kernel_ureg_t.  Use printflags64 instead
1994	of printflags_long.  Use printxval64 instead of printxval_long.
1995	(SYS_FUNC(old_mmap)): Check for current_klongsize instead
1996	of [AARCH64 || X86_64] to take X32 into account.
1997	(SYS_FUNC(mremap)): Use printflags64 instead of printflags_long.
1998	(SYS_FUNC(remap_file_pages)): Change the type of size, prot, pgoff, and
1999	flags from unsigned long to kernel_ureg_t.  Use printflags64 instead
2000	of printflags_long.  Use printxval64 instead of printxval_long.
2001	[POWERPC] (SYS_FUNC(subpage_prot)): Change the type of len and nmemb
2002	from unsigned long to kernel_ureg_t.
2003
2004	numa: change size arguments type from unsigned long to kernel_ureg_t.
2005	* numa.c (print_node, print_addr): Add kernel_ureg_t support.
2006	(print_nodemask): Change type of maxnodes argument from unsigned long
2007	to kernel_ureg_t.
2008	(SYS_FUNC(move_pages)): Change npages type from unsigned long
2009	to kernel_ureg_t.  Change buf type from long to kernel_ureg_t.
2010
2011	print_sigset_addr_len: change len argument type from long to kernel_ureg_t
2012	* defs.h (print_sigset_addr_len): Change len argument type from long
2013	to kernel_ureg_t.
2014	* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.
2015
2016	process_vm: change size arguments type from unsigned long to kernel_ureg_t
2017	* process_vm.c (SYS_FUNC(process_vm_readv),
2018	SYS_FUNC(process_vm_writev)): Change the type of local_iovcnt,
2019	remote_iovcnt, and flags from unsigned long to kernel_ureg_t.
2020
2021	printstr*: change len argument type from long to kernel_ureg_t.
2022	* defs.h (printstr_ex, printstrn): Change len argument type from long
2023	to kernel_ureg_t.
2024	* util.c (printstr_ex): Likewise.
2025
2026	xattr: change size arguments type from unsigned long to kernel_ureg_t.
2027	* xattr.c (print_xattr_val): Change type of insize and size arguments
2028	from unsigned long to kernel_ureg_t.
2029	(print_xattr_list): Change type of size argument from unsigned long
2030	to kernel_ureg_t.
2031
20322016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
2033
2034	printstr_ex: fix decoding of non-NUL-terminated strings when len == -1.
2035	Do not treat len == -1 in any special way.  All users who need the
2036	string to be handled as a NUL-terminated string set QUOTE_0_TERMINATED
2037	bit in user_style flags already.
2038
2039	* util.c (printstr_ex): Remove (len == -1) check.
2040	* tests/printstr.c: New file.
2041	* tests/printstr.test: New test.
2042	* tests/.gitignore: Add printstr.
2043	* tests/Makefile.am (check_PROGRAMS): Likewise.
2044	(DECODER_TESTS): Add printstr.test.
2045
20462016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
2047
2048	Fix decoding of sethostname syscall.
2049	The second argument of sethostname syscall is not an unsigned long but
2050	unsigned int.  The kernel does not look at the string argument when
2051	the length argument is too long.
2052
2053	* hostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
2054	[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
2055	(SYS_FUNC(sethostname)): Treat the second argument as unsigned int.
2056	Print the first argument as a pointer when the second argument exceeds
2057	__NEW_UTS_LEN.
2058	* tests/sethostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
2059	[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
2060	(main): Use it.  Check that the second argument of sethostname
2061	is handled as unsigned int.  Check that the first argument is printed
2062	as a pointer when the second argument exceeds __NEW_UTS_LEN.
2063
20642016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
2065
2066	tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h.
2067	* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
2068	(f8ill_ptr_to_kulong): New static inline function.
2069
20702016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
2071
2072	printstr: rename to printstrn, add printstr as a thin wrapper.
2073	As about half of all printstr uses cases are invocations with the last
2074	argument set to -1, create a dedicated function for this use case.
2075
2076	* defs.h (printstr): Rename to printstrn.  All callers updated.
2077	(printstr): New static inline function.  All callers updated.
2078
20792016-12-25  Dmitry V. Levin  <ldv@altlinux.org>
2080
2081	process: change ptrace arguments type from unsigned long to kernel_ureg_t
2082	(SYS_FUNC(ptrace)): Change type of request and data arguments
2083	from unsigned long to kernel_ureg_t.
2084
2085	process: change tracee address type from unsigned long to kernel_ureg_t.
2086	* process.c (print_user_offset_addr): Change address argument type
2087	from unsigned long to kernel_ureg_t.
2088	(SYS_FUNC(ptrace)): Change addr variable type from unsigned long
2089	to kernel_ureg_t.
2090
2091	net: change address argument type from long to kernel_ureg_t.
2092	* net.c (decode_sockbuf, decode_pair_fd, print_linger, print_ucred,
2093	print_tpacket_stats, print_icmp_filter, print_getsockopt, print_mreq,
2094	print_mreq6, print_group_req, print_tpacket_req, print_packet_mreq,
2095	print_setsockopt): Change address argument type from long
2096	to kernel_ureg_t.
2097
2098	print_mq_attr: change address argument type from long to kernel_ureg_t.
2099	* print_mq_attr.c (printmqattr): Change address argument type from long
2100	to kernel_ureg_t.
2101
2102	ipc_*: change address argument type from long to kernel_ureg_t.
2103	* ipc_msg.c (tprint_msgsnd, tprint_msgrcv, fetch_msgrcv_args): Change
2104	address argument type from long to kernel_ureg_t.
2105	* ipc_msgctl.c (print_msqid_ds): Likewise.
2106	* ipc_sem.c (tprint_sembuf_array): Likewise.
2107	* ipc_shmctl.c (print_shmid_ds): Likewise.
2108
2109	print_msgbuf: change address argument type from long to kernel_ureg_t.
2110	* print_msgbuf.c (tprint_msgbuf): Change address argument type
2111	from long to kernel_ureg_t.
2112
2113	desc: change tracee address type from long to kernel_ureg_t.
2114	* desc.c (decode_select): Rename arg to addr, change its type
2115	from long to kernel_ureg_t.
2116
2117	uid: change address argument type from long to kernel_ureg_t.
2118	* uid.c (get_print_uid): Change address argument type
2119	from long to kernel_ureg_t.
2120
2121	time: change address argument type from long to kernel_ureg_t.
2122	* time.c (print_timezone, do_adjtimex): Change address argument type
2123	from long to kernel_ureg_t.
2124
2125	sched: change address argument type from long to kernel_ureg_t.
2126	* sched.c (print_sched_attr): Change address argument type
2127	from long to kernel_ureg_t.
2128
2129	printsiginfo: change address argument type from long to kernel_ureg_t.
2130	* printsiginfo.c (printsiginfo_at): Change address argument type
2131	from long to kernel_ureg_t.
2132
2133	print_timex: change address argument type from long to kernel_ureg_t.
2134	* print_timex.c (print_timex): Change address argument type
2135	from long to kernel_ureg_t.
2136
2137	print_sigevent: change address argument type from long to kernel_ureg_t.
2138	* print_sigevent.c (print_sigevent): Change address argument type
2139	from long to kernel_ureg_t.
2140
2141	poll: change address argument type from long to kernel_ureg_t.
2142	* poll.c (decode_poll_exiting): Change tracee address argument type
2143	from long to kernel_ureg_t.
2144
2145	printrusage*: change tracee address argument type from long to kernel_ureg_t
2146	* defs.h [ALPHA] (printrusage32): Change address argument type
2147	from long to kernel_ureg_t.
2148	* printrusage.c (printrusage): Likewise.
2149	[ALPHA] (printrusage32): Likewise.
2150	* wait.c (printwaitn): Change the type of tracee address argument
2151	of print_rusage from long to kernel_ureg_t.
2152
2153	print_time*: change tracee address argument type from long to kernel_ureg_t
2154	* defs.h [ALPHA] (sprint_timeval32, print_timeval32,
2155	print_timeval32_pair, print_itimerval32): Change address argument type
2156	from long to kernel_ureg_t.
2157	* desc.c (decode_select): Change the type of tracee address argument
2158	of print_tv_ts and sprint_tv_ts from long to kernel_ureg_t.
2159	* print_timespec.c (print_timespec, sprint_timespec,
2160	print_timespec_utime_pair, print_itimerspec): Change address argument
2161	type from long to kernel_ureg_t.
2162	* print_timeval.c (print_timeval, print_timeval_pair, sprint_timeval,
2163	print_itimerval, print_timeval32, print_timeval32_pair,
2164	print_itimerval32, sprint_timeval32): Likewise.
2165
2166	rtc: change type of ioctl 3rd argument from long to kernel_ureg_t.
2167	* rtc.c (decode_rtc_time, decode_rtc_wkalrm, decode_rtc_pll_info):
2168	Change addr type from long to kernel_ureg_t.
2169	(rtc_ioctl): Change arg type from long to kernel_ureg_t.
2170
2171	mtd: change type of ioctl 3rd argument from long to kernel_ureg_t.
2172	* mtd.c (decode_erase_info_user, decode_erase_info_user64,
2173	decode_mtd_oob_buf, decode_mtd_oob_buf64, decode_otp_info,
2174	decode_otp_select, decode_mtd_write_req, decode_mtd_info_user,
2175	decode_nand_oobinfo, decode_nand_ecclayout_user, decode_mtd_ecc_stats):
2176	Change addr type from long to kernel_ureg_t.
2177	(mtd_ioctl): Change arg type from long to kernel_ureg_t.
2178
2179	hdio: change type of ioctl 3rd argument from long to kernel_ureg_t.
2180	* hdio.c (hdio_ioctl): Change arg type from long to kernel_ureg_t.
2181
2182	v4l2: change type of ioctl 3rd argument from long to kernel_ureg_t.
2183	* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc, print_v4l2_format,
2184	print_v4l2_requestbuffers, print_v4l2_buffer, print_v4l2_framebuffer,
2185	print_v4l2_buf_type, print_v4l2_streamparm, print_v4l2_standard,
2186	print_v4l2_input, print_v4l2_control, print_v4l2_queryctrl,
2187	print_v4l2_cropcap, print_v4l2_crop, print_v4l2_ext_controls,
2188	print_v4l2_frmsizeenum, print_v4l2_frmivalenum,
2189	print_v4l2_create_buffers, v4l2_ioctl): Change arg type from long
2190	to kernel_ureg_t.
2191
2192	evdev: change type of ioctl 3rd argument from long to kernel_ureg_t.
2193	* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
2194	getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
2195	evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
2196	from long to kernel_ureg_t.
2197
2198	btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t.
2199	* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
2200	to kernel_ureg_t.
2201
2202	block: change type of ioctl 3rd argument from long to kernel_ureg_t.
2203	* block.c (block_ioctl): Change arg type from long to kernel_ureg_t.
2204
2205	Change type of ioctl 3rd argument from long to kernel_ureg_t.
2206	* defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t.
2207	* dm.c (dm_known_ioctl, dm_ioctl): Likewise.
2208	* file_ioctl.c (file_ioctl): Likewise.
2209	* fs_x_ioctl.c (fs_x_ioctl): Likewise.
2210	* ioctl.c (ioctl_decode): Likewise.
2211	* loop.c (decode_loop_info, decode_loop_info64): Change addr type
2212	from long to kernel_ureg_t.
2213	(loop_ioctl): Change arg type from long to kernel_ureg_t.
2214	* ptp.c (ptp_ioctl): Likewise.
2215	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
2216	print_sg_io_v4_res, scsi_ioctl): Likewise.
2217	* sock.c (print_ifreq, sock_ioctl): Likewise.
2218	(decode_ifconf): Change addr type from long to kernel_ureg_t.
2219	* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
2220	decode_modem_flags): Likewise.
2221	(term_ioctl): Change arg type from long to kernel_ureg_t.
2222	* ubi.c (ubi_ioctl): Likewise.
2223	* userfaultfd.c (uffdio_ioctl): Likewise.
2224
2225	ldt: change address argument type from long to kernel_ureg_t.
2226	* defs.h [HAVE_STRUCT_USER_DESC] (print_user_desc): Change address
2227	argument type from long to kernel_ureg_t.
2228	* ldt.c [HAVE_STRUCT_USER_DESC] (print_user_desc): Likewise.
2229
2230	fcntl: change address argument type from long to kernel_ureg_t.
2231	* fcntl.c (printflock64, printflock, print_f_owner_ex): Change
2232	address argument type from long to kernel_ureg_t.
2233
2234	execve: change address argument type from long to kernel_ureg_t.
2235	* execve.c (printargv, printargc): Change address argument type
2236	from long to kernel_ureg_t.
2237
2238	dirent: change address argument type from long to kernel_ureg_t.
2239	* dirent.c (print_old_dirent): Change address argument type from long
2240	to kernel_ureg_t.
2241
2242	bpf: change address argument type from long to kernel_ureg_t.
2243	* bpf.c (bpf_map_create, bpf_map_update_elem, bpf_map_delete_elem,
2244	bpf_map_io, bpf_prog_load, SYS_FUNC(bpf)): Change address argument
2245	type from long to kernel_ureg_t.
2246
2247	dump*: change address argument type from long to kernel_ureg_t.
2248	* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
2249	Change address argument type from long to kernel_ureg_t.
2250	* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
2251	* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
2252	Likewise.
2253	* util.c (dumpiov_upto, dumpstr): Likewise.
2254
2255	print_sigset_addr_len: change address argument type from long to kernel_ureg_t
2256	* defs.h (print_sigset_addr_len) Change address argument type from long
2257	to kernel_ureg_t.
2258	* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
2259	decode_old_sigaction, decode_new_sigaction): Likewise.
2260
2261	decode_sockaddr: change address argument type from long to kernel_ureg_t
2262	* defs.h (decode_sockaddr) Change tracee address argument type from long
2263	to kernel_ureg_t.
2264	* sockaddr.c (decode_sockaddr): Likewise.
2265
2266	print_struct_statfs*: change address argument type from long to kernel_ureg_t
2267	* defs.h (print_struct_statfs, print_struct_statfs64): Change address
2268	argument type from long to kernel_ureg_t.
2269	* print_statfs.c (print_struct_statfs, print_struct_statfs64): Likewise.
2270	* fetch_struct_statfs.c (fetch_struct_statfs, fetch_struct_statfs64):
2271	Likewise.
2272
2273	fetch_struct_flock: change address argument type from long to kernel_ureg_t
2274	* fetch_struct_flock.c (fetch_struct_flock, fetch_struct_flock64):
2275	Change address argument type from long to kernel_ureg_t.
2276
2277	fetch_seccomp_fprog: change address argument type from long to kernel_ureg_t
2278	* fetch_seccomp_fprog.c (fetch_seccomp_fprog): Change address argument
2279	type from long to kernel_ureg_t.
2280
2281	printnum_*, printpair_*: change address argument type from long to kernel_ureg_t
2282	* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR, printnum_long_int): Change
2283	address argument type from long to kernel_ureg_t.
2284	* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
2285
2286	printpath*: change address argument type from long to kernel_ureg_t.
2287	* defs.h (printpath, printpathn): Change address argument type
2288	from long to kernel_ureg_t.
2289	* util.c (printpath, printpathn): Likewise.
2290
2291	printstr*: change address argument type from long to kernel_ureg_t.
2292	* defs.h (printstr_ex, printstr_ex): Change address argument type
2293	from long to kernel_ureg_t.
2294	* util.c (printstr_ex): Likewise.
2295
2296	umove*: change tracee address argument type from long to kernel_ureg_t.
2297	* defs.h (umovestr, umoven, umoven_or_printaddr,
2298	umoven_or_printaddr_ignore_syserror): Change tracee address argument
2299	type from long to kernel_ureg_t.
2300	(print_array): Change the type of tracee address argument of umoven_func
2301	from long to kernel_ureg_t.
2302	* util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr,
2303	umoven_or_printaddr_ignore_syserror): Change tracee address argument
2304	type from long to kernel_ureg_t.
2305	(print_array): Change the type of tracee address argument of umoven_func
2306	from long to kernel_ureg_t.
2307	* desc.c (umove_kulong_array_or_printaddr): Change tracee address
2308	argument type from long to kernel_ureg_t.
2309	* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise.
2310
2311	futex: change address type from long to kernel_ureg_t.
2312	* futex.c (SYS_FUNC(futex)): Change address type from long
2313	to kernel_ureg_t.
2314
2315	file_handle: change address type from long to kernel_ureg_t.
2316	* file_handle.c (SYS_FUNC(name_to_handle_at),
2317	SYS_FUNC(open_by_handle_at)): Change address type from long
2318	to kernel_ureg_t.
2319
2320	printsiginfo: cast pointers to kernel_ureg_t instead of unsigned long.
2321	* printsiginfo.c (printsigval): Cast siginfo.si_ptr pointer
2322	to kernel_ureg_t instead of unsigned long.
2323	(print_si_info): Cast siginfo.si_addr and siginfo.si_call_addr pointers
2324	to kernel_ureg_t instead of unsigned long.
2325
2326	sigaltstack: cast pointers and sizes to kernel_ureg_t instead of unsigned long
2327	* sigaltstack.c (print_stack_t): Cast sigaltstack.ss_sp pointer
2328	and sigaltstack.ss_size to kernel_ureg_t instead of unsigned long.
2329
2330	v4l2: cast pointers to kernel_ureg_t instead of long.
2331	* v4l2.c (print_v4l2_ext_control): Cast v4l2_ext_control.string pointer
2332	to kernel_ureg_t instead of long.
2333
2334	v4l2: cast pointers to kernel_ureg_t instead of unsigned long.
2335	* v4l2.c (print_v4l2_buffer): Remove redundant cast.
2336	(print_v4l2_framebuffer): Cast v4l2_framebuffer.base pointer
2337	to kernel_ureg_t instead of unsigned long.
2338	(print_v4l2_ext_controls): Cast v4l2_ext_controls.controls pointer
2339	to kernel_ureg_t instead of unsigned long.
2340
23412016-12-24  Dmitry V. Levin  <ldv@altlinux.org>
2342
2343	sysctl: cast pointers to kernel_ureg_t instead of size_t.
2344	* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldval and
2345	__sysctl_args.newval pointers to kernel_ureg_t instead of size_t.
2346
2347	sysctl: cast pointers to kernel_ureg_t instead of long.
2348	* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldlenp pointer
2349	to kernel_ureg_t instead of long.
2350
2351	block: cast pointers to kernel_ureg_t instead of long.
2352	* block.c (print_blkpg_req): Cast blkpg_ioctl_arg.data pointer
2353	to kernel_ureg_t instead of long.
2354
2355	dumpiov_upto: cast pointers to kernel_ureg_t instead of long.
2356	* util.c  (dumpiov_upto): Cast iovec.iov_base pointer to kernel_ureg_t
2357	instead of long.
2358
2359	msghdr: cast pointers to kernel_ureg_t instead of long.
2360	* msghdr.c (print_struct_msghdr): Cast msghdr.msg_name pointer
2361	to kernel_ureg_t instead of long.
2362	(dumpiov_in_msghdr): Cast msghdr.msg_iov pointer to kernel_ureg_t
2363	instead of long.
2364
2365	mmsghdr: cast pointers to kernel_ureg_t instead of long.
2366	* mmsghdr.c (dumpiov_in_mmsghdr): Cast msghdr.msg_iov pointer
2367	to kernel_ureg_t instead of long.
2368
2369	Remove redundant casts of ptrace arguments.
2370	* strace.c (maybe_switch_tcbs, trace): Do not cast ptrace 4th argument
2371	from pointer to long type.
2372
2373	ptrace_restart: cleanup.
2374	* strace.c (ptrace_restart): Replace the sequence of "if" statements
2375	with a "switch" statement.
2376
2377	ptrace_restart: change types of integer arguments to unsigned.
2378	* strace.c (ptrace_restart): Change types of "op" and "sig"
2379	from int to unsigned int.
2380
2381	process: remove redundant syserror checks.
2382	* process.c (SYS_FUNC(ptrace)): Remove syserror checks as both
2383	print_siginfo_array and print_seccomp_fprog do the right thing
2384	by using umoven_or_printaddr.
2385
2386	sparc64: remove redundant casts.
2387	* linux/sparc64/get_syscall_args.c (get_syscall_args): Remove
2388	redundant casts from uint32_t to long.
2389
23902016-12-23  Dmitry V. Levin  <ldv@altlinux.org>
2391
2392	numa: change address argument type from unsigned long to kernel_ureg_t.
2393	* numa.c (print_nodemask): Change address argument type from
2394	unsigned long to kernel_ureg_t.
2395
2396	net: change address argument type from unsigned long to kernel_ureg_t.
2397	* net.c (fetch_socklen): Change address argument type from
2398	unsigned long to kernel_ureg_t.
2399
2400	mem: change tracee address type from unsigned long to kernel_ureg_t.
2401	* mem.c (print_mmap, SYS_FUNC(remap_file_pages),
2402	SYS_FUNC(subpage_prot)): Change the type of variables containing tracee
2403	addresses from unsigned long to kernel_ureg_t.
2404
2405	kexec: change address argument type from unsigned long to kernel_ureg_t.
2406	* kexec.c (print_kexec_segments): Change address argument type
2407	from unsigned long to kernel_ureg_t.
2408
2409	poll: change counter type from unsigned long to unsigned int.
2410	* poll.c (decode_poll_exiting): Change the type of printed and
2411	max_printed counters from unsigned long to unsigned int.
2412
2413	xattr: change address argument type from unsigned long to kernel_ureg_t.
2414	* xattr.c (print_xattr_val, print_xattr_list): Change address
2415	argument type from unsigned long to kernel_ureg_t.
2416
2417	uid: change address argument type from unsigned long to kernel_ureg_t.
2418	* uid.c (print_groups): Change address argument type
2419	from unsigned long to kernel_ureg_t.
2420
2421	stat64: change address argument type from unsigned long to kernel_ureg_t
2422	* stat64.c (decode_struct_stat64): Change address argument type
2423	from unsigned long to kernel_ureg_t.
2424
2425	stat: change address argument type from unsigned long to kernel_ureg_t.
2426	* stat.c (decode_struct_stat): Change address argument type
2427	from unsigned long to kernel_ureg_t.
2428
2429	sigaltstack: change address argument type from unsigned long to kernel_ureg_t
2430	* sigaltstack.c (print_stack_t): Change address argument type
2431	from unsigned long to kernel_ureg_t.
2432
2433	resource: change address argument type from unsigned long to kernel_ureg_t
2434	* resource.c (print_rlimit64, print_rlimit32, decode_rlimit): Change
2435	address argument type from unsigned long to kernel_ureg_t.
2436
2437	printsiginfo: change address argument type from unsigned long to kernel_ureg_t
2438	* printsiginfo.c (print_siginfo_array): Change address argument type
2439	from unsigned long to kernel_ureg_t.
2440
2441	poll: change tracee address type from unsigned long to kernel_ureg_t.
2442	* poll.c (decode_poll_entering, decode_poll_exiting): Change the type
2443	all tracee address variables from unsigned long to kernel_ureg_t.
2444
2445	perf: change address argument type from unsigned long to kernel_ureg_t.
2446	* perf.c (fetch_perf_event_attr, print_perf_event_attr): Change
2447	address argument type from unsigned long to kernel_ureg_t.
2448
2449	pathtrace: change tracee address type from unsigned long to kernel_ureg_t
2450	* pathtrace.c (upathmatch): Change address argument type
2451	from unsigned long to kernel_ureg_t.
2452	(pathtrace_match): Change the type of all tracee address variables
2453	from unsigned long to kernel_ureg_t.
2454
2455	scsi: change address argument type from unsigned long to kernel_ureg_t.
2456	* scsi.c (print_sg_io_buffer): Change address argument type
2457	from unsigned long to kernel_ureg_t.
2458
2459	dm: change address argument type from unsigned long to kernel_ureg_t.
2460	* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
2461	dm_decode_dm_name_list, dm_decode_dm_target_versions,
2462	dm_decode_dm_target_msg, dm_decode_string): Change address argument type
2463	from unsigned long to kernel_ureg_t.
2464
2465	oldstat: change address argument type from unsigned long to kernel_ureg_t
2466	* oldstat.c (print_old_kernel_stat): Change address argument type
2467	from unsigned long to kernel_ureg_t.
2468
2469	capability: change address argument type from unsigned long to kernel_ureg_t
2470	* capability.c (get_cap_header, print_cap_header, print_cap_data):
2471	Change address argument type from unsigned long to kernel_ureg_t.
2472
2473	btrfs: change address argument type from unsigned long to kernel_ureg_t.
2474	* btrfs.c (btrfs_print_qgroup_inherit): Change address argument type
2475	from unsigned long to kernel_ureg_t.
2476
2477	affinity: change address argument type from unsigned long to kernel_ureg_t
2478	* affinity.c (print_affinitylist): Change address argument type from
2479	unsigned long to kernel_ureg_t.
2480
2481	aio: change address type from unsigned long to kernel_ureg_t.
2482	* aio.c (print_iocb): Remove casts to unsigned long.
2483	(print_iocbp,  SYS_FUNC(io_submit)): Change address type
2484	from unsigned long to kernel_ureg_t.
2485
2486	mmsghdr: change address argument type from unsigned long to kernel_ureg_t
2487	* mmsghdr.c (save_mmsgvec_namelen, decode_mmsgvec): Change
2488	address argument type from unsigned long to kernel_ureg_t.
2489
2490	msghdr: change address argument type from unsigned long to kernel_ureg_t
2491	* msghdr.c (decode_msg_control): Change address argument type
2492	from unsigned long to kernel_ureg_t.
2493
2494	fetch_struct_stat64: change address argument type from unsigned long to kernel_ureg_t
2495	* fetch_struct_stat64.c (fetch_struct_stat64): Change address argument
2496	type from unsigned long to kernel_ureg_t.
2497
2498	fetch_struct_stat: change address argument type from unsigned long to kernel_ureg_t
2499	* fetch_struct_stat.c (fetch_struct_stat): Change address argument
2500	type from unsigned long to kernel_ureg_t.
2501
2502	fetch_struct_msghdr: change address argument type from unsigned long to kernel_ureg_t
2503	* fetch_struct_msghdr.c (fetch_struct_msghdr): Change
2504	address argument type from unsigned long to kernel_ureg_t.
2505
2506	fetch_struct_mmsghdr: change address argument type from unsigned long to kernel_ureg_t
2507	* fetch_struct_mmsghdr.c (fetch_struct_mmsghdr): Change
2508	address argument type from unsigned long to kernel_ureg_t.
2509
2510	decode_netlink: change address argument type from unsigned long to kernel_ureg_t
2511	* defs.h (decode_netlink) Change address argument type
2512	from unsigned long to kernel_ureg_t.
2513	* netlink.c (fetch_nlmsghdr, decode_nlmsghdr_with_payload,
2514	decode_netlink): Likewise.
2515
2516	print_seccomp_*: change address argument type from unsigned long to kernel_ureg_t
2517	* defs.h (print_seccomp_filter, print_seccomp_fprog): Change
2518	address argument type from unsigned long to kernel_ureg_t.
2519	* seccomp.c (print_seccomp_filter, print_seccomp_fprog,
2520	decode_seccomp_set_mode_strict): Likewise.
2521
2522	tprint_iov*: change address argument type from unsigned long to kernel_ureg_t
2523	* defs.h (tprint_iov, tprint_iov_upto): Change address argument type
2524	from unsigned long to kernel_ureg_t.
2525	* io.c (tprint_iov, tprint_iov_upto): Likewise.
2526
2527	print_array: change tracee address type from unsigned long to kernel_ureg_t
2528	* defs.h (print_array): Change start_addr type from unsigned long
2529	to kernel_ureg_t.
2530	* util.c (print_array): Likewise.  Change the type of all tracee
2531	address variables from unsigned long to kernel_ureg_t.
2532
25332016-12-23  Dmitry V. Levin  <ldv@altlinux.org>
2534
2535	Rename LONG_LONG to ULONG_LONG and change it to return unsigned long long
2536	In all places where LONG_LONG is used the destination already has type
2537	unsigned long long, so it is quite natural to change LONG_LONG as well.
2538
2539	* defs.h (LONG_LONG): Rename to ULONG_LONG, change return type
2540	from long long to unsigned long long.  All callers updated.
2541
25422016-12-23  Dmitry V. Levin  <ldv@altlinux.org>
2543
2544	mem: remove redundant casts.
2545	* mem.c (SYS_FUNC(old_mmap)): Remove redundant cast
2546	from kernel_ureg_t to unsigned long.
2547	[S390] (SYS_FUNC(old_mmap_pgoff)): Remove redundant cast
2548	from unsigned int to unsigned long.
2549
2550	desc: remove redundant casts.
2551	* desc.c (umove_kulong_array_or_printaddr): Remove redundant cast
2552	from uint32_t to kernel_ulong_t.
2553	(SYS_FUNC(pselect6)): Remove redundant casts from kernel_ulong_t
2554	to unsigned long.
2555
25562016-12-22  Dmitry V. Levin  <ldv@altlinux.org>
2557
2558	print_sigevent: remove redundant cast.
2559	* print_sigevent.c (print_sigevent): Remove redundant cast from
2560	struct_sigevent.sigev_value.sival_ptr to unsigned long as the former
2561	is not a pointer but an unsigned integer.
2562
2563	tests: fix xattr.test for the case when listxattr returns a long list.
2564	* tests/xattr.c (DEFAULT_STRLEN): New macro.
2565	(main): Use it to limit the length passed to print_quoted_memory.
2566	Print ellipsis when the list returned by listxattr is too long.
2567
25682016-12-22  Gabriel Laskar  <gabriel@lse.epita.fr>
2569
2570	tests: test for correct ellipsis with -s in xattr.
2571	* tests/xattr-strings.c: New file.
2572	* tests/xattr-strings.test: New test.
2573	* tests/.gitignore: Add xattr-string.
2574	* tests/Makefile.am (check_PROGRAMS): Likewise.
2575	(DECODER_TESTS): Add xattr-string.test.
2576
25772016-12-22  Gabriel Laskar  <gabriel@lse.epita.fr>
2578
2579	xattr: use printstr_ex instead of print_quoted_string.
2580	This fixes the display when using `-s` to limit the string size
2581	of the values displayed by {get,set}xattr.
2582
2583	* xattr.c (print_xattr_val): Remove static buffer.  Use printstr_ex
2584	instead of print_quoted_string.
2585
2586	Reported-by: Марк Коренберг <socketpair@gmail.com>
2587
25882016-12-22  Eugene Syromyatnikov  <evgsyr@gmail.com>
2589
2590	tests: use scno.h in finit_module, kcmp, renameat2 tests.
2591	* tests/finit_module.c: Include "scno.h".
2592	* tests/kcmp.c: Likewise.
2593	* tests/renameat2.c: Likewise.
2594
25952016-12-21  Dmitry V. Levin  <ldv@altlinux.org>
2596
2597	sock: cast pointers to kernel_ureg_t instead of unsigned long.
2598	* sock.c (decode_ifconf): Cast ifconf.ifc_buf pointer to kernel_ureg_t
2599	instead of unsigned long.
2600
2601	scsi: cast pointers to kernel_ureg_t instead of unsigned long.
2602	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Cast sg_io_hdr.cmdp,
2603	sg_io_hdr.dxferp, and sg_io_hdr.sbp pointers to kernel_ureg_t instead
2604	of unsigned long.
2605
2606	mtd: cast pointers to kernel_ureg_t instead of unsigned long.
2607	* mtd.c (decode_mtd_oob_buf): Cast mtd_oob_buf.ptr pointer
2608	to kernel_ureg_t instead of unsigned long.
2609
2610	msghdr: cast pointers to kernel_ureg_t instead of unsigned long.
2611	* msghdr.c (print_struct_msghdr): Cast msghdr.msg_iov and
2612	msghdr.msg_control pointers to kernel_ureg_t instead of unsigned long.
2613
2614	evdev: cast tcp->u_rval to kernel_ureg_t instead of unsigned long.
2615	* evdev.c (decode_bitset): Cast tcp->u_rval to kernel_ureg_t
2616	instead of unsigned long.
2617
2618	evdev: cast pointers to kernel_ureg_t instead of unsigned long.
2619	* evdev.c (ff_effect_ioctl): Cast ff_periodic_effect.custom_data
2620	pointer to kernel_ureg_t instead of unsigned long.
2621
2622	btrfs: cast pointers to kernel_ureg_t instead of unsigned long.
2623	* btrfs.c (btrfs_ioctl): Cast btrfs_ioctl_send_args.clone_sources
2624	and btrfs_ioctl_vol_args_v2.qgroup_inherit pointers to kernel_ureg_t
2625	instead of unsigned long.
2626
2627	Rework ifdefery around print_user_desc.
2628	* configure.ac (AC_CHECK_TYPES): Check for struct user_desc
2629	in <asm/ldt.h>.
2630	* clone.c (print_tls_arg): New function.
2631	(SYS_FUNC(clone)): Use it.
2632	(print_user_desc): Move prototype ...
2633	* defs.h [HAVE_STRUCT_USER_DESC]: ... here.
2634	* ldt.c: Check for HAVE_STRUCT_USER_DESC instead of architectures.
2635	* linux/dummy.h: Likewise.
2636
2637	Introduce DECL_IOCTL macro to declare *_ioctl functions.
2638	* defs.h (DECL_IOCTL): New macro.
2639	(dm_ioctl, file_ioctl, fs_x_ioctl, loop_ioctl, ptp_ioctl, scsi_ioctl,
2640	sock_ioctl, term_ioctl, ubi_ioctl, uffdio_ioctl): Rewrite prototypes
2641	using DECL_IOCTL.
2642
2643	Introduce DECL_PRINT* macros to declare printnum_* and printpair_*
2644	* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR): New macros.
2645	(printnum_short, printnum_int, printnum_int64): Rewrite prototypes
2646	using DECL_PRINTNUM.
2647	(printpair_int, printpair_int64): Rewrite prototypes
2648	using DECL_PRINTPAIR.
2649
2650	ioctl: use uintptr_t for casts between 32-bit integers and pointers.
2651	* ioctl.c (compare): Cast pointer to uintptr_t before assigning
2652	it to an integer.
2653	(ioctl_lookup): Cast integer to uintptr_t before passing it
2654	as a pointer.
2655
2656	scsi: use umove_or_printaddr.
2657	* scsi.c (scsi_ioctl): Use umove_or_printaddr.
2658
2659	Remove dumpiov wrapper.
2660	* defs.h (dumpiov): Remove.
2661	* syscall.c (dumpio): Use dumpiov_upto instead of dumpiov.
2662
2663	travis: fix enabling of gcc -Werror builds.
2664	* travis-build.sh: Use DISTCHECK_CONFIGURE_FLAGS instead
2665	of CHECK_CONFIGURE_FLAGS and ENABLE_GCC_WERROR.
2666	[$CC == gcc]: Add --enable-gcc-Werror to DISTCHECK_CONFIGURE_FLAGS
2667	instead of ENABLE_GCC_WERROR.
2668	[$CHECK == coverage]: Add --enable-code-coverage
2669	to DISTCHECK_CONFIGURE_FLAGS instead of CHECK_CONFIGURE_FLAGS.
2670
2671	printaddr: change argument type to kernel_ureg_t.
2672	* defs.h (printaddr): Change argument type from unsigned long
2673	to kernel_ureg_t.
2674
2675	tests: check decoding of unreadable ip_mreq and ipv6_mreq structures.
2676	* tests/ip_mreq.c (main): Check short read.
2677
2678	tests: rewrite ip_mreq.c using arrays and iterators.
2679	* tests/ip_mreq.c (main): Create arrays of setsockopt arguments to test.
2680	Iterate over these arrays invoking setsockopt and printing expected
2681	output.
2682
2683	tests: rewrite ip_mreq.c using tail_alloc.
2684	* tests/ip_mreq.c (main): Allocate objects of struct ip_mreq
2685	and struct ipv6_mreq using tail_alloc instead of using stack.
2686
2687	tests: rewrite ip_mreq.c without asserts.
2688	* tests/ip_mreq.c: Do not include <assert.h>.
2689	(main): Do not use assert.  Use sprintrc instead of errno2name.
2690
26912016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2692
2693	Remove NEED_PTRACE_PROTOTYPE_WORKAROUND.
2694	Remove the workaround for broken ptrace prototypes
2695	that seems to be unneeded for quite a long time.
2696
2697	* defs.h [NEED_PTRACE_PROTOTYPE_WORKAROUND]: Remove.
2698
26992016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2700
2701	tests: use scno.h in tests of relatively new syscalls.
2702	* tests/add_key.c: Include "scno.h" after <asm/unistd.h>.
2703	* tests/copy_file_range.c: Likewise.
2704	* tests/execveat.c: Likewise.
2705	* tests/kexec_file_load.c: Likewise.
2706	* tests/membarrier.c: Likewise.
2707	* tests/memfd_create.c: Likewise.
2708	* tests/mlock2.c: Likewise.
2709	* tests/pkey_alloc.c: Likewise.
2710	* tests/pkey_free.c: Likewise.
2711	* tests/pkey_mprotect.c: Likewise.
2712	* tests/preadv2-pwritev2.c: Likewise.
2713	* tests/userfaultfd.c: Likewise.
2714
27152016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2716
2717	tests: generate scno.h from syscallent.h for use by other tests.
2718	Provide scno.h with fallback definitions of all __NR_* constants known
2719	to strace for the personbality being tested.
2720
2721	Some tests need just __NR_* constants without any kernel support.
2722	Such tests can include "scno.h" after <asm/unistd.h> to get definitions
2723	of these constants when system headers are too old.
2724
2725	* tests/generate_scno.c: New file.
2726	* tests/.gitignore: Add generate_scno.
2727	* tests/Makefile.am (check_PROGRAMS): Likewise.
2728	(scno.h): New rule.
2729	(BUILT_SOURCES, CLEANFILES): Add scno.h.
2730
27312016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2732
2733	tests: fix potential errno clobbering in membarrier test.
2734	* tests/membarrier.c (main): Save errno.
2735
27362016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2737
2738	Do not use widen_to_ulong in kexec.c and process_vm.c.
2739	Automatic argument truncation makes use of this function redundant.
2740
2741	* kexec.c (SYS_FUNC(kexec_load)): Do not invoke widen_to_ulong.
2742	* process_vm.c (SYS_FUNC(process_vm_readv),
2743	SYS_FUNC(process_vm_writev)): Likewise.
2744
27452016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2746
2747	x32: implement automatic argument truncation for compat syscalls.
2748	x32 syscalls starting with number 512 are compat syscalls that operate
2749	on compat types.  Set COMPAT_SYSCALL_TYPES flag to these syscall entries
2750	and make get_syscall_args truncate arguments of syscalls that have this
2751	flag set, to avoid unpleasant alternative of adding multiple
2752	widen_to_ulong invocations to individual syscall parsers.
2753
2754	preadv, pwritev, preadv2, and pwritev2 are exceptions: while these
2755	syscalls operate on compat types, the offset argument has a regular
2756	64-bit type, so the automatic argument truncation cannot be applied.
2757
2758	* defs.h (COMPAT_SYSCALL_TYPES): New macro.
2759	* syscall.c (CST): New macro, defined to COMPAT_SYSCALL_TYPES.
2760	* linux/ia64/syscallent.h: Do not include "../i386/syscallent.h"
2761	unless [CST > 0].
2762	* linux/x32/syscallent.h [512..533, 536..545]: Add CST flag.
2763	* linux/x86_64/get_syscall_args.c (get_syscall_args): Truncate arguments
2764	of compat syscalls to 32-bit values.
2765	* tests/ksysent.c (CST): New macro, defined to 0.
2766	* tests/nsyscalls.c (CST): Likewise.
2767
27682016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2769
2770	x32: fix decoding of mprotect and pkey_mprotect syscall arguments.
2771	As there are no compat versions of mprotect or pkey_mprotect syscalls
2772	in x32 personality, "addr", "len", and "prot" syscall arguments have
2773	kernel_ulong_t type and should be printed accordingly.
2774
2775	* mem.c (do_mprotect): Retrieve 1st, 2nd and 3rd arguments using
2776	getarg_klu, print them using printaddr_klu, PRI_klu format,
2777	and printflags64, correspondingly.
2778
27792016-12-20  Dmitry V. Levin  <ldv@altlinux.org>
2780
2781	Make tprint_iov function a static inline wrapper.
2782	* io.c (tprint_iov): Move ...
2783	* defs.h: ... here, add static inline keywords.
2784
27852016-12-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
2786
2787	x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls.
2788	In x32 personality these syscalls use compat type for the 3rd argument,
2789	therefore it has to be truncated there.
2790
2791	* io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using
2792	widen_to_ulong.
2793
27942016-12-19  Eugene Syromyatnikov  <evgsyr@gmail.com>
2795
2796	tests: fix preadv2-pwritev2 test on x32.
2797	On x32 p(read|write)v(|2) syscalls are implemented via compat, which
2798	truncates len argument to unsigned int.
2799
2800	* tests/preadv2-pwritev2.c (main): Print vlen argument as unsigned long.
2801
28022016-12-19  Eugene Syromyatnikov  <evgsyr@gmail.com>
2803
2804	kexec: fix for the x32 ABI.
2805	There is no compat (and no 32-bit version, ever) for x32 ABI, so
2806	kernel's long type should be used for arguments' values.
2807
2808	The only remaining thing is a pointer to cmdline string, but it is
2809	currently broken on x32 anyway.
2810
2811	* kexec.c (SYS_FUNC(kexec_file_load)): Print the cmdline_len argument
2812	as kernel long, retrieve it via getarg_klu; use printflags64 for
2813	printing the flags argument, retrieve it via getarg_klu.
2814
28152016-12-19  Dmitry V. Levin  <ldv@altlinux.org>
2816
2817	Check for current_klongsize instead of current_personality where appropriate
2818	current_klongsize checks are more universal, therefore they are usually
2819	shorter and easier to comprehend.
2820
2821	* desc.c (umove_kulong_array_or_printaddr): Check for current_klongsize
2822	instead of current_personality and current_wordsize.
2823	* io.c (print_lld_from_low_high_val): Likewise.
2824	* lseek.c (SYS_FUNC(lseek)): Likewise.
2825	* resource.c (decode_rlimit): Likewise.
2826	* syscall.c (is_negated_errno): Likewise.
2827	* util.c (getllval, getarg_klu): Likewise.
2828
28292016-12-19  Dmitry V. Levin  <ldv@altlinux.org>
2830
2831	Use kernel_ulong_t instead of unsigned long long where appropriate.
2832	* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
2833	type from unsigned long long to kernel_ulong_t.  All callers updated.
2834	(getarg_ull): Rename to getarg_klu, change return value type
2835	from unsigned long long to kernel_ulong_t.  All callers updated.
2836	(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
2837	* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
2838	PRI_klu format.
2839	* desc.c (SYS_FUNC(pselect6)): Likewise.
2840	* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
2841	* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
2842	* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
2843	* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
2844	PRI_klx format.
2845	* keyctl.c (SYS_FUNC(keyctl)): Likewise.
2846	* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
2847	* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
2848	Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
2849	* util.c (printaddr_ull): Rename to printaddr_klu, change argument
2850	type from unsigned long long to kernel_ulong_t, print it using
2851	PRI_klx format.
2852	(getarg_ull): Rename to getarg_klu, change return value type
2853	from unsigned long long to kernel_ulong_t, print it using
2854	PRI_klx format.
2855
2856	fcntl.c: print 64-bit fields of struct_kernel_flock64 using PRId64 format
2857	* fcntl.c (print_struct_flock64): Print l_start and l_len fields
2858	of struct_kernel_flock64 using PRId64 format.
2859
2860	v4l2.c: print v4l2_ext_control.value64 using PRId64 format.
2861	* v4l2.c (print_v4l2_ext_control): Print value64 field
2862	of struct_v4l2_ext_control using PRId64 format.
2863
2864	perf.c: print perf_event_attr.__reserved_1 using PRIx64 format.
2865	* perf.c (print_perf_event_attr): Print __reserved_1 field
2866	of perf_event_attr using PRIx64 format.
2867
2868	btrfs.c: print 64-bit fields of btrfs_ioctl_vol_args_v2 using PRIu64 format
2869	* block.c (btrfs_ioctl): Print size and transid fields
2870	of struct_btrfs_ioctl_vol_args_v2 using PRIu64 format.
2871
2872	block.c: change type of long long fileds to int64_t.
2873	* block.c (struct_blkpg_partition): Change type of start and length
2874	fields from long long to int64_t.
2875	(print_blkpg_req): Print them using PRId64 format.
2876
28772016-12-19  Eugene Syromyatnikov  <evgsyr@gmail.com>
2878
2879	Introduce current_klongsize in addition to current_wordsize.
2880	Subsequent commits are going to use current_klongsize
2881	as the tracee's size of kernel_ulong_t type.
2882
2883	* defs.h (PERSONALITY0_KLONGSIZE): New macro.
2884	[X86_64] (PERSONALITY2_KLONGSIZE): Likewise.
2885	[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_KLONGSIZE): Likewise.
2886	[SUPPORTED_PERSONALITIES == 1] (current_klongsize): Likewise.
2887	[SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE ==
2888	PERSONALITY1_KLONGSIZE] (current_klongsize): Likewise.
2889	[SUPPORTED_PERSONALITIES != 1 && (SUPPORTED_PERSONALITIES != 2 ||
2890	PERSONALITY0_KLONGSIZE != PERSONALITY1_KLONGSIZE)] (current_klongsize):
2891	New variable prototype.
2892	* syscall.c [!current_klongsize] (current_klongsize): New variable.
2893	[!current_klongsize] (personality_klongsize): New array.
2894	(set_personality) [!current_klongsize]: Update current_klongsize
2895	with the appropriate value from personality_klongsize.
2896
28972016-12-19  Dmitry V. Levin  <ldv@altlinux.org>
2898
2899	configure: define SIZEOF_KERNEL_LONG_T macro.
2900	Provide SIZEOF_KERNEL_LONG_T macro in addition to SIZEOF_LONG and
2901	SIZEOF_LONG_LONG for checking of kernel_long_t and kernel_ulong_t
2902	types at the time of preprocessing.
2903
2904	* configure.ac (AC_CHECK_SIZEOF): Add kernel_long_t.
2905
29062016-12-19  Dmitry V. Levin  <ldv@altlinux.org>
2907
2908	Remove getarg_ll.
2909	This function has never been used in the code, and in perspective
2910	the whole ext_arg thing will go away.
2911
2912	* defs.h (getarg_ll): Remove prototype.
2913	* util.c (getarg_ll): Remove.
2914
29152016-12-19  Dmitry V. Levin  <ldv@altlinux.org>
2916
2917	struct tcb: make types of syscall arguments unsigned.
2918	This is the first step in the direction of revisiting current practice
2919	of indiscriminate use of signed types for syscall arguments and memory
2920	addresses.
2921
2922	* kernel_types.h (kernel_ureg_t): New type, typedef to unsigned long.
2923	* defs.h (struct tcb): Change type of u_arg from long to kernel_ureg_t.
2924	[HAVE_STRUCT_TCB_EXT_ARG]: Change type of ext_arg from long long
2925	to unsigned long long.
2926	* desc.c (decode_select): Change type of syscall arguments from long
2927	to kernel_ureg_t.
2928	(SYS_FUNC(oldselect)): Change type of select_args from long
2929	to kernel_ureg_t.
2930	* io.c (print_lld_from_low_high_val): Remove no longer needed cast
2931	of syscall arguments to unsigned long.
2932	* lseek.c (SYS_FUNC(lseek)): Cast syscall argument from unsigned long
2933	to long.
2934	* mem.c (print_mmap): Change type of syscall arguments from long
2935	to kernel_ureg_t.
2936	(SYS_FUNC(old_mmap), SYS_FUNC(old_mmap_pgoff)): Change type of u_arg
2937	from long to kernel_ureg_t.
2938	(SYS_FUNC(mmap), SYS_FUNC(mmap_pgoff), SYS_FUNC(mmap_pgoff)): Remove
2939	no longer needed cast of syscall arguments to unsigned long.
2940	* pathtrace.c (pathtrace_match): Change type of args and select_args
2941	from long to kernel_ureg_t.
2942	* util.c (getarg_ull): Remove no longer needed casts of syscall
2943	arguments to unsigned types.
2944
29452016-12-19  Dmitry V. Levin  <ldv@altlinux.org>
2946
2947	s390: fix decoding of mmap2 syscall when arguments are not available.
2948	* mem.c [S390] (SYS_FUNC(old_mmap_pgoff)): Use umove_or_printaddr
2949	instead of umoven to fetch mmap arguments, fix return value when this
2950	fetch fails.
2951
2952	Fix pathmatch of oldselect syscall on 64-bit architectures.
2953	* pathtrace.c (pathtrace_match): Fix fetching of 32-bit oldselect
2954	arguments on 64-bit architectures.
2955
2956	Cleanup oldselect.
2957	* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.
2958
29592016-12-18  Dmitry V. Levin  <ldv@altlinux.org>
2960
2961	Change scno type from long to unsigned long.
2962	Use an unsigned type for syscall numbers as they are not intended
2963	for signed arithmetics.  Introduce kernel_scno_t as a typedef
2964	to unsigned long, that could be changed later to kernel_ulong_t.
2965
2966	* kernel_types.h (kernel_scno_t): New type, typedef to unsigned long.
2967	* defs.h (struct tcb): Change type of scno field from long
2968	to kernel_scno_t.
2969	(syscall_name): Change argument type from long to kernel_scno_t.
2970	(scno_in_range, scno_is_valid): Change argument type from unsigned long
2971	to kernel_scno_t.
2972	* linux/aarch64/set_scno.c (arch_set_scno): Change scno argument type
2973	from long to kernel_scno_t.
2974	* linux/alpha/set_scno.c (arch_set_scno): Likewise.
2975	* linux/arc/set_scno.c (arch_set_scno): Likewise.
2976	* linux/arm/set_scno.c (arch_set_scno): Likewise.
2977	* linux/avr32/set_scno.c (arch_set_scno): Likewise.
2978	* linux/bfin/set_scno.c (arch_set_scno): Likewise.
2979	* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
2980	* linux/hppa/set_scno.c (arch_set_scno): Likewise.
2981	* linux/i386/set_scno.c (arch_set_scno): Likewise.
2982	* linux/ia64/set_scno.c (arch_set_scno): Likewise.
2983	* linux/m68k/set_scno.c (arch_set_scno): Likewise.
2984	* linux/metag/set_scno.c (arch_set_scno): Likewise.
2985	* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
2986	* linux/mips/set_scno.c (arch_set_scno): Likewise.
2987	* linux/nios2/set_scno.c (arch_set_scno): Likewise.
2988	* linux/or1k/set_scno.c (arch_set_scno): Likewise.
2989	* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
2990	* linux/riscv/set_scno.c (arch_set_scno): Likewise.
2991	* linux/s390/set_scno.c (arch_set_scno): Likewise.
2992	* linux/sh/set_scno.c (arch_set_scno): Likewise.
2993	* linux/sh64/set_scno.c (arch_set_scno): Likewise.
2994	* linux/sparc/set_scno.c (arch_set_scno): Likewise.
2995	* linux/tile/set_scno.c (arch_set_scno): Likewise.
2996	* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
2997	* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
2998	* linux/aarch64/get_scno.c (arch_get_scno): Change scno variable type
2999	from long to kernel_scno_t.
3000	* linux/alpha/get_scno.c (arch_get_scno): Likewise.
3001	* linux/arm/get_scno.c (arch_get_scno): Likewise.
3002	* linux/sh/get_scno.c (arch_get_scno): Likewise.
3003	* linux/x86_64/get_scno.c (arch_get_scno): Likewise.
3004	* syscall.c (arch_set_scno): Likewise.
3005	(shuffle_scno): Change return type from long to kernel_scno_t.
3006	(syscall_name): Change argument type from long to kernel_scno_t.
3007
30082016-12-18  Dmitry V. Levin  <ldv@altlinux.org>
3009
3010	Lowercase SCNO_IN_RANGE and SCNO_IS_VALID.
3011	* defs.h (SCNO_IN_RANGE): Rename to scno_in_range.  All callers updated.
3012	(SCNO_IS_VALID): Rename to scno_is_valid.  All callers updated.
3013
3014	Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions.
3015	* defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline
3016	functions.
3017
3018	count.c: use syserror instead of direct u_error access.
3019	* count.c (count_syscall): Use syserror instead of u_error.
3020
3021	Replace "(unsigned long) -1L" with -1UL.
3022	* defs.h (dumpiov): Replace "(unsigned long) -1L" with -1UL.
3023	* io.c (print_iovec, tprint_iov): Likewise.
3024	* msghdr.c (SYS_FUNC(sendmsg)): Likewise.
3025	* syscall.c (dumpio): Likewise.
3026	* poll.c (decode_poll_exiting): Replace "(unsigned int) -1" with -1U.
3027
3028	Add toplevel recursive check-valgrind rule.
3029	* Makefile.am (.PHONY): Add check-valgrind-local.
3030	(check-valgrind): New rule.
3031	* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Add it.
3032
3033	m4: fix check-valgrind-* rules generated by AX_VALGRIND_CHECK.
3034	* m4/ax_valgrind_check.m4 (check-valgrind-$(1)): Depend
3035	on $(BUILT_SOURCES), honor $(AM_MAKEFLAGS), build check-am
3036	instead of check-TESTS.
3037
3038	travis: do coverage using a dedicated build.
3039	* .travis.yml (after_success): Remove.
3040	(matrix): Create an entry for the regular x86_64 target.
3041	* travis-success.sh: Merge into ...
3042	* travis-build.sh: ... this file.  Disable optimization
3043	for coverage builds.
3044	* travis-install.sh: Rename COVERAGE=true to CHECK=coverage.
3045
30462016-12-17  Dmitry V. Levin  <ldv@altlinux.org>
3047
3048	mips n32: provide fallback definitions of kernel_long_t/kernel_ulong_t.
3049	* kernel_types.h [!(HAVE___KERNEL_LONG_T && HAVE___KERNEL_ULONG_T) &&
3050	LINUX_MIPSN32] (kernel_long_t, kernel_ulong_t): Define to long long types.
3051
30522016-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>
3053
3054	util: simplify definitions of bit mask constants in umovestr.
3055	* util.c (umovestr): Do not check for SIZEOF_LONG in definitions
3056	of bit mask constants.
3057
3058	tests: check decoding of prctl operations without arguments.
3059	* tests/prctl-no-args.c: New file.
3060	* tests/prctl-no-args.test: New test.
3061	* tests/.gitignore: Add prctl-no-args.
3062	* tests/Makefile.am (check_PROGRAMS): Likewise.
3063	(DECODER_TESTS): Add prctl-no-args.test.
3064
3065	tests: check decoding of prctl PR_[GS]ET_SECUREBITS operations.
3066	* tests/prctl-securebits.c: New file.
3067	* tests/prctl-securebits.test: New test.
3068	* tests/.gitignore: Add prctl-securebits.
3069	* tests/Makefile.am (check_PROGRAMS): Likewise.
3070	(DECODER_TESTS): Add prctl-securebits.test.
3071
3072	tests: check decoding of prctl PR_[GS]ET_DUMPABLE operations.
3073	* tests/prctl-dumpable.c: New file.
3074	* tests/prctl-dumpable.test: New test.
3075	* tests/.gitignore: Add prctl-dumpable.
3076	* tests/Makefile.am (check_PROGRAMS): Likewise.
3077	(DECODER_TESTS): Add prctl-dumpable.test.
3078
3079	prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE
3080	* xlat/pr_dumpable.in: New file.
3081	* prctl.c: Include "xlat/pr_dumpable.h".
3082	(SYS_FUNC(prctl)): Decode returned value of PR_GET_DUMPABLE operation
3083	and the second syscall argument of PR_SET_DUMPABLE operation
3084	as SUID_DUMP_* constants.
3085
30862016-12-16  Dmitry V. Levin  <ldv@altlinux.org>
3087
3088	Include "kernel_types.h" in defs.h and tests/tests.h.
3089	As kernel_ulong_t type is going to be used in the definition
3090	of struct tcb and in many function prototypes, make it readily
3091	available for every source file by including "kernel_types.h"
3092	in defs.h and tests/tests.h files.
3093
3094	* defs.h: Include "kernel_types.h".
3095	* tests/tests.h: Likewise.
3096	* desc.c: Do not include "kernel_types.h".
3097	* dirent.c: Likewise.
3098	* keyctl.c: Likewise.
3099	* syscall.c: Likewise.
3100	* linux/asm_stat.h: Likewise.
3101	* tests/answer.c: Likewise.
3102	* tests/epoll_pwait.c: Likewise.
3103	* tests/fanotify_init.c: Likewise.
3104	* tests/fanotify_mark.c: Likewise.
3105	* tests/file_handle.c: Likewise.
3106	* tests/ftruncate.c: Likewise.
3107	* tests/getdents.c: Likewise.
3108	* tests/init_delete_module.h: Likewise.
3109	* tests/inotify.c: Likewise.
3110	* tests/inotify_init1.c: Likewise.
3111	* tests/ioprio.c: Likewise.
3112	* tests/ipc_msgbuf.c: Likewise.
3113	* tests/kcmp.c: Likewise.
3114	* tests/kexec_file_load.c: Likewise.
3115	* tests/kexec_load.c: Likewise.
3116	* tests/keyctl.c: Likewise.
3117	* tests/lookup_dcookie.c: Likewise.
3118	* tests/lseek.c: Likewise.
3119	* tests/mq_sendrecv.c: Likewise.
3120	* tests/nsyscalls.c: Likewise.
3121	* tests/pkey_alloc.c: Likewise.
3122	* tests/pkey_free.c: Likewise.
3123	* tests/pkey_mprotect.c: Likewise.
3124	* tests/prctl-pdeathsig.c: Likewise.
3125	* tests/prctl-tsc.c: Likewise.
3126	* tests/preadv2-pwritev2.c: Likewise.
3127	* tests/process_vm_readv_writev.c: Likewise.
3128	* tests/read-write.c: Likewise.
3129	* tests/setfsugid.c: Likewise.
3130	* tests/setns.c: Likewise.
3131	* tests/truncate.c: Likewise.
3132	* tests/unshare.c: Likewise.
3133	* tests/xgetrlimit.c: Likewise.
3134
31352016-12-15  Dmitry V. Levin  <ldv@altlinux.org>
3136
3137	Post-release administrivia.
3138	* NEWS: Add a header line for the next release.
3139	* debian/changelog.in: Add a changelog entry for 4.15-1.
3140	* strace.spec.in: Likewise.
3141
31422016-12-14  Dmitry V. Levin  <ldv@altlinux.org>
3143
3144	xlat: provide fallback definitions for NETLINK_* constants.
3145	As new constants have been added gradually over kernel releases, define
3146	all constant values to make newer constants decoded properly when strace
3147	is built with older kernel headers.
3148
3149	* xlat/netlink_protocols.in: Add default values for constants.
3150	* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]: Remove.
3151	* socketutils.c: Likewise.
3152
31532016-12-14  Dmitry V. Levin  <ldv@altlinux.org>
3154
3155	tests: relax getaffinity return value check in tests/sched_xetaffinity.c
3156	* tests/sched_xetaffinity.c (errstr): New variable.
3157	(getaffinity, setaffinity): Initialize it.
3158	(main): Use it.  Allow getaffinity return value to be less than
3159	its cpusetsize argument.
3160
3161	tests: fix threads-execve.test for large pids.
3162	* tests/threads-execve.c (main): Fix expected output for large pids.
3163
31642016-12-13  Dmitry V. Levin  <ldv@altlinux.org>
3165
3166	Prepare for 4.15 release.
3167	* NEWS: Update for 4.15 release.
3168
3169	.mailmap: add addresses of Thomas De Schampheleire.
3170	* .mailmap: Add both addresses of Thomas De Schampheleire here to avoid
3171	duplications in CREDITS file.
3172
3173	Sync strace.spec and debian/ with packages.
3174	* debian/control: Add Vcs-* metadata from 4.13-0.1.
3175	* debian/watch: Sync with 4.13-0.1.
3176	* strace.spec.in: Sync with 4.14.0.100.622a-1.
3177
31782016-12-13  Dmitry V. Levin  <ldv@altlinux.org>
3179
3180	tests: workaround a bug in GNU grep.
3181	Workaround a bug introduced in GNU grep 2.27, for details see
3182	https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html
3183
3184	* tests/init.sh (grep_pid_status): New function.
3185	* tests/detach-running.test: Use it instead of grep to search
3186	in /proc/$pid/status.
3187	* tests/detach-sleeping.test: Likewise.
3188	* tests/detach-stopped.test: Likewise.
3189
31902016-12-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
3191
3192	tests: fix typo in comment inside prctl-tsc.c.
3193
31942016-12-13  Sean Stangl  <sstangl@mozilla.com>
3195	    Dmitry V. Levin  <ldv@altlinux.org>
3196
3197	Fix libunwind segfault when -p is passed before -k.
3198	* strace.c (init) [USE_LIBUNWIND]: Call unwind_tcb_init after
3199	unwind_init for all allocated tcb structures if stack trace is enabled.
3200	* unwind.c (unwind_tcb_init): Skip if tcb is already initialized.
3201
32022016-12-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
3203	    Dmitry V. Levin  <ldv@altlinux.org>
3204
3205	Update NEWS.
3206
32072016-12-07  Dmitry V. Levin  <ldv@altlinux.org>
3208
3209	tests: skip fault injection tests on unsupported platforms.
3210	* tests/fault_injection.sh: New file.
3211	* tests/Makefile.am (EXTRA_DIST): Add it.
3212	* tests/fault_injection-exit_group.test: Use it.
3213	* tests/fault_injection.test: Likewise.
3214
3215	tests: introduce require_min_kernel_version_or_skip function.
3216	* tests/init.sh (kernel_version_code,
3217	require_min_kernel_version_or_skip): New functions.
3218	* tests/threads-execve.test: Use require_min_kernel_version_or_skip.
3219
32202016-12-07  Eugene Syromyatnikov  <evgsyr@gmail.com>
3221
3222	tests: add descriptions to prctl-pdeathsig and prctl-tsc tests.
3223
32242016-12-07  Dmitry V. Levin  <ldv@altlinux.org>
3225
3226	tests: robustify prctl-pdeathsig.test and prctl-tsc.test.
3227	Rrobustify remaining prctl tests against unrelated prctl invocations
3228
3229	* tests/prctl-pdeathsig.test: Filter out unrelated PR_GET_* and PR_SET_*
3230	prctl calls.
3231	* tests/prctl-tsc.test: Likewise.
3232
32332016-12-07  Thomas De Schampheleire  <thomas.de_schampheleire@nokia.com>
3234
3235	Makefile.am: don't confuse CFLAGS and CFLAGS_FOR_BUILD.
3236	Commit dc427d50d96b15c9a64d7e78d97ce4d194622a63 enabled a number of extra
3237	warning flags through configure.ac.  The configure script will determine
3238	dynamically if CC supports these flags before adding them to WARN_CFLAGS.
3239
3240	ioctlsort is compiled with CC_FOR_BUILD, rather than CC.  Nevertheless,
3241	the flags passed to this compilation also include WARN_CFLAGS (through
3242	AM_CFLAGS).  This is incorrect: in a cross-compilation use case, CC
3243	and CC_FOR_BUILD are not the same.  The former is the cross-compiler,
3244	the latter is the host compiler.  Both may be of different versions
3245	and support different warning flags.
3246
3247	In particular, this posed a problem when cross-compiling with a host
3248	compiler gcc 4.1, which does not support all the new flags:
3249
3250	    /usr/bin/gcc -DHAVE_CONFIG_H   -I./linux/arm -I./linux/arm -I./linux
3251	    -I./linux -I. -I. -I/host-sysroot/usr/include -Wall -Wempty-body
3252	    -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op
3253	    -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration
3254	    -Wold-style-definition -Wsign-compare -Wtype-limits -Wwrite-strings -O2
3255	    -I/host-sysroot/usr/include -DIOCTLSORT_INC=\"ioctls_all0.h\" -c -o
3256	    ioctlsort0.o ./ioctlsort.c
3257	    cc1: error: unrecognized command line option "-Wempty-body"
3258	    cc1: error: unrecognized command line option "-Wignored-qualifiers"
3259	    cc1: error: unrecognized command line option "-Wlogical-op"
3260	    cc1: error: unrecognized command line option "-Wmissing-parameter-type"
3261	    cc1: error: unrecognized command line option "-Wold-style-declaration"
3262	    cc1: error: unrecognized command line option "-Wtype-limits"
3263	    make[2]: *** [ioctlsort0.o] Error 1
3264
3265	* Makefile.am (AM_CFLAGS_FOR_BUILD, AM_CPPFLAGS_FOR_BUILD): New
3266	variables.
3267	(ioctlsort_CPPFLAGS): Use AM_CPPFLAGS_FOR_BUILD instead of AM_CPPFLAGS.
3268	(ioctlsort_CFLAGS): Use AM_CFLAGS_FOR_BUILD instead of AM_CFLAGS.
3269	(ioctlsort_LDFLAGS): Use AM_LDFLAGS_FOR_BUILD instead of AM_LDFLAGS.
3270	* m4/ax_prog_cc_for_build.m4 (AX_PROG_CC_FOR_BUILD): Redirect
3271	WARN_CFLAGS and gl_unknown_warnings_are_errors, call st_WARN_CFLAGS,
3272	substitute WARN_CFLAGS_FOR_BUILD.
3273
32742016-12-07  Dmitry V. Levin  <ldv@altlinux.org>
3275
3276	m4: prepare gl_WARN_ADD for simultaneous use of multiple compilers.
3277	* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Change gl_Flags to use
3278	_AC_LANG_PREFIX[]FLAGS in unquoted form.  Change gl_Warn to use gl_Flags
3279	instead of _AC_LANG_ABBREV.  Change notification message to mention
3280	the variable name of the compiler.
3281	(gl_UNKNOWN_WARNINGS_ARE_ERRORS): Do nothing if
3282	gl_unknown_warnings_are_errors is set.
3283	(gl_WARN_ADD): Change the use of gl_UNKNOWN_WARNINGS_ARE_ERRORS from
3284	AC_REQUIRE to a regular call.
3285
32862016-12-07  Dmitry V. Levin  <ldv@altlinux.org>
3287
3288	AX_PROG_CC_FOR_BUILD: redirect more variables related to C compiler.
3289	Some of these variables cannot be redirected using traditional
3290	pushdef/popdef mechanism because of complex constructions like
3291	[ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu] employed by autoconf macros.
3292	Use st_SAVE_VAR/st_RESTORE_VAR to workaround this issue.
3293
3294	* m4/ax_prog_cc_for_build.m4: Redirect ac_cv_prog_cc_stdc,
3295	ac_cv_prog_cc_c11, ac_cv_prog_cc_c99, ac_cv_prog_cc_c89,
3296	am_cv_prog_cc_c_o, and am_cv_CC_dependencies_compiler_type using
3297	pushdef/popdef.
3298	Redirect ac_c_decl_warn_flag, ac_c_preproc_warn_flag, ac_c_werror_flag,
3299	ac_compile, ac_compiler_gnu, ac_cpp, ac_cv_c_compiler_gnu,
3300	ac_cv_c_decl_report, and ac_link using st_SAVE_VAR/st_RESTORE_VAR.
3301
33022016-12-07  Dmitry V. Levin  <ldv@altlinux.org>
3303
3304	Move all gl_WARN_ADD calls to a separate m4 macro.
3305	This is going to be needed for the upcoming AX_PROG_CC_FOR_BUILD
3306	change.
3307
3308	* configure.ac: Call st_WARN_CFLAGS before AX_PROG_CC_FOR_BUILD.
3309	Move all gl_WARN_ADD calls ...
3310	* m4/st_warn_cflags.m4: ... here.
3311
33122016-12-07  Dmitry V. Levin  <ldv@altlinux.org>
3313
3314	m4: introduce st_SAVE_VAR and st_RESTORE_VAR macros.
3315	These new macros are going to be needed for the upcoming
3316	AX_PROG_CC_FOR_BUILD change.
3317
3318	* m4/st_save_restore_var.m4: New file.
3319
33202016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3321
3322	tests: add valgrind support to "make check"
3323	* m4/ax_valgrind_check.m4: Import from the autoconf-archive package.
3324	* configure.ac: Invoke AX_VALGRIND_CHECK.
3325	* valgrind.supp: Move to tests/strace.supp.
3326	* Makefile.am (EXTRA_DIST): Remove valgrind.supp.
3327	* tests/Makefile.am: Add @VALGRIND_CHECK_RULES@.
3328	(VALGRIND_FLAGS, VALGRIND_SUPPRESSIONS_FILES): New variables.
3329	(EXTRA_DIST): Add strace.supp.
3330	* tests/init.sh: Add valgrind command prefix to $STRACE when appropriate.
3331
33322016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3333
3334	tests: robustify threads-execve.test against race conditions.
3335	Due to probabilistic nature of the test, try it several times.
3336
3337	* tests/threads-execve.c (NUMBER_OF_ITERATIONS): Change to 1.
3338	* tests/threads-execve.test: Iterate up to 10 times.
3339
33402016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3341
3342	tests: fix expected output in strace-ttt.test.
3343	If strace -ttt is running too long, it might happen that time stamps
3344	before and after its invocation differ for more than a second.
3345	Adjust expected output to handle this rare but possible case.
3346
3347	* tests/strace-ttt.test: Allow any time stamp between start and finish
3348	of strace invocation.
3349
33502016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3351
3352	tests: fix expected output in strace-tt.test.
3353	If strace -tt is running too long, it might happen that time stamps
3354	before and after its invocation differ for more than a second.
3355	Adjust expected output to handle this rare but possible case.
3356
3357	* tests/strace-tt.test: Allow any time stamp between start and finish
3358	of strace invocation.
3359
33602016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3361
3362	tests: robustify redirect.test against race conditions.
3363	Introduce a synchronization mechanism between the tracee and its peer.
3364
3365	* tests/redirect.test: Change timeout file to $OUT.  Let the tracee
3366	remove $LOG, wait for $LOG removal in its peer.
3367
33682016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3369
3370	tests: robustify attach-f-p.test against race conditions.
3371	Introduce a synchronization mechanism between attach-f-p and strace.
3372
3373	* tests/attach-f-p-cmd.c: New file.
3374	* tests/Makefile.am (check_PROGRAMS): Add attach-f-p-cmd.
3375	* tests/attach-f-p.c: Include <sys/stat.h>.
3376	(main): Write to stdout instead of descriptor 3.  Wait for the peer
3377	writing to stdout.
3378	* tests/attach-f-p.test: Assume that ./attach-f-p-cmd works.
3379	Use $OUT for expected output.  Use attach-f-p-cmd for unlocking $OUT.
3380
33812016-12-06  Dmitry V. Levin  <ldv@altlinux.org>
3382
3383	tests: robustify attach-p-cmd.test against race conditions.
3384	Introduce a synchronization mechanism between attach-p-cmd-p
3385	and attach-p-cmd-cmd processes.
3386
3387	* tests/attach-p-cmd-cmd.c: Include <errno.h> and <sys/stat.h>.
3388	(main): Wait for the lock directory creation by attach-p-cmd-p.
3389	* tests/attach-p-cmd-p.c: Include <errno.h> and <sys/stat.h>.
3390	(main): Create a lock directory and wait for its removal
3391	by attach-p-cmd-cmd.
3392	* tests/attach-p-cmd.test: Assume that test programs work.
3393
33942016-12-05  Dmitry V. Levin  <ldv@altlinux.org>
3395
3396	Rewrite remaining qual_* parsers using bit sets.
3397	* defs.h (struct fault_opts): Replace forward declaration
3398	with a definition.
3399	(qualbits_t, qualify_read, qualify_write, qualify_signals): Remove.
3400	(qual_flags): New function prototype.
3401	(nsyscall_vec, sysent_vec, fault_vec): New variable prototypes.
3402	* qualify.c (abbrev_set, fault_set, raw_set, trace_set, verbose_set):
3403	New variables.
3404	(qualify_read, qualify_write, qualify_signals): Add static qualifier.
3405	(find_errno_by_name, lookup_class, parse_fault_expression,
3406	parse_fault_token, qual_flags, qualify, qualify_abbrev, qualify_fault,
3407	qualify_raw, qualify_syscall, qualify_syscall_class,
3408	qualify_syscall_name, qualify_syscall_number, qualify_syscall_tokens,
3409	qualify_trace, qualify_verbose, strip_prefix): New functions.
3410	* syscall.c (nsyscall_vec, nsysent_vec): Remove static qualifier.
3411	(MAX_NSYSCALLS1, MAX_NSYSCALLS2, MAX_NSYSCALLS, qual_vec, qual_flags,
3412	qual_fault, qual_syscall, qual_options, fault_opts, qualify_one,
3413	qualify_scno, lookup_class, qualify_syscall_class, qualify_syscall_name,
3414	qual_syscall_ex, qual_syscall, strip_prefix, find_errno_by_name,
3415	parse_fault_token, parse_fault_expression, qual_fault, qualify): Remove.
3416	(decode_socket_subcall, decode_ipc_subcall, decode_mips_subcall,
3417	get_scno): Update use of qual_flags.
3418	(inject_syscall_fault_entering): Update per-personality allocation
3419	of tcp->fault_vec.
3420	* tests/fault_injection-exit_group.test: Check parsing of inversed
3421	fault sets.
3422	* tests/fault_injection.test: Check parsing of -efault=none.
3423	* tests/options-syntax.test: Check parsing of invalid syscall numbers.
3424
3425	Change qual_vec/qual_fault into static fixed size arrays.
3426	* defs.h (qual_vec, num_quals): Remove.
3427	(qual_flags): Move ...
3428	* syscall.c: ... here.
3429	(num_quals, num_faults, MIN_QUALS, reallocate_vec, reallocate_qual,
3430	reallocate_fault): Remove.
3431	(qual_vec, qual_fault): Change into static fixed size arrays.
3432	(qualify_one): Remove reallocate_qual and reallocate_fault calls.
3433	(qualify): Likewise.  Replace num_quals and num_faults with
3434	MAX_NSYSCALLS.
3435
3436	Rewrite qual_signal using bit sets.
3437	* defs.h (signal_set): New variable prototypes.
3438	(qualify_signals): New function prototypes.
3439	(QUAL_SIGNAL): Change to a value greater than 0xff.
3440	(QUAL_FAULT): Change to a lower value.
3441	* qualify.c (signal_set): New variable.
3442	(sigstr_to_uint, qualify_signals): New functions.
3443	* syscall.c (qual_signal): Remove.
3444	(qual_options): Replace qual_signal with NULL.
3445	(qualify): Use qualify_signals.
3446	* strace.c (print_signalled, print_stopped): Use is_number_in_set
3447	with signal_set argument.
3448
34492016-12-05  Dmitry V. Levin  <ldv@altlinux.org>
3450
3451	Rewrite qual_desc using bit sets.
3452	As a side effect, this also fixes support of negated sets
3453	of descriptors.
3454
3455	* defs.h (struct number_set): New forward declaration.
3456	(read_set, write_set): New variable prototypes.
3457	(is_number_in_set, qualify_read, qualify_write): New function
3458	prototypes.
3459	(QUAL_READ, QUAL_WRITE): Change to values greater than 0xff.
3460	* qualify.c: New file.
3461	* Makefile.am (strace_SOURCES): Add it.
3462	* syscall.c (qual_desc): Remove.
3463	(qual_options): Replace qual_desc with NULL.
3464	(qualify): Use qualify_read and qualify_write.
3465	(dumpio): Use is_number_in_set.
3466	* tests/options-syntax.test: Check invalid sets of descriptors.
3467	* tests/readv.test: Check dumping of negated sets of descriptors.
3468
34692016-12-05  Dmitry V. Levin  <ldv@altlinux.org>
3470
3471	tests: skip redirect-fds.test when strace is wrapped with valgrind.
3472	valgrind is not as transparent as strace wrt standard descriptors,
3473	so if strace is wrapped with valgrind, the test would check valgrind
3474	transparency properties and fail imminently.
3475
3476	* tests/redirect-fds.test: Skip the test when $STRACE shows a presence
3477	of valgrind.
3478
34792016-12-05  Dmitry V. Levin  <ldv@altlinux.org>
3480
3481	Add valgrind.supp.
3482	As valgrind is not quite happy about the way how get_cpuset_size uses
3483	sched_getaffinity, add a suppression file for this case.
3484
3485	* valgrind.supp: New file.
3486	* Makefile.am (EXTRA_DIST): Add it.
3487
34882016-12-05  Dmitry V. Levin  <ldv@altlinux.org>
3489
3490	affinity: pass 0 as a pid to sched_getaffinity.
3491	* affinity.c (get_cpuset_size): Pass 0 instead of getpid()
3492	to sched_getaffinity.
3493
3494	affinity: document the method of finding out the cpuset size.
3495	* affinity.c (get_cpuset_size): Add a comment about sched_getaffinity.
3496
34972016-12-05  Dmitry V. Levin  <ldv@altlinux.org>
3498
3499	tests: make options-syntax.test tolerant of strace wrappers.
3500	Change the test to allow wrappers like STRACE="valgrind ./strace".
3501
3502	* tests/options-syntax.test: Strip all words but last from $STRACE
3503	variable in all contexts where the name of strace executable is expected
3504	in its output.
3505
35062016-12-04  Dmitry V. Levin  <ldv@altlinux.org>
3507
3508	Do not allocate memory for line buffered output.
3509	libc is perfectly capable of allocating memory for its buffers,
3510	so let it do its job.
3511
3512	* strace.c (init): Do not allocate memory for setvbuf invocation.
3513
35142016-12-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
3515
3516	Update NEWS.
3517
3518	tests: use kernel_ulong_t as argument type in setfsuid/setfsgid tests.
3519	* setfsugid.c: Include "kernel_types.h".
3520	(main): Change type of entries of the "tests" array from long to
3521	kernel_ulong_t.
3522
35232016-12-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
3524	    Elvira Khabirova  <lineprinter0@gmail.com>
3525
3526	uid: print size as signed in setgroups/getgroups.
3527	As this is the type used in kernel.
3528
3529	* uid.c (SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Print size parameter
3530	as "%d".
3531	* tests/getgroups.c: Update expected output.
3532	* tests/setgroups.c: Likewise.
3533
35342016-12-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
3535	    Elvira Khabirova  <lineprinter0@gmail.com>
3536
3537	uid: use printuid for printing UID/GID value.
3538	* uid.c (setfsuid, get_print_uid, print_gid): Use printuid.
3539	* tests/setfsugid.c (printuid): New function.
3540	(main): Use it to print UID/GID values.
3541	* tests/setgroups.c: Likewise.
3542	* tests/setugid.c (ugid2int): Remove.
3543	(printuid): New function.
3544	(main): Use it to print UID/GID values.
3545
35462016-12-01  Eugene Syromyatnikov  <evgsyr@gmail.com>
3547
3548	tests: additional check for PTRACE_SETSIGINFO ptrace command.
3549	* tests/ptrace.c (main): Add an additional PTRACE_SETSIGINFO check.
3550
35512016-12-01  Dmitry V. Levin  <ldv@altlinux.org>
3552
3553	syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32.
3554	* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
3555	* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
3556	Clear __X32_SYSCALL_BIT from scno on x32 personality.
3557
35582016-12-01  Eugene Syromyatnikov  <evgsyr@gmail.com>
3559
3560	Print syscall names only for defined syscalls.
3561	The string literal "__NR_syscall_4294967295" is semantically incorrect
3562	as there is no such constant defined.
3563
3564	* syscall.c (syscall_name): Return NULL if there is no syscall
3565	corresponding to the given number.
3566	* defs.h (syscall_name): Document this behaviour.
3567	* printsiginfo.c (print_si_info): Print syscall name with "__NR_" prefix
3568	only if there is a syscall corresponding to si_syscall number; print
3569	a plain syscall number otherwise.
3570	* tests/ptrace.c (main): Update expected output.
3571
35722016-12-01  Eugene Syromyatnikov  <evgsyr@gmail.com>
3573
3574	affinity: print cpu set as an array.
3575	* affinity.c: Add comma between elements of cpu set.
3576	* tests/sched_xetaffinity.c (main): Update expected output.
3577
3578	statfs: fix printing format of f_fsid field.
3579	* print_statfs.c: Print f_fsid as a structure containing field "val"
3580	which, in turn, is an array of two elements that used to be printed
3581	as members of f_fsid structure.
3582	* tests/statfs.expected: Update expected output.
3583	* tests/xstatfsx.c (print_statfs): Likewise.
3584
3585	swap: always print priority value.
3586	* swapon.c (SYS_FUNC(swapon)): Do not check for non-zero the value
3587	of the prio variable in order to print it.
3588	* tests/swap.c (main): Update expected output.
3589
35902016-12-01  Elvira Khabirova  <lineprinter0@gmail.com>
3591
3592	tests: show pattern line number in match_grep.
3593	This makes debugging of failing test  a bit easier.
3594
3595	* tests/init.sh (match_grep): Add the cnt variable, increment it on every
3596	pattern line read, print it as a prefix for non-matched pattern.
3597
35982016-11-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
3599	    Elvira Khabirova  <lineprinter0@gmail.com>
3600
3601	futex: make output of the val3 argument of the FUTEX_WAKE_OP command more structured
3602	It is a number which consists of several xlat values, not a structure.
3603
3604	* futex.c (SYS_FUNC(futex)): Modify output of the val3 argument
3605	of the FUTEX_WAKE_OP futex syscall command.
3606	* tests/futex.c (main): Update expected output.
3607
36082016-11-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
3609
3610	tests: additional checks for prctl-* tests.
3611	* tests/prctl-pdeathsig.c (main): Additional checks.
3612	* tests/prctl-tsc.c (main): Likewise.
3613	* tests/prctl-pdeathsig.test: Update value of -a argument.
3614	* tests/prctl-tsc.test: Likewise.
3615
36162016-11-30  JingPiao Chen  <chenjingpiao@foxmail.com>
3617
3618	tests: add prctl-pdeathsig.test and prctl-tsc.test.
3619	* tests/prctl-pdeathsig.c: New file.
3620	* tests/prctl-tsc.c: Likewise.
3621	* tests/prctl-pdeathsig.test: New test.
3622	* tests/prctl-tsc.test: Likewise.
3623	* tests/.gitignore: Add prctl-pdeathsig and prctl-tsc.
3624	* tests/Makefile.am (check_PROGRAMS): Likewise.
3625	(DECODER_TESTS): Add prctl-pdeathsig.test and prctl-tsc.test.
3626
36272016-11-30  Dmitry V. Levin  <ldv@altlinux.org>
3628
3629	syscall: Simplify strip_prefix.
3630	* syscall.c (strip_prefix): Use strncmp instead of strlen+memcmp.
3631
3632	util: fix integer overflow check in string_to_uint_ex.
3633	* util.c (string_to_uint_ex): Fix the check for integer overflow
3634	on systems where LONG_MAX == INT_MAX.
3635
3636	Check dumping of io syscalls when descriptor arguments are sensibly large
3637	* tests/tests.h (pipe_maxfd): New prototype.
3638	* tests/pipe_maxfd.c: New file.
3639	* tests/print_maxfd.c: Likewise.
3640	* tests/.gitignore: Add print_maxfd.
3641	* tests/Makefile.am (check_PROGRAMS): Likewise.
3642	(libtests_a_SOURCES): Add pipe_maxfd.c.
3643	* tests/readv.c (main): Use pipe_maxfd() instead of pipe(),
3644	fds[0] instead of 0, fds[1] instead of 1.
3645	* tests/readv.test: Use print_maxfd to specify dump descriptor numbers.
3646
3647	dumpio: remove useless check.
3648	* syscall.c (dumpio): Remove SEN_printargs check.  Use tcp->s_ent->sen
3649	directly.
3650
36512016-11-29  Dmitry V. Levin  <ldv@altlinux.org>
3652
3653	Fix dumping of io syscalls when descriptor argument has unused bits set.
3654	* syscall.c (dumpio): Explicitly cast the first argument of syscall
3655	to "int", the same way as the kernel does.
3656	* tests/read-write.c: Include <asm/unistd.h> and "kernel_types.h".
3657	(k_read, k_write): New functions.
3658	(test_dump, main): Use them.
3659
3660	x32: fix preadv2-pwritev2.test.
3661	* tests/preadv2-pwritev2.c: Include "kernel_types.h".
3662	(main): Use kernel_ulong_t instead of unsigned long as types
3663	of arguments of preadv2 and pwritev2 syscalls.
3664
3665	x32: wire up preadv2 and pwritev2 syscalls.
3666	* linux/x32/syscallent.h [546]: Add preadv2 entry.
3667	[547]: Add pwritev2 entry.
3668
36692016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
3670	    Elvira Khabirova  <lineprinter0@gmail.com>
3671
3672	signal: fix omission of field names in sigaction printers.
3673	* signal.c (decode_old_sigaction, decode_new_sigaction): Add printing
3674	of the field names.
3675	* tests/sigaction.awk: Update expected output.
3676
36772016-11-29  Elvira Khabirova  <lineprinter0@gmail.com>
3678
3679	Make date output format conform to ISO 8601.
3680	* util.c (sprinttime): Make date output conform to ISO 8601.
3681	* tests/utime.c (print_tm): Update expected output.
3682	* tests/xstatx.c (print_time): Likewise.
3683
36842016-11-29  Dmitry V. Levin  <ldv@altlinux.org>
3685
3686	tests: rewrite utime.test without relying on libc utime wrapper.
3687	* tests/utime.c (k_utime): New function, a thin wrapper around
3688	syscall(__NR_utime).
3689	(main): Use it instead of utime.
3690	* tests/utime.test: Update.
3691
36922016-11-29  Dmitry V. Levin  <ldv@altlinux.org>
3693
3694	Fix meaning of negated sets in fault expressions.
3695	Change the parser of fault expression to follow the POLA:
3696	-e fault=!SET
3697	means that all syscalls except those from SET are subject to fault
3698	injection;
3699	-e fault=!SET1:error=ERRNO1, -e fault=!SET2:error=ERRNO2
3700	means that all syscalls except those from SET2 are subject to fault
3701	injection with error code ERRNO2, and all syscalls from SET2 that are
3702	not in SET1 are subject to fault injection with error code ERRNO1.
3703
3704	* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
3705	Handle negated QUAL_FAULT case differently.
3706	* tests/fault_syntax.test: Add checks of negated sets.
3707
37082016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
3709
3710	print_sigevent: fix field names of sigev_value structure.
3711	* print_sigevent.c (print_sigevent): Change "int" to "sival_int", "ptr"
3712	to "sival_ptr".
3713	* tests/mq_sendrecv.c (main): Update expected output in accordance with
3714	fixed field names.
3715	* tests/timer_create.c (main): Likewise.
3716
3717	tests: add more utime checks.
3718	* tests/utime.c: Include <unistd.h> and <asm/unistd.h>.
3719	(main): Add checks for invalid pointers.
3720
3721	utime: fix omission of field names in utimbuf structure printing.
3722	* utime.c (SYS_FUNC(utime)): Print struct utimbuf as a structure,
3723	not as an array (use curly brackets instead of square ones).
3724	Add field names to the output.
3725	* tests/utime.c (main): Update expected output.
3726
3727	mem: print mincore output as an array.
3728	* mem.c (SYS_FUNC(minore)): Print commas between elements.
3729	* tests/mincore.c (print_mincore): Update expected output in accordance
3730	with syscall decoder formatting change.
3731
37322016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
3733
3734	util: provide information whether xlat value has been found.
3735	This is necessary for the upcoming change in the output format
3736	of the val3 argument of the FUTEX_WAKE_OP futex command.
3737
3738	* defs.h (printxvals, printxval_searchn): Change return type to int.
3739	(printxval64, printxval, printxval_long): Likewise.  Forward the value
3740	returned by printxvals call.
3741	* util.c (printxvals, printxval_searchn): Change return type to int,
3742	return 1 if xlat value has been found, 0 otherwise.
3743
37442016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
3745
3746	util: check dflt argument for NULL in printxvals.
3747	This is necessary for the upcoming change in the output format
3748	of the val3 argument of the FUTEX_WAKE_OP futex command.
3749
3750	* util.c (printxvals): Do not print dflt if it is NULL.
3751
37522016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
3753
3754	capability: fix omission of capability structure field names.
3755	* capability.c (print_cap_header, print_cap_data): Add field names
3756	to the output.
3757	* tests/caps.awk: Update test output.
3758
37592016-11-28  Dmitry V. Levin  <ldv@altlinux.org>
3760
3761	tests: fix "comparison between signed and unsigned" compilation warnings
3762	* tests/readv.c (main): Cast r_len to int.
3763	* tests/preadv2-pwritev2.c (dumpio): Likewise.
3764
3765	aarch64, arm, sparc: add comments on fault injection support in kernel.
3766	* linux/aarch64/set_scno.c: Note the kernel commit that introduced
3767	NT_ARM_SYSTEM_CALL support.
3768	* linux/arm/set_scno.c: Note the kernel commit that introduced
3769	PTRACE_SET_SYSCALL support.
3770	* linux/sparc/set_scno.c: Note the kernel commit that introduced
3771	reloading from the syscall number register.
3772
3773	tests: check -C option.
3774	* tests/strace-C.expected: New file.
3775	* tests/strace-C.test: New test.
3776	* tests/Makefile.am (MISC_TESTS): Add strace-C.test.
3777	(EXTRA_DIST): Add strace-C.expected.
3778
3779	tests: check basic options syntax.
3780	* tests/options-syntax.test: New file.
3781	* tests/Makefile.am (MISC_TESTS): Add it.
3782
37832016-11-28  Dmitry V. Levin  <ldv@altlinux.org>
3784
3785	Fix -r option syntax.
3786	While -r option implies -t, it should not literally have the effect
3787	of -t option, e.g. -rr should not increment tflag twice.
3788
3789	* strace.c (init): In the getopt loop, do not increment tflag for each
3790	occurrence of -r option.  After the getopt loop, if rflag is set, set
3791	tflag to 1.  Issue a warning that -tt has no effect with -r.
3792
37932016-11-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
3794
3795	Print timeval pair as an array of timeval entries.
3796	* print_timeval.c (print_timeval_item): New function.
3797	(print_timeval_pair): Use it as a print_function in print_array call.
3798	* tests/futimesat.c (main): Update to test new behaviour.
3799	* tests/utimes.c (main): Likewise.
3800
3801	tests: treat tv_sec/tv_usec as signed types in futimesat and utimes tests
3802	* tests/futimesat.c: Print tv_sec and tv_usec fields as signed types.
3803	* tests/utimes.c: Likewise.
3804
38052016-11-28  Dmitry V. Levin  <ldv@altlinux.org>
3806
3807	alpha: print struct timeval32 consistently.
3808	* defs.h [ALPHA] (timeval32_t): New type.
3809	[ALPHA] (print_timeval32_t): New prototype.
3810	* print_timeval.c [ALPHA] (timeval32_t): Remove.
3811	[ALPHA] (print_timeval32_t): Remove static keyword.
3812	* printrusage.c [ALPHA] (printrusage32): Use timeval32_t instead
3813	of local definition of struct timeval32.  Use print_timeval32_t.
3814
38152016-11-28  Dmitry V. Levin  <ldv@altlinux.org>
3816
3817	Print struct timeval consistently.
3818	Use print_struct_timeval interface to print struct timeval.
3819
3820	* print_timeval.c (print_struct_timeval): New mpers printer.
3821	* print_timex.c (print_timex): Use it.
3822	* printrusage.c (printrusage): Likewise.
3823	* v4l2.c (print_v4l2_buffer): Likewise.
3824	* tests/getrusage.c (main): Print tv_sec and tv_usec fields as signed.
3825	* tests/waitid.c (sprint_rusage): Likewise.
3826
3827	Suggested-by: Eugene Syromyatnikov <evgsyr@gmail.com>
3828
38292016-11-28  Dmitry V. Levin  <ldv@altlinux.org>
3830
3831	Split print_time.c.
3832	After commit v4.14-136-g151d1d1 that removed the last object common
3833	for timespec and timeval parsers there is no need to keep them all
3834	in a single file.
3835
3836	* print_timespec.c: New file.
3837	* print_timeval.c: Likewise.
3838	* Makefile.am (strace_SOURCES): Add them.
3839	* print_time.c: Move all timespec related code to print_timespec.c.
3840	Move all timeval related code to print_timeval.c.
3841
38422016-11-28  Dmitry V. Levin  <ldv@altlinux.org>
3843
3844	tests: check decoding of threads when a non-leader thread invokes execve
3845	* tests/threads-execve.c: New file.
3846	* tests/threads-execve.test: New test.
3847	* tests/.gitignore: Add threads-execve.
3848	* tests/Makefile.am (check_PROGRAMS): Likewise.
3849	(threads_execve_LDADD): New variable.
3850	(MISC_TESTS): Add threads-execve.test.
3851
38522016-11-27  Dmitry V. Levin  <ldv@altlinux.org>
3853
3854	tests: check decoding of fault injected exit_group syscall.
3855	* tests/answer.c: New file.
3856	* tests/fault_injection-exit_group.expected: Likewise.
3857	* tests/fault_injection-exit_group.test: New test.
3858	* tests/.gitignore: Add answer.
3859	* tests/Makefile.am (check_PROGRAMS): Likewise.
3860	(DECODER_TESTS): Add fault_injection-exit_group.test.
3861	(EXTRA_DIST): Add fault_injection-exit_group.expected.
3862
38632016-11-27  Dmitry V. Levin  <ldv@altlinux.org>
3864
3865	Set PTRACE_O_TRACEEXIT option and handle PTRACE_EVENT_EXIT events.
3866	Do not assume that some syscalls do not generate syscall-exit-stops.
3867	When syscalls fail for any reason they may generate syscall-exit-stops.
3868
3869	The solution is to wait for an actual exit reported by PTRACE_EVENT_EXIT
3870	and print the end of unfinished exiting syscall properly.
3871
3872	* exit.c: Remove.
3873	* Makefile.am (strace_SOURCES): Remove exit.c.
3874	* linux/dummy.h (sys_exit): Alias to printargs_d.
3875	* strace.c (ptrace_setoptions): Add PTRACE_O_TRACEEXIT bit.
3876	(print_event_exit): New function.
3877	(trace): Use it in case of PTRACE_EVENT_EXIT.
3878	* syscall.c (trace_syscall_entering): Remove special handling
3879	of SEN_exit.
3880
38812016-11-27  Dmitry V. Levin  <ldv@altlinux.org>
3882
3883	Change printargs to return RVAL_DECODED.
3884	As printargs is invoked as a generic syscall decoder only and
3885	it is not supposed to print anything on exiting, change printargs
3886	to return RVAL_DECODED so it would not be called on exiting at all.
3887
3888	* util.c (printargs): Print args unconditionally, return RVAL_DECODED.
3889
38902016-11-26  Dmitry V. Levin  <ldv@altlinux.org>
3891
3892	Enhance error diagnostics of exit/exit_group decoder.
3893	* exit.c (SYS_FUNC(exit)): Print the name of syscall that has returned.
3894
38952016-11-26  Dmitry V. Levin  <ldv@altlinux.org>
3896
3897	Restrain from fault injection while the trace executes strace code.
3898	There is little use in injections of faults into syscalls made by strace.
3899
3900	* syscall.c (trace_syscall_entering): Clear QUAL_FAULT bit from
3901	tcp->qual_flg when tcp->flags has TCB_HIDE_LOG bit set.
3902
39032016-11-26  Dmitry V. Levin  <ldv@altlinux.org>
3904
3905	Move two global flags to tracee scope.
3906	A simultaneous use of -p option and tracing of a command available
3907	since commit v4.11-183-gfa8c286 introduces a race condition because
3908	the flags whether the first exec has happened are global.
3909
3910	Fix the race by moving hide_log_until_execve and hide_log_until_execve
3911	global variables to TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
3912	in struct tcb.flags, correspondingly.
3913
3914	* defs.h (TCB_HIDE_LOG, TCB_SKIP_DETACH_ON_FIRST_EXEC, hide_log):
3915	New macros.
3916	(hide_log_until_execve): Remove prototype.
3917	* strace.c (skip_one_b_execve, hide_log_until_execve): Remove.
3918	(startup_child): Set TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
3919	in the allocated tcb structure.
3920	(init): Remove initialization of hide_log_until_execve and
3921	skip_one_b_execve.
3922	(print_stopped): Use hide_log() instead of hide_log_until_execve.
3923	(trace): Check and clear TCB_SKIP_DETACH_ON_FIRST_EXEC flag instead
3924	of skip_one_b_execve.
3925	* syscall.c (trace_syscall_entering): Clear TCB_HIDE_LOG flag instead of
3926	hide_log_until_execve.
3927	(trace_syscall_entering, trace_syscall_exiting): Check hide_log()
3928	instead of hide_log_until_execve.
3929
39302016-11-26  Dmitry V. Levin  <ldv@altlinux.org>
3931
3932	Treat execveat as an execve family syscall.
3933	* syscall.c (trace_syscall_entering): Clear hide_log_until_execve flag
3934	also when SEN_execveat is encountered.
3935
39362016-11-25  Dmitry V. Levin  <ldv@altlinux.org>
3937
3938	Change parser of fault expressions to conform the documentation.
3939	Make expressions like fault=SYSCALL1,SYSCALL2:error=EPERM work
3940	as documented, i.e. fail both SYSCALL1 and SYSCALL2 with EPERM.
3941
3942	* syscall.c (parse_fault_expression): Remove const qualifier from
3943	"name" and "token: variables, as well as from the return value.
3944	(qual_fault): Remove const qualifier from "name" variables.
3945	Split "name" into comma delimited tokens and pass each token
3946	to individual qual_syscall_ex call.
3947	(qualify): For QUAL_FAULT options, pass the whole option value
3948	to their qualify methods without prior splitting into comma
3949	delimited tokens.
3950	* tests/fault_injection.test: Check it.
3951	* tests/fault_syntax.test: Check empty syscall sets.
3952
39532016-11-24  Dmitry V. Levin  <ldv@altlinux.org>
3954
3955	Simplify parse_fault_expression.
3956	* syscall.c (parse_fault_expression): Rewrite iterator over strtok_r
3957	in a more concise way.
3958
39592016-11-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
3960
3961	Fix omission of field names in printers of timeval structure.
3962	* print_time.c (time_fmt): Remove.
3963	(timeval_fmt): New constant.
3964	(print_timeval_t, sprint_timeval, print_timeval32_t, sprint_timeval32):
3965	Use it instead of time_fmt.
3966	* print_timex.c (print_timex): Print field names of the time field.
3967	* printrusage.c (printrusage, printrusage32): Print field names
3968	of ru_utime and ru_stime fields.
3969	* tests/adjtimex.c (main): Add field names to expected output.
3970	* tests/clock_nanosleep.c (main): Likewise.
3971	* tests/futimesat.c (main): Likewise.
3972	* tests/getrusage.c (main): Likewise.
3973	* tests/nanosleep.c (main): Likewise.
3974	* tests/oldselect.expected: Likewise.
3975	* tests/utimes.c (main): Likewise.
3976	* tests/wait4.c (sprint_rusage): Likewise.
3977	* tests/waitid.c (sprint_rusage): Likewise.
3978	* tests/xetitimer.c (main): Likewise.
3979	* tests/xettimeofday.c (main): Likewise.
3980	* tests/xselect.c (main): Likewise.
3981
3982	Fix omission of field names in printers of timespec structure.
3983	* print_time.c (timespec_fmt): New constant.
3984	(print_timespec_t, sprint_timespec): Use it instead of time_fmt.
3985	* tests/aio.c: Add field names to expected output.
3986	* tests/clock_nanosleep.c (main): Likewise.
3987	* tests/clock_xettime.c (main): Likewise.
3988	* tests/futex.c (main): Likewise.
3989	* tests/mq_sendrecv.c (do_send, do_recv): Likewise.
3990	* tests/nanosleep.c (main): Likewise.
3991	* tests/ppoll-v.expected: Likewise.
3992	* tests/ppoll.expected: Likewise.
3993	* tests/pselect6.c (main): Likewise.
3994	* tests/recvmmsg-timeout.c (main): Likewise.
3995	* tests/restart_syscall.c (main): Likewise.
3996	* tests/rt_sigtimedwait.c (iterate, main): Likewise.
3997	* tests/sched_rr_get_interval.c (main): Likewise.
3998	* tests/semop.c (main): Likewise.
3999	* tests/strace-T.expected: Likewise.
4000	* tests/timer_xettime.c (main): Likewise.
4001	* tests/timerfd_xettime.c (main): Likewise.
4002	* tests/utimensat.c (print_ts): Likewise.
4003
40042016-11-26  Dmitry V. Levin  <ldv@altlinux.org>
4005
4006	tests: robustify prctl-name.test against unrelated prctl invocations.
4007	* tests/prctl-name.test: Filter out unrelated PR_GET_* prctl calls.
4008
40092016-11-22  Dmitry V. Levin  <ldv@altlinux.org>
4010
4011	tests: cleanup prctl-name.c.
4012	* tests/prctl-name.c (main): Remove "len" variable, rename "len1"
4013	to "len".  Remove "name1" variable, use "name" instead.
4014
4015	Move KVM_* ioctl entries from ioctls_inc*.h to ioctls_arch*.h.
4016	* linux/32/ioctls_inc_align32.h: Regenerate.
4017	* linux/32/ioctls_inc_align64.h: Likewise.
4018	* linux/64/ioctls_inc.h: Likewise.
4019	* linux/arm/ioctls_arch0.h: Likewise.
4020	* linux/i386/ioctls_arch0.h: Likewise.
4021	* linux/powerpc/ioctls_arch0.h: Likewise.
4022	* linux/s390/ioctls_arch0.h: Likewise.
4023	* linux/s390x/ioctls_arch0.h: Likewise.
4024	* linux/x32/ioctls_inc0.h: Likewise.
4025	* linux/x86_64/ioctls_arch0.h: Likewise.
4026
4027	maint: add more workarounds for alpha and powerpc.
4028	* maint/ioctls_sym.sh: Skip asm/core_*.h.  Filter out from
4029	asm-generic/ioctls.h those macros that are defined using unavailable
4030	struct termios2 on alpha and powerpc.
4031
40322016-11-22  Andreas Schwab  <schwab@linux-m68k.org>
4033
4034	Add ioctl definitions for 16-bit alignment.
4035	* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align16.h.
4036	* linux/32/ioctls_inc_align16.h: New file.
4037	* linux/32/ioctls_inc.h [M68K]: Include it.
4038
40392016-11-22  Dmitry V. Levin  <ldv@altlinux.org>
4040
4041	maint: move KVM_* constants from ioctls_inc.h to ioctls_arch.h.
4042	* maint/ioctls_gen.sh: Place constants defined in linux/kvm.h
4043	into ioctls_arch.h instead of ioctls_inc.h.
4044
40452016-11-21  Dmitry V. Levin  <ldv@altlinux.org>
4046
4047	maint: harmonize use of ioctls_sym.sh.
4048	* maint/ioctls_gen.sh: Consistently specify INCLUDES for all
4049	ioctls_sym.sh invocations.  Use $mydir to specify ioctls_sym.sh
4050	location.
4051
4052	maint: rework workarounds for linux/kvm.h.
4053	* maint/ioctls_sym.sh: Remove pre-include linux/kvm.h workarounds.
4054	Skip linux/kvm.h on those architectures that have no asm/kvm.h file.
4055	Introduce post-process workarounds, add post-process workarounds
4056	for linux/kvm.h.
4057
40582016-11-20  Elvira Khabirova  <lineprinter0@gmail.com>
4059
4060	Restructure strace.1.
4061	* strace.1 (OPTIONS): Add subsections.
4062	(PROBLEMS): Rename to REPORTING BUGS.
4063	(SEE ALSO): Move to the bottom.
4064
40652016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
4066
4067	prctl: implement decoding of PR_SET_FP_MODE and PR_GET_FP_MODE options.
4068	* xlat/pr_fp_mode.in: New file.
4069	* prctl.c: Include "xlat/pr_fp_mode.h".
4070	(SYS_FUNC(prctl)): Add handling for PR_SET_FP_MODE and PR_GET_FP_MODE
4071	options.
4072
4073	prctl: add braces for conditional blocks with else/else-if blocks having braces
4074
40752016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
4076
4077	prctl: cast arg2 to int in PR_SET_PTRACER handler.
4078	Kernel code does this when compares it with -1 (apart from comparing it with
4079	PR_SET_PTRACER_ANY, which is also -1) in security/yama/yama_lsm.c.
4080
4081	* prctl.c (SYS_FUNC(prctl)) <PR_SET_PTRACER>: Cast arg2 to int before
4082	comparing it with -1.
4083
40842016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
4085
4086	prctl: use getarg_ull for option value retrieval.
4087	The prctl syscall does not use compat on x32/n32, so argument types
4088	are in fact kernel_ulong_t.
4089
4090	* prctl.c (print_prctl_args): Use getarg_ull, print as "%#llx" instead
4091	of "%#lx".
4092	(SYS_FUNC(prctl)): Use getarg_ull to store call arguments in arg2, arg3,
4093	arg4, arg5 variables of type unsigned long long.  Use them in printing
4094	routines.
4095	(SYS_FUNC(arch_prctl)): Use getarg_ull to store call argument in addr
4096	variable of type unsigned long long.  Print it as "%#llx" instead of
4097	"%#lx".
4098
40992016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
4100
4101	block: add some definitions from <linux/blkpg.h>
4102	This is done in order to fix build error on old distributions where
4103	struct blkpg_ioctl_arg declaration is broken:
4104
4105	In file included from block.c:35:
4106	/usr/include/linux/blkpg.h:36: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token
4107	block.c: In function 'print_blkpg_req':
4108	block.c:113: error: 'struct_blkpg_ioctl_arg' has no member named 'data'
4109
4110	(from SLE10)
4111
4112	* block.c: Include <linux/ioctl.h> instead of <linux/blkpg.h>.
4113	(BLKPG, BLKPG_DEVNAMELTH, BLKPG_VOLNAMELTH): New macros.
4114	(struct_blkpg_ioctl_arg, struct_blkpg_partition): New definitions,
4115	copied from blkpg_ioctl_arg and blkpg_partition structures defined
4116	in <linux/blkpg.h>.
4117
41182016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
4119
4120	xlat: add values to new ARCH_* constants.
4121	Since UAPI header declares them under CONFIG_CHECKPOINT_RESTORE
4122	and they would never be defined in user space.
4123
4124	* xlat/archvals.in: Add numeric values to ARCH_MAP_VDSO_* constants.
4125
41262016-11-20  Dmitry V. Levin  <ldv@altlinux.org>
4127
4128	prctl: include <linux/prctl.h> instead of <sys/prctl.h>
4129	There are no users of prctl function in prctl.c, and all the rest
4130	is provided by <linux/prctl.h> anyway.
4131
4132	* prctl.c: Include <linux/prctl.h> instead of <sys/prctl.h>.
4133
41342016-11-20  Dmitry V. Levin  <ldv@altlinux.org>
4135
4136	tests: check decoding of prctl PR_GET_NAME/PR_SET_NAME operations.
4137	* tests/prctl-name.c: New file.
4138	* tests/prctl-name.test: New test.
4139	* tests/.gitignore: Add prctl-name.
4140	* tests/Makefile.am (check_PROGRAMS): Likewise.
4141	(DECODER_TESTS): Add prctl-name.test.
4142
4143	prctl: fix printing of PR_SET_NAME's argument.
4144	* prctl.c (SYS_FUNC(prctl)): Use printstr_ex with QUOTE_0_TERMINATED
4145	instead of printstr to print the argument of PR_SET_NAME and PR_GET_NAME
4146	operations.
4147
4148	printstr_ex: fix handling of last byte when QUOTE_0_TERMINATED bit set.
4149	* util.c (printstr_ex): Simplify handling of size == 0 case.
4150	Do not artificially decrement size when QUOTE_0_TERMINATED bit is set.
4151	Ensure that str[size] byte is non-zero if it hasn't been fetched.
4152
41532016-11-19  Dmitry V. Levin  <ldv@altlinux.org>
4154
4155	printstr_ex: handle QUOTE_0_TERMINATED bit consistently.
4156	When user_style has QUOTE_0_TERMINATED bit set, printstr_ex prints
4157	the fetched string as a NUL-terminated.
4158	After this change, the string is being fetched as a NUL-terminated, too.
4159
4160	* util.c (printstr_ex): Use umovestr instead of umoven
4161	if QUOTE_0_TERMINATED bit is set.
4162
41632016-11-19  Dmitry V. Levin  <ldv@altlinux.org>
4164
4165	Cleanup fetch part of printstr_ex.
4166	* util.c (printstr_ex): Initialize "style" early, unify error handling.
4167
41682016-11-18  Dmitry V. Levin  <ldv@altlinux.org>
4169
4170	Update prctl ARCH_* constants.
4171	* xlat/archvals.in: Add ARCH_MAP_VDSO_X32, ARCH_MAP_VDSO_32, and
4172	ARCH_MAP_VDSO_64 introduced by linux kernel commit v4.9-rc1~155^2~6.
4173
4174	Update V4L2_* constants.
4175	* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_TOUCH introduced
4176	by linux kernel commit v4.9-rc4~7^2~422.
4177	* xlat/v4l2_input_types.in: Add V4L2_CAP_TOUCH introduced
4178	by linux kernel commit v4.9-rc4~7^2~422.
4179
4180	Update fs *_MAGIC constants.
4181	* xlat/fsmagic.in: Add DAXFS_MAGIC introduced by linux kernel commit
4182	v4.9-rc1~45^2^2~5.
4183
4184	Update MS_* constants.
4185	* xlat/mount_flags.in: Add MS_NOREMOTELOCK introduced
4186	by linux kernel commit v4.9-rc1~57^2~1^2~7.
4187
4188	Update FALLOC_* constants.
4189	* xlat/falloc_flags.in: Add FALLOC_FL_UNSHARE_RANGE introduced
4190	by linux kernel commit v4.9-rc1~31^2~69.
4191
4192	Update BTRFS_* constants.
4193	* xlat/btrfs_features_compat_ro.in: Add
4194	BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID introduced
4195	by linux kernel commit v4.9-rc1~7^2^2~4.
4196
4197	Update BPF_* constants.
4198	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_PERF_EVENT introduced
4199	by linux kernel commit v4.9-rc1~127^2~302^2~4.
4200
42012016-11-18  Eugene Syromyatnikov  <evgsyr@gmail.com>
4202
4203	make-dist: use HEAD for making distribution package.
4204	* make-dist: Use HEAD commit instead of master branch by default.
4205
42062016-11-18  Dmitry V. Levin  <ldv@altlinux.org>
4207
4208	tests: fix btrfs build error on some old systems.
4209	Fix the following build error on SLE 11 SP4:
4210
4211	btrfs.c: In function 'btrfs_test_dev_replace_ioctl':
4212	btrfs.c:1570: error: unknown field 'start' specified in initializer
4213
4214	* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Move initialization
4215	of struct btrfs_ioctl_dev_replace_args.start.srcdevid out of the
4216	designated initializer.
4217
42182016-11-18  Dmitry V. Levin  <ldv@altlinux.org>
4219
4220	tests: check decoding of ERESTARTSYS error code.
4221	* tests/erestartsys.c: New file.
4222	* tests/erestartsys.test: New test.
4223	* tests/.gitignore: Add erestartsys.
4224	* tests/Makefile.am (check_PROGRAMS): Likewise.
4225	(DECODER_TESTS): Add erestartsys.test.
4226
42272016-11-18  Dmitry V. Levin  <ldv@altlinux.org>
4228
4229	Fix signame usage in qual_signal.
4230	Do not assume that the string returned by signame starts with "SIG"
4231	prefix, this is not always the case.
4232
4233	* syscall.c (qual_signal): Skip signame return value
4234	when it does not have "SIG" prefix.
4235
42362016-11-18  Dmitry V. Levin  <ldv@altlinux.org>
4237
4238	tests: check -e signal=set syntax.
4239	* tests/qual_signal.c: New file.
4240	* tests/qual_signal.test: New test.
4241	* tests/.gitignore: Add qual_signal.
4242	* tests/Makefile.am (check_PROGRAMS): Likewise.
4243	(MISC_TESTS): Add qual_signal.test.
4244
42452016-11-17  Dmitry V. Levin  <ldv@altlinux.org>
4246
4247	Make -e fault= expressions cumulative.
4248	Change the way how subsequent -e fault= expressions are interpreted
4249	to implement a cumulative behavior.  For example,
4250	-e fault=file:when=3+ -e fault=chdir
4251	now specifies that all chdir syscalls and 3+ file related syscalls
4252	except chdir are subject for fault injection.
4253
4254	* syscall.c (qualify): Do not reset qual_vec for QUAL_FAULT.
4255	* tests/fault_injection.test: Check it.
4256
42572016-11-16  Dmitry V. Levin  <ldv@altlinux.org>
4258
4259	tests: check syscall fault injection.
4260	* tests/fault_injection.c: New file.
4261	* tests/fault_injection.test: New test.
4262	* tests/fault_syntax.test: Likewise.
4263	* tests/.gitignore: Add fault_injection.
4264	* tests/Makefile.am (check_PROGRAMS): Likewise.
4265	(MISC_TESTS): Add fault_injection.test and fault_syntax.test.
4266
42672016-11-16  Dmitry V. Levin  <ldv@altlinux.org>
4268
4269	Implement syscall fault injection.
4270	Introduce new -e fault=EXPR syntax that can be used to specify a subset
4271	of syscalls that are subject of syscall fault injection, an error code
4272	that has to be injected, and a frequency of injection.
4273
4274	The expression specifying syscall fault injection has the following
4275	format: SET[:error=ERRNO][:when=FIRST[+[STEP]]]
4276	where only SET is a required part and all the rest is optional.
4277
4278	The method used to implement syscall fault injection is the following:
4279	on entering syscall the syscall number is substituted by an invalid
4280	syscall number -1, and on exiting syscall the error code returned by
4281	the kernel is substituted with the error code specified in the fault
4282	expression.
4283
4284	This implementaion is based on the prototype developed
4285	by Nahim El Atmani as a part of his GSoC 2016 strace project.
4286
4287	* defs.h (struct fault_opts): New forward declaration.
4288	(struct tcb): Add fault_vec field.
4289	(TCB_FAULT_INJ, QUAL_FAULT): New macros.
4290	* strace.1: Document -e fault expression syntax.
4291	* strace.c (usage): Mention -e fault expression.
4292	(droptcb): Deallocate fault_vec member.
4293	* syscall.c (qual_fault, arch_set_scno, arch_set_error): New prototypes.
4294	(qual_options): Add "fault" option.
4295	(struct fault_opts): New structure.
4296	(num_faults): New variable.
4297	(fault_vec): New array.
4298	(syscall_fault_injected, tcb_fault_opts, reallocate_fault,
4299	find_errno_by_name, qual_syscall_ex, strip_prefix, parse_fault_token,
4300	parse_fault_expression, qual_fault, inject_syscall_fault_entering,
4301	update_syscall_fault_exiting): New functions.
4302	(qual_syscall): Use qual_syscall_ex.
4303	(qualify_one): Add argument: a pointer to struct fault_opts, all callers
4304	changed.  Copy struct fault_opts from the pointer to fault_vec.
4305	Use reallocate_fault.
4306	(qualify_scno, qualify_syscall_class, qualify_syscall_name): Add
4307	argument: a pointer to struct fault_opts.
4308	(qualify): Use reallocate_fault.  Do not check "all" class for
4309	QUAL_FAULT qualifier.
4310	(lookup_class): Check for "all" class.
4311	(trace_syscall_entering): Use inject_syscall_fault_entering.
4312	(trace_syscall_exiting): Use update_syscall_fault_exiting.  Clear
4313	TCB_FAULT_INJ flag along with TCB_INSYSCALL.  Print " (INJECTED)" suffix
4314	when the syscall has been injected successfully.
4315	[ARCH_REGS_FOR_GETREGSET && !HAVE_GETREGS_OLD]
4316	(ptrace_setregset): New function.
4317	(ptrace_setregset_or_setregs): Define to ptrace_setregset.
4318	[ARCH_REGS_FOR_GETREGS && !HAVE_GETREGS_OLD]
4319	(ptrace_setregs): New function.
4320	(ptrace_setregset_or_setregs): Define to ptrace_setregs.
4321	[ptrace_setregset_or_setregs] (set_regs): New function.
4322	Include "set_scno.c" and "set_error.c"
4323	* NEWS: Mention this enhancement.
4324
43252016-11-16  Dmitry V. Levin  <ldv@altlinux.org>
4326
4327	Implement arch specific methods of changing syscall number and error code
4328	This introduces arch_set_error and arch_set_scno functions for each
4329	supported architecture, needed to implement syscall fault injection.
4330
4331	* linux/aarch64/set_error.c: New file.
4332	* linux/aarch64/set_scno.c: Likewise.
4333	* linux/alpha/set_error.c: Likewise.
4334	* linux/alpha/set_scno.c: Likewise.
4335	* linux/arc/set_error.c: Likewise.
4336	* linux/arc/set_scno.c: Likewise.
4337	* linux/arm/set_error.c: Likewise.
4338	* linux/arm/set_scno.c: Likewise.
4339	* linux/avr32/set_error.c: Likewise.
4340	* linux/avr32/set_scno.c: Likewise.
4341	* linux/bfin/set_error.c: Likewise.
4342	* linux/bfin/set_scno.c: Likewise.
4343	* linux/crisv10/set_error.c: Likewise.
4344	* linux/crisv10/set_scno.c: Likewise.
4345	* linux/crisv32/set_error.c: Likewise.
4346	* linux/crisv32/set_scno.c: Likewise.
4347	* linux/hppa/set_error.c: Likewise.
4348	* linux/hppa/set_scno.c: Likewise.
4349	* linux/i386/set_error.c: Likewise.
4350	* linux/i386/set_scno.c: Likewise.
4351	* linux/ia64/set_error.c: Likewise.
4352	* linux/ia64/set_scno.c: Likewise.
4353	* linux/m68k/set_error.c: Likewise.
4354	* linux/m68k/set_scno.c: Likewise.
4355	* linux/metag/set_error.c: Likewise.
4356	* linux/metag/set_scno.c: Likewise.
4357	* linux/microblaze/set_error.c: Likewise.
4358	* linux/microblaze/set_scno.c: Likewise.
4359	* linux/mips/set_error.c: Likewise.
4360	* linux/mips/set_scno.c: Likewise.
4361	* linux/nios2/set_error.c: Likewise.
4362	* linux/nios2/set_scno.c: Likewise.
4363	* linux/or1k/set_error.c: Likewise.
4364	* linux/or1k/set_scno.c: Likewise.
4365	* linux/powerpc/set_error.c: Likewise.
4366	* linux/powerpc/set_scno.c: Likewise.
4367	* linux/powerpc64/set_error.c: Likewise.
4368	* linux/powerpc64/set_scno.c: Likewise.
4369	* linux/riscv/set_error.c: Likewise.
4370	* linux/riscv/set_scno.c: Likewise.
4371	* linux/s390/set_error.c: Likewise.
4372	* linux/s390/set_scno.c: Likewise.
4373	* linux/s390x/set_error.c: Likewise.
4374	* linux/s390x/set_scno.c: Likewise.
4375	* linux/sh/set_error.c: Likewise.
4376	* linux/sh/set_scno.c: Likewise.
4377	* linux/sh64/set_error.c: Likewise.
4378	* linux/sh64/set_scno.c: Likewise.
4379	* linux/sparc/set_error.c: Likewise.
4380	* linux/sparc/set_scno.c: Likewise.
4381	* linux/sparc64/set_error.c: Likewise.
4382	* linux/sparc64/set_scno.c: Likewise.
4383	* linux/tile/set_error.c: Likewise.
4384	* linux/tile/set_scno.c: Likewise.
4385	* linux/x32/set_error.c: Likewise.
4386	* linux/x32/set_scno.c: Likewise.
4387	* linux/x86_64/set_error.c: Likewise.
4388	* linux/x86_64/set_scno.c: Likewise.
4389	* linux/xtensa/set_error.c: Likewise.
4390	* linux/xtensa/set_scno.c: Likewise.
4391	* Makefile.am (EXTRA_DIST): Add them.
4392
43932016-11-16  Dmitry V. Levin  <ldv@altlinux.org>
4394
4395	cris: add syscall tables.
4396	The incomplete CRIS support introduced by commit v4.5.18-77-gea0e6e8
4397	should not have been merged because it lacks essential parts, e.g.
4398	syscall tables.
4399
4400	This change adds missing syscall tables for crisv10 and crisv32.
4401
4402	* linux/crisv10/syscallent.h: New file.
4403	* linux/crisv32/syscallent.h: Likewise.
4404	* Makefile.am (EXTRA_DIST): Add them.
4405
44062016-11-16  Dmitry V. Levin  <ldv@altlinux.org>
4407
4408	Introduce string_to_uint_ex and string_to_uint_upto functions.
4409	* defs.h (string_to_uint_ex): New prototype.
4410	(string_to_uint_upto): New function, a thin wrapper around
4411	string_to_uint_ex.
4412	* util.c (string_to_uint_ex): New function.
4413	(string_to_uint): Change into a thin wrapper around string_to_uint_upto.
4414	* strace.c (init): Use string_to_uint_upto.
4415	* syscall.c (qualify_scno, qual_signal, qual_desc): Use
4416	string_to_uint_upto instead of string_to_uint.
4417
44182016-11-16  Dmitry V. Levin  <ldv@altlinux.org>
4419
4420	Split qual_syscall into separate functions.
4421	Split qual_syscall into qualify_scno, qualify_syscall_class,
4422	and qualify_syscall_name.
4423	This might be needed later to implement syscall fault injection.
4424
4425	* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
4426	New functions.
4427	(qual_syscall): Use them.
4428
44292016-11-15  Dmitry V. Levin  <ldv@altlinux.org>
4430
4431	xtensa: wire up new syscalls.
4432	* linux/xtensa/syscallent.h [342..347]: New entries.
4433
44342016-11-14  Dmitry V. Levin  <ldv@altlinux.org>
4435
4436	arc: wire up new syscalls.
4437	* linux/arc/syscallent.h [247, 248]: New entries.
4438
44392016-11-13  Dmitry V. Levin  <ldv@altlinux.org>
4440
4441	tests: fix potential compilation warning in ioctl_block.c.
4442	ioctl_block.c:48: warning: 'init_magic' defined but not used
4443
4444	* tests/ioctl_block.c (init_magic): Define only for
4445	[BLKTRACESETUP && HAVE_STRUCT_BLK_USER_TRACE_SETUP].
4446
44472016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
4448
4449	Add support for pkey_mprotect, pkey_alloc, pkey_free syscalls.
4450	* linux/32/syscallent.h: Add syscall entries for pkey_* calls.
4451	* linux/64/syscallent.h: Likewise.
4452	* linux/arm/syscallent.h: Likewise.
4453	* linux/i386/syscallent.h: Likewise.
4454	* linux/mips/syscallent-n32.h: Likewise.
4455	* linux/mips/syscallent-n64.h: Likewise.
4456	* linux/mips/syscallent-o32.h: Likewise.
4457	* linux/x32/syscallent.h: Likewise.
4458	* linux/x86_64/syscallent.h: Likewise.
4459	* mem.c (do_mprotect): New function, common handler for mprotect and
4460	pkey_mprotect.
4461	(SYS_FUNC(mprotect)): Convert to wrapper around do_mprotect.
4462	(SYS_FUNC(pkey_mprotect)): New function.
4463	* xlat/pkey_access.in: New file.
4464	* pkeys.c: New file containing implementation of pkey_alloc and
4465	pkey_free.
4466	* Makefile.am: Add it.
4467	* NEWS: Mention this enhancement.
4468	* tests/.gitignore: Add pkey_alloc, pkey_free, and pkey_mprotect.
4469	* tests/Makefile.am (check_PROGRAMS): Likewise.
4470	(DECODER_TESTS): Add pkey_alloc.test, pkey_free.test, and
4471	pkey_mprotect.test.
4472	* tests/pkey_alloc.c: New file.
4473	* tests/pkey_free.c: Likewise.
4474	* tests/pkey_mprotect.c: Likewise.
4475	* tests/pkey_alloc.test: New test.
4476	* tests/pkey_free.test: Likewise.
4477	* tests/pkey_mprotect.test: Likewise.
4478
44792016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
4480
4481	tests: fix "constant is too large" compilation warnings.
4482	alarm.c: In function 'main':
4483	alarm.c:41: warning: integer constant is too large for 'long' type
4484	aio.c: In function 'main':
4485	aio.c:162: warning: integer constant is too large for 'long' type
4486	btrfs.c: In function 'btrfs_test_sync_ioctls':
4487	btrfs.c:202: warning: integer constant is too large for 'long' type
4488	btrfs.c: In function 'btrfs_test_subvol_ioctls':
4489	btrfs.c:289: warning: integer constant is too large for 'long' type
4490	btrfs.c:290: warning: integer constant is too large for 'long' type
4491	dup2.c: In function 'main':
4492	dup2.c:12: warning: integer constant is too large for 'long' type
4493	dup2.c:13: warning: integer constant is too large for 'long' type
4494	dup3.c: In function 'main':
4495	dup3.c:13: warning: integer constant is too large for 'long' type
4496	dup3.c:14: warning: integer constant is too large for 'long' type
4497	epoll_create.c: In function 'main':
4498	epoll_create.c:12: warning: integer constant is too large for 'long' type
4499	epoll_ctl.c: In function 'invoke_syscall':
4500	epoll_ctl.c:14: warning: integer constant is too large for 'long' type
4501	faccessat.c: In function 'main':
4502	faccessat.c:13: warning: integer constant is too large for 'long' type
4503	fchdir.c: In function 'main':
4504	fchdir.c:12: warning: integer constant is too large for 'long' type
4505	struct_flock.c: In function 'invoke_test_syscall':
4506	struct_flock.c:48: warning: integer constant is too large for 'long' type
4507	struct_flock.c: In function 'test_flock_einval':
4508	struct_flock.c:58: warning: integer constant is too large for 'long' type
4509	struct_flock.c:59: warning: integer constant is too large for 'long' type
4510	fcntl64.c: In function 'test_flock64_einval':
4511	fcntl64.c:44: warning: integer constant is too large for 'long' type
4512	fcntl64.c:45: warning: integer constant is too large for 'long' type
4513	fcntl.c: In function 'test_flock64_einval':
4514	fcntl.c:44: warning: integer constant is too large for 'long' type
4515	fcntl.c:45: warning: integer constant is too large for 'long' type
4516	fdatasync.c: In function 'main':
4517	fdatasync.c:12: warning: integer constant is too large for 'long' type
4518	flock.c: In function 'main':
4519	flock.c:13: warning: integer constant is too large for 'long' type
4520	xstatx.c: In function 'main':
4521	xstatx.c:255: warning: integer constant is too large for 'long' type
4522	xstatx.c:290: warning: integer constant is too large for 'long' type
4523	xstatx.c:290: warning: integer constant is too large for 'long' type
4524	xstatx.c:290: warning: integer constant is too large for 'long' type
4525	xstatx.c:290: warning: integer constant is too large for 'long' type
4526	xstatx.c:290: warning: integer constant is too large for 'long' type
4527	xstatx.c:290: warning: integer constant is too large for 'long' type
4528	xstatx.c:290: warning: integer constant is too large for 'long' type
4529	xstatx.c:290: warning: integer constant is too large for 'long' type
4530	xstatx.c:290: warning: integer constant is too large for 'long' type
4531	xstatx.c:294: warning: integer constant is too large for 'long' type
4532	xstatx.c:294: warning: integer constant is too large for 'long' type
4533	xstatx.c:294: warning: integer constant is too large for 'long' type
4534	xstatx.c:294: warning: integer constant is too large for 'long' type
4535	xstatx.c:294: warning: integer constant is too large for 'long' type
4536	xstatx.c:294: warning: integer constant is too large for 'long' type
4537	xstatx.c:294: warning: integer constant is too large for 'long' type
4538	xstatx.c:294: warning: integer constant is too large for 'long' type
4539	xstatx.c:294: warning: integer constant is too large for 'long' type
4540	xstatfsx.c: In function 'main':
4541	xstatfsx.c:113: warning: integer constant is too large for 'long' type
4542	fsync.c: In function 'main':
4543	fsync.c:12: warning: integer constant is too large for 'long' type
4544	ftruncate64.c: In function 'main':
4545	ftruncate64.c:39: warning: integer constant is too large for 'long' type
4546	futimesat.c: In function 'main':
4547	futimesat.c:52: warning: integer constant is too large for 'long' type
4548	futimesat.c:59: warning: integer constant is too large for 'long' type
4549	get_mempolicy.c: In function 'main':
4550	get_mempolicy.c:83: warning: integer constant is too large for 'long' type
4551	get_mempolicy.c:84: warning: integer constant is too large for 'long' type
4552	get_mempolicy.c:85: warning: integer constant is too large for 'long' type
4553	get_mempolicy.c:86: warning: integer constant is too large for 'long' type
4554	getdents.c: In function 'main':
4555	getdents.c:109: warning: integer constant is too large for 'long' type
4556	getdents.c:110: warning: integer constant is too large for 'long' type
4557	getdents.c:114: warning: integer constant is too large for 'long' type
4558	getdents64.c: In function 'main':
4559	getdents64.c:114: warning: integer constant is too large for 'long' type
4560	getdents64.c:115: warning: integer constant is too large for 'long' type
4561	getdents64.c:119: warning: integer constant is too large for 'long' type
4562	xgetrlimit.c: In function 'main':
4563	xgetrlimit.c:71: warning: integer constant is too large for 'long' type
4564	ioctl_block.c:44: warning: integer constant is too large for 'long' type
4565	ioctl_block.c: In function 'main':
4566	ioctl_block.c:136: warning: integer constant is too large for 'long' type
4567	ioctl_block.c:137: warning: integer constant is too large for 'long' type
4568	ioctl_block.c:161: warning: integer constant is too large for 'long' type
4569	ioctl_block.c:170: warning: integer constant is too large for 'long' type
4570	ioctl_block.c:171: warning: integer constant is too large for 'long' type
4571	ioctl_evdev.c:42: warning: integer constant is too large for 'long' type
4572	ioctl_mtd.c:46: warning: integer constant is too large for 'long' type
4573	ioctl_rtc.c:40: warning: integer constant is too large for 'long' type
4574	ioperm.c: In function 'main':
4575	ioperm.c:12: warning: integer constant is too large for 'long' type
4576	ioctl_v4l2.c: In function 'main':
4577	ioctl_v4l2.c:409: warning: integer constant is too large for 'long' type
4578	ipc.c: In function 'ipc_call':
4579	ipc.c:52: warning: integer constant is too large for 'long' type
4580	kill.c: In function 'main':
4581	kill.c:59: warning: integer constant is too large for 'long' type
4582	kill.c:62: warning: integer constant is too large for 'long' type
4583	kill.c:63: warning: integer constant is too large for 'long' type
4584	kill.c:68: warning: integer constant is too large for 'long' type
4585	linkat.c: In function 'main':
4586	linkat.c:14: warning: integer constant is too large for 'long' type
4587	linkat.c:15: warning: integer constant is too large for 'long' type
4588	mbind.c: In function 'main':
4589	mbind.c:41: warning: integer constant is too large for 'long' type
4590	mbind.c:43: warning: integer constant is too large for 'long' type
4591	mbind.c:44: warning: integer constant is too large for 'long' type
4592	migrate_pages.c: In function 'main':
4593	migrate_pages.c:41: warning: integer constant is too large for 'long' type
4594	In file included from mkdirat.c:10:
4595	umode_t.c: In function 'test_syscall':
4596	umode_t.c:47: warning: integer constant is too large for 'long' type
4597	mknod.c: In function 'call_mknod':
4598	mknod.c:16: warning: integer constant is too large for 'long' type
4599	mknod.c: In function 'main':
4600	mknod.c:23: warning: integer constant is too large for 'long' type
4601	mknod.c:49: warning: integer constant is too large for 'long' type
4602	mknod.c:56: warning: integer constant is too large for 'long' type
4603	mknodat.c:12: warning: integer constant is too large for 'long' type
4604	mknodat.c: In function 'call_mknodat':
4605	mknodat.c:17: warning: integer constant is too large for 'long' type
4606	mknodat.c: In function 'main':
4607	mknodat.c:24: warning: integer constant is too large for 'long' type
4608	mknodat.c:50: warning: integer constant is too large for 'long' type
4609	mknodat.c:57: warning: integer constant is too large for 'long' type
4610	mmap.c: In function 'main':
4611	mmap.c:51: warning: integer constant is too large for 'long' type
4612	move_pages.c: In function 'print_stat_pages':
4613	move_pages.c:139: warning: integer constant is too large for 'long' type
4614	move_pages.c: In function 'print_move_pages':
4615	move_pages.c:166: warning: integer constant is too large for 'long' type
4616	move_pages.c: In function 'main':
4617	move_pages.c:188: warning: integer constant is too large for 'long' type
4618	mq_sendrecv.c: In function 'main':
4619	mq_sendrecv.c:238: warning: integer constant is too large for 'long' type
4620	mq_sendrecv.c:401: warning: integer constant is too large for 'long' type
4621	mq_sendrecv.c:403: warning: integer constant is too large for 'long' type
4622	nsyscalls.c: In function 'test_syscall':
4623	nsyscalls.c:64: warning: integer constant is too large for 'long' type
4624	nsyscalls.c:65: warning: integer constant is too large for 'long' type
4625	nsyscalls.c:66: warning: integer constant is too large for 'long' type
4626	nsyscalls.c:67: warning: integer constant is too large for 'long' type
4627	nsyscalls.c:68: warning: integer constant is too large for 'long' type
4628	nsyscalls.c:69: warning: integer constant is too large for 'long' type
4629	preadv-pwritev.c: In function 'main':
4630	preadv-pwritev.c:162: warning: comparison between signed and unsigned
4631	prlimit64.c: In function 'main':
4632	prlimit64.c:65: warning: integer constant is too large for 'long' type
4633	prlimit64.c:70: warning: integer constant is too large for 'long' type
4634	remap_file_pages.c: In function 'main':
4635	remap_file_pages.c:42: warning: integer constant is too large for 'long' type
4636	remap_file_pages.c:43: warning: integer constant is too large for 'long' type
4637	remap_file_pages.c:45: warning: integer constant is too large for 'long' type
4638	renameat.c: In function 'main':
4639	renameat.c:15: warning: integer constant is too large for 'long' type
4640	renameat.c:16: warning: integer constant is too large for 'long' type
4641	rt_sigqueueinfo.c: In function 'main':
4642	rt_sigqueueinfo.c:41: warning: integer constant is too large for 'long' type
4643	rt_tgsigqueueinfo.c: In function 'k_tgsigqueueinfo':
4644	rt_tgsigqueueinfo.c:45: warning: integer constant is too large for 'long' type
4645	rt_tgsigqueueinfo.c:46: warning: integer constant is too large for 'long' type
4646	rt_tgsigqueueinfo.c:47: warning: integer constant is too large for 'long' type
4647	rt_tgsigqueueinfo.c: In function 'main':
4648	rt_tgsigqueueinfo.c:67: warning: integer constant is too large for 'long' type
4649	sendfile.c: In function 'main':
4650	sendfile.c:110: warning: integer constant is too large for 'long' type
4651	sendfile64.c: In function 'main':
4652	sendfile64.c:100: warning: integer constant is too large for 'long' type
4653	set_mempolicy.c: In function 'main':
4654	set_mempolicy.c:129: warning: integer constant is too large for 'long' type
4655	set_mempolicy.c:130: warning: integer constant is too large for 'long' type
4656	setrlimit.c: In function 'main':
4657	setrlimit.c:44: warning: integer constant is too large for 'long' type
4658	socketcall.c: In function 'test_socketcall':
4659	socketcall.c:58: warning: integer constant is too large for 'long' type
4660	splice.c: In function 'main':
4661	splice.c:41: warning: integer constant is too large for 'long' type
4662	splice.c:42: warning: integer constant is too large for 'long' type
4663	splice.c:45: warning: integer constant is too large for 'long' type
4664	splice.c:46: warning: integer constant is too large for 'long' type
4665	symlinkat.c: In function 'main':
4666	symlinkat.c:12: warning: integer constant is too large for 'long' type
4667	sync_file_range.c: In function 'main':
4668	sync_file_range.c:42: warning: integer constant is too large for 'long' type
4669	sync_file_range.c:43: warning: integer constant is too large for 'long' type
4670	syslog.c: In function 'main':
4671	syslog.c:14: warning: integer constant is too large for 'long' type
4672	tee.c: In function 'main':
4673	tee.c:41: warning: integer constant is too large for 'long' type
4674	tee.c:42: warning: integer constant is too large for 'long' type
4675	timer_create.c: In function 'main':
4676	timer_create.c:52: warning: integer constant is too large for 'long' type
4677	timer_create.c:84: warning: integer constant is too large for 'long' type
4678	timer_create.c:85: warning: integer constant is too large for 'long' type
4679	truncate64.c: In function 'main':
4680	truncate64.c:41: warning: integer constant is too large for 'long' type
4681	xgetrlimit.c: In function 'main':
4682	xgetrlimit.c:71: warning: integer constant is too large for 'long' type
4683	umode_t.c: In function 'test_syscall':
4684	umode_t.c:46: warning: integer constant is too large for 'long' type
4685	unlinkat.c: In function 'main':
4686	unlinkat.c:13: warning: integer constant is too large for 'long' type
4687	waitpid.c: In function 'main':
4688	waitpid.c:43: warning: integer constant is too large for 'long' type
4689	waitid.c: In function 'poison':
4690	waitid.c:141: warning: integer constant is too large for 'long' type
4691	xetpriority.c: In function 'main':
4692	xetpriority.c:15: warning: integer constant is too large for 'long' type
4693	xetpriority.c:19: warning: integer constant is too large for 'long' type
4694	xetpriority.c:20: warning: integer constant is too large for 'long' type
4695	xetpgid.c: In function 'main':
4696	xetpgid.c:43: warning: integer constant is too large for 'long' type
4697	xetpgid.c:47: warning: integer constant is too large for 'long' type
4698	xetpgid.c:48: warning: integer constant is too large for 'long' type
4699
4700	(SLES 11SP4, i386)
4701
4702	* tests/alarm.c (main): Add proper suffix to integer constant.
4703	* tests/aio.c (main): Likewise.
4704	* tests/btrfs.c (btrfs_test_sync_ioctls, btrfs_test_subvol_ioctls): Likewise.
4705	* tests/dup2.c (main): Likewise.
4706	* tests/dup3.c (main): Likewise.
4707	* tests/epoll_create.c (main): Likewise.
4708	* tests/epoll_ctl.c (invoke_syscall): Likewise.
4709	* tests/faccessat.c (main): Likewise.
4710	* tests/fchdir.c (main): Likewise.
4711	* tests/fcntl.c (test_flock64_einval): Likewise.
4712	* tests/fcntl64.c (test_flock64_einval): Likewise.
4713	* tests/fdatasync.c (main): Likewise.
4714	* tests/flock.c (main): Likewise.
4715	* tests/fstat64.c (SAMPLE_SIZE): Likewise.
4716	* tests/fstat.c (SAMPLE_SIZE): Likewise.
4717	* tests/fsync.c (main): Likewise.
4718	* tests/ftruncate64.c (main): Likewise.
4719	* tests/futimesat.c (main): Likewise.
4720	* tests/get_mempolicy.c (main): Likewise.
4721	* tests/getdents.c (main): Likewise.
4722	* tests/getdents64.c (main): Likewise.
4723	* tests/ioctl_block.c (lmagic, main): Likewise.
4724	* tests/ioctl_evdev.c (lmagic): Likewise.
4725	* tests/ioctl_mtd.c (lmagic): Likewise.
4726	* tests/ioctl_rtc.c (lmagic): Likewise.
4727	* tests/ioctl_v4l2.c (main): Likewise.
4728	* tests/ioperm.c (main): Likewise.
4729	* tests/ipc.c (ipc_call): Likewise.
4730	* tests/kill.c (main): Likewise.
4731	* tests/linkat.c (main): Likewise.
4732	* tests/lstat64.c (SAMPLE_SIZE): Likewise.
4733	* tests/lstat.c (SAMPLE_SIZE): Likewise.
4734	* tests/mbind.c (main): Likewise.
4735	* tests/migrate_pages.c (main): Likewise.
4736	* tests/mkdirat.c (TEST_SYSCALL_PREFIX_ARGS): Likewise.
4737	* tests/mknod.c (call_mknod, main): Likewise.
4738	* tests/mknodat.c (fd, call_mknodat, main): Likewise.
4739	* tests/mmap.c (main): Likewise.
4740	* tests/move_pages.c (print_stat_pages, print_move_pages): Likewise.
4741	* tests/mq_sendrecv.c (main): Likewise.
4742	* tests/nsyscalls.c (test_syscall): Likewise.
4743	* tests/prlimit64.c (main): Likewise.
4744	* tests/remap_file_pages.c (main): Likewise.
4745	* tests/renameat.c (main): Likewise.
4746	* tests/rt_sigqueueinfo.c (main): Likewise.
4747	* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo, main): Likewise.
4748	* tests/sendfile.c (main): Likewise.
4749	* tests/sendfile64.c (main): Likewise.
4750	* tests/set_mempolicy.c (main): Likewise.
4751	* tests/setrlimit.c (main): Likewise.
4752	* tests/socketcall.c (test_socketcall): Likewise.
4753	* tests/splice.c (main): Likewise.
4754	* tests/stat64.c (SAMPLE_SIZE): Likewise.
4755	* tests/stat.c (SAMPLE_SIZE): Likewise.
4756	* tests/struct_flock.c (invoke_test_syscall, test_flock_einval): Likewise.
4757	* tests/symlinkat.c (main): Likewise.
4758	* tests/sync_file_range.c (main): Likewise.
4759	* tests/syslog.c (main): Likewise.
4760	* tests/tee.c (main): Likewise.
4761	* tests/timer_create.c (main): Likewise.
4762	* tests/truncate64.c (main): Likewise.
4763	* tests/umode_t.c (test_syscall): Likewise.
4764	* tests/unlinkat.c (main): Likewise.
4765	* tests/waitid.c (main): Likewise.
4766	* tests/waitpid.c (main): Likewise.
4767	* tests/xetpgid.c (main): Likewise.
4768	* tests/xetpriority.c (main): Likewise.
4769	* tests/xgetrlimit.c (main): Likewise.
4770	* tests/xstatfsx.c (main) [CHECK_ODD_SIZE]: Likewise.
4771	* tests/xstatx.c (main): Likewise.
4772
47732016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
4774
4775	tests: fix "comparison between signed and unsigned" compilation warnings
4776	preadv-pwritev.c: In function 'main':
4777	preadv-pwritev.c:162: warning: comparison between signed and unsigned
4778	readv.c: In function 'main':
4779	readv.c:148: warning: comparison between signed and unsigned
4780	recvmsg.c: In function 'main':
4781	recvmsg.c:148: warning: comparison between signed and unsigned
4782
4783	* tests/preadv-pwritev.c (main): Cast r_len to int.
4784	* tests/readv.c (main): Likewise.
4785	* tests/recvmsg.c (main): Likewise.
4786
47872016-11-13  Dmitry V. Levin  <ldv@altlinux.org>
4788
4789	syscall.c: refactor getregs_old fallback in get_regs.
4790	This change moves remaining arch specific getregs_old code into
4791	appropriate arch subdirectories and removes unnecessary code
4792	duplication.
4793
4794	* linux/getregs_old.h: New file.
4795	* linux/powerpc/getregs_old.h: Likewise.
4796	* linux/powerpc64/getregs_old.h: Likewise.
4797	* linux/x86_64/getregs_old.h: Likewise.
4798	* Makefile.am (EXTRA_DIST): Add them.
4799	* syscall.c: Include "getregs_old.h".
4800	[X86_64 || POWERPC]: Remove.
4801	[ARCH_REGS_FOR_GETREGSET] (ptrace_getregset_or_getregs): Define
4802	to ptrace_getregset.
4803	[ARCH_REGS_FOR_GETREGS] (ptrace_getregset_or_getregs): Define
4804	to ptrace_getregs.
4805	(get_regs): Check for ptrace_getregset_or_getregs instead
4806	of ARCH_REGS_FOR_GETREGSET and ARCH_REGS_FOR_GETREGS.  Use
4807	ptrace_getregset_or_getregs instead of ptrace_getregset and
4808	ptrace_getregs.  Check for HAVE_GETREGS_OLD instead of X86_64
4809	and POWERPC.  Use use_getregs_old instead of getregset_support
4810	and old_kernel.
4811
48122016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
4813
4814	Rename BUILD_BUG_ON_ZERO macro.
4815	In order to avoid name clash on distributions which decide to include
4816	kernel headers instead of UAPI ones.  For example, on SLES 11SP4:
4817
4818	gcc -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux -I. -Wall -O2 -c net.c
4819	In file included from /usr/include/linux/sysctl.h:25:0,
4820	                 from /usr/include/linux/netfilter.h:6,
4821	                 from /usr/include/linux/netfilter_arp.h:8,
4822	                 from /usr/include/linux/netfilter_arp/arp_tables.h:14,
4823	                 from net.c:60:
4824	net.c: In function 'print_packet_mreq':
4825	gcc_compat.h:59:27: error: negative width in bit-field '<anonymous>'
4826	 # define MUST_BE_ARRAY(a) BUILD_BUG_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
4827	                           ^
4828	defs.h:76:53: note: in expansion of macro 'MUST_BE_ARRAY'
4829	 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
4830	                                                     ^
4831	net.c:747:22: note: in expansion of macro 'ARRAY_SIZE'
4832	   if (mreq.mr_alen > ARRAY_SIZE(mreq.mr_address))
4833	                      ^
4834	due to the fact BUILD_BUG_ON_ZERO is already defined in <linux/kernel.h>.
4835
4836	* gcc_compat.h (BUILD_BUG_ON_ZERO): Rename to FAIL_BUILD_ON_ZERO.
4837	(MUST_BE_ARRAY): Update usage.
4838
48392016-11-12  Dmitry V. Levin  <ldv@altlinux.org>
4840
4841	syscall.c: factor out ptrace_getregs from get_regs.
4842	Move the code that calls ptrace(PTRACE_GETREGS) to a separate function.
4843
4844	* syscall.c (ptrace_getregs): New function.
4845	(get_regs): Use it.
4846
48472016-11-12  Dmitry V. Levin  <ldv@altlinux.org>
4848
4849	syscall.c: rename get_regset to ptrace_getregset.
4850	* syscall.c (get_regset): Rename to ptrace_getregset.
4851	(get_regs): Rename get_regset to ptrace_getregset.
4852
48532016-11-12  Andreas Schwab  <schwab@linux-m68k.org>
4854
4855	m68k: switch to PTRACE_GETREGS.
4856	* Makefile.am (EXTRA_DIST): Add linux/m68k/arch_regs.h, remove
4857	linux/m68k/get_syscall_result.c.
4858	* linux/m68k/arch_regs.c (m68k_d0, ARCH_PC_PEEK_ADDR): Don't
4859	define.
4860	(m68k_regs, m68k_usp_ptr, ARCH_PC_REG, ARCH_REGS_FOR_GETREGS):
4861	Define.
4862	* linux/m68k/arch_regs.h: New file.
4863	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use m68k_usp_ptr.
4864	* linux/m68k/get_error.c (get_error): Use m68k_regs.d0.
4865	* linux/m68k/get_scno.c (arch_get_scno): Use m68k_regs.orig_d0.
4866	* linux/m68k/get_syscall_args.c (get_syscall_args): Use m68k_regs.
4867	* linux/m68k/get_syscall_result.c: Remove.
4868
4869	tests: do not run old_mmap test on m68k.
4870	* tests/old_mmap.c: Skip test on m68k.
4871
48722016-11-12  Dmitry V. Levin  <ldv@altlinux.org>
4873
4874	syscall.c: introduce reallocate_vec function.
4875	This might be needed later to implement syscall fault injection.
4876
4877	* syscall.c (reallocate_vec): New function.
4878	(reallocate_qual): Use it.
4879
48802016-11-12  Dmitry V. Levin  <ldv@altlinux.org>
4881
4882	Fix prototypes of qual_desc, qual_signal, and qual_syscall functions.
4883	* syscall.c (qual_desc, qual_signal, qual_syscall): Fix prototypes.
4884	(struct qual_options): Fix type of "qualify" member.
4885
48862016-11-12  Eugene Syromyatnikov  <evgsyr@gmail.com>
4887
4888	linux/x32/syscallent.h: fix syscallent array initialisation on x32.
4889	Why gcc didn't complain about it? It is definitely an index clash.
4890
4891	* linux/x32/syscallent.h: Change initializer indices for empty records from
4892	[327 ... 511] to [329 ... 511].
4893
48942016-11-11  Dmitry V. Levin  <ldv@altlinux.org>
4895
4896	Introduce upoke function.
4897	This will be needed to implement fault injection on those architectures
4898	that lack PTRACE_SETREGSET/PTRACE_SETREGS support.
4899
4900	* defs.h (upoke): New prototype.
4901	* upoke.c: New file.
4902	* Makefile.am (libstrace_a_SOURCES): Add it.
4903
49042016-11-11  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
4905
4906	Update ioctl entries from linux 4.9.
4907	* linux/32/ioctls_inc_align32.h: Update from linux v4.9 using ioctls_gen.sh.
4908	* linux/32/ioctls_inc_align64.h: Likewise.
4909	* linux/64/ioctls_inc.h: Likewise.
4910	* linux/x32/ioctls_inc0.h: Likewise.
4911	* NEWS: Mention this.
4912
49132016-11-10  Eugene Syromyatnikov  <evgsyr@gmail.com>
4914
4915	Update NEWS.
4916
49172016-11-10  Mikulas Patocka  <mpatocka@redhat.com>
4918	    Eugene Syromyatnikov  <evgsyr@gmail.com>
4919
4920	Add support for decoding of DM_* ioctl commands.
4921	* dm.c: New file.
4922	* xlat/dm_flags.in: Likewise.
4923	* Makefile.am (strace_SOURCES): Add dm.c.
4924	* configure.ac (AC_CHECK_HEADERS): Add linux/dm-ioctl.h.
4925	* defs.h (dm_ioctl): New prototype.
4926	* ioctl.c (ioctl_decode) [HAVE_LINUX_DM_IOCTL_H]: Call dm_ioctl
4927	for 0xfd ioctl type.
4928	* tests/ioctl_dm.c: New file.
4929	* tests/ioctl_dm-v.c: Likewise.
4930	* tests/ioctl_dm.test: New test.
4931	* tests/ioctl_dm-v.test: Likewise.
4932	* tests/.gitignore: Add ioctl_dm and ioctl_dm-v.
4933	* tests/Makefile.am (check_PROGRAMS): Likewise.
4934	(DECODER_TESTS): Add ioctl_dm.test and ioctl_dm-v.test.
4935
49362016-11-10  Dmitry V. Levin  <ldv@altlinux.org>
4937
4938	Introduce ALIGNOF macro.
4939	* gcc_compat.h (ALIGNOF): New macro.
4940
49412016-11-10  Eugene Syromyatnikov  <evgsyr@gmail.com>
4942
4943	util: add support for QUOTE_0_TERMINATED in user_style to ptrintstr_ex.
4944	This enables printing size-limited (expectedly) ASCIZ strings.
4945
4946	This is done by increasing umoven size limit for sized strings by one
4947	byte above max_strlen (enabling copying possible NUL byte in case len is
4948	greater than max_strlen) and decreasing size after copying by one byte
4949	in case QUOTE_0_TERMINATED is set (due to user_style or usage of len of
4950	-1).  As a result, there is one excess byte for string_quote in case
4951	QUOTE_0_TERMINATED is set so string_quote can check for NUL termination
4952	of strings up to size bytes in size (which is len or max_strlen, whatever
4953	is greater).
4954
4955	The catch here is that when string is not properly NUL-terminated and
4956	QUOTE_0_TERMINATED is provided in user_style and len is less than
4957	max_strlen then last non-NUL byte is not printed.  But ellipsis is
4958	printed instead, being indication that string is not terminated
4959	properly.  QUOTE_OMIT_TRAILING_0 should be used instead in case this
4960	behaviour is not intended.
4961
4962	* util.c (printstr_ex): Copy one excess byte in case of non-negative len
4963	provided and it is more than max_strlen; handle case of max_strlen of 0
4964	in case QUOTE_0_TERMINATED is set separately; check for need of printing
4965	ellipsis by checking resulting style against QUOTE_0_TERMINATED.
4966
49672016-11-09  Eugene Syromyatnikov  <evgsyr@gmail.com>
4968
4969	tests: check decoding of mq_{notify,open,timedreceive,timedsend,unlink}
4970	* tests/mq_sendrecv.c: New file.
4971	* tests/mq_sendrecv-read.c: Likewise.
4972	* tests/mq_sendrecv-write.c: Likewise.
4973	* tests/mq_sendrecv.test: New test.
4974	* tests/mq_sendrecv-read.test: Likewise.
4975	* tests/mq_sendrecv-write.test: Likewise.
4976	* tests/.gitignore: Add mq_sendrecv, mq_sendrecv-read,
4977	and mq_sendrecv-write.
4978	* tests/Makefile.am (check_PROGRAMS): Likewise.
4979	(mq_sendrecv_LDADD, mq_sendrecv_read_LDADD, mq_sendrecv_write_LDADD):
4980	New variables.
4981	(DECODER_TESTS): Add mq_sendrecv.test, mq_sendrecv-read.test,
4982	and mq_sendrecv-write.test.
4983
49842016-11-08  Dmitry V. Levin  <ldv@altlinux.org>
4985
4986	tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work.
4987	* tests/times.c (main): Skip if clock_gettime consistenly returns zero
4988	for CLOCK_PROCESS_CPUTIME_ID timer.
4989
49902016-10-31  Eugene Syromyatnikov  <evgsyr@gmail.com>
4991
4992	tests: add tests for perf_event_attr structure decoding in perf_event_open
4993	* configure.ac: Add checks for presence of various fields of struct
4994	perf_event_attr defined in kernel headers.
4995	* tests/perf_event_open.c: New file.
4996	* tests/perf_event_open_unabbrev.c: Likewise.
4997	* tests/perf_event_open.test: New test.
4998	* tests/perf_event_open_unabbrev.test: Likewise.
4999	* tests/.gitignore: Add perf_event_open, perf_event_open_unabbrev.
5000	* tests/Makefile.am (check_PROGRAMS): Likewise.
5001	(DECODER_TESTS): Add perf_event_open.test, perf_event_open_unabbrev.test.
5002
5003	Implement decoding of perf_event_attr structure in perf_event_open syscall
5004	* linux/perf_event_struct.h: New file, definition of struct perf_event_attr
5005	from Linux 4.8
5006	* Makefile.am (strace_SOURCES): Add it.
5007	* xlat/hw_breakpoint_len.in: New file.
5008	* xlat/hw_breakpoint_type.in: Likewise.
5009	* xlat/perf_attr_size.in: Likewise.
5010	* xlat/perf_branch_sample_type.in: Likewise.
5011	* xlat/perf_event_read_format.in: Likewise.
5012	* xlat/perf_event_sample_format.in: Likewise.
5013	* xlat/perf_hw_cache_id.in: Likewise.
5014	* xlat/perf_hw_cache_op_id.in: Likewise.
5015	* xlat/perf_hw_cache_op_result_id.in: Likewise.
5016	* xlat/perf_hw_id.in: Likewise.
5017	* xlat/perf_sw_ids.in: Likewise.
5018	* xlat/perf_type_id.in: Likewise.
5019	* perf.c [HAVE_LINUX_PERF_EVENT_H]: Remove inclusion of
5020	<linux/perf_event.h>.
5021	(PRINT_XLAT): New macro for simplifying printing values from
5022	sorted xlat.
5023	(printxlat_search): New function, wrapper for xlat_search with behaviour
5024	similar to printval.
5025	(print_perf_event_attr): New print_event_attr structure fetching and
5026	printing function.
5027	(SYS_FUNC(perf_event_open)): Use print_perf_event_attr for displaying
5028	attr argument contents.
5029	* tests/perf_event_open.c: Renamed to
5030	tests/perf_event_open_nonverbose.c.
5031	* tests/perf_event_open.test: add -e verbose=none in order to preserve
5032	output format being checked (in case verbose output is enabled,
5033	contents of attr arguments are shown now); rename to
5034	tests/perf_event_open_nonverbose.test; add -e trace=perf_event_open.
5035
5036	tests: fix name spelling.
5037
50382016-10-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
5039
5040	tests: fix name spelling.
5041
5042	Update NEWS.
5043
5044	Fix typo in comment in tests/quotactl.h.
5045
5046	tests: fix invalid pointer checks in quotactl test.
5047	* tests/quotactl.h (bogus_special, bogus_addr): Move it...
5048	* tests/quotactl.c (main): ... here; remove static and const qualifiers,
5049	use memory after tail_alloc instead of magic numbers.
5050	* tests/quotactl-xfs.c (main): Likewise.
5051
5052	tests: fix invalid pointer checks in getcpu test.
5053	* test/getcpu.c (main): Replace magic numbers deemed invalid pointers
5054	with addresses after memory returned by tail_alloc.
5055
5056	tests: fix invalid pointer checks in request_key test.
5057	* test/request_key.c (main): Replace magic numbers deemed invalid pointers
5058	with addresses after memory returned by tail_alloc.
5059
5060	tests: fix invalid pointer checks in add_key test.
5061	* test/add_key.c (main): Replace magic numbers deemed invalid pointers
5062	with addresses after memory returned by tail_alloc.
5063
5064	statfs: use printxval_search.
5065	* print_statfs.c (print_statfs_type): Use printxval_search for printing
5066	FS magic xlat value.
5067
5068	util: add printing helper for sorted xlat arrays.
5069	* util.c (printxval_searchn): New function.
5070	* defs.h (printxval_searchn): New prototype.
5071	(printxval_search): New helper macro useful in conjunction with static
5072	xlat arrays.
5073
5074	defs: add check for argument being array to ARRAY_SIZE macro.
5075	* gcc_compat.h [GNUC_PREREQ(3, 0)] (BUILD_BUG_ON_ZERO): New macro.
5076	(SAME_TYPE, MUST_BE_ARRAY): Likewise.
5077	* defs.h (ARRAY_SIZE): Add MUST_BE_ARRAY for build-time type check.
5078
5079	tests: check decoding of oldfstat, oldlstat, and oldstat syscalls.
5080	* tests/oldfstat.c: New file.
5081	* tests/oldlstat.c: Likewise.
5082	* tests/oldstat.c: Likewise.
5083	* tests/oldfstat.test: New test.
5084	* tests/oldlstat.test: Likewise.
5085	* tests/oldstat.test: Likewise.
5086	* tests/xstatx.c [!OLD_STAT]: define OLD_STAT to 0.
5087	(print_stat) [OLD_STAT]: Print predefined values for
5088	st_blksize/st_blocks.
5089	(print_stat): Check for !OLD_STAT in nanosecond precision checks.
5090	(main) [OLD_STAT]: Ignore EOVERFLOW.
5091	(main): Test for successful rc in returned size value check;
5092	print address only on non-successful rc.
5093	* tests/.gitignore: Add oldfstat, oldlstat, and oldstat.
5094	* tests/Makefile.am (check_PROGRAMS): Likewise.
5095	(DECODER_TESTS): Add oldfstat.test, oldlstat.test, and oldstat.test.
5096
5097	tests: additional tests of stat decoders.
5098	* tests/fstatx.c (IS_FSTAT): Define to 1.
5099	* tests/fstatat64.c [__GLIBC__ && __sparc64__] (TEST_BOGUS_STRUCT_STAT):
5100	Define to 0.
5101	* tests/xstatx.c [!IS_STAT] (IS_STAT): Define to 0.
5102	[!TEST_BOGUS_STRUCT_STAT] (TEST_BOGUS_STRUCT_STAT): Define to 1.
5103	(main): Add a check for non-available pointer and a check
5104	for block device file.
5105	* tests/statx.sh: Add tracing of /dev/full file, specify alignment.
5106	* tests/fstat.test: Specify alignment.
5107
51082016-10-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
5109
5110	tests: prepare for additional tests of stat decoders.
5111	PRINT_SYSCALL_HEADER/PRINT_SYSCALL_FOOTER now contain open/close brace
5112	pair in order to save errno.  PRINT_SYSCALL_FOOTER now uses sprintrc for
5113	printing rc/errno.
5114
5115	* tests/xstatx.c: Include <errno.h>.
5116	(main): Update PRINT_SYSCALL_FOOTER call convention.
5117	* tests/fstatat.c (PRINT_SYSCALL_HEADER): Add errno saving.
5118	(PRINT_SYSCALL_FOOTER): Restore errno.
5119	* tests/fstatx.c: Likewise.
5120	* tests/lstatx.c: Likewise.
5121
51222016-10-28  Dmitry V. Levin  <ldv@altlinux.org>
5123
5124	Provide a safe definition of O_ACCMODE.
5125	Some libcs e.g. musl are guilty of messing up with O_ACCMODE.
5126
5127	* open.c (O_ACCMODE): Redefine to 03.
5128
51292016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5130
5131	Implement dumping of mq_timedsend and mq_timedreceive syscalls.
5132	* syscall.c (dumpio): Add SEN_mq_timedreceive and SEN_mq_timedsend.
5133
5134	mq: print msg_prio as a pointer, not as an immediate value.
5135	* mq.c (SYS_FUNC(mq_timedreceive)): Use printnum_int for printing
5136	msg_prio argument.
5137
51382016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5139
5140	mq: print msg payload only in case of successful mq_timedreceive call.
5141	Also, use u_rval for determining message size.
5142
5143	* mq.c (SYS_FUNC(mq_timedreceive)): Check for syserror and non-negative
5144	u_rval before calling printstr on msg_ptr argument, or use printaddr otherwise;
5145	provide u_rval as string size.
5146
51472016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5148
5149	mq: Print msg_prio parameter as unsigned int in mq_timedsend.
5150	* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%ld"
5151	to "%u", cast argument value to unsigned int.
5152
51532016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5154
5155	mq: Properly print mq_flags field.
5156	mq_flags field of struct mq_attr can contain only O_NONBLOCK flag (other
5157	flags are treated as invalid by mq_getsetattr). Moreover, this field is
5158	ignored by mq_open at all (O_NONBLOCK is set via oflag, not via attr
5159	attribute).
5160
5161	* xlat/mq_attr_flags.in: New file.
5162	* print_mq_attr.c: Include xlat/mq_attr_flags.h.
5163	(printmqattr): New parameter, bool decode_flags; cast members of struct
5164	mq_attr to long long type; use mq_attr_flags xlat for printing mq_flags;
5165	print mq_flags as flags only in case decode_flags parameter is set
5166	to true.
5167	* mq.c (SYS_FUNC(mq_open)): Specify value of false for decode_flags
5168	parameter of printmqattr call.
5169	(SYS_FUNC(mq_getsetattr)): Specify value of true for decode_flags
5170	parameter of printmqattr call.
5171	* tests/mq.expected: Update expected output.
5172
51732016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5174
5175	mq: Print msg_len parameter as kernel_ulong_t.
5176	* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%lu"
5177	to "%llu", use getarg_ull for obtaining msg_len parameter.
5178	(SYS_FUNC(mq_timedreceive)): Likewise.
5179
5180	print_mq_attr: fix typo.
5181	* print_mq_attr.c (printmqattr): Print field name "mq_curmsgs"
5182	instead of "mq_curmsg".
5183	* tests/mq.expected: Update expected output.
5184
51852016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5186
5187	mq: print mqdes parameter as int.
5188	It is defined as int in <linux/posix_types.h>.
5189
5190	* mq.c (SYS_FUNC(mq_timedsend)): Use "%d" conversion specifier instead
5191	of "%ld" for printing mqdes (0th parameter), cast parameter value to
5192	int.
5193	(SYS_FUNC(mq_timedreceive)): Likewise.
5194	(SYS_FUNC(mq_notify)): Likewise.
5195	(SYS_FUNC(mq_getsetattr)): Likewise.
5196
51972016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5198
5199	mq: curly brackets usage fix.
5200	Use curly brackets for denoting blocks in both of if branches if they
5201	are already used in at least one branch.
5202
5203	tests: additional name_to_handle_at/open_by_handle_at checks.
5204	* tests/file_handle.c: Additional name_to_handle_at/open_by_handle_at
5205	checks.
5206
5207	tests: require only presence of __NR_* macros for file_handle test.
5208	* tests/file_handle.c: replace fcntl.h include with asm/unistd.h.
5209	[MAX_HANDLE_SZ]: change to defined __NR_name_to_handle_at
5210	&& defined __NR_open_by_handle_at, add fcntl.h include
5211	[!MAX_HANDLE_SZ]: Add definition of MAX_HANDLE_SZ and struct
5212	file_handle.
5213	(main): Change name_to_handle_at and open_by_handle_at calls to syscall.
5214
5215	tests: proper type conversion in keyctl test.
5216	* tests/keyctl.c (printarg): Add intermediate conversion of arg to uintptr_t
5217	since kernel_ulong_t may be of different size.
5218
52192016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5220
5221	file_handle: use separate xlat for name_ta_handle_at flags.
5222	Since the only two flags supported are AT_SYMLINK_FOLLOW and
5223	AT_EMPTY_PATH.
5224
5225	* xlat/name_to_handle_at_flags.in: New file.
5226	* file_handle.c (SYS_FUNC(name_to_handle_at)): Use name_to_handle_at_flags
5227	for printing flags parameter.
5228
52292016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5230
5231	tests: check decoding of kexec_file_load and kexec_load syscalls.
5232	* tests/kexec_file_load.c: New file.
5233	* tests/kexec_load.c: Likewise.
5234	* tests/kexec_file_load.test: New test.
5235	* tests/kexec_load.test: Likewise.
5236	* tests/.gitignore: Add kexec_file_load and kexec_load.
5237	* tests/Makefile.am (check_PROGRAMS): Likewise.
5238	(DECODER_TESTS): Add kexec_file_load.test and kexec_load.test.
5239
52402016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5241
5242	kexec: use widen_to_ulong since kexec_load has compat on x32/n32.
5243	Curiously, kexec_load uses compat on x32/n32, so its parameters should
5244	be 4 bytes in size on these ABIs.
5245
5246	* kexec.c (SYS_FUNC(kexec_load)): Use widen_to_ulong for casting
5247	parameters to proper size on x32/n32.
5248
52492016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5250
5251	kexec: fix zeroing of higher bits of flags parameter in kexec_load.
5252	* kexec.c (SYS_FUNC(kexec_load)): Perform type conversion before
5253	negation in order to properly negate higher bits of KEXEC_ARCH_MASK.
5254
5255	kexec: add printing of struct kexec_segment field names.
5256	* kexec.c (print_seg): Print field names of the kexec_segment structure.
5257
5258	tests: check decoding of unshare syscall.
5259	* tests/unshare.c: New file.
5260	* tests/unshare.test: New test.
5261	* tests/.gitignore: Add unshare.
5262	* tests/Makefile.am (check_PROGRAMS): Likewise.
5263	(DECODER_TESTS): Add unshare.test.
5264
52652016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5266
5267	clone: use kernel_ulong_t as type of flags parameter of unshare call.
5268	Kernel declares flags parameter as long and looks like x32 and n32
5269	implement no compat for this call.
5270
5271	* clone.c (SYS_FUNC(unshare)): Use getarg_ull and printflags64 for
5272	obtaining and parsing flags parameter.
5273
52742016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5275
5276	clone: use separate flag list for unshare.
5277	Not all clone flags could be passed to unshare (see check_unshare_flags
5278	function in kernel/fork.c).
5279
5280	* xlat/unshare_flags.in: New file.
5281	* clone.c (SYS_FUNC(unshare)): Use unshare_flags for printing flags
5282	parameter.
5283
52842016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5285
5286	tests: check decoding of setns syscall.
5287	* tests/setns.c: New file.
5288	* tests/setns.test: New test.
5289	* tests/.gitignore: Add setns.
5290	* tests/Makefile.am (check_PROGRAMS): Likewise.
5291	(DECODER_TESTS): Add setns.test.
5292
52932016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5294
5295	clone: use separate xlat for nstype parameter of setns syscall.
5296	nstype is not flag set but specific type value against which it is
5297	compared in kernel (see kernel/nsproxy.c, SYSCALL_DEFINE2(setns, ...)).
5298
5299	* xlat/setns_types.in: New file.
5300	* clone.c: Use printxval and setns_types for nstype parameter.
5301
53022016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5303
5304	tests: check non-verbose capget/capset output.
5305	* tests/caps-abbrev.awk: New file.
5306	* tests/caps-abbrev.c: Likewise.
5307	* tests/caps-abbrev.test: New test.
5308	* tests/.gitignore: Add caps-abbrev.
5309	* tests/Makefile.am (check_PROGRAMS): Likewise.
5310	(DECODER_TESTS): Add caps-abbrev.test.
5311	(EXTRA_DIST): Add caps-abbrev.awk.
5312
5313	tests: additional capset decoder checks.
5314	* tests/caps.awk: Add patterns for additional checks.
5315	* tests/caps.c: Implement additional checks.
5316
5317	tests: check decoding of fanotify_init syscall.
5318	* tests/fanotify_init.c: New file.
5319	* tests/fanotify_init.test: New test.
5320	* tests/.gitignore: Add fanotify_init.
5321	* tests/Makefile.am (check_PROGRAMS): Likewise.
5322	(DECODER_TESTS): Add fanotify_init.test.
5323
5324	tests: some additional checks for fanotify_mark.
5325	* tests/fanotify_mark.c (do_call): New function.
5326	(main): Use it.
5327
5328	tests: use sprintrc in tests/fanotify_mark.c.
5329	* tests/fanotify.c (main): Use sprintrc.
5330
5331	tests: check decoding of {init,finit,delete}_module syscalls.
5332	* tests/delete_module.c: New file.
5333	* tests/finit_module.c: Likewise.
5334	* tests/init_delete_module.h: Likewise.
5335	* tests/init_module.c: Likewise.
5336	* tests/delete_module.test: New test.
5337	* tests/finit_module.test: Likewise.
5338	* tests/init_module.test: Likewise.
5339	* tests/.gitignore: Add delete_nodule, finit_module, and init_module.
5340	* tests/Makefile.am (check_PROGRAMS): Likewise.
5341	(DECODER_TESTS): Add delete_module.test, finit_module.test,
5342	and init_module.test.
5343	(EXTRA_DIST): Add init_delete_module.h.
5344
53452016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5346
5347	bjm: use getarg_ull for retrieving first two parameters of init_module syscall
5348	As init_module has no compat wrapper, its first parameter is a pointer
5349	and the second is length, they both have the same size as kernel_ulong_t
5350	type.
5351
5352	* bjm.c (SYS_FUNC(init_module)): Obtain first two parameters using
5353	getarg_ull, print address argument using printaddr_ull, print length
5354	argument using "%llu" conversion specifier.
5355
53562016-10-28  Dmitry V. Levin  <ldv@altlinux.org>
5357
5358	Add printaddr_ull, change printaddr into a thin wrapper around it.
5359	* defs.h (printaddr_ull): New prototype.
5360	(printaddr): Change to a static inline wrapper around printaddr_ull.
5361	* util.c (printaddr): Rename to printaddr_ull, change argument type
5362	to unsigned long long, change print format to %#llx.
5363
53642016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5365
5366	xlat: add values for MODULE_INIT_* constants.
5367	* bjm.c (MODULE_INIT_IGNORE_MODVERSIONS, MODULE_INIT_IGNORE_VERMAGIC):
5368	Remove.
5369	* xlat/module_init_flags.in: Add values for
5370	MODULE_INIT_IGNORE_MODVERSIONS and MODULE_INIT_IGNORE_VERMAGIC records.
5371
53722016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5373
5374	Remove parser of create_module syscall.
5375	Since create_module syscall is present only in kernels before Linux 2.6
5376	and strace does not support those kernels, there is no use to keep this
5377	parser any longer.
5378
5379	* bjm.c (SYS_FUNC(create_module)): Remove.
5380	* linux/dummy.h (sys_create_module): Add stub alias.
5381
53822016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5383
5384	tests: check decoding of process_vm_readv and process_vm_writev syscalls
5385	* tests/process_vm_readv.c: New file.
5386	* tests/process_vm_readv_writev.c: Likewise.
5387	* tests/process_vm_writev.c: Likewise.
5388	* tests/process_vm_readv.test: New test.
5389	* tests/process_vm_writev.test: Likewise.
5390	* tests/.gitignore: Add process_vm_readv and process_vm_writev.
5391	* tests/Makefile.am (check_PROGRAMS): Likewise.
5392	(DECODER_TESTS): Add process_vm_readv.test and process_vm_writev.test.
5393	(EXTRA_DIST): Add process_vm_readv_writev.c.
5394
5395	process_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags
5396	* process_vm.c (SYS_FUNC(process_vm_readv),
5397	SYS_FUNC(process_vm_writev)): Use widen_to_ulong for local_iovcnt,
5398	renote_iovcnt, and flags parameters.
5399
54002016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5401
5402	defs: add widen_to_ulong macro.
5403	This is similar to widen_to_long, but for unsigned values.
5404
5405	* defs.h (widen_to_ulong): New macro.
5406
54072016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5408
5409	process_vm: print pid argument as int.
5410	* process_vm.c (SYS_FUNC(process_vm_readv),
5411	SYS_FUNC(process_vm_writev)): Change conversion specifier for pid
5412	argument from "%ld" to "%d".
5413
54142016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5415
5416	process_vm: remove syserror check for iovec printing.
5417	This check had been done by print_array inside tprint_iov anyway.
5418
5419	* process_vm.c (SYS_FUNC(process_vm_readv)): Use tprint_iov_upto for
5420	printing local_iov; do not check for syserror, provide decode_iov
5421	parameter to tprint_iov{,_upto} based on its value instead.
5422
54232016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5424
5425	io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_upto
5426	This enables printing of iovec arrays even in case of failed syscall
5427	(failed syscall doesn't mean that iovec itself is inaccessible and
5428	useless).  One caveat here is that we should explicitly provide proper
5429	IOV_DECODE_* value based on syserror value in case printing is performed
5430	on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting
5431	when syserror is up, since this may be called by code which tries to
5432	print iovec containing local data, which should be perfectly accessible
5433	(on the other hand, there are no cases of such behaviour at the moment).
5434
5435	Since iovecs themselves are printed even if syscall has failed now,
5436	preadv test is updated to reflect this.  It is notable, though, that this
5437	is the only place where this case is checked.
5438
5439	* io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror
5440	instead of umoven_or_printaddr as umoven_func parameter.
5441	(SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value
5442	based on syserror(tcp) value.
5443	* scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise.
5444	* tests/preadv.c: Update expected output for the case when preadv
5445	with singe-item iovec failed.
5446
54472016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5448
5449	Move umoven_or_printaddr_ignore_syserror to util.c.
5450	* defs.h (umoven_or_printaddr_ignore_syserror): New prototype.
5451	* v4l2.c (umoven_or_printaddr_ignore_syserror): Move ...
5452	* util.c: ... here.
5453
54542016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5455
5456	v4l2: check for verbose flag in umoven_or_printaddr_ignore_syserror.
5457	This change makes behaviour of umoven_or_printaddr_ignore_syserror in
5458	line with umoven_or_printaddr when verbose flag is disabled.
5459
5460	* v4l2.c (umoven_or_printaddr_ignore_syserror): Simply call printaddr
5461	when verbose flag is unset.
5462
54632016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5464
5465	tests: check decoding of kcmp syscall.
5466	* tests/kcmp.c: New file.
5467	* tests/kcmp.test: New test.
5468	* tests/.gitignore: Add kcmp.
5469	* tests/Makefile.am (check_PROGRAMS): Likewise.
5470	(DECODER_TESTS): Add kcmp.test.
5471
54722016-10-28  Dmitry V. Levin  <ldv@altlinux.org>
5473
5474	kcmp: print index parameters of unknown commands as kernel_ulong_t.
5475	* lookup_dcookie.c (SYS_FUNC(kcmp)): Use getarg_ull to retrieve idx1
5476	and idx2, print them using %#llx format in case of unknown command.
5477
54782016-10-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5479
5480	tests: check decoding of inotify family syscalls.
5481	* tests/inotify.c: New file.
5482	* tests/inotify_init1.c: Likewise.
5483	* tests/inotify.test: New test.
5484	* tests/inotify_init1.test: Likewise.
5485	* tests/.gitignore: Add inotify and inotify_init1.
5486	* tests/Makefile.am (check_PROGRAMS): Likewise.
5487	(DECODER_TESTS): Add inotify.test and inotify_init1.test.
5488
5489	xlat: use IN_* prefix for inotify_init1 flag constants.
5490	* xlat/inotify_init_flags.in: Replace O_* prefix with IN_* prefix for
5491	O_NONBLOCK and O_CLOEXEC constants, provide fallback definitions.
5492
5493	tests: check decoding of lookup_dcookie syscall.
5494	* tests/lookup_dcookie.c: New file.
5495	* tests/lookup_dcookie.test: New test.
5496	* tests/.gitignore: Add lookup_dcookie.
5497	* tests/Makefile.am (check_PROGRAMS): Likewise.
5498	(DECODER_TESTS): Add lookup_dcookie.test.
5499
55002016-10-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5501
5502	lookup_dcookie: print len parameter as kernel_ulong_t.
5503	It is size_t and without compat on x32/n32.
5504
5505	* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Change conversion
5506	specifier from "%lu" to "%llu", use getarg_ull for len argument
5507	retrieval.
5508
55092016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
5510
5511	defs.h: add offsetofend macro.
5512	Analogous to offsetof but returns structure offset after the specified
5513	field.  Useful for checking whether specific field is present in obtained
5514	data or specifying amount of data to copy based on the (last) field needed.
5515
5516	* defs.h (offsetofend): New macro.
5517
55182016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
5519
5520	tests: move ARG_STR and similar macros to tests.h.
5521	* tests/add_key.c (_STR, ARG_STR): Move ...
5522	* tests/tests.h: ... here.
5523	(ARG_ULL_STR): New macro.
5524	* tests/keyctl.c (ARG_STR): Remove.
5525	* tests/quotactl.h (ARG_STR): Likewise.
5526	* tests/request_key.c (ARG_STR): Likewise.
5527
5528	tests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h.
5529	* tests/fadvise.h (LL_PAIR, LL_VAL_TO_PAIR): Move ...
5530	* tests/tests.h: ... here.
5531
5532	tests: check decoding of ioprio_get and ioprio_set syscalls.
5533	* tests/ioprio.c: New file.
5534	* tests/ioprio.test: New test.
5535	* tests/.gitignore: Add ioprio.
5536	* tests/Makefile.am (check_PROGRAMS): Likewise.
5537	(DECODER_TESTS): Add ioprio.test.
5538
55392016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
5540
5541	xlat: provide fallback definitions for CLOCK_* constants.
5542	Since new values have been added gradually over various kernel versions,
5543	it's better to define them explicitly in order to avoid situations when
5544	strace built with older kernel headers cannot decode some recently
5545	defined values.
5546
5547	* xlat/clocknames.in: Add values for constants.
5548
55492016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
5550
5551	tests: move fill_memory and fill_memory_ex into a separate file.
5552	* tests/fill_memory.c: New file.
5553	* tests/Makefile.am (libtests_a_SOURCES): Add it.
5554	* tests/quotactl.h (fill_memory, fill_memory_ex): Move to fill_memory.c.
5555	* tests/tests.h (fill_memory, fill_memory_ex): New prototypes.
5556
5557	tests: add period parameter to fill_memory_ex.
5558	* tests/quotactl.h (fill_memory_ex): Add period parameter,
5559	use it as a divisor in non-constant part of value.
5560	(fill_memory): Specify period of 0x80 to fill_memory_ex call.
5561	* tests/quotactl-xfs.c (main): Likewise.
5562
55632016-10-05  Dmitry V. Levin  <ldv@altlinux.org>
5564
5565	Post-release administrivia.
5566	* NEWS: Add a header line for the next release.
5567	* debian/changelog.in: Add a changelog entry for 4.14-1.
5568	* strace.spec.in: Likewise.
5569
55702016-10-04  Dmitry V. Levin  <ldv@altlinux.org>
5571
5572	Prepare for 4.14 release.
5573	* NEWS: Update for 4.14 release.
5574
5575	Generate SEN numbers in a locale independent order.
5576	* generate_sen.sh: Sort SEN numbers using C collation rules.
5577
55782016-10-04  Dmitry V. Levin  <ldv@altlinux.org>
5579
5580	Assume that offsetof is provided by stddef.h.
5581	According to C89, <stddef.h> shall define offsetof macro.
5582
5583	* defs.h: Include <stddef.h> unconditionally.
5584	[!offsetof]: Remove.
5585
55862016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5587
5588	tests: check decoding of add_key, keyctl, and request_key syscalls.
5589	* tests/add_key.c: New file.
5590	* tests/keyctl.c: Likewise.
5591	* tests/request_key.c: Likewise.
5592	* tests/add_key.test: New test.
5593	* tests/keyctl.test: Likewise.
5594	* tests/request_key.test: Likewise.
5595	* tests/.gitignore: Add add_key, keyctl, and request_key.
5596	* tests/Makefile.am (check_PROGRAMS): Likewise.
5597	(DECODER_TESTS): Add add_key.test, keyctl.test, and request_key.test.
5598
55992016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5600
5601	keyctl: use kernel_ulong_t and getarg_ull instead of long.
5602	This potentially fixes keyctl decoder for x32 personality.
5603
5604	* keyctl.c (keyctl_update_key, keyctl_read_key, keyctl_instantiate_key,
5605	keyctl_instantiate_key_iov, keyctl_dh_compute): Change addr and len
5606	arguments to kernel_ulong_t.  Print len using %llu format.
5607	(keyctl_keyring_search): Change addr1 and addr2 arguments
5608	to kernel_ulong_t.
5609	(print_dh_params): Change addr argument to kernel_ulong_t.
5610	(SYS_FUNC(keyctl)): Retrieve arguments via getarg_ull, pass them
5611	to the appropriate handlers.
5612
56132016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5614
5615	keyctl: fix parameter signedness.
5616	* keyctl.c (keyctl_update_key): Change addr and len arguments
5617	to unsigned.
5618	(keyctl_read_key): Likewise.
5619	(keyctl_instantiate_key): Likewise.
5620	(keyctl_instantiate_key_iov): Likewise.
5621	(keyctl_dh_compute): Likewise.
5622	(keyctl_keyring_search): Change addr1 and addr2 arguments to unsigned.
5623	(keyctl_chown_key): Change user and group arguments to unsigned.
5624	(keyctl_get_persistent): Change uid argument to unsigned.
5625
56262016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5627
5628	keyctl: use printstr_ex for printing out buffer.
5629	keyctl_read_key had subtle bug by treating out buffer in KEYCTL_READ
5630	as NUL-terminated, which is not true.  We fix it by adding parameter to
5631	keyctl_read_key signalising whether buffer is NUL-terminated and using
5632	printstr_ex for printing (expectedly) NUL-terminated strings.
5633
5634	* keyctl.c (keyctl_read_key): Add has_nul parameter.  Do not use -1 as
5635	string len.  Use printstr_ex for buffer output with user style depending
5636	on has_nul value.
5637	(SYS_FUNC(keyctl)): Specify has_nul parameter to keyctl_read_key
5638	by comparing cmd value with KEYCTL_READ.
5639
56402016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5641
5642	Add printstr_ex which allows for providing user quotation style.
5643	This is useful for providing QUOTE_OMIT_TRAILING_0 and maybe other
5644	flags.
5645
5646	* defs.h (printstr_ex): New prototype.
5647	(printstr): Change to a wrapper around printstr_ex with zero user style.
5648	* util.c (printstr): Rename to ...
5649	(printstr_ex) ... new function, add user_style argument which is or'ed
5650	with computed style.
5651
56522016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5653
5654	util: add quote_string flag signalising that string is NUL-terminated.
5655	It is useful in cases strings with size provided are expected to be
5656	NUL-terminated but are not trustworthy enough to call just plain
5657	printstr(str, -1).
5658
5659	* defs.h (QUOTE_OMIT_TRAILING_0): New constant definition.
5660	* util.c (string_quote): Swallow terminating NUL if
5661	QUOTE_OMIT_TRAILING_0 is set.
5662
56632016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5664
5665	keyctl: add support for KEYCTL_DH_COMPUTE.
5666	* keyctl.c (struct keyctl_dh_params): New structure.
5667	(print_dh_params, keyctl_dh_compute): New functions.
5668	(SYS_FUNC(keyctl)): Add support for KEYCTL_DH_COMPUTE cmd value.
5669
56702016-10-03  Dmitry V. Levin  <ldv@altlinux.org>
5671
5672	x86_64: fix is_negated_errno for x32 personality.
5673	* syscall.c (is_negated_errno) [X86_64]: Do not truncate kernel_ulong_t
5674	to uint32_t for x32 personality.
5675
5676	tests: fix another regression in qual_syscall.test.
5677	* tests/qual_syscall.test: Fix pattern_nonabbrev_verbose pattern.
5678	(check_output_mismatch): Print the pattern that triggered match failure.
5679
5680	Use err_name, print unrecognized errno values as numbers.
5681	* syscall.c (trace_syscall_exiting): Use err_name() instead
5682	of open-coding it.  Print unrecognized errno values using %lu format
5683	instead of ERRNO_%lu as the latter prodices an invalid constant.
5684
56852016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
5686
5687	keyctl: print errno name in KEYCTL_REJECT in case it is available.
5688	* keyctl.c (keyctl_reject_key): Get errno string via err_name
5689	and print it if it is not NULL.
5690
5691	Add function for getting errno string.
5692	* defs.h (err_name): New prototype.
5693	* syscall.c (err_name): New function.
5694
56952016-10-03  Dmitry V. Levin  <ldv@altlinux.org>
5696
5697	struct tcb: change the type of u_error field from int to unsigned long.
5698	This is the type actually used for the error code on architectures
5699	that use a dedicated register.
5700
5701	* defs.h (struct tcb): Change the type of u_error to unsigned long.
5702	* syscall.c (trace_syscall_exiting): Change the type of u_error variable
5703	to unsigned long, print it using %lu format, drop no longer needed
5704	explicit cast to unsigned long.
5705	(saved_u_error): Change type to unsigned long.
5706
57072016-10-02  Dmitry V. Levin  <ldv@altlinux.org>
5708
5709	Use tprints instead of tprintf in a few more places.
5710	* btrfs.c (btrfs_print_qgroup_inherit, btrfs_print_tree_search,
5711	btrfs_ioctl): Replace tprintf with tprints for printing strings without
5712	format specifiers.
5713	* net.c (print_group_req): Likewise.
5714	* scsi.c (scsi_ioctl): Likewise.
5715	* term.c (decode_termios, decode_termio): Likewise.
5716	* userfaultfd.c (uffdio_ioctl): Likewise.
5717
57182016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>
5719
5720	keyctl: do not print comma for KEYCTL_SESSION_TO_PARENT command.
5721	Since this command doesn't have any additional arguments, the comma does
5722	not needed.  Since this is the only command which lacks additional
5723	arguments, it's better to add special case for it rather than add
5724	printing of comma to all other commands.
5725
5726	* keyctl.c (SYS_FUNC(keyctl)): Add check for command not being
5727	KEYCTL_SESSION_TO_PARENT when printing comma dividing cmd argument
5728	from the rest.
5729
57302016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>
5731
5732	keyctl: use getarg_ull for printing generic arguments.
5733	Otherwise it is erroneous on x32, for example.
5734
5735	* keyctl.c (SYS_FUNC(keyctl)): Use "%#llx" conversion specifier
5736	and getarg_ull for fallback argument printing.
5737
57382016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>
5739
5740	keyctl: use printuid for printing UID/GID.
5741	UID/GID are unsigned except special -1 value (which is also special in
5742	context of specific keyctl commands), so special printing function
5743	should be used.
5744
5745	* keyctl.c (keyctl_chown_key, keyctl_get_persistent): Use printuid
5746	instead of printf with "%d" conversion for printing UID/GID.
5747
57482016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>
5749
5750	io: handle data_size of -1 as unlimited data in print_iovec.
5751	Otherwise it can be depleted and print_iovec starts printing empty
5752	strings.
5753
5754	* io.c (print_iovec): Interpret c->data_size of -1 as unlimited data
5755	and do not decrease it in this case.
5756
57572016-10-01  Dmitry V. Levin  <ldv@altlinux.org>
5758
5759	tests: fix typo in qual_syscall.test.
5760	Fix test regression introduced by commit v4.13-225-g55334ef.
5761
5762	* tests/qual_syscall.test: Fix typo.
5763
57642016-09-30  Dmitry V. Levin  <ldv@altlinux.org>
5765
5766	Enhance -e abbrev=set, -e raw=set, and -e verbose=set.
5767	Enhance abbrev=, raw=, and verbose= to accept the same syntax as trace=.
5768	For example, this allows such syntax as -e verbose=file.
5769
5770	* syscall.c (lookup_class): Define before qual_syscall.
5771	(qualify): Move the loop based on lookup_class ...
5772	(qual_syscall): ... here.
5773	* tests/qual_syscall.test: Check it.
5774
57752016-09-30  Dmitry V. Levin  <ldv@altlinux.org>
5776
5777	tests/qual_syscall.test: rewrite without ls.
5778	* tests/qual_syscall.test: Invoke ./umovestr instead of ls.
5779	Update expected output.
5780
57812016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5782
5783	tests: check decoding of fadvise64 and fadvise64_64 syscalls.
5784	* tests/fadvise.h: New file.
5785	* tests/fadvise64.c: Likewise.
5786	* tests/fadvise64_64.c: Likewise.
5787	* tests/fadvise64.test: New test.
5788	* tests/fadvise64_64.test: Likewise.
5789	* tests/.gitignore: Add fadvise64 and fadvise64_64.
5790	* tests/Makefile.am (check_PROGRAMS): Likewise.
5791	(DECODER_TESTS): Add fadvise64.test, fadvise64_64.test.
5792	(EXTRA_DIST): Add fadvise.h.
5793
57942016-09-28  Dmitry V. Levin  <ldv@altlinux.org>
5795
5796	mips o32: implement fetching the 7th subcall argument.
5797	* syscall.c [LINUX_MIPSO32] (decode_mips_subcall): Fetch the last
5798	argument of 7-arg syscalls.
5799
58002016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5801
5802	x32: use proper decoder for fadvise64 syscall.
5803	fadvise_64_64 decoder used before this change prints different sign
5804	of the "len" argument (loff_t vs size_t).
5805
5806	* linux/x32/syscallent.h (fadvise64): Replace SEN(fadvise64_64)
5807	with SEN(fadvise64).
5808
58092016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5810
5811	fadvise: use getarg_ull for obtaining len argument of fadvise64 syscall.
5812	Since its type is size_t, it is 64-bit wide on x32 and special care
5813	should be taken in order to obtain it.
5814
5815	* fadvise.c (SYS_FUNC(fadvise64)): Use getarg_ull for obtaining value
5816	of "len" syscall argument.
5817
58182016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5819
5820	util: add getarg_ll and getarg_ull functions.
5821	These allow retrieving specific argument in full taking into account
5822	peculiarities of runtimes which employ tcp->ext_arg (e.g. x32).
5823
5824	* defs.h (getarg_ll, getarg_ull): New prototypes.
5825	* util.c (getarg_ll, getarg_ull): New functions.
5826	(printargs): Use getarg_ull.
5827
58282016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5829
5830	fadvise: change printing of len argument to unsigned in fadvise64 syscall
5831	The kernel declares fadvise64 as
5832	long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);
5833
5834	* fadvise.c (SYS_FUNC(fadvise64)): Change conversion specifier from
5835	"%ld" to "%lu" for printing len argument since kernel expects argument
5836	of type size_t.
5837
58382016-09-28  Dmitry V. Levin  <ldv@altlinux.org>
5839
5840	sh64, sparc64: use proper decoder for fadvise64_64 syscall.
5841	This change is no-op yet, but things will change when decoder
5842	of fadvise64 syscall get fixed.
5843
5844	* linux/sh64/syscallent.h (fadvise64_64): Replace SEN(fadvise64)
5845	with SEN(fadvise64_64).
5846	* linux/sparc64/syscallent.h (fadvise64_64): Likewise.
5847
58482016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
5849
5850	tests: check decoding of fallocate syscall.
5851	* configure.ac (AC_CHECK_FUNCS): Add fallocate.
5852	* tests/fallocate.c: New file.
5853	* tests/fallocate.test: New test.
5854	* tests/.gitignore: Add fallocate.
5855	* tests/Makefile.am (check_PROGRAMS): Likewise.
5856	(DECODER_TESTS): Add fallocate.test.
5857
58582016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5859
5860	fallocate: change print format of offset and len arguments to signed.
5861	Since types of these arguments are off_t and kernel actually expects
5862	signed values in order to fail when negative values are provided,
5863	lets display these values as signed.
5864
5865	* fallocate.c (SYS_FUNC(fallocate)): Change conversion specifier for
5866	printing "offset" and "len" syscall arguments from %llu to %lld.
5867
58682016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5869
5870	xlat: add default values for falloc_flags constants.
5871	In order to avoid dependence of declared constants to headers available
5872	on build system.
5873
5874	* xlat/falloc_flags.in: Add default values for constants.
5875
58762016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5877
5878	tests: check decoding of getcpu syscall.
5879	* tests/getcpu.c: New file.
5880	* tests/getcpu.test: New test.
5881	* tests/.gitignore: Add getcpu.
5882	* tests/Makefile.am (check_PROGRAMS): Likewise.
5883	(DECODER_TESTS): Add getcpu.test.
5884
5885	tests: make magic values in ioctl_block test distinctive.
5886	* tests/ioctl.block (init_magic): Add iterator value to magic value
5887	in order to enable detection of potential 4-byte aligned shifts.
5888
5889	tests: additional getcwd decoding checks.
5890	* tests/getcwd.c (main): Add more checks for getcwd arguments decoding.
5891
5892	tests: check decoding of quotactl syscall.
5893	* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, linux/quota.h,
5894	and sys/quota.h.
5895	* tests/.gitignore: Add quotactl, quotactl-v, quotactl-xfs,
5896	and quotactl-xfs-v.
5897	* tests/Makefile.am (check_PROGRAMS): Likewise.
5898	(DECODER_TESTS): Add quotactl.test, quotactl-v.test,
5899	quotactl-xfs.test, and quotactl-xfs-v.test.
5900	(EXTRA_DIST): Add quotactl.h
5901	* quotactl.h: New file.
5902	* quotactl.c: Likewise.
5903	* quotactl-v.c: Likewise.
5904	* quotactl-xfs.c: Likewise.
5905	* quotactl-xfs-v.c: Likewise.
5906	* quotactl.test: New test.
5907	* quotactl-v.test: Likewise.
5908	* quotactl-xfs.test: Likewise.
5909	* quotactl-xfs-v.test: Likewise.
5910
59112016-09-27  Dmitry V. Levin  <ldv@altlinux.org>
5912
5913	quota: ensure that names of structure fields are printed properly.
5914	* quota.c (PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): New macros.
5915	(decode_cmd_data): Use them to print structure fields.
5916
5917	Enhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros.
5918	* defs.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
5919	Add support of char types.
5920	* tests/tests.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
5921	Likewise.
5922
5923	quota: move Q_QUOTAON handling to subcommand switch statement.
5924	* quota.c (SYS_FUNC(quotactl)): Move handling of Q_QUOTAON subcommand ...
5925	(decode_cmd_data): ... here.
5926
59272016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5928
5929	quota: remove legacy subcommand decoding support code.
5930	Support for these quota subcommands by linux kernels has been dropped
5931	long time ago (between 2.5.16 and 2.5.17), so lets drop it in order
5932	to minimize amount of code which should be subjected to testing and
5933	structured conversion.
5934
5935	* quota.c (struct v1_dqblk, struct v2_dqblk, struct v2_dqinfo,
5936	struct v1_dqstats, struct v2_dqstats): Remove.
5937	(decode_cmd_data): Remove handling of Q_V1_GETQUOTA, Q_V1_SETQUOTA,
5938	Q_V2_GETQUOTA, Q_V2_SETQUOTA, Q_V2_GETINFO, Q_V2_SETINFO, Q_V1_GETSTATS,
5939	and Q_V2_GETSTATS subcommands.
5940	(SYS_FUNC(quotactl)): Remove handling of Q_V1_QUOTAON subcommand.
5941
59422016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5943
5944	quota: add realtime block limits fields to XFS disk quota printing code.
5945	* quota.c (decode_cmd_data): Add printing of d_rtb_hardlimit
5946	and d_rtb_softlimit fields to struct xfs_dqblk printing code.
5947
59482016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5949
5950	quota: add packed attribute to struct if_dqblk definition.
5951	Since the only difference between 32-bit and 64-bit environments
5952	regarding this structure is its padding, lets just add packed attribute
5953	to its definition instead of going full mpers.
5954
5955	* quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED.
5956
59572016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5958
5959	quota: Add decoding for Q_XQUOTARM subcommand.
5960	* quota.c (decode_cmd_data): Add Q_XQUOTARM handling to subcommand
5961	  switch.
5962
59632016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5964
5965	quota: add dispatch of SYNC subcommands.
5966	Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway.
5967
5968	* quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand
5969	dispatch switch since id/addr arguments for these subcommands are known
5970	to be ignored.
5971
59722016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5973
5974	quota: add missing prefixes to struct field names.
5975	* quota.c (decode_cmd_data): Print field names in accordance with
5976	their definition.
5977
5978	quota: fix indentation inside subcommand dispatching switch statement.
5979
59802016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5981
5982	quota: avoid printing id argument for those commands that ignore it.
5983	As id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO,
5984	Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF,
5985	Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, and
5986	Q_V2_GETSTATS subcommands, do not print it for these subcommands.
5987
5988	* quota.c (decode_cmd_data): Add id argument parameter, add printing
5989	of id argument for Q_GETQUOTA, Q_SETQUOTA, Q_GETNEXTQUOTA,
5990	Q_V1_GETQUOTA, Q_V1_SETQUOTA, Q_V2_GETQUOTA, Q_V2_SETQUOTA,
5991	Q_XGETQUOTA, Q_XGETNEXTQUOTA, Q_XSETQLIM, and unknown subcommands.
5992	(SYS_FUNC(quotactl)): Remove printing of id argument, pass it
5993	to decode_cmd_data.
5994
59952016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>
5996
5997	quota: use printuid for id parameter printing.
5998	* quota.c (SYS_FUNC(quotactl)): Since id call argument is used for
5999	user/group/project ID which all have special semantics for -1,
6000	print it the same way as UIDs are printed.
6001
6002	quota: display quota subcommand as a macro.
6003	* quota.c (SYS_FUNC(quotactl)): Replace disjunction of two xlat values
6004	(which also lacks shift of the left part) with QCMD macro call.
6005
60062016-09-26  Dmitry V. Levin  <ldv@altlinux.org>
6007
6008	tests: use VERBOSE macro in waitid and waitid-v tests.
6009	* tests/waitid-v.c (VERBOSE_RUSAGE): Remove.
6010	(VERBOSE): Define to 1.
6011	* tests/waitid.c (sprint_rusage): Check VERBOSE instead
6012	of VERBOSE_RUSAGE.
6013
6014	tests: use VERBOSE macro in wait4 and wait4-v tests.
6015	* tests/wait4-v.c (VERBOSE_RUSAGE): Remove.
6016	(VERBOSE): Define to 1.
6017	* tests/wait4.c (sprint_rusage): Check VERBOSE instead
6018	of VERBOSE_RUSAGE.
6019
6020	tests: use VERBOSE macro in msg_control and msg_control-v tests.
6021	* tests/msg_control-v.c (VERBOSE_MSGHDR): Remove.
6022	(VERBOSE): Define to 1.
6023	* tests/msg_control.c (print_fds, print_ip_opts): Check VERBOSE instead
6024	of VERBOSE_MSGHDR.
6025
6026	tests: use VERBOSE macro in mmsg_name and mmsg_name-v tests.
6027	* tests/mmsg_name-v.c (VERBOSE_MMSGHDR): Remove.
6028	(VERBOSE): Define to 1.
6029	* tests/mmsg_name.c (test_mmsg_name): Check VERBOSE instead
6030	of VERBOSE_MMSGHDR.
6031
6032	tests: use VERBOSE macro in ioctl_rtc and ioctl_rtc-v tests.
6033	* tests/ioctl_rtc-v.c (VERBOSE_IOCTL): Remove.
6034	(VERBOSE): Define to 1.
6035	* tests/ioctl_rtc.c (print_rtc_time): Check VERBOSE instead
6036	of VERBOSE_IOCTL.
6037
6038	tests: use VERBOSE macro in ioctl_evdev and ioctl_evdev-v tests.
6039	* tests/ioctl_evdev-v.c (VERBOSE_IOCTL): Remove.
6040	(VERBOSE): Define to 1.
6041	* tests/ioctl_evdev.c: Check VERBOSE instead of VERBOSE_IOCTL.
6042
6043	tests: use VERBOSE macro in execveat and execveat-v tests.
6044	* tests/execveat-v.c (VERBOSE_EXECVEAT): Remove.
6045	(VERBOSE): Define to 1.
6046	* tests/execveat.c (main): Check VERBOSE instead of VERBOSE_EXECVEAT.
6047
6048	tests: use VERBOSE macro in execve and execve-v tests.
6049	* tests/execve-v.c (VERBOSE_EXECVE): Remove.
6050	(VERBOSE): Define to 1.
6051	* tests/execve.c (main): Check VERBOSE instead of VERBOSE_EXECVE.
6052
60532016-09-26  Dmitry V. Levin  <ldv@altlinux.org>
6054
6055	tests: add VERBOSE macro.
6056	Introduce VERBOSE macro (defaults to 0) that is expected to be defined
6057	to 1 by code testing "strace -v" output.
6058
6059	* tests/tests.h [!VERBOSE] (VERBOSE): New macro.
6060
60612016-09-20  Dmitry V. Levin  <ldv@altlinux.org>
6062
6063	decode_open: print the mode argument when O_TMPFILE flag is set.
6064	O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.
6065
6066	* open.c (STRACE_O_TMPFILE): New macro.
6067	(decode_open): Print the mode argument when O_TMPFILE flag is set.
6068	* tests/open.c (main): Check it.
6069	Fixes RH#1377846.
6070
60712016-09-20  Dmitry V. Levin  <ldv@altlinux.org>
6072
6073	tests: use sprintrc in tests/ptrace.c.
6074	* tests/ptrace.c (errstr): New static variable.
6075	(do_ptrace): Initialize it using sprintrc.
6076	(test_peeksiginfo, main): Use errstr.
6077
6078	tests: use sprintrc in tests/netlink_protocol.c.
6079	* tests/netlink_protocol.c (main): Use sprintrc.
6080
6081	tests: use sprintrc in tests/fchownat.c.
6082	* tests/fchownat.c (main): Use sprintrc.
6083
6084	tests: use sprintrc in tests/fchmodat.c.
6085	* tests/fchmodat.c (main): Use sprintrc.  Add more fchmodat decoding tests.
6086
6087	tests: use sprintrc in tests/fchmod.c.
6088	* tests/fchmod.c (main): Use sprintrc.  Add more fchmod decoding tests.
6089	* tests/fchmod.test: Update the value specified for strace -a parameter.
6090
6091	tests: use sprintrc in tests/getgroups.c.
6092	* tests/getgroups.c (main): Use sprintrc.
6093
6094	tests: use sprintrc in tests/setgroups.c.
6095	* tests/setgroups.c (main): Use sprintrc.
6096
60972016-09-19  Dmitry V. Levin  <ldv@altlinux.org>
6098
6099	tests/utime.c: rewrite without assert.
6100	* tests/utime.c: Do not include <assert.h>.
6101	(main): Use sprintrc instead of assert.
6102
6103	tests/xattr.c: rewrite without assert.
6104	* tests/xattr.c: Do not include <assert.h>.
6105	(main): Use sprintrc instead of assert.
6106
6107	tests: use sprintrc in tests/xchownx.c.
6108	* tests/xchownx.c (main): Do not include <errno.h>.  Use sprintrc.
6109
6110	tests/xstatfsx.c: fix potential errno clobbering.
6111	* tests/xstatfsx.c (main): Use sprintrc.
6112
61132016-09-19  Dmitry V. Levin  <ldv@altlinux.org>
6114
6115	Add more fs magic constants.
6116	Add *_MAGIC constants defined for some relatively widespread
6117	non-mainline filesystems.
6118
6119	* xlat/fsmagic.in: Add AUFS_SUPER_MAGIC, GPFS_SUPER_MAGIC,
6120	VZFS_SUPER_MAGIC, and ZFS_SUPER_MAGIC constants.
6121
61222016-09-15  Eugene Syromyatnikov  <evgsyr@gmail.com>
6123
6124	tests: fix whitespace for explicit type casts in futex test.
6125
61262016-09-14  Dmitry V. Levin  <ldv@altlinux.org>
6127
6128	Add more fs magic constants.
6129	Add *_MAGIC constants defined inside linux fs but not explicitly
6130	exported via linux uapi.
6131
6132	* xlat/fsmagic.in: Add HFS_SUPER_MAGIC, HFSPLUS_SUPER_MAGIC,
6133	EXOFS_SUPER_MAGIC, CEPH_SUPER_MAGIC, UBIFS_SUPER_MAGIC, JFS_SUPER_MAGIC,
6134	BEFS_SUPER_MAGIC, NTFS_SB_MAGIC, XFS_SB_MAGIC, CONFIGFS_MAGIC,
6135	FUSE_CTL_SUPER_MAGIC, FUSE_SUPER_MAGIC, AFS_FS_MAGIC, OCFS2_SUPER_MAGIC,
6136	VXFS_SUPER_MAGIC, LOGFS_MAGIC, SMB2_MAGIC_NUMBER, and CIFS_MAGIC_NUMBER
6137	constants.
6138
61392016-09-14  Dmitry V. Levin  <ldv@altlinux.org>
6140
6141	Update fs *_MAGIC constants.
6142	Add fs *_MAGIC constants exported by linux uapi.
6143
6144	* xlat/fsmagic.in: Add BFS_MAGIC, GFS2_MAGIC, and ROMFS_MAGIC constants
6145	defined in linux/bfs_fs.h, linux/gfs2_ondisk.h, and linux/romfs_fs.h,
6146	respectively.
6147
61482016-09-13  Dmitry V. Levin  <ldv@altlinux.org>
6149
6150	tests: workaround limited semctl implementation in musl.
6151	musl libc forwards semctl command argument for 8 known commands only,
6152	for all the rest it passes 0 instead.
6153
6154	* tests/ipc_sem.c (main): Update semctl expected output.
6155
61562016-09-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
6157
6158	tests: add more IPC decoding checks.
6159	* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
6160	(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
6161	commands) checks.
6162	* tests/ipc_sem.c: Additional semget and semctl checks.
6163	* tests/ipc_shm.c: Additional shmget and shmctl checks.
6164	* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
6165	* tests/semop.test: Add explicit -e parameter in order to trace both
6166	semop and semtimedop.
6167	* tests/shmxt.c: Additional shmat and shmdt checks.
6168
61692016-09-12  Dmitry V. Levin  <ldv@altlinux.org>
6170
6171	.mailmap: add addresses of Dr. David Alan Gilbert.
6172	* .mailmap: Add both addresses of Dr. David Alan Gilbert here to avoid
6173	duplications in CREDITS file.
6174
61752016-09-12  Eugene Syromyatnikov  <evgsyr@gmail.com>
6176
6177	.mailmap: add canonical name for Eugene Syromyatnikov.
6178	This is needed due to apparent deviation in spelling of commit author
6179	name in several commits.
6180
6181	* .mailmap: Add canonical name for Eugene Syromyatnikov.
6182
61832016-09-12  Dmitry V. Levin  <ldv@altlinux.org>
6184
6185	Update generic ioctl entries from linux 4.8.
6186	* linux/64/ioctls_inc.h: Update from linux v4.8 using ioctls_gen.sh.
6187	* linux/32/ioctls_inc_align32.h: Likewise.
6188	* linux/32/ioctls_inc_align64.h: Likewise.
6189
61902016-09-12  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
6191
6192	x32: update ioctl entries from linux 4.8.
6193	* linux/x32/ioctls_inc0.h: Update from linux v4.8 using ioctls_gen.sh.
6194
6195	maint: update for linux 4.8.
6196	* maint/ioctls_sym.sh: Add workarounds for linux/atm_zatm.h and
6197	xen/evtchn.h files.
6198
61992016-09-12  Dmitry V. Levin  <ldv@altlinux.org>
6200
6201	tests: use sprintrc_grep in tests/ipc_shm.c.
6202	* tests/ipc_shm.c (main): Use sprintrc_grep.
6203
6204	tests: use sprintrc_grep in tests/ipc_sem.c.
6205	* tests/ipc_sem.c (main): Use sprintrc_grep.
6206
62072016-09-11  Dmitry V. Levin  <ldv@altlinux.org>
6208
6209	tests: use sprintrc_grep in tests/ipc_msg.c.
6210	* tests/ipc_msg.c (main): Use sprintrc_grep.
6211
62122016-09-10  Dmitry V. Levin  <ldv@altlinux.org>
6213
6214	tests: use sprintrc in tests/chmod.c.
6215	* tests/chmod.c (main): Use sprintrc.  Add more chmod decoding tests.
6216
62172016-09-09  Dmitry V. Levin  <ldv@altlinux.org>
6218
6219	ipc: fix printing of nsops argument of semop and semtimedop syscalls.
6220	According to POSIX, nsops argument of semop syscall has type size_t,
6221	but the kernel treats nsops argument of semop and semtimedop syscalls
6222	as unsigned int.
6223
6224	* ipc_sem.c (tprint_sembuf_array): Change type of "count" argument
6225	from unsigned long to unsigned int, print it using %u format.
6226
62272016-09-09  Eugene Syromyatnikov  <evgsyr@gmail.com>
6228
6229	tests/aio.c: bring indentation in conformance with the rest of the file.
6230
62312016-09-09  Eugene Syromyatnikov  <evgsyr@gmail.com>
6232
6233	tests: use predefined constant in aio_context_t checks in aio test.
6234	Also fix io_cancel and io_destroy checks which did not check correct
6235	printing of context argument properly.
6236
6237	* tests/aio.c (main): Update syscall checks in order to use newly
6238	defined bogus_ctx constant.
6239
62402016-09-09  Dmitry V. Levin  <ldv@altlinux.org>
6241
6242	Mark io_setup and io_destroy as memory mapping related syscalls.
6243	As io_setup syscall allocates some memory using do_mmap_pgoff, and
6244	io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
6245	flag for all sysentries of io_setup and io_destroy using the following
6246	oneliner:
6247	sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h
6248
6249	* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.
6250
62512016-09-08  Dmitry V. Levin  <ldv@altlinux.org>
6252
6253	travis: add x86 musl.
6254	* .travis.yml (matric): Add musl-gcc/x86.
6255	* travis-build.sh [TARGET == x86]: Specify --target along with --build
6256	to configure.
6257	* travis-install.sh [CC == musl-gcc && TARGET == x32]: Add -mx32 to $CC.
6258	[CC == musl-gcc && TARGET == x86]: Add -m32 to $CC.  Specify --build
6259	and --target to musl configure invocation.
6260
62612016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6262
6263	tests: use PRI__*64 macros in aio test.
6264	It was incorrectly assumed that __*64 types are long long on all
6265	platforms, despite strace having specially crafted macros in order
6266	to handle precisely this architecture discrepancy.
6267	The commit fixes this oversight.
6268
6269	* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
6270	specifiers for __*64-typed values.
6271
62722016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6273
6274	ipc: fix printing of integer arguments.
6275	* ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int
6276	by the kernel, cast it to int and print it using %d format.
6277	* ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise,
6278	for semid argument.
6279	(SYS_FUNC(semget)): Likewise, for nsems argument.
6280	(SYS_FUNC(semctl)): Likewise, for semid and semnum arguments.
6281	* ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument.
6282	* ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise.
6283
62842016-09-08  Dmitry V. Levin  <ldv@altlinux.org>
6285
6286	ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
6287	* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
6288	is __kernel_key_t (i.e. int), cast key_t argument to int
6289	and print it using %#x format.
6290	* ipc_sem.c (SYS_FUNC(semget)): Likewise.
6291	* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
6292	* tests/ipc_msg.c (main): Test it.
6293	* tests/ipc_sem.c (main): Likewise.
6294	* tests/ipc_shm.c (main): Likewise.
6295
62962016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6297
6298	tests: add more sched_getattr and sched_setattr decoding checks.
6299	* tests/sched_xetattr.c (main): Add more sched_getattr and sched_setattr
6300	decoding checks.
6301
63022016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6303
6304	tests: change type of sched_nice field to signed in sched_xetattr test.
6305	Kernel headers declare this field as s32, and strace prints it with %d
6306	specifier.
6307
6308	* tests/sched_xetattr.c (main): Change type of sched_nice field of struct
6309	sched_attr to int32_t, update format specifiers accordingly.
6310
63112016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6312
6313	tests: add sprintrc_grep function to libtests.
6314	New sprintrc_grep function is sprintrc function equivalent suitable for
6315	tests where grep-base pattern matching is employed.
6316
6317	* tests/tests.h (sprintrc_grep): New prototype.
6318	* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
6319	(sprintrc_ex): New function, renamed from sprintrc and updated to
6320	support different formats.
6321	(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
6322	(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.
6323
63242016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6325
6326	tests: perform more strict structure allocation in sched_xetattr test.
6327	Use tail_alloc with precise size of the structure.
6328
6329	* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
6330	Rename sched to sched_attr.  Change type of sched_attr to struct
6331	pointer.  Use tail_alloc for sched_attr allocation, update printf
6332	statements accrodingly.
6333
63342016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
6335
6336	tests: split long lines in sched_xetattr test.
6337	* tests/sched_xetattr.c (main): Split long lines.
6338
63392016-09-07  Dmitry V. Levin  <ldv@altlinux.org>
6340
6341	tests/aio.c: fix for x32 personality.
6342	* tests/aio.c (main): Do not pass 64-bit aio_context_t to io_submit
6343	and io_getevents until strace learns how to print 64-bit pointers on x32
6344	and on x86_64 for x32 personality.
6345
63462016-09-07  Dmitry V. Levin  <ldv@altlinux.org>
6347
6348	aio: print aio_context_t as a pointer type.
6349	As aio_context_t is treated by the kernel as a pointer,
6350	print it using printaddr.
6351
6352	* aio.c (SYS_FUNC(io_setup)): Print the pointer to aio_context_t
6353	argument using printnum_ptr.
6354	(SYS_FUNC(io_destroy), SYS_FUNC(io_submit), SYS_FUNC(io_cancel),
6355	SYS_FUNC(io_getevents)): Print aio_context_t argument using printaddr.
6356	* tests/aio.c (sprint_aio_context_t): Remove.
6357	(main): Update expected output.
6358
63592016-09-07  Dmitry V. Levin  <ldv@altlinux.org>
6360
6361	tests/aio.c: rewrite without assert.
6362	* tests/aio.c: Do not include <assert.h>.
6363	(main): Use sprintrc instead of assert.
6364
63652016-09-06  Eugene Syromyatnikov  <evgsyr@gmail.com>
6366
6367	tests: add more aio decoding checks.
6368	* tests/aio.c (sprint_aio_context_t): New function.
6369	(main): Use it; add more checks.
6370
63712016-09-06  Eugene Syromyatnikov  <evgsyr@gmail.com>
6372
6373	tests: add suffix and cast to 64-bit constants in aio test.
6374	This helps to avoid warnings like
6375	"integer constant is too large for ‘long’ type"
6376	reported by some versions of gcc on 32-bit platforms.
6377
6378	* tests/aio.c (main): Add ULL suffix to 64-bit constants
6379	and cast them to unsigned long.
6380
63812016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>
6382
6383	tests: check decoding of perf_event_open syscall.
6384	* tests/perf_event_open.c: New file.
6385	* tests/perf_event_open.test: New test.
6386	* tests/.gitignore: Add perf_event_open.
6387	* tests/Makefile.am (check_PROGRAMS): Likewise.
6388	(DECODER_TESTS): Add perf_event_open.test.
6389
6390	Makefile.am: use pwd instead of realpath.
6391	* Makefile.am (CODE_COVERAGE_GENHTML_OPTIONS): Use standard pwd(1)
6392	instead of less widespread realpath(1) utility from GNU coreutils.
6393
63942016-09-05  Dmitry V. Levin  <ldv@altlinux.org>
6395
6396	tests: use sprintrc in tests/xetpriority.c.
6397	* tests/xetpriority.c (main): Use sprintrc.
6398
6399	tests: use sprintrc in vhangup.test.
6400	* tests/vhangup.c (main): Use sprintrc.
6401
6402	tests: use sprintrc in tests/sockname.c.
6403	* tests/sockname.c (test_sockname_syscall): Use sprintrc.
6404
6405	tests: use sprintrc in signalfd4.test.
6406	* tests/signalfd4.c (main): Use sprintrc.
6407
6408	tests: use sprintrc in setrlimit.test.
6409	* tests/setrlimit.c (main): Use sprintrc.
6410
6411	tests: use sprintrc in set_mempolicy.test.
6412	* tests/set_mempolicy.c (main, print_nodes): Use sprintrc.
6413
6414	tests: use sprintrc in openat.test.
6415	* tests/openat.c (main): Use sprintrc.
6416
6417	tests: use sprintrc in open.test.
6418	* tests/open.c (main): Use sprintrc.
6419
6420	tests: use sprintrc in move_pages.test.
6421	* tests/move_pages.c (print_stat_pages, print_move_pages): Use sprintrc.
6422
6423	tests: use sprintrc in mlockall.test.
6424	* tests/mlockall.c (main): Use sprintrc.
6425
6426	tests: use sprintrc in mlock.test.
6427	* tests/mlock.c (main): Use sprintrc.
6428
6429	tests: use sprintrc in epoll_create1.test.
6430	* tests/epoll_create1.c (main): Use sprintrc.
6431
64322016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>
6433
6434	tests: fix printing of min_nr and nr arguments of io_getevents syscall.
6435	* tests/aio.c (main): Change output format for min_nr and nr arguments
6436	in io_getevents check to %ld, cast these arguments to long.
6437
6438	tests: use sprintrc for return code output in aio test.
6439	* tests/aio.c (main): Use sprintrc for return code output.
6440
6441	tests: add more tests for ched_rr_get_interval decoding.
6442	* tests/sched_rr_get_interval.c (main): Check decoding of invalid
6443	timespec pointer and successful syscall invocation.
6444
6445	tests: use sprintrc for return code output in sched_rr_get_interval test
6446	* tests/sched_rr_get_interval.c (main): Use sprintrc for return code
6447	output.
6448
6449	tests: add more tests for sched_getscheduler and sched_xetscheduler.
6450	* tests/sched_xetscheduler.c (main): Check for decoding of invalid PID
6451	in sched_getscheduler and sched_setscheduler, invalid address
6452	of sched_param structure, and invalid policy value.
6453
6454	tests: use sprintrc for return code output in sched_xetscheduler test.
6455	* tests/sched_xetscheduler.c (main): Use sprintrc for return code output.
6456
64572016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>
6458
6459	aio: use printfd for fd printing.
6460	struct iocb contains two fields with fd semantics: aio_fildes and
6461	aio_resfd.  It is quite reasonable to use the appropriate function for
6462	printing them (apart from just "%d").
6463
6464	* aio.c (print_common_flags): Add struct tcb pointer to parameter list;
6465	use printfd for printing aio_resfd field.
6466	(print_iocb_header): Add struct tcb pointer to parameter list;
6467	use printfd for printing aio_fildes field.
6468	(print_iocb): Provide tcp argument to print_iocb_header
6469	and print_common_flags.
6470	(SYS_FUNC(io_cancel)): Likewise.
6471
64722016-09-05  Dmitry V. Levin  <ldv@altlinux.org>
6473
6474	sh64: wire up new syscalls.
6475	* linux/sh64/syscallent.h [380..393]: New entries.
6476
64772016-09-02  Dmitry V. Levin  <ldv@altlinux.org>
6478
6479	sh: wire up new syscalls.
6480	* linux/sh/syscallent.h [369..382]: New entries.
6481
64822016-09-05  Dmitry V. Levin  <ldv@altlinux.org>
6483
6484	avr32: wire up preadv2 and pwritev2 syscalls.
6485	* linux/avr32/syscallent.h [326]: Add preadv2 entry.
6486	[327]: Add pwritev2 entry.
6487
64882016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>
6489
6490	tests: check decoding of readahead syscall.
6491	* configure.ac (AC_CHECK_FUNCS): Add readahead.
6492	* tests/readahead.c: New file.
6493	* tests/readahead.test: New test.
6494	* tests/.gitignore: Add readahead.
6495	* tests/Makefile.am (check_PROGRAMS): Likewise.
6496	(DECODER_TESTS): Add readahead.test.
6497
64982016-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>
6499
6500	tests: move sprintrc function to libtests.
6501	* tests/tests.h (sprintrc): New prototype.
6502	* tests/futex.c (sprintrc): Move to ...
6503	* tests/sprintrc.c: ... new file.
6504	* tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c.
6505
6506	tests/futex: add support to sprintrc for return codes other than 0 and -1
6507	* tests/futex.c (sprintrc): Print the actual return code provided,
6508	not just "0".  Check snprintf return code.
6509
6510	tests/futex: increase sprintrc static buffer size.
6511	* tests/futex.c (sprintrc): Increase buffer size from 256 to 4096.
6512
6513	tests/futex: rename retstr to sprintrc.
6514	* tests/futex.c (retstr): Rename to sprintrc.
6515	(main): Convert all retstr calls to sprintrc.
6516
65172016-09-01  Eugene Syromyatnikov  <evgsyr@gmail.com>
6518
6519	readahead: fix print format for the "count" argument.
6520	According to documentation and kernel's syscalls.h, its type is size_t,
6521	so "%lu" format should be used instead of "%ld".
6522
6523	* readahead.c (SYS_FUNC(readahead)): Fix conversion specifier
6524	for the "count" argument.
6525
65262016-08-31  Dmitry V. Levin  <ldv@altlinux.org>
6527
6528	tests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll
6529	Use zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
6530	instead of explicit casts with unpredictable sign extension semantics.
6531
6532	* tests/xstatx.c (print_time, main): Use zero_extend_signed_to_ull
6533	instead of explicit cast.
6534	(print_stat): Use zero_extend_signed_to_ull and
6535	sign_extend_unsigned_to_ll instead of explicit casts.
6536
65372016-08-31  Dmitry V. Levin  <ldv@altlinux.org>
6538
6539	tests: add sign_extend_unsigned_to_ll macro.
6540	* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.
6541
65422016-08-31  Eugene Syromiatnikov  <evgsyr@gmail.com>
6543
6544	Refactor common sa_handler printing code.
6545	* xlat/sa_handler_values.in: New file.
6546	* signal.c: Include "xlat/sa_handler_values.h".
6547	(get_sa_handler_str, print_sa_handler): New functions.
6548	(SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them.
6549
65502016-08-31  Dmitry V. Levin  <ldv@altlinux.org>
6551
6552	Update TCP* constants.
6553	* xlat/socktcpoptions.in: Add TCP_REPAIR_WINDOW introduced by linux
6554	kernel commit v4.8-rc1~140^2~226.
6555
65562016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6557
6558	Update SCTP_* constants.
6559	* xlat/socksctpoptions.in: Add SCTP_PR_SUPPORTED, SCTP_DEFAULT_PRINFO,
6560	and SCTP_PR_ASSOC_STATUS introduced by linux kernel commits
6561	v4.8-rc1~140^2~148^2~5, v4.8-rc1~140^2~148^2~4, and
6562	v4.8-rc1~140^2~148^2~3, respectively.
6563
6564	Update fs *_MAGIC constants.
6565	* xlat/fsmagic.in: Add BALLOON_KVM_MAGIC and ZSMALLOC_MAGIC introduced
6566	by linux kernel commits v4.8-rc1~147^2~82 and v4.8-rc1~147^2~74,
6567	respectively.
6568
6569	Update KEXEC_ARCH_* constants.
6570	* xlat/kexec_arch_values.in: Add KEXEC_ARCH_AARCH64 introduced by linux
6571	kernel commit v4.8-rc1~16^2~41.
6572
6573	Update ETH_P_* constants.
6574	* xlat/ethernet_protocols.in: Add ETH_P_NCSI introduced by linux kernel
6575	commit v4.8-rc1~140^2~65^2~8.
6576
6577	Update BPF_* constants.
6578	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_CGROUP_ARRAY introduced
6579	by linux kernel commit v4.8-rc1~140^2~212^2~2.
6580	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_XDP introduced
6581	by linux kernel commit v4.8-rc1~140^2~64^2~10.
6582
65832016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6584
6585	Remove HAVE_SIGACTION checks.
6586	The syscall parsers guarded by HAVE_SIGACTION check have to be compiled
6587	regardless of libc sigaction function availability.
6588
6589	* configure.ac (AC_CHECK_FUNCS): Remove sigaction.
6590	* signal.c: Remove HAVE_SIGACTION checks.
6591
65922016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6593
6594	Remove obsolescent autoconf macro AC_TYPE_SIGNAL.
6595	All supported systems are expected to have C89 conforming sematics.
6596
6597	* configure.ac (AC_TYPE_SIGNAL): Remove.
6598
65992016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6600
6601	Remove obsolescent autoconf macro AC_C_CONST.
6602	All supported systems are expected to have the 'const' keyword.
6603
6604	* configure.ac (AC_C_CONST): Remove.
6605
66062016-08-30  Eugene Syromiatnikov  <evgsyr@gmail.com>
6607
6608	tests: check decoding of futex syscall.
6609	* tests/futex.c: New file.
6610	* tests/futex.test: New test.
6611	* tests/.gitignore: Add futex.
6612	* tests/Makefile.am (check_PROGRAMS): Likewise.
6613	(DECODER_TESTS): Add futex.test.
6614
66152016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6616
6617	futex: do not pretend <linux/futex.h> is included.
6618	As configure.ac does not check for linux/futex.h, HAVE_LINUX_FUTEX_H is
6619	never defined and therefore the inclusion of <linux/futex.h> guarded by
6620	HAVE_LINUX_FUTEX_H makes no sense.
6621
6622	Moreover, <linux/futex.h> used to have an incorrect definition
6623	of FUTEX_WAIT_BITSET_PRIVATE and FUTEX_WAKE_BITSET_PRIVATE:
6624	since kernel commit v2.6.24-6320-gcd68998 where these definitions
6625	were initially introduced and up to v2.6.31-7082-gf8d1e54 where they
6626	were finally fixed these macros had been incorrectly defined via
6627	FUTEX_WAIT_BITS and FUTEX_WAKE_BITS instead of FUTEX_WAIT_BITSET
6628	and FUTEX_WAKE_BITSET, and these incorrect definitions made their way
6629	into some distributions still in use.
6630
6631	* futex.c [HAVE_LINUX_FUTEX_H]: Remove.
6632
66332016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6634
6635	futex: avoid printing val when it is not used by the futex command.
6636	This is analogous to timeout argument omitting in FUTEX_WAKE_BITSET
6637	command.
6638
6639	* futex.c (SYS_FUNC(futex)): Remove common printing of val argument.
6640	Add printing of val argument for all futex commands except
6641	FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI.
6642
66432016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6644
6645	xlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set.
6646	* xlat/futexops.in: Add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and
6647	FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME values supported by linux kernel
6648	since commit v4.5-rc1~172^2.
6649
66502016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6651
6652	futex: fix formatting of unknown command argument.
6653	Use alternate form for printing hexadecimal numbers to avoid confusion.
6654	Use printaddr to print uaddr as the latter is interpreted as a pointer
6655	in all currently supported futex operations.
6656
6657	* futex.c (SYS_FUNC(futex)): Fix formatting of unknown command
6658	argument.
6659
66602016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6661
6662	futex: add handling of FUTEX_FD command.
6663	Since obsolete FUTEX_FD command is known and used to have some expected
6664	argument format, print FUTEX_FD using that format.
6665
6666	* futex.c (SYS_FUNC(futex)): Handle FUTEX_FD command.
6667
66682016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6669
6670	futex: fix formatting of val3 hexadecimal argument.
6671	* futex.c (SYS_FUNC(futex)): In FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET,
6672	print hexadecimal val3 argument in alternate form to avoid confusion.
6673
66742016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
6675
6676	futex: fix FUTEX_WAKE_OP compare function mask.
6677	According to the initial and current (v4.7) kernel implementations,
6678	in FUTEX_WAKE_OP case the compare function does not have
6679	FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits starting with bit 24.
6680
6681	* futex.c (SYS_FUNC(futex)): Do not print FUTEX_OP_OPARG_SHIFT
6682	for 27th bit of val3 in FUTEX_WAKE_OP case.
6683
66842016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6685
6686	tests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c.
6687	* bootstrap: Add -DMPERS_IS_$(MPERS_NAME) to ARCH_MFLAGS.
6688	* tests/xstatx.c [USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
6689	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
6690	to HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC.
6691	[USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
6692	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
6693	to HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC.
6694	[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
6695	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
6696	to HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC.
6697	[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
6698	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
6699	to HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC.
6700
6701	Based on patch by James Clarke <jrtc27@jrtc27.com>.
6702
67032016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6704
6705	Remove redundant check for PTRACE_LISTEN availability.
6706	As ptrace.h already ensures that PTRACE_LISTEN is defined,
6707	there is no need to check this fact in other places.
6708
6709	* strace.c (ptrace_restart): Do not check that PTRACE_LISTEN is defined.
6710
67112016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6712
6713	Remove unused autoconf macro AC_TYPE_GETGROUPS.
6714	strace code does not use GETGROUPS_T.
6715
6716	* configure.ac (AC_TYPE_GETGROUPS): Remove.
6717
67182016-08-30  Dmitry V. Levin  <ldv@altlinux.org>
6719
6720	Remove unused autoconf macro AC_TYPE_MODE_T.
6721	strace code already redefines mode_t.
6722
6723	* configure.ac (AC_TYPE_MODE_T): Remove.
6724
67252016-08-30  James Clarke  <jrtc27@jrtc27.com>
6726
6727	Use PTRACE_SUNDETACH everywhere on SPARC and SPARC64.
6728	SPARC has a different PTRACE_DETACH value correctly defined in
6729	sys/ptrace.h, but linux/ptrace.h clobbers it with the standard one.
6730	PTRACE_SUNDETACH is also defined to the correct value by sys/ptrace.h,
6731	so use that instead.
6732
6733	* strace.c (detach) [SPARC]: Move redefinition of PTRACE_DETACH
6734	to PTRACE_SUNDETACH ...
6735	* ptrace.h [SPARC || SPARC64]: ... here.
6736
67372016-08-29  Dmitry V. Levin  <ldv@altlinux.org>
6738
6739	Remove obsolescent autoconf macro AC_HEADER_STDC.
6740	All systems supported by strace are expected to have C89 conforming
6741	header files.
6742
6743	* configure.ac (AC_HEADER_STDC): Remove.
6744
67452016-08-29  Dmitry V. Levin  <ldv@altlinux.org>
6746
6747	Remove unneeded autoconf macro AC_HEADER_DIRENT.
6748	strace code already includes <dirent.h> unconditionally.
6749
6750	* configure.ac (AC_HEADER_DIRENT): Remove.
6751
67522016-08-28  Dmitry V. Levin  <ldv@altlinux.org>
6753
6754	Remove unneeded autoconf macro AC_HEADER_STDBOOL.
6755	strace code assumes C99.
6756
6757	* configure.ac (AC_HEADER_STDBOOL): Remove.
6758	* defs.h: Include <stdbool.h> unconditionally.
6759
67602016-08-27  Dmitry V. Levin  <ldv@altlinux.org>
6761
6762	Remove obsolescent autoconf macro AC_HEADER_STAT.
6763	No systems supported by strace are expected to have the bug workarounded
6764	by AC_HEADER_STAT macro.
6765
6766	* configure.ac (AC_HEADER_STAT): Remove.
6767
67682016-08-29  Dmitry V. Levin  <ldv@altlinux.org>
6769
6770	Do not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally.
6771	glibc, starting with commit glibc-2.24-28-gdbab657, has deprecated
6772	inclusion of <sys/sysmacros.h> by <sys/types.h>.  The method used
6773	for deprecation breaks AC_HEADER_MAJOR: this autoconf macro no longer
6774	defines MAJOR_IN_SYSMACROS, which consequently breaks build.
6775
6776	Let's assume that all systems supported by strace provide major, minor,
6777	and makedev macros via <sys/sysmacros.h>.
6778
6779	* configure.ac (AC_HEADER_MAJOR): Remove.
6780	* mknod.c [MAJOR_IN_SYSMACROS, MAJOR_IN_MKDEV]: Remove.
6781	Include <sys/sysmacros.h> unconditionally.
6782	* print_struct_stat.c: Likewise.
6783	* tests/mknod.c: Likewise.
6784	* tests/mknodat.c: Likewise.
6785	* tests/xstatx.c: Likewise.
6786
67872016-08-29  Dmitry V. Levin  <ldv@altlinux.org>
6788
6789	btrfs: mpersify struct btrfs_ioctl_vol_args_v2.
6790	This complements commit v4.11-719-gfb0c609.
6791
6792	* btrfs.c (struct_btrfs_ioctl_vol_args_v2): New type.  Mpersify it.
6793	(btrfs_print_qgroup_inherit): Change qgi_addr type to unsigned long.
6794	(btrfs_ioctl): Replace struct btrfs_ioctl_vol_args_v2 with
6795	struct_btrfs_ioctl_vol_args_v2.
6796
67972016-08-29  Elvira Khabirova  <lineprinter0@gmail.com>
6798
6799	mpers.awk: relax union member name absence check.
6800	This fixes mpersing of unions containing nameless members,
6801	e.g. struct btrfs_ioctl_vol_args_v2.
6802
6803	* mpers.awk (what_is): Print names of union_type members as is.
6804
68052016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6806
6807	Revert "tests/xstatx.c: fix stat syscall tests on mips64"
6808	Previous commit effectively changed types of st_atime, st_ctime, and
6809	st_mtime members of struct stat and struct stat64 to signed integers,
6810	making the mips64 workaround obsolete.
6811
6812	This reverts commit 3fb84bfc79949c145197c61fbf04ce18464e9112.
6813
6814	* tests/xstatx.c (create_sample) [__mips64]: Remove.
6815
68162016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6817
6818	Mpersify parsers of struct stat and struct stat64.
6819	On many architectures that support multiple personalities,
6820	struct stat differ between personalities.  While old code could handle
6821	these differences, there are some architectures, e.g. sparc64, that also
6822	have different struct stat64.  Rewrite parsers using mpers functionality
6823	to fix these issues.
6824
6825	* fetch_struct_stat.c: New file.
6826	* fetch_struct_stat64.c: Likewise.
6827	* print_struct_stat.c: Likewise.
6828	* oldstat.c: Likewise.
6829	* stat.c: Likewise.
6830	* stat.h: Likewise.
6831	* stat64.c: Likewise.
6832	* file.c: Remove.
6833	* printstat.h: Likewise.
6834	* linux/aarch64/stat32.h: Likewise.
6835	* linux/powerpc64/stat32.h: Likewise.
6836	* linux/riscv/stat32.h: Likewise.
6837	* linux/sparc64/stat32.h: Likewise.
6838	* linux/tile/stat32.h: Likewise.
6839	* linux/x32/stat32.h: Likewise.
6840	* linux/x86_64/stat32.h: Likewise.
6841	* Makefile.am (strace_SOURCES): Add fetch_struct_stat.c,
6842	fetch_struct_stat64.c, print_struct_stat.c, oldstat.c, stat.c, stat.h,
6843	and stat64.c.  Remove file.c, printstat.h, linux/aarch64/stat32.h,
6844	linux/powerpc64/stat32.h, linux/riscv/stat32.h, linux/sparc64/stat32.h,
6845	linux/tile/stat32.h, linux/x32/stat32.h, and linux/x86_64/stat32.h.
6846	* configure.ac (AC_CHECK_MEMBERS): Add struct stat64.st_mtime_nsec.
6847	* defs.h (struct strace_stat): New declaration.
6848	(print_struct_stat): New prototype.
6849	* linux/dummy.h (sys_fstatat64): Remove.
6850
68512016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6852
6853	mpers.m4: check for struct stat64, struct stat, and their members.
6854	* m4/mpers.m4 (st_MPERS_STRUCT_STAT): New macro.
6855	(st_MPERS): Use it.
6856
68572016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6858
6859	mpers: add MPERS_IS_* to CFLAGS passed to mpers.sh.
6860	This allows testing of MPERS_IS_* macros in pre-MPERS_DEFS parts
6861	of source code.
6862
6863	* Makefile.am (mpers-m%.stamp): Add -DMPERS_IS_$(mpers_NAME) to CFLAGS
6864	passed to mpers.sh.
6865	* mpers_test.sh: Likewise.
6866
68672016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6868
6869	Move redefinition of stat types to asm_stat.h.
6870	* file.c: Move redefinition of types that might be used
6871	to define struct stat ...
6872	* linux/asm_stat.h: ... here.
6873	* tests/xstatx.c: Remove redefinition of stat types.
6874
68752016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6876
6877	x86_64: provide a replacement of <asm/stat.h> for x32 personality.
6878	For the reason described in commit v4.10-517-gcfde1e3, a correct
6879	definition of struct stat for x32 personality is necessary to enable
6880	"asm_stat.h" with -mx32 on x86_64.
6881
6882	* linux/x32/asm_stat.h: Rename to ...
6883	* linux/x86_64/asm_stat.h: ... new file.
6884	* Makefile.am (strace_SOURCES): Add it.
6885	* linux/x32/asm_stat.h: New file, include "x86_64/asm_stat.h".
6886
68872016-08-24  Dmitry V. Levin  <ldv@altlinux.org>
6888
6889	x32/asm_stat.h: provide definitions for i386 personality.
6890	This enables x32/asm_stat.h with -m32.
6891
6892	* linux/x32/asm_stat.h [__x86_64__ && __ILP32__]: Redirect stat.
6893	Include "linux/asm_stat.h".
6894	(struct stat): Define for [__x86_64__ && __ILP32__] only.
6895	(struct __old_kernel_stat): Remove.
6896
68972016-08-23  Dmitry V. Levin  <ldv@altlinux.org>
6898
6899	Introduce a separate SEN entry for fstatat64 syscall.
6900	* linux/dummy.h (sys_fstatat64): Redirect to sys_newfstatat.
6901	* linux/32/syscallent.h: Replace SEN(newfstatat) with SEN(fstatat64).
6902	* linux/alpha/syscallent.h: Likewise.
6903	* linux/arm/syscallent.h: Likewise.
6904	* linux/avr32/syscallent.h: Likewise.
6905	* linux/bfin/syscallent.h: Likewise.
6906	* linux/hppa/syscallent.h: Likewise.
6907	* linux/i386/syscallent.h: Likewise.
6908	* linux/m68k/syscallent.h: Likewise.
6909	* linux/microblaze/syscallent.h: Likewise.
6910	* linux/mips/syscallent-o32.h: Likewise.
6911	* linux/powerpc/syscallent.h: Likewise.
6912	* linux/s390/syscallent.h: Likewise.
6913	* linux/sh/syscallent.h: Likewise.
6914	* linux/sh64/syscallent.h: Likewise.
6915	* linux/sparc/syscallent.h: Likewise.
6916	* linux/sparc64/syscallent.h: Likewise.
6917	* linux/xtensa/syscallent.h: Likewise.
6918	* pathtrace.c (pathtrace_match): Handle SEN_fstatat64.
6919
69202016-08-23  Dmitry V. Levin  <ldv@altlinux.org>
6921
6922	Do not check for struct stat.st_{a,c}time_nsec.
6923	Assume that the check for struct stat.st_mtime_nsec is enough.
6924	Likewise, do not check for struct stat.st_{a,c}tim.tv_nsec.
6925
6926	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_atime_nsec,
6927	struct stat.st_ctime_nsec, struct stat.st_atim.tv_nsec,
6928	and struct stat.st_ctim.tv_nsec.
6929	* file.c (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
6930	HAVE_STRUCT_STAT_ST_CTIME_NSEC): Remove.
6931	* printstat.h (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
6932	HAVE_STRUCT_STAT_ST_CTIME_NSEC): Replace with
6933	HAVE_STRUCT_STAT_ST_MTIME_NSEC.
6934	* tests/xstatx.c: Likewise.
6935
69362016-08-23  Dmitry V. Levin  <ldv@altlinux.org>
6937
6938	Add sign_extend_unsigned_to_ll macro.
6939	* defs.h (sign_extend_unsigned_to_ll): New macro, mirrors
6940	zero_extend_signed_to_ull.
6941
6942	zero_extend_signed_to_ull: add short int support.
6943	* defs.h (zero_extend_signed_to_ull): Add short int support.
6944	* tests/tests.h: Likewise.
6945
6946	Rename widen_to_ull to zero_extend_signed_to_ull.
6947	* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
6948	All callers changed.
6949	* tests/tests.h: Likewise.
6950
69512016-08-23  Dmitry V. Levin  <ldv@altlinux.org>
6952
6953	sparc, sparc64: remove obsolete code.
6954	Remove remains of solaris personality support.
6955	This complements commit v4.10-45-gdf4dd8b.
6956
6957	* file.c [SPARC || SPARC64] (SYS_FUNC(xstat), SYS_FUNC(fxstat)): Remove.
6958
69592016-08-22  Dmitry V. Levin  <ldv@altlinux.org>
6960
6961	sparc64: fix decoding of struct stat64 related syscalls.
6962	For some reason, struct stat and struct stat64 are different on sparc64.
6963	This change fixes decoding of struct stat64 related syscalls for sparc64
6964	personality, sparc32 personality on sparc64 needs more work.
6965
6966	* file.c (printstat64) [SPARC64]: Do not use printstat.
6967	(SYS_FUNC(newfstatat)): Likewise.
6968
69692016-08-22  Eugene Syromyatnikov  <evgsyr@gmail.com>
6970
6971	tests: fill old_value argument in timer{,fd}_xettime tests.
6972	This is needed in order to differentiate it from the value returned
6973	by the call.  As a consequence, it enables revealing possible bugs
6974	in syscall parsers, for example, when the value read on syscall
6975	entering and not on syscall exiting, as it was the case with
6976	timerfd_settime parser.
6977
6978	* tests/timer_xettime.c (main): Fill old.its field with value different
6979	from the expected one upon call return.
6980	* tests/timerfd_xettime.c: Likewise.
6981
69822016-08-22  Eugene Syromyatnikov  <evgsyr@gmail.com>
6983
6984	Fix old_value argument retrieval in timerfd_settime parser.
6985	This is done similar to timer_settime syscall parser.
6986
6987	* time.c (SYS_FUNC(timerfd_settime)): Retrieve old_value argument
6988	on exiting and not on entering.  Return 0 instead of RVAL_DECODED
6989	since the call hasn't been decoded in full on entering.
6990
69912016-08-21  Richard W.M. Jones  <rjones@redhat.com>
6992
6993	Add RISC-V architecture support.
6994	The original port of strace was done by Palmer Dabbelt
6995	(eecs.berkeley.edu), based on strace 4.9.
6996
6997	* configure.ac: Define RISCV for riscv*.
6998	* clone.c [RISCV]: Define ARG_* macros as for OR1K.
6999	* defs.h [RISCV] (SUPPORTED_PERSONALITIES): Define to 2.
7000	[RISCV] (NEED_UID16_PARSERS): Define to 1.
7001	* linux/riscv/arch_regs.c: New file.
7002	* linux/riscv/errnoent1.h: Likewise.
7003	* linux/riscv/get_error.c: Likewise.
7004	* linux/riscv/get_scno.c: Likewise.
7005	* linux/riscv/get_syscall_args.c: Likewise.
7006	* linux/riscv/ioctls_arch0.h: Likewise.
7007	* linux/riscv/ioctls_arch1.h: Likewise.
7008	* linux/riscv/ioctls_inc0.h: Likewise.
7009	* linux/riscv/ioctls_inc1.h: Likewise.
7010	* linux/riscv/signalent1.h: Likewise.
7011	* linux/riscv/stat32.h: Likewise.
7012	* linux/riscv/syscallent.h: Likewise.
7013	* linux/riscv/syscallent1.h: Likewise.
7014	* Makefile.am (EXTRA_DIST): Add them.
7015
70162016-08-21  Eugene Syromyatnikov  <evgsyr@gmail.com>
7017
7018	Move SH-specific argument number calculation to getllval.
7019	This change prevents scattering of ll-related hacks and simplifies
7020	pread/pwrite syscalls parsers' logic a bit.
7021
7022	* util.c (getllval): Add fixup for arg_no for SuperH when argument
7023	number is equal to 3.
7024	* io.c (PREAD_OFFSET_ARG): Remove.
7025	(SYS_FUNC(pread)): Always use argument number 3 for "count" argument
7026	printing.
7027	(SYS_FUNC(pwrite)): Likewise.
7028
70292016-08-21  Dmitry V. Levin  <ldv@altlinux.org>
7030
7031	sparc64: fix sigreturn decoding for sparc personality.
7032	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Parametrize
7033	member types of struct signal_frame.
7034	* linux/sparc64/arch_sigreturn.c (sparc64_arch_sigreturn,
7035	sparc32_arch_sigreturn): New functions.
7036	(arch_sigreturn): Use them.
7037
70382016-08-20  Dmitry V. Levin  <ldv@altlinux.org>
7039
7040	Fix compat decoding of struct sigaction.sa_mask on big endian architectures
7041	* signal.c (decode_new_sigaction) [SUPPORTED_PERSONALITIES > 1 &&
7042	SIZEOF_LONG > 4]: Use LONG_LONG to convert sa_mask from 32-bit
7043	struct sigaction to 64-bit struct sigaction.
7044
70452016-08-19  Dmitry V. Levin  <ldv@altlinux.org>
7046
7047	Fix decoding of indirect shmat's return code for non-native personalities
7048	* ipc_shm.c (SYS_FUNC(shmat)): Fetch current_wordsize bytes of data
7049	to obtain return code of indirect shmat subcall.
7050
70512016-08-18  Dmitry V. Levin  <ldv@altlinux.org>
7052
7053	sparc64: fix sparc personality decoding of mmap64's offset argument.
7054	* linux/sparc64/syscallent1.h: Remove redirection of sys_mmap_4koff.
7055
70562016-08-19  Dmitry V. Levin  <ldv@altlinux.org>
7057
7058	sparc64: fix decoding of the forth argument of semctl syscall.
7059	On sparc64, unlike all other architectures where semctl is an indirect
7060	ipc subcall, the forth argument is passed directly.
7061
7062	* ipc_sem.c (SYS_FUNC(semctl)) [SPARC64]: Print 4th argument without
7063	indirection in case of native personality.
7064
70652016-08-16  Dmitry V. Levin  <ldv@altlinux.org>
7066
7067	Add sparc64 specific ptrace constants.
7068	* xlat/ptrace_cmds.in: Add PTRACE_GETREGS64, PTRACE_SETREGS64,
7069	PTRACE_GETFPREGS64, and PTRACE_SETFPREGS64.
7070
7071	sparc64: fix sign extension bug of syscall args for sparc personality.
7072	* linux/sparc64/get_syscall_args.c (get_syscall_args): Zero-extend
7073	syscall args from 32 bit for sparc personality.
7074
70752016-08-16  Dmitry V. Levin  <ldv@altlinux.org>
7076
7077	sparc64: fix tty ioctl numbers.
7078	The structures defined in asm/termbits.h have the same size
7079	on sparc and sparc64.
7080
7081	* linux/sparc64/ioctls_arch0.h (TCGETS, TCGETS2, TCSETS, TCSETS2,
7082	TCSETSF, TCSETSF2, TCSETSW, TCSETSW2): Sync with
7083	linux/sparc/ioctls_arch0.h
7084
70852016-08-15  Dmitry V. Levin  <ldv@altlinux.org>
7086
7087	evdev.c: fix typo in comment.
7088
70892016-08-15  Dmitry V. Levin  <ldv@altlinux.org>
7090
7091	Drop support of dummy members of struct stat.
7092	As st_flags, st_fstype, and st_gen members of struct stat are not filled
7093	by the kernel, there is no use supporting them.
7094
7095	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_flags,
7096	struct stat.st_fstype, and struct stat.st_gen.
7097	* file.c [STAT32_PERSONALITY, HAVE_STRUCT_STAT64]: Do not undefine
7098	HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
7099	and HAVE_STRUCT_STAT_ST_GEN.
7100	* printstat.h (DO_PRINTSTAT): Do not check for
7101	HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
7102	and HAVE_STRUCT_STAT_ST_GEN.
7103
71042016-08-15  Dmitry V. Levin  <ldv@altlinux.org>
7105
7106	Assume that struct stat contains st_blksize, st_blocks, and st_rdev.
7107	Our test suite already assumes that struct stat contains st_blksize,
7108	st_blocks, and st_rdev members, and there haven't been any complaints.
7109
7110	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_blksize,
7111	struct stat.st_blocks, and struct stat.st_rdev.
7112	* printstat.h (DO_PRINTSTAT): Do not check for
7113	HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_STRUCT_STAT_ST_BLOCKS,
7114	and HAVE_STRUCT_STAT_ST_RDEV.
7115
71162016-08-15  Dmitry V. Levin  <ldv@altlinux.org>
7117
7118	tests: fix pause.test when pause syscall is not available.
7119	* tests/pause.c (main): Fix expected output when pause syscall
7120	is not available.
7121
71222016-08-14  Dmitry V. Levin  <ldv@altlinux.org>
7123
7124	powerpc64, sparc64: fix redefinitions of ARCH_PC_REG.
7125	This fixes compilation warning that ARCH_PC_REG is redefined.
7126
7127	* linux/powerpc64/arch_regs.c (ARCH_PC_REG): Undefine before
7128	the new definition.
7129	* linux/sparc64/arch_regs.c (ARCH_PC_REG): Likewise.
7130
71312016-08-14  Dmitry V. Levin  <ldv@altlinux.org>
7132
7133	s390x, x32: remove redundant definitions of ARCH_PC_REG.
7134	* linux/s390x/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
7135	in just included linux/s390/arch_regs.c.
7136	* linux/x32/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
7137	in just included linux/x86_64/arch_regs.c.
7138
71392016-08-13  Dmitry V. Levin  <ldv@altlinux.org>
7140
7141	tests: check for leaks of placeholder descriptors.
7142	* tests/redirect-fds.c: New file.
7143	* tests/redirect-fds.test: New test.
7144	* tests/.gitignore: Add redirect-fds.
7145	* tests/Makefile.am (check_PROGRAMS): Likewise.
7146	(MISC_TESTS): Add redirect-fds.test.
7147
7148	tests/init.sh: print exit code of failed commands.
7149	* init.sh (run_prog, run_prog_skip_if_failed): When the program fails,
7150	add its exit code to the diagnostic message.
7151	(run_strace): When strace fails, add its exit code to the diagnostic
7152	message.
7153	(run_strace_merge): When strace-log-merge fails, add its exit code
7154	to the diagnostic message.
7155
71562016-08-13  Dmitry V. Levin  <ldv@altlinux.org>
7157
7158	Fix leakage of placeholder descriptors to tracees.
7159	As a side effect of commit v4.11-211-g0736d4e, strace used to leak
7160	placeholders for standard descriptors to tracees thus affecting their
7161	behaviour.  Fix this by setting close-on-exec flag on placeholder
7162	descriptors.
7163
7164	* strace.c (open_dummy_desc): Set close-on-exec flag on the descriptor
7165	that is going to be returned to the caller.
7166	(fd_is_placeholder): New array.
7167	(ensure_standard_fds_opened, redirect_standard_fds): New functions.
7168	(startup_child): Use redirect_standard_fds.
7169	(init): Use ensure_standard_fds_opened.
7170
71712016-08-12  Dmitry V. Levin  <ldv@altlinux.org>
7172
7173	sparc64: fix decoding of uid and gid-related syscalls.
7174	sparc64 has no native 16-bit uid/gid syscalls.
7175
7176	* linux/sparc64/syscallent.h (chown, lchown, setuid, getuid, setgid,
7177	getgid, geteuid, getegid, getgroups, setgroups, fchown, setreuid,
7178	setregid, setfsuid, setfsgid): Change handlers from 16-bit to 32-bit.
7179
71802016-08-12  Dmitry V. Levin  <ldv@altlinux.org>
7181
7182	tests: fix *stat64 tests on alpha.
7183	On some architectures including alpha, <asm/stat.h> provides a
7184	definition of struct stat that has no st_atime_nsec, st_mtime_nsec, and
7185	st_ctime_nsec fields.  At the same time, struct stat64 always has these
7186	fields.  Fix tests to take this difference into account.
7187
7188	* tests/fstat64.c (STRUCT_STAT_IS_STAT64): New macro, defined to 1.
7189	* tests/lstat64.c (STRUCT_STAT_IS_STAT64): Likewise.
7190	* tests/stat64.c (STRUCT_STAT_IS_STAT64): Likewise.
7191	* tests/xstatx.c [!STRUCT_STAT] (STRUCT_STAT_IS_STAT64): New macro,
7192	defined to 0.
7193	[USE_ASM_STAT && STRUCT_STAT_IS_STAT64]:
7194	(HAVE_STRUCT_STAT_ST_ATIME_NSEC, HAVE_STRUCT_STAT_ST_CTIME_NSEC,
7195	HAVE_STRUCT_STAT_ST_MTIME_NSEC): Redefine to 1.
7196
71972016-08-11  Dmitry V. Levin  <ldv@altlinux.org>
7198
7199	tests: skip rt_tgsigqueueinfo.test when the syscall is not available.
7200	* tests/rt_tgsigqueueinfo.c (main): Skip the test when the syscall
7201	is not available.
7202
72032016-08-11  James Cowgill  <james410@cowgill.org.uk>
7204
7205	tests/fcntl.c: fix fcntl test on mips64.
7206	On mips64 the F_GETLK and F_SETLKW64 constants have identical values which
7207	causes the "wrong" constant to be printed by strace.
7208
7209	tests/fcntl.c (test_flock64): Do not test F_SETLKW64 on mips64.
7210
72112016-08-11  James Cowgill  <james410@cowgill.org.uk>
7212
7213	tests/nsyscalls.test: only trace the "syscall" syscall on mips o32.
7214	The "syscall" syscall only exists on o32 and causes strace to error out on
7215	64-bit mips ABIs. Pass MIPS_ABI from the configure script through to
7216	nsyscalls.test so the MIPS ABI can be checked.
7217
7218	* configure.ac (MIPS_ABI): Substitute into output files.
7219	* tests/Makefile.am (MIPS_ABI): Export via AM_TEST_LOG_FLAGS.
7220	* tests/nsyscalls.test: Restrict special mips handling to mips o32.
7221
72222016-08-11  James Cowgill  <james410@cowgill.org.uk>
7223
7224	tests/xstatx.c: fix stat syscall tests on mips64.
7225	For historical reasons the kernel struct stat represents times as unsigned
7226	32-bit integers on mips64. Therefore, while it's possible to give a file a
7227	timestamp before 1970 with futimens, reading the same timestamp through
7228	struct stat will give a positive time (around 2106).
7229	Workaround by using positive timestamps for testing on mips64.
7230
7231	* tests/xstatx.c (create_sample): Use positive timestamps on mips64.
7232
72332016-08-11  Dmitry V. Levin  <ldv@altlinux.org>
7234
7235	tests/mlock2.c: fix test failure on mips64.
7236	* tests/mlock2.c (main): Pass unsigned long arguments to mlock2 syscall
7237	explicitly, to avoid unwanted sign extension issues.
7238
7239	Based on patch by James Cowgill <james410@cowgill.org.uk>
7240
72412016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7242
7243	Use <asm/unistd.h> instead of <sys/syscall.h>
7244	There are no users of SYS_* macros provided by <sys/syscall.h>,
7245	and definitions of __NR_* macros could be obtained directly
7246	from <asm/unistd.h>.
7247
7248	* defs.h: Include <asm/unistd.h> instead of <sys/syscall.h>.
7249	* test/seccomp.c: Likewise.
7250	* test/threaded_execve.c: Likewise.
7251	* test/x32_lseek.c: Likewise.
7252	* test/x32_mmap.c: Likewise.
7253	* tests/_newselect.c: Likewise.
7254	* tests/access.c: Likewise.
7255	* tests/acct.c: Likewise.
7256	* tests/aio.c: Likewise.
7257	* tests/alarm.c: Likewise.
7258	* tests/attach-f-p.c: Likewise.
7259	* tests/bpf.c: Likewise.
7260	* tests/brk.c: Likewise.
7261	* tests/chmod.c: Likewise.
7262	* tests/chown.c: Likewise.
7263	* tests/chown32.c: Likewise.
7264	* tests/chroot.c: Likewise.
7265	* tests/clock_adjtime.c: Likewise.
7266	* tests/clock_nanosleep.c: Likewise.
7267	* tests/clock_xettime.c: Likewise.
7268	* tests/copy_file_range.c: Likewise.
7269	* tests/creat.c: Likewise.
7270	* tests/dup2.c: Likewise.
7271	* tests/dup3.c: Likewise.
7272	* tests/epoll_create.c: Likewise.
7273	* tests/epoll_create1.c: Likewise.
7274	* tests/epoll_ctl.c: Likewise.
7275	* tests/epoll_pwait.c: Likewise.
7276	* tests/epoll_wait.c: Likewise.
7277	* tests/eventfd.c: Likewise.
7278	* tests/execveat.c: Likewise.
7279	* tests/faccessat.c: Likewise.
7280	* tests/fchdir.c: Likewise.
7281	* tests/fchmod.c: Likewise.
7282	* tests/fchmodat.c: Likewise.
7283	* tests/fchown.c: Likewise.
7284	* tests/fchown32.c: Likewise.
7285	* tests/fchownat.c: Likewise.
7286	* tests/fcntl.c: Likewise.
7287	* tests/fcntl64.c: Likewise.
7288	* tests/fdatasync.c: Likewise.
7289	* tests/flock.c: Likewise.
7290	* tests/fstat.c: Likewise.
7291	* tests/fstat64.c: Likewise.
7292	* tests/fstatat64.c: Likewise.
7293	* tests/fstatfs.c: Likewise.
7294	* tests/fstatfs64.c: Likewise.
7295	* tests/fsync.c: Likewise.
7296	* tests/ftruncate.c: Likewise.
7297	* tests/ftruncate64.c: Likewise.
7298	* tests/futimesat.c: Likewise.
7299	* tests/get_mempolicy.c: Likewise.
7300	* tests/getcwd.c: Likewise.
7301	* tests/getdents.c: Likewise.
7302	* tests/getdents64.c: Likewise.
7303	* tests/getegid.c: Likewise.
7304	* tests/getegid32.c: Likewise.
7305	* tests/geteuid.c: Likewise.
7306	* tests/geteuid32.c: Likewise.
7307	* tests/getgid.c: Likewise.
7308	* tests/getgid32.c: Likewise.
7309	* tests/getgroups.c: Likewise.
7310	* tests/getgroups32.c: Likewise.
7311	* tests/getpgrp.c: Likewise.
7312	* tests/getrandom.c: Likewise.
7313	* tests/getresgid.c: Likewise.
7314	* tests/getresgid32.c: Likewise.
7315	* tests/getresuid.c: Likewise.
7316	* tests/getresuid32.c: Likewise.
7317	* tests/getrlimit.c: Likewise.
7318	* tests/getrusage.c: Likewise.
7319	* tests/getuid.c: Likewise.
7320	* tests/getuid32.c: Likewise.
7321	* tests/getxxid.c: Likewise.
7322	* tests/ioctl_uffdio.c: Likewise.
7323	* tests/ioperm.c: Likewise.
7324	* tests/iopl.c: Likewise.
7325	* tests/ipc.c: Likewise.
7326	* tests/kill.c: Likewise.
7327	* tests/lchown.c: Likewise.
7328	* tests/lchown32.c: Likewise.
7329	* tests/libmmsg.c: Likewise.
7330	* tests/libsocketcall.c: Likewise.
7331	* tests/link.c: Likewise.
7332	* tests/linkat.c: Likewise.
7333	* tests/llseek.c: Likewise.
7334	* tests/lseek.c: Likewise.
7335	* tests/lstat.c: Likewise.
7336	* tests/lstat64.c: Likewise.
7337	* tests/mbind.c: Likewise.
7338	* tests/membarrier.c: Likewise.
7339	* tests/memfd_create.c: Likewise.
7340	* tests/migrate_pages.c: Likewise.
7341	* tests/mkdir.c: Likewise.
7342	* tests/mkdirat.c: Likewise.
7343	* tests/mknod.c: Likewise.
7344	* tests/mknodat.c: Likewise.
7345	* tests/mlock.c: Likewise.
7346	* tests/mlock2.c: Likewise.
7347	* tests/move_pages.c: Likewise.
7348	* tests/newfstatat.c: Likewise.
7349	* tests/nsyscalls.c: Likewise.
7350	* tests/old_mmap.c: Likewise.
7351	* tests/oldselect.c: Likewise.
7352	* tests/open.c: Likewise.
7353	* tests/openat.c: Likewise.
7354	* tests/pause.c: Likewise.
7355	* tests/poll.c: Likewise.
7356	* tests/prctl-seccomp-filter-v.c: Likewise.
7357	* tests/prctl-seccomp-strict.c: Likewise.
7358	* tests/preadv2-pwritev2.c: Likewise.
7359	* tests/prlimit64.c: Likewise.
7360	* tests/pselect6.c: Likewise.
7361	* tests/ptrace.c: Likewise.
7362	* tests/readdir.c: Likewise.
7363	* tests/readlink.c: Likewise.
7364	* tests/readlinkat.c: Likewise.
7365	* tests/reboot.c: Likewise.
7366	* tests/remap_file_pages.c: Likewise.
7367	* tests/rename.c: Likewise.
7368	* tests/renameat.c: Likewise.
7369	* tests/renameat2.c: Likewise.
7370	* tests/rmdir.c: Likewise.
7371	* tests/rt_sigpending.c: Likewise.
7372	* tests/rt_sigprocmask.c: Likewise.
7373	* tests/rt_sigsuspend.c: Likewise.
7374	* tests/rt_sigtimedwait.c: Likewise.
7375	* tests/rt_tgsigqueueinfo.c: Likewise.
7376	* tests/sched_get_priority_mxx.c: Likewise.
7377	* tests/sched_rr_get_interval.c: Likewise.
7378	* tests/sched_xetaffinity.c: Likewise.
7379	* tests/sched_xetattr.c: Likewise.
7380	* tests/sched_xetparam.c: Likewise.
7381	* tests/sched_xetscheduler.c: Likewise.
7382	* tests/sched_yield.c: Likewise.
7383	* tests/seccomp-filter-v.c: Likewise.
7384	* tests/seccomp-filter.c: Likewise.
7385	* tests/seccomp-strict.c: Likewise.
7386	* tests/select.c: Likewise.
7387	* tests/sendfile.c: Likewise.
7388	* tests/sendfile64.c: Likewise.
7389	* tests/set_mempolicy.c: Likewise.
7390	* tests/setdomainname.c: Likewise.
7391	* tests/setfsgid.c: Likewise.
7392	* tests/setfsgid32.c: Likewise.
7393	* tests/setfsuid.c: Likewise.
7394	* tests/setfsuid32.c: Likewise.
7395	* tests/setgid.c: Likewise.
7396	* tests/setgid32.c: Likewise.
7397	* tests/setgroups.c: Likewise.
7398	* tests/setgroups32.c: Likewise.
7399	* tests/sethostname.c: Likewise.
7400	* tests/setregid.c: Likewise.
7401	* tests/setregid32.c: Likewise.
7402	* tests/setresgid.c: Likewise.
7403	* tests/setresgid32.c: Likewise.
7404	* tests/setresuid.c: Likewise.
7405	* tests/setresuid32.c: Likewise.
7406	* tests/setreuid.c: Likewise.
7407	* tests/setreuid32.c: Likewise.
7408	* tests/setrlimit.c: Likewise.
7409	* tests/setuid.c: Likewise.
7410	* tests/setuid32.c: Likewise.
7411	* tests/signalfd4.c: Likewise.
7412	* tests/socketcall.c: Likewise.
7413	* tests/splice.c: Likewise.
7414	* tests/stat.c: Likewise.
7415	* tests/stat64.c: Likewise.
7416	* tests/statfs.c: Likewise.
7417	* tests/statfs64.c: Likewise.
7418	* tests/swap.c: Likewise.
7419	* tests/symlink.c: Likewise.
7420	* tests/symlinkat.c: Likewise.
7421	* tests/sync.c: Likewise.
7422	* tests/sync_file_range.c: Likewise.
7423	* tests/sync_file_range2.c: Likewise.
7424	* tests/syslog.c: Likewise.
7425	* tests/tee.c: Likewise.
7426	* tests/time.c: Likewise.
7427	* tests/timer_create.c: Likewise.
7428	* tests/timer_xettime.c: Likewise.
7429	* tests/timerfd_xettime.c: Likewise.
7430	* tests/times-fail.c: Likewise.
7431	* tests/times.c: Likewise.
7432	* tests/truncate.c: Likewise.
7433	* tests/truncate64.c: Likewise.
7434	* tests/ugetrlimit.c: Likewise.
7435	* tests/umount.c: Likewise.
7436	* tests/umount2.c: Likewise.
7437	* tests/uname.c: Likewise.
7438	* tests/unix-pair-send-recv.c: Likewise.
7439	* tests/unlink.c: Likewise.
7440	* tests/unlinkat.c: Likewise.
7441	* tests/userfaultfd.c: Likewise.
7442	* tests/utimes.c: Likewise.
7443	* tests/vhangup.c: Likewise.
7444	* tests/vmsplice.c: Likewise.
7445	* tests/waitid.c: Likewise.
7446	* tests/waitpid.c: Likewise.
7447	* tests/xet_robust_list.c: Likewise.
7448	* tests/xetpgid.c: Likewise.
7449	* tests/xetpriority.c: Likewise.
7450	* tests/xettimeofday.c: Likewise.
7451
74522016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7453
7454	ia64: replace SYS_clone2 with __NR_clone2.
7455	Migrate to __NR_* the last user of SYS_* macros provided
7456	by <sys/syscall.h>.
7457
7458	* clone.c [IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Replace
7459	SYS_clone2 with __NR_clone2.
7460
74612016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7462
7463	Make sure that tcp->s_ent and tcp->s_prev_ent do not point to freed memory
7464	This complements commit v4.13-33-g60d7ec8.
7465
7466	* syscall.c (sysent_buf): New structure.
7467	(free_sysent_buf): New function.
7468	(get_scno): Use them.
7469
74702016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7471
7472	file.c: move definitions of struct stat32 to separate files.
7473	* linux/aarch64/stat32.h: New file.
7474	* linux/powerpc64/stat32.h: Likewise.
7475	* linux/sparc64/stat32.h: Likewise.
7476	* linux/tile/stat32.h: Likewise.
7477	* linux/x32/stat32.h: Likewise.
7478	* linux/x86_64/stat32.h: Likewise.
7479	* Makefile.am (EXTRA_DIST): Add them.
7480	* file.c [SUPPORTED_PERSONALITIES > 1]: Remove arch specific definitions
7481	of struct stat32, include "stat32.h" instead.
7482
74832016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7484
7485	sparc, sparc64: remove obsolete code.
7486	Remove remains of solaris personality support.
7487	This complements commit v4.10-45-gdf4dd8b.
7488
7489	* file.c [SPARC || SPARC64]: Remove the code related to struct solstat.
7490	(printstat, printoldstat) [SPARC || SPARC64]: Remove.
7491
74922016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7493
7494	sparc64: fix decoding of stat family syscalls.
7495	This complements commit v4.13-28-gaebfe83.
7496
7497	* file.c [SPARC64]: Change STAT32_PERSONALITY to 1.
7498
74992016-08-09  Dmitry V. Levin  <ldv@altlinux.org>
7500
7501	Fix decoding of invalid syscalls mapped to indirect subcalls.
7502	When the syscall number returned by arch_get_scno is a mapped indirect
7503	subcall (i.e. mapped subcall of socketcall or ipc syscall), do not
7504	mistakenly treat it as a valid indirect subcall.
7505
7506	* defs.h (SCNO_IS_VALID): Treat scno with TRACE_INDIRECT_SUBCALL flag
7507	as invalid.
7508	* syscall.c (syscall_name): Do no shuffle scno.
7509	(trace_syscall_entering, trace_syscall_exiting): Use
7510	tcp->s_ent->sys_name instead of syscall_name.
7511	(get_scno): In case of invalid syscall, allocate a dynamic struct sysent
7512	containing an appropriate .sys_name.
7513	* tests/nsyscalls.c (main) [SYS_socket_subcall]: Check decoding
7514	of direct syscall number SYS_socket_subcall+1.
7515	(main) [SYS_ipc_subcall]: Check decoding of direct syscall number
7516	SYS_ipc_subcall+1.
7517
75182016-08-08  Dmitry V. Levin  <ldv@altlinux.org>
7519
7520	linux/subcall.h: remove redundant definitions.
7521	* linux/subcall.h: Remove definitions of non-existent socket
7522	and ipc subcalls.
7523
7524	defs.h: simplify SUPPORTED_PERSONALITIES definition.
7525	* defs.h: Group definition of SUPPORTED_PERSONALITIES by value.
7526
75272016-08-08  Dmitry V. Levin  <ldv@altlinux.org>
7528
7529	defs.h: simplify PERSONALITY1_WORDSIZE definition.
7530	Move definition of PERSONALITY1_WORDSIZE macro outside arch specific
7531	ifdefs.
7532
7533	* defs.h [SPARC64 || X86_64 || X32 || AARCH64 || POWERPC64 || TILE]
7534	(PERSONALITY1_WORDSIZE): Remove.
7535	[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_WORDSIZE): Define to 4
7536	unconditionally.
7537
75382016-08-08  Dmitry V. Levin  <ldv@altlinux.org>
7539
7540	defs.h: simplify PERSONALITY0_WORDSIZE definition.
7541	Move definition of PERSONALITY0_WORDSIZE macro outside arch specific
7542	ifdefs.
7543
7544	* defs.h (PERSONALITY0_WORDSIZE): Define to SIZEOF_LONG unconditionally.
7545
75462016-08-08  Dmitry V. Levin  <ldv@altlinux.org>
7547
7548	sparc64: swap personality numbers.
7549	Fix inconsistency between syscall and ioctl entries on sparc64.
7550	Make layout of personalities on sparc64 the same as on other
7551	architectures that support two personalities.
7552
7553	* defs.h [SPARC64] (PERSONALITY0_WORDSIZE): Change to 8.
7554	[SPARC64] (PERSONALITY1_WORDSIZE): Change to 4.
7555	* linux/sparc64/get_scno.c (arch_get_scno): Swap personality numbers.
7556	* linux/sparc64/ioctls_arch1.h: Rename to ioctls_arch0.h.
7557	* linux/sparc64/ioctls_arch0.h: Rename to ioctls_arch1.h.
7558	* linux/sparc64/ioctls_inc0.h: Rename to ioctls_inc1.h.
7559	* linux/sparc64/ioctls_inc1.h: Rename to ioctls_inc0.h.
7560
75612016-08-08  Dmitry V. Levin  <ldv@altlinux.org>
7562
7563	defs.h: cleanup personality specific macro definitions.
7564	Move the code that defines PERSONALITY[12]_INCLUDE_FUNCS,
7565	PERSONALITY[12]_INCLUDE_PRINTERS_DECLS,
7566	PERSONALITY[12]_INCLUDE_PRINTERS_DEFS, and MPERS_{m,mx}32_IOCTL_MACROS
7567	macros outside arch specific ifdefs.
7568
7569	* defs.h [SPARC] (PERSONALITY0_WORDSIZE): Remove.
7570	[SPARC64 && HAVE_M32_MPERS]: Remove.
7571	[X86_64 && HAVE_M32_MPERS]: Remove.
7572	[X86_64 && HAVE_MX32_MPERS]: Remove.
7573	[X32 && HAVE_M32_MPERS]: Remove.
7574	[AARCH64 && HAVE_M32_MPERS]: Remove.
7575	[POWERPC64 && HAVE_M32_MPERS]: Remove.
7576	[TILE && HAVE_M32_MPERS]: Remove.
7577	(PERSONALITY0_INCLUDE_PRINTERS_DECLS,
7578	PERSONALITY0_INCLUDE_PRINTERS_DEFS): Define unconditionally.
7579	[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS]
7580	(PERSONALITY1_INCLUDE_PRINTERS_DECLS,
7581	PERSONALITY1_INCLUDE_PRINTERS_DEFS, PERSONALITY1_INCLUDE_FUNCS,
7582	MPERS_m32_IOCTL_MACROS): Define for
7583	[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS] case.
7584	(PERSONALITY2_INCLUDE_PRINTERS_DECLS,
7585	PERSONALITY2_INCLUDE_PRINTERS_DEFS, PERSONALITY2_INCLUDE_FUNCS,
7586	MPERS_mx32_IOCTL_MACROS): Define for
7587	[SUPPORTED_PERSONALITIES > 2 && HAVE_MX32_MPERS] case.
7588
75892016-08-07  Dmitry V. Levin  <ldv@altlinux.org>
7590
7591	Change #include guard trailing part comments.
7592	* defs.h: Change comment of the trailing part of #include guard.
7593	* flock.h: Likewise.
7594	* gcc_compat.h: Likewise.
7595	* ipc_defs.h: Likewise.
7596	* kernel_types.h: Likewise.
7597	* mpers_type.h: Likewise.
7598	* msghdr.h: Likewise.
7599	* printsiginfo.h: Likewise.
7600	* ptrace.h: Likewise.
7601	* regs.h: Likewise.
7602	* seccomp_fprog.h: Likewise.
7603	* sigevent.h: Likewise.
7604	* statfs.h: Likewise.
7605	* xlat.h: Likewise.
7606
76072016-08-08  Eugene Syromyatnikov  <evgsyr@gmail.com>
7608
7609	Unify usage of #include guards.
7610	This commit is an attempt to unify usage of include guards (in top-level
7611	headers, at least).  As a side note, different files with *.h extension
7612	have different semantics: for example, printargs.h is included multiple
7613	times in order to generate slightly varying code depending on values of
7614	macro definitions - maybe it's better to change extension of such files
7615	to something like *.inc.
7616
7617	* defs.h: Add #include guard.
7618	* flock.h: Likewise.
7619	* ipc_defs.h: Likewise.
7620	* mpers_type.h: Likewise.
7621	* printsiginfo.h: Likewise.
7622	* ptrace.h: Likewise.
7623	* regs.h: Likewise.
7624	* seccomp_fprog.h: Likewise.
7625	* gcc_compat.h: Rename the macro used for #include guard.
7626	* msghdr.h: Likewise.
7627	* sigevent.h: Likewise.
7628	* kernel_types.h: Comment the trailing part of #include guard.
7629	* xlat.h: Add missing macro definition for #include guard.
7630
76312016-08-06  Dmitry V. Levin  <ldv@altlinux.org>
7632
7633	tests: add #include guards.
7634	* tests/tests.h: Add #include guard.
7635
76362016-08-05  Dmitry V. Levin  <ldv@altlinux.org>
7637
7638	linux: add #include guards.
7639	* linux/dummy.h: Add #include guard.
7640	* linux/inet_diag.h: Likewise.
7641	* linux/netlink_diag.h: Likewise.
7642	* linux/sock_diag.h: Likewise.
7643	* linux/syscall.h: Likewise.
7644	* linux/unix_diag.h: Likewise.
7645
76462016-08-04  Dmitry V. Levin  <ldv@altlinux.org>
7647
7648	tests/umode_t.c: guard against libc printf format errors.
7649	* tests/umode_t.c (test_syscall): Use different printf format specifiers
7650	to detect libc printf format errors.
7651
76522016-08-04  Dmitry V. Levin  <ldv@altlinux.org>
7653
7654	travis: use a suitable musl revision.
7655	There seems to be no readily available binary packages of musl that are
7656	sufficiently up to date to be used to build and test strace, so prepare
7657	a suitable musl from source.
7658
7659	* travis-install.sh (musl-gcc): Do not add an extra repository,
7660	do not install musl-tools and linux-musl-dev packages.
7661	Download, build, and install a suitable musl revision instead.
7662
76632016-08-03  Dmitry V. Levin  <ldv@altlinux.org>
7664
7665	Fix printing of mode_t, umode_t, and umask types.
7666	Print numeric umode_t type using %#03ho format.
7667	Print return value of umask syscall using %#03lo format.
7668	When printing symbolic mode_t type, always print lower 9 bits,
7669	and print the numeric part using %#03o format.
7670
7671	* defs.h (sprintmode): Remove.
7672	(print_symbolic_mode_t, print_numeric_umode_t,
7673	print_numeric_long_umask): New prototypes.
7674	* printmode.c (sprintmode): Remove.
7675	(print_symbolic_mode_t, print_numeric_umode_t,
7676	print_numeric_long_umask): New functions.
7677	* chmod.c (decode_chmod): Use print_numeric_umode_t.
7678	* ipc_msg.c (SYS_FUNC(msgget)): Likewise.
7679	* ipc_msgctl.c (print_msqid_ds): Likewise.
7680	* ipc_sem.c (SYS_FUNC(semget)): Likewise.
7681	* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
7682	* ipc_shmctl.c (print_shmid_ds): Likewise.
7683	* mq.c (SYS_FUNC(mq_open)): Likewise.
7684	* open.c (decode_open, SYS_FUNC(creat)): Likewise.
7685	* umask.c (SYS_FUNC(umask)): Likewise.
7686	* mknod.c (decode_mknod): Use print_symbolic_mode_t.
7687	* printstat.h (DO_PRINTSTAT): Likewise.
7688	* syscall.c (trace_syscall_exiting): Use print_numeric_long_umask.
7689	* tests/umode_t.c: New file.
7690	* tests/Makefile.am (EXTRA_DIST): Add it.
7691	* tests/creat.c: Rewrite as a thin wrapper around umode_t.c
7692	* tests/mkdir.c: Likewise.
7693	* tests/mkdirat.c: Likewise.
7694	* tests/mknod.c: Extend test coverage of mknod syscall.
7695	* tests/mknodat.c: Extend test coverage of mknodat syscall.
7696	* tests/umask.c: Extend test coverage of umask syscall.
7697	* tests/creat.test: Update the value specified for strace -a parameter.
7698	* tests/mkdir.test: Likewise.
7699	* tests/mkdirat.test: Likewise.
7700	* tests/mknodat.test: Likewise.
7701
77022016-08-02  Dmitry V. Levin  <ldv@altlinux.org>
7703
7704	tests: simplify attach-f-p.test.
7705	* tests/attach-f-p.c Simplify communications between threads
7706	by replacing per-thread timers with pipes.
7707	* tests/attach-f-p.test: Do not ignore signals.
7708
7709	tests: cleanup attach-p-cmd.test.
7710	* tests/attach-p-cmd-cmd.c (main): Cleanup expected output.
7711	* tests/attach-p-cmd-p.c (main): Print expected output.
7712	* tests/attach-p-cmd.test: Do not print expected output.
7713
7714	ip_mreq.test: rewrite from match_grep to match_diff.
7715	* tests/ip_mreq.c (main): Print expected output.
7716	* tests/ip_mreq.test: Use run_strace_match_diff.
7717	* tests/ip_mreq.expected: Remove.
7718	* tests/Makefile.am (EXTRA_DIST): Remove it.
7719
7720	fanotify_mark.test: rewrite from match_grep to match_diff.
7721	* tests/fanotify_mark.c (main): Print expected output.
7722	* tests/fanotify_mark.test: Use run_strace_match_diff.
7723	* tests/fanotify_mark.expected: Remove.
7724	* tests/Makefile.am (EXTRA_DIST): Remove it.
7725
7726	signalfd4.test: rewrite from match_grep to match_diff.
7727	* tests/signalfd4.c (get_sigset_size): New function.
7728	(main): Use it.  Print expected output.
7729	* tests/signalfd4.test: Use run_strace_match_diff.
7730	* tests/signalfd4.expected: Remove.
7731	* tests/Makefile.am (EXTRA_DIST): Remove it.
7732
77332016-07-31  Dmitry V. Levin  <ldv@altlinux.org>
7734
7735	tests: rename signalfd.test to signalfd4.test.
7736	* tests/signalfd.c: Rename to signalfd4.c.
7737	* tests/signalfd.test: Rename to signalfd4.test.
7738	* tests/signalfd.expected: Rename to signalfd4.expected.
7739	* tests/.gitignore: Replace signalfd with signalfd4.
7740	* tests/Makefile.am (check_PROGRAMS): Likewise.
7741	(DECODER_TESTS): Replace signalfd.test with signalfd4.test.
7742	(EXTRA_DIST): Replace signalfd.expected with signalfd4.expected.
7743
77442016-07-30  Dmitry V. Levin  <ldv@altlinux.org>
7745
7746	memfd_create.test: rewrite from match_grep to match_diff.
7747	* tests/memfd_create.c (main): Print expected output.
7748	* tests/memfd_create.test: Use run_strace_match_diff.
7749	* tests/memfd_create.expected: Remove.
7750	* tests/Makefile.am (EXTRA_DIST): Remove it.
7751
77522016-07-29  Dmitry V. Levin  <ldv@altlinux.org>
7753
7754	Set exit status to 1 if strace has not traced any processes.
7755	* strace.c (main): Initialize exit_code with 1 when no processes
7756	has been attached.
7757	* strace.1: Document it.
7758	* NEWS: Mention this change.
7759
7760	Attach to the target process before attempting to attach to its siblings
7761	* strace.c (attach_tcb): Attach to tcp->pid first.
7762
7763	Report the name of ptrace command when ptrace_attach_or_seize fails.
7764	* strace.c (ptrace_attach_cmd): New variable.
7765	(ptrace_attach_or_seize): Save last ptrace command's name
7766	to ptrace_attach_cmd.
7767	(attach_tcb, startup_child): Use it in error diagnostics.
7768
7769	strace.c: refactor startup_attach.
7770	* strace.c (startup_attach): Move the inner part of the big loop
7771	over tcbtab elements ...
7772	(attach_tcb): ... to this new function.
7773
7774	startup_attach: do not use atoi.
7775	* strace.c (startup_attach): Replace atoi with string_to_uint.
7776
77772016-07-28  Dmitry V. Levin  <ldv@altlinux.org>
7778
7779	Do not enable mpers runtime checks if mpers is not enabled.
7780	* m4/mpers.m4 (HAVE_RUNTIME): Enable iff both mpers and runtime
7781	work properly.
7782
77832016-07-28  Dmitry V. Levin  <ldv@altlinux.org>
7784
7785	linux/dummy_check.sh: remove obsolete script.
7786	Starting with commit v4.10-62-ga0bd374, function prototypes
7787	of syscall parsers are generated at build time.
7788
7789	* linux/dummy_check.sh: Remove.
7790
77912016-07-28  Dmitry V. Levin  <ldv@altlinux.org>
7792
7793	generate_xlat_in.sh: remove obsolete script.
7794	This script has been created by commit v4.8-180-g0ed617b
7795	for the one-shot job of automatic convertion of xlat structures
7796	from *.c files to xlat/*.in files.
7797
7798	* generate_xlat_in.sh: Remove.
7799
78002016-07-28  Dmitry V. Levin  <ldv@altlinux.org>
7801
7802	tests: use terse notation in designated initializers where appropriate.
7803	* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Initialize
7804	struct btrfs_ioctl_dev_replace_args using terse notation.
7805	* tests/clock_nanosleep.c (main): Initialize struct timespec
7806	using terse notation.
7807	* tests/nanosleep.c (main): Likewise.
7808
78092016-07-28  Dmitry V. Levin  <ldv@altlinux.org>
7810
7811	Consistently use extended regular expressions where appropriate.
7812	When grep or sed is used with basic regular expressions containing
7813	'(', ')', '{', '}', '|', '?', and '+' special characters, convert them
7814	to extended regular expressions for better portability and readability.
7815
7816	* generate_mpers_am.sh: Convert grep and sed BREs to EREs.
7817	* Makefile.am (ioctl_redefs%.h, m%_type_defs.h, m%_funcs.h,
7818	mpers_printer_decl_pattern, printers.h, %_printer_decls.h,
7819	%_printer_defs.h): Convert sed BREs to EREs.
7820	* generate_sen.sh: Likewise.
7821	* linux/mips/genstub.sh: Likewise.
7822	* make-dsc: Likewise.
7823	* mpers.sh: Likewise.
7824	* xlat/gen.sh: Likewise.
7825	* tests/Makefile.am (ksysent.h): Likewise.
7826	* tests/ksysent.sed: Likewise.
7827	* tests/pc.test: Likewise.
7828	* tests/strace-S.test: Likewise.
7829	* tests/strace-V.test: Likewise.
7830	* tests/strace-k.test: Likewise.
7831
78322016-07-28  Dmitry V. Levin  <ldv@altlinux.org>
7833
7834	tests: fix extended regexps.
7835	* tests/adjtimex.c (main): Consistently quote curly braces
7836	in expected output.
7837	* tests/uio.expected: Likewise.
7838
78392016-07-27  Dmitry V. Levin  <ldv@altlinux.org>
7840
7841	Post-release administrivia.
7842	* NEWS: Add header line for the next release.
7843	* debian/changelog.in: Add a changelog entry for 4.13-1.
7844	* strace.spec.in: Likewise.
7845
78462016-07-26  Dmitry V. Levin  <ldv@altlinux.org>
7847
7848	Prepare for 4.13 release.
7849	* NEWS: Update for 4.13 release.
7850
7851	Fix one more code pattern that might break gcc strict aliasing rules.
7852	* btrfs.c (btrfs_ioctl): Add one more expicit cast to "void *",
7853	to avoid breaking strict-aliasing rules reported by some gcc compilers.
7854	* syscall.c (decode_socket_subcall): Likewise.
7855	* util.c (next_set_bit): Likewise.
7856	* tests/btrfs.c (btrfs_test_send_ioctl): Likewise.
7857
7858	Fix casts of ptrace's third argument.
7859	* strace.c (maybe_allocate_tcb): Replace "(char *) 0" with NULL
7860	as ptrace's third argument.
7861	* linux/sparc64/get_scno.c (arch_get_scno): Cast third argument
7862	of ptrace to "void *'.
7863	* syscall.c (get_regs): Likewise.
7864	* upeek.c (upeek): Likewise.
7865	* util.c (umoven): Likewise.
7866
7867	tests/btrfs.c: do not include the same header file twice.
7868	* tests/btrfs.c: Do not include <sys/fcntl.h>, <fcntl.h> is enough.
7869
7870	tests: fix accept4.test on systems that lack SOCK_CLOEXEC definition.
7871	* tests/accept4.c: Check that O_CLOEXEC is defined.  Use O_CLOEXEC
7872	instead of SOCK_CLOEXEC.
7873
78742016-07-26  Dmitry V. Levin  <ldv@altlinux.org>
7875
7876	tests: fix vhangup.test.
7877	* tests/vhangup.c (main): Fix expected output for the case when
7878	the calling process has CAP_SYS_TTY_CONFIG capability.
7879
7880	Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>
7881
78822016-07-26  Dmitry V. Levin  <ldv@altlinux.org>
7883
7884	tests: fix chown.test.
7885	* tests/chown.test: Fix the value specified for strace -a parameter.
7886
7887	Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>
7888
78892016-07-25  Dmitry V. Levin  <ldv@altlinux.org>
7890
7891	x32: fix syscall entries for x86_64 variants of io_setup and io_submit.
7892	* linux/x32/syscallent.h (64:io_setup, 64:io_submit): Change handler
7893	to printargs.
7894
7895	tests/ipc.c: fix typo.
7896
78972016-07-24  Dmitry V. Levin  <ldv@altlinux.org>
7898
7899	NEWS: Prepare for 4.13 release.
7900
79012016-07-23  Dmitry V. Levin  <ldv@altlinux.org>
7902
7903	debian: add gcc-multilib to Build-Depends for relevant architectures.
7904	* debian/control (Build-Depends) [amd64, ppc64, sparc64, x32]:
7905	Add gcc-multilib to enable multiple personalities support.
7906
79072016-07-22  Dmitry V. Levin  <ldv@altlinux.org>
7908
7909	tests: check decoding of ipc syscall.
7910	* tests/ipc.c: New file.
7911	* tests/ipc.test: New test.
7912	* tests/.gitignore: Add ipc.
7913	* tests/Makefile.am (check_PROGRAMS): Likewise.
7914	(DECODER_TESTS): Add ipc.test.
7915
7916	Fix corner cases of ipc syscall decoding.
7917	* xlat/ipccalls.in: New file.
7918	* ipc.c: New file.
7919	* Makefile.am (libstrace_a_SOURCES): Add it.
7920	* linux/dummy.h (sys_ipc): Remove stub alias.
7921	* syscall.c (decode_ipc_subcall): Treat 1st argument of ipc syscall
7922	as "unsigned int".
7923	[S390 || S390X]: Skip ipc cubcalls that have non-zero version.
7924	[SPARC64]: Likewise, for the native personality.
7925	Save ipc cubcall version for later use by specific ipc parsers.
7926	* ipc_msg.c (SYS_FUNC(msgrcv)): Handle non-zero ipc subcall version.
7927	[SPARC64]: Handle non-ipc_kludge case for the native personality.
7928	* linux/subcall.h (msgrcv): Change nargs from 4 to 5.
7929	* linux/s390/syscallent.h (ipc): Change nargs from 6 to 5.
7930	* linux/s390x/syscallent.h (ipc): Likewise.
7931
79322016-07-21  Dmitry V. Levin  <ldv@altlinux.org>
7933
7934	tests: skip netlink_protocol.test on old systems.
7935	* tests/netlink_protocol.c: Check that HAVE_SYS_XATTR_H is defined.
7936	Include <stdlib.h> and <sys/xattr.h>.
7937	(main): Check that system.sockprotoname attribute is supported.
7938
7939	Do not print too many arguments of socketcall syscall.
7940	* socketcall.c (SYS_FUNC(socketcall)): Print just "call" and "args"
7941	syscall arguments.
7942	* tests/socketcall.c (test_socketcall): Update expected output.
7943	* tests/socketcall.test: Likewise.
7944
79452016-07-20  Dmitry V. Levin  <ldv@altlinux.org>
7946
7947	tests/nsyscalls.c: change the type of syscall arguments to kernel_ulong_t
7948	As most syscalls on x32 and mips n32 are actually 64-bit,
7949	check that 64-bit syscall arguments are decoded properly.
7950
7951	This also workarounds x32 gcc sign extension bug
7952	reported by Eugene Syromyatnikov at
7953	https://sourceforge.net/p/strace/mailman/message/35150860/
7954
7955	* tests/nsyscalls.c: Include "kernel_types.h".
7956	(main): Change the type of syscall arguments to kernel_ulong_t.
7957
79582016-07-20  Dmitry V. Levin  <ldv@altlinux.org>
7959
7960	x32, mips n32: make printargs print full 64-bit syscall arguments.
7961	As most of x32 syscalls are regular x86_64 syscalls, they should be
7962	printed by default as 64-bit syscalls, and syscall parsers at their
7963	discretion might print syscalls differently.  This is already
7964	implemented in 64-bit strace tracing x32 personality processes,
7965	and now x32 strace will also behave this way.
7966
7967	Similar reasoning applies to mips n32.
7968
7969	* util.c (printargs) [HAVE_STRUCT_TCB_EXT_ARG]: Print syscall arguments
7970	from ext_arg array using %llx format.
7971
79722016-07-20  Dmitry V. Levin  <ldv@altlinux.org>
7973
7974	tests: check decoding of socketcall syscall.
7975	* tests/socketcall.c: New file.
7976	* tests/socketcall.test: New test.
7977	* tests/.gitignore: Add socketcall.
7978	* tests/Makefile.am (check_PROGRAMS): Likewise.
7979	(DECODER_TESTS): Add socketcall.test.
7980
7981	Fix corner cases of socketcall syscall.
7982	* xlat/socketcalls.in: New file.
7983	* socketcall.c: New file.
7984	* Makefile.am (libstrace_a_SOURCES): Add it.
7985	* linux/dummy.h (sys_socketcall): Remove stub alias.
7986	* syscall.c (decode_socket_subcall): Treat 1st argument of socketcall
7987	as "int".  Do not substitute syscall until all socketcall arguments
7988	have been fetched successfully.
7989
79902016-07-19  Dmitry V. Levin  <ldv@altlinux.org>
7991
7992	tests: check decoding and dumping of send and recv syscalls.
7993	* tests/unix-pair-send-recv.c: New file.
7994	* tests/unix-pair-send-recv.expected: Likewise.
7995	* tests/unix-pair-send-recv.test: New test.
7996	* tests/.gitignore: Add unix-pair-send-recv.
7997	* tests/Makefile.am (check_PROGRAMS): Likewise.
7998	(DECODER_TESTS): Add unix-pair-send-recv.test.
7999	(EXTRA_DIST): Add unix-pair-send-recv.expected.
8000
8001	tests: rename unix-pair-send-recv to unix-pair-sendto-recvfrom.
8002	* dumpio.expected: Rename to unix-pair-sendto-recvfrom.expected.
8003	* dumpio.test: Rename to unix-pair-sendto-recvfrom.test.
8004	* unix-pair-send-recv.c: Rename to unix-pair-sendto-recvfrom.c
8005	* .gitignore: Rename unix-pair-send-recv to unix-pair-sendto-recvfrom.
8006	* Makefile.am (check_PROGRAMS): Likewise.
8007	(DECODER_TESTS): Add unix-pair-sendto-recvfrom.test.
8008	(MISC_TESTS): Remove dumpio.test.
8009	(EXTRA_DIST): Rename dumpio.expected
8010	to unix-pair-sendto-recvfrom.expected.
8011
8012	tests: check decoding of shutdown syscall.
8013	* tests/shutdown.c: New file.
8014	* tests/shutdown.test: New test.
8015	* tests/.gitignore: Add shutdown.
8016	* tests/Makefile.am (check_PROGRAMS): Likewise.
8017	(DECODER_TESTS): Add shutdown.test.
8018
8019	xlat/shutdown_modes.in: convert to modern syntax.
8020	* xlat/shutdown_modes.in: Replace open-coded xlat table with a list
8021	of constants.
8022
8023	tests: check silent decoding of sendmmsg and recvmmsg syscalls.
8024	* tests/mmsg-silent.c: New file.
8025	* tests/mmsg-silent.test: New test.
8026	* tests/.gitignore: Add mmsg-silent.
8027	* tests/Makefile.am (check_PROGRAMS): Likewise.
8028	(DECODER_TESTS): Add mmsg-silent.test.
8029
8030	Print unsent messages of failed sendmmsg syscall.
8031	* mmsghdr.c (decode_mmsgvec): Clear syserror for the time of printing
8032	struct mmsghdr array in !use_msg_len case.
8033	(SYS_FUNC(sendmmsg)): As failed sendmmsg syscall does not
8034	set msg_len fields, tell this to decode_mmsgvec.
8035	* tests/mmsg_name.c (test_mmsg_name): Check it.
8036
8037	Print unsent messages of sendmmsg syscall.
8038	* defs.h (decode_mmsgvec): Add int argument.
8039	* mmsghdr.c (print_struct_mmsghdr_config): Add msg_len_vlen field.
8040	(print_struct_mmsghdr): Print struct mmsghdr.msg_len only for
8041	msg_len_vlen first elements of struct mmsghdr array.
8042	(decode_mmsgvec): Add msg_len_vlen argument.
8043	(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Pass to decode_mmsgvec
8044	the number of elements of struct mmsghdr array that contain meaningful
8045	struct mmsghdr.msg_len.
8046	* tests/mmsg_name.c (test_mmsg_name): Check it.
8047
8048	tests: check verbose decoding of msg_name* fields of struct mmsghdr array
8049	* tests/mmsg_name-v.c: New file.
8050	* tests/mmsg_name-v.test: New test.
8051	* tests/.gitignore: Add mmsg_name-v.
8052	* tests/Makefile.am (check_PROGRAMS): Likewise.
8053	(DECODER_TESTS): Add mmsg_name-v.test.
8054
8055	tests: check decoding of msg_name* fields of struct mmsghdr array.
8056	* tests/mmsg_name.c: New file.
8057	* tests/mmsg_name.test: New test.
8058	* tests/.gitignore: Add mmsg_name.
8059	* tests/Makefile.am (check_PROGRAMS): Likewise.
8060	(DECODER_TESTS): Add mmsg_name.test.
8061
80622016-07-19  Dmitry V. Levin  <ldv@altlinux.org>
8063
8064	Fix decoding of msg_name* fields of recvmmsg syscall's msghdr array argument
8065	As msg_namelen fields of recvmmsg syscall's struct msghdr array have
8066	the same read-write semantics as struct msghdr argument of recvmsg
8067	syscall, parser of recvmmsg syscall needs a similar fix.
8068
8069	* mmsghdr.c (print_struct_mmsghdr): Increment p_user_msg_namelen field.
8070	(mmsgvec_data): New structure.
8071	(free_mmsgvec_data, save_mmsgvec_namelen): New functions.
8072	(decode_mmsgvec): Take into account the data saved
8073	by save_mmsgvec_namelen function.
8074	(SYS_FUNC(recvmmsg)): Use save_mmsgvec_namelen.
8075
80762016-07-19  Dmitry V. Levin  <ldv@altlinux.org>
8077
8078	mmsghdr.c: rewrite decode_mmsgvec using print_array.
8079	* fetch_struct_mmsghdr.c (sizeof_struct_mmsghdr): New mpers printer.
8080	* mmsghdr.c: Include <limits.h>.
8081	(print_struct_mmsghdr_config): New structure.
8082	(fetch_struct_mmsghdr_or_printaddr, print_struct_mmsghdr): New functions.
8083	(decode_mmsgvec): Rewrite using them and print_array.
8084
8085	tests: check decoding of timeout argument of recvmmsg syscall.
8086	* tests/recvmmsg-timeout.c: New file.
8087	* tests/recvmmsg-timeout.test: New test.
8088	* tests/.gitignore: Add recvmmsg-timeout.
8089	* tests/Makefile.am (check_PROGRAMS): Likewise.
8090	(DECODER_TESTS): Add recvmmsg-timeout.test.
8091
8092	Fix printing of remaining timeout of recvmmsg syscall.
8093	* mmsghdr.c (SYS_FUNC(recvmmsg)): Do not print remaining timeout
8094	when the 5th syscall argument is NULL.
8095	* tests/mmsg.c (main): Update expected output.
8096
8097	Remove configure checks for recvmmsg and sendmmsg.
8098	* configure.ac (AC_CHECK_FUNCS): Remove recvmmsg and sendmmsg.
8099
8100	tests: add recv_mmsg and send_mmsg functions to libtests.
8101	* tests/tests.h (recv_mmsg, send_mmsg): New prototype.
8102	* tests/libmmsg.c: New file.
8103	* tests/Makefile.am (libtests_a_SOURCES): Add it.
8104	* tests/mmsg.c Do not check for __NR_sendmmsg, __NR_recvmmsg,
8105	HAVE_SENDMMSG, and HAVE_RECVMMSG.  Do not include unused headers.
8106	(recv_mmsg, send_mmsg): Remove.
8107
8108	tests: add socketcall function to libtests.
8109	* tests/tests.h (socketcall): New prototype.
8110	* tests/libsocketcall.c: New file.
8111	* tests/Makefile.am (libtests_a_SOURCES): Add it.
8112
81132016-07-18  Dmitry V. Levin  <ldv@altlinux.org>
8114
8115	Use IOV_MAX instead of UIO_MAXIOV.
8116	IOV_MAX appears to be more portable than UIO_MAXIOV.
8117
8118	* msghdr.c: Include <limits.h>. Remove fallback defintion of UIO_MAXIOV.
8119	(get_optmem_max): Replace UIO_MAXIOV with IOV_MAX.
8120	* tests/msg_control.c: Likewise.
8121
81222016-07-18  Dmitry V. Levin  <ldv@altlinux.org>
8123
8124	Unabuse struct tcb.auxstr.
8125	As we've got a proper mechanism that parsers can use for storing private
8126	data between entering and exiting stages, all cases of struct tcb.auxstr
8127	abuse should go.
8128
8129	* btrfs.c (btrfs_ioctl): Use set_tcb_priv_ulong and get_tcb_priv_ulong
8130	instead of abusing tcp->auxstr.
8131	* file_handle.c (SYS_FUNC(name_to_handle_at)): Likewise.
8132	* msghdr.c (SYS_FUNC(recvmsg)): Likewise.
8133	* net.c (decode_sockname, SYS_FUNC(recvfrom)): Likewise.
8134	* v4l2.c (print_v4l2_queryctrl): Likewise.
8135
81362016-07-18  Dmitry V. Levin  <ldv@altlinux.org>
8137
8138	Fix race condition in decoding timeout argument of recvmmsg syscall.
8139	As the value returned by sprint_timespec points to a static area and may
8140	be overwritten by subsequent calls to sprint_timespec, it is not safe to
8141	save this value on entering syscall and use it later on exiting.
8142
8143	* mmsghdr.c (SYS_FUNC(recvmmsg)): On entering syscall, copy the value
8144	returned by sprint_timespec to a dynamically allocated memory, and save
8145	the pointer using set_tcb_priv_data.  On exiting, restore it using
8146	get_tcb_priv_data.
8147
81482016-07-18  Dmitry V. Levin  <ldv@altlinux.org>
8149
8150	Fix race condition in decoding rt_sigtimedwait's timeout argument.
8151	As the value returned by sprint_timespec points to a static area and may
8152	be overwritten by subsequent calls to sprint_timespec, it is not safe to
8153	save this value on entering syscall and use it later on exiting.
8154
8155	* signal.c (SYS_FUNC(rt_sigtimedwait)): On entering syscall, copy the
8156	value returned by sprint_timespec to a dynamically allocated memory,
8157	and save the pointer using set_tcb_priv_data.  On exiting, restore it
8158	using get_tcb_priv_data.
8159
81602016-07-18  Patrik Jakobsson  <patrik.jakobsson@linux.intel.com>
8161
8162	Add private data field to struct tcb.
8163	We need to be able to store private data in the struct tcb across it's
8164	lifetime.  To ensure proper deallocation of this stored data a callback
8165	must be provided along with the data.  The callback is executed
8166	automatically on exiting syscall, and when the life of the tcb ends.
8167
8168	* defs.h (struct tcb): Add _priv_data and _free_priv_data fields.
8169	(get_tcb_priv_data, set_tcb_priv_data, free_tcb_priv_data):
8170	New prototypes.
8171	(get_tcb_priv_ulong, set_tcb_priv_ulong): New static inline functions.
8172	* strace.c (get_tcb_priv_data, set_tcb_priv_data, free_tcb_priv_data):
8173	New functions.
8174	(droptcb): Call free_tcb_priv_data.
8175	* syscall.c (trace_syscall_exiting): Call free_tcb_priv_data
8176	when clearing TCB_INSYSCALL flag.
8177
81782016-07-18  Dmitry V. Levin  <ldv@altlinux.org>
8179
8180	net.c: move parsers of sendmsg and recvmsg syscalls to msghdr.c.
8181	* defs.h (fetch_msghdr_namelen, decode_msghdr): Remove.
8182	* net.c (SYS_FUNC(sendmsg), SYS_FUNC(recvmsg)): Move ...
8183	* msghdr.c: ... here.
8184	(fetch_msghdr_namelen, decode_msghdr): Add static qualifier.
8185
8186	net.c: move parsers of sendmmsg and recvmmsg syscalls to mmsghdr.c.
8187	* defs.h (decode_mmsgvec): Remove.
8188	* net.c: Do not include "msghdr.h".
8189	(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Move ...
8190	* mmsghdr.c: ... here.
8191	(decode_mmsgvec): Add static qualifier.
8192
8193	msghdr.c: move all mmsghdr parsers to a separate file.
8194	* msghdr.h (print_struct_msghdr): New prototype.
8195	* msghdr.c (print_msghdr): Rename to print_struct_msghdr, remove
8196	static qualifier, all callers changed.
8197	(decode_mmsghdr, decode_mmsgvec, dumpiov_in_mmsghdr): Move to ...
8198	* mmsghdr.c: ... new file.
8199	* Makefile.am (strace_SOURCES): Add it.
8200
82012016-07-14  Dmitry V. Levin  <ldv@altlinux.org>
8202
8203	tests: disable part of msg_name test on non-glibc systems.
8204	Sadly, musl recvmsg wrapper blindly dereferences 2nd argument,
8205	so limit the affected part of the test to glibc that doesn't.
8206
8207	* tests/msg_name.c (test_msg_name) [!__GLIBC__]: Do not test
8208	with inaccessible 2nd argument.
8209
82102016-07-13  Dmitry V. Levin  <ldv@altlinux.org>
8211
8212	Print struct iovec as a regular structure.
8213	* io.c (print_iovec): Print names of iov_base and iov_len fields.
8214	* tests/aio.c (main): Update expected output.
8215	* tests/inet-cmsg.c (main): Likewise.
8216	* tests/mmsg.c (main): Likewise.
8217	* tests/msg_name.c (test_msg_name): Likewise.
8218	* tests/preadv-pwritev.c (main): Likewise.
8219	* tests/preadv2-pwritev2.c (main): Likewise.
8220	* tests/preadv.c (main): Likewise.
8221	* tests/pwritev.c (main): Likewise.
8222	* tests/readv.c (main): Likewise.
8223	* tests/recvmsg.c (main): Likewise.
8224	* tests/vmsplice.c (main): Likewise.
8225	* tests/scm_rights-fd.test: Likewise.
8226	* tests/uio.expected: Likewise.
8227
8228	tests: check decoding of msghdr.msg_name* arguments of recvmsg syscall.
8229	* tests/msg_name.c: New file.
8230	* tests/msg_name.test: New test.
8231	* tests/.gitignore: Add msg_name.
8232	* tests/Makefile.am (check_PROGRAMS): Likewise.
8233	(DECODER_TESTS): Add msg_name.test.
8234
82352016-07-13  Dmitry V. Levin  <ldv@altlinux.org>
8236
8237	Fix decoding of struct msghdr.msg_name* arguments of recvmsg syscall.
8238	As the msghdr.msg_namelen argument of recvmsg syscall has the same
8239	read-write semantics as the address length argument of recvfrom syscall,
8240	parser of recvmsg syscall needs a similar fix.
8241
8242	* defs.h (fetch_msghdr_namelen): New prototype.
8243	(decode_msghdr): Add "int *" argument.
8244	* msghdr.c (print_msghdr): Likewise.  Treat it as a pointer to struct
8245	msghdr.msg_namelen passed to the kernel.  Pass to decode_sockaddr
8246	the size of socket address actually returned by the kernel.
8247	Print both user and kernel address lengths when the value changes.
8248	(decode_msghdr, decode_mmsghdr): Add "int *" argument,
8249	forward it to print_msghdr.
8250	(decode_mmsgvec): Update decode_mmsghdr invocation.
8251	(fetch_msghdr_namelen): New function.
8252	* net.c (SYS_FUNC(sendmsg)): Update decode_msghdr invocation.
8253	(SYS_FUNC(recvmsg)): Use fetch_msghdr_namelen on entering to save
8254	struct msghdr.msg_namelen.  On exiting, pass the saved value
8255	to decode_msghdr.
8256
82572016-07-12  Dmitry V. Levin  <ldv@altlinux.org>
8258
8259	Update generic ioctl entries from linux 4.7.
8260	* linux/64/ioctls_inc.h: Update from linux v4.7 using ioctls_gen.sh.
8261	* linux/32/ioctls_inc_align32.h: Likewise.
8262	* linux/32/ioctls_inc_align64.h: Likewise.
8263
82642016-07-12  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
8265
8266	x32: update ioctl entries from linux 4.7.
8267	* linux/x32/ioctls_inc0.h: Update from linux v4.7 using ioctls_gen.sh.
8268
8269	maint: update for linux 4.7.
8270	* maint/ioctls_sym.sh: Drop obsolete workarounds for linux/btrfs.h.
8271
82722016-07-12  Dmitry V. Levin  <ldv@altlinux.org>
8273
8274	block.c: remove BLKDAXGET support.
8275	BLKDAXGET was removed by linux kernel commit v4.7-rc1~78^2^2~4.
8276
8277	* block.c: Do not define BLKDAXGET.
8278	(block_ioctl): Remove BLKDAXGET support.
8279	* tests/ioctl_block.c (main): Remove BLKDAXGET test.
8280
82812016-07-12  Dmitry V. Levin  <ldv@altlinux.org>
8282
8283	Fix printing of socklen argument of bind and sendto syscalls.
8284	* net.c (SYS_FUNC(bind)): Print 3rd syscall argument using %d format.
8285	(SYS_FUNC(sendto)): Print 6th syscall argument using %d format.
8286
8287	tests: check decoding of sockaddr related arguments of recvfrom syscall.
8288	* configure.ac (AC_CHECK_FUNCS): Add recvfrom.
8289	* tests/recvfrom.c: New file.
8290	* tests/recvfrom.test: New test.
8291	* tests/.gitignore: Add recvfrom.
8292	* tests/Makefile.am (check_PROGRAMS): Likewise.
8293	(DECODER_TESTS): Add recvfrom.test.
8294
8295	Fix decoding of sockaddr related arguments of recvfrom syscall.
8296	* net.c (SYS_FUNC(recvfrom)): Use fetch_socklen.  Save the address
8297	length passed to the kernel and print it on error.  Do not print more
8298	bytes of the socket address than actually returned by the kernel.
8299	Print both user and kernel address lengths when the returned address
8300	is truncated.
8301
8302	tests: check decoding of accept4 syscall.
8303	* configure.ac (AC_CHECK_FUNCS): Add accept4.
8304	* tests/accept4.c: New file.
8305	* tests/accept4.test: New test.
8306	* tests/.gitignore: Add accept4.
8307	* tests/Makefile.am (check_PROGRAMS): Likewise.
8308	(DECODER_TESTS): Add accept4.test.
8309
8310	tests: check decoding of accept syscall.
8311	* tests/accept.c: New file.
8312	* tests/accept.test: New test.
8313	* tests/.gitignore: Add accept.
8314	* tests/Makefile.am (check_PROGRAMS): Likewise.
8315	(DECODER_TESTS): Add accept.test.
8316
8317	tests: check decoding of getpeername syscall.
8318	* tests/getpeername.c: New file.
8319	* tests/getpeername.test: New test.
8320	* tests/.gitignore: Add getpeername.
8321	* tests/Makefile.am (check_PROGRAMS): Likewise.
8322	(DECODER_TESTS): Add getpeername.test.
8323
8324	tests: check decoding of getsockname syscall.
8325	* tests/getsockname.c: New file.
8326	* tests/getsockname.test: New test.
8327	* tests/sockname.c: New file.
8328	* tests/.gitignore: Add getsockname.
8329	* tests/Makefile.am (check_PROGRAMS): Likewise.
8330	(DECODER_TESTS): Add getsockname.test.
8331	(EXTRA_DIST): Add sockname.c.
8332
8333	Print both values of changing address length in sockname family syscalls
8334	* net.c (decode_sockname): Print both user and kernel address lengths
8335	when the value changes.
8336	* tests/net-y-unix.c (main): Update expected output.
8337	* tests/net-yy-unix.c (main): Likewise.
8338	* tests/net.expected: Likewise.
8339
8340	Enhance diagnostics of address truncation in sockname family syscalls.
8341	* net.c (decode_sockname): Print both user and kernel address lengths
8342	when the returned address is truncated.
8343	* tests/sun_path.expected: Update expected output.
8344
8345	Fix decoding of getsockname, getpeername, accept, and accept4 syscalls.
8346	* net.c (fetch_socklen): New function.
8347	(decode_sockname): Use it.  On entering syscall, decode early
8348	and return RVAL_DECODED when possible.  On error, print the address
8349	length passed to the kernel.  Do not print more bytes of the socket
8350	address than actually returned by the kernel.
8351
83522016-07-11  Dmitry V. Levin  <ldv@altlinux.org>
8353
8354	Prepare parsers of sockname family syscalls for the upcoming fix.
8355	* net.c (do_sockname): Rename to decode_sockname, drop second argument,
8356	do not print sock_type_flags, return RVAL_DECODED on exiting.
8357	(SYS_FUNC(accept), SYS_FUNC(getsockname)): Use decode_sockname instead
8358	of do_sockname, take its return code into account.
8359	(SYS_FUNC(accept4)): Likewise.  Print sock_type_flags when
8360	decode_sockname returns RVAL_DECODED.
8361
83622016-07-08  Dmitry V. Levin  <ldv@altlinux.org>
8363
8364	netlink: handle multipart netlink messages.
8365	Handle multipart netlink messages made of multiple struct nlmsghdr
8366	headers with associated payload in one byte stream.
8367
8368	* netlink.c (fetch_nlmsghdr, print_nlmsghdr,
8369	decode_nlmsghdr_with_payload): New functions.
8370	(decode_netlink): Use them.
8371	* tests/netlink_parsing.c (send_query): Check them.
8372
83732016-07-07  Dmitry V. Levin  <ldv@altlinux.org>
8374
8375	tests: extend netlink protocol check.
8376	* tests/netlink_protocol.c (send_query): Check that no part
8377	of netlink message is fetched beyond the end of message.
8378	Check decoding of zero address and zero length messages.
8379	Check decoding of messages with nlmsg_len exceeding message length.
8380
83812016-07-07  Fabien Siron  <fabien.siron@epita.fr>
8382
8383	tests: check decoding of netlink protocol.
8384	* tests/netlink_protocol.test: New test.
8385	* tests/netlink_protocol.c: New file.
8386	* tests/.gitignore: Add netlink_protocol.
8387	* tests/Makefile.am (check_PROGRAMS): Likewise.
8388	(DECODER_TESTS): Add netlink_protocol.test.
8389
83902016-07-07  Fabien Siron  <fabien.siron@epita.fr>
8391
8392	Add a general netlink socket parser.
8393	Introduce a general socket netlink parser which prints the header and
8394	a string for the remaining part of the buffer.  It doesn't handle all
8395	the netlink flags and types yet because the parser needs more
8396	information, this will be implemented later.
8397
8398	* net.c (decode_sockbuf): New function.
8399	(SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)):
8400	Use it instead of printstr.
8401	* msghdr.c (print_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto()
8402	for netlink sockets.
8403	* netlink.c: New file.
8404	* Makefile.am (strace_SOURCES): Add it.
8405	* defs.h (decode_netlink, getfdproto): New prototypes.
8406	(iov_decode): Add IOV_DECODER_NETLINK.
8407	* io.c (print_iovec): Use decode_netlink().
8408	* util.c (getfdproto): Remove static keyword.
8409	* xlat/netlink_flags.in: New file.
8410	* xlat/netlink_types.in: New file.
8411
84122016-07-07  Dmitry V. Levin  <ldv@altlinux.org>
8413
8414	Update sigaltstack SS_* constants.
8415	* xlat/sigaltstack_flags.in: Add SS_AUTODISARM introduced
8416	by linux kernel commit v4.7-rc1~195^2.
8417
8418	Update fs *_MAGIC constants.
8419	* xlat/fsmagic.in: Add NSFS_MAGIC, TRACEFS_MAGIC, BPF_FS_MAGIC,
8420	and UDF_SUPER_MAGIC introduced by linux kernel commits
8421	v3.19-rc1~53^2~7^2~1, v4.1-rc1~147^2~4, v4.4-rc1~141^2~17^2~1,
8422	and v4.7-rc1~161^2, respectively.
8423
84242016-07-05  Dmitry V. Levin  <ldv@altlinux.org>
8425
8426	Update KEYCTL_* constants.
8427	* xlat/keyctl_commands.in: Add KEYCTL_DH_COMPUTE introduced
8428	by linux kernel commit v4.7-rc1~124^2~2^2~2^2.
8429
8430	Update input event constants.
8431	* xlat/evdev_keycode.in: Add KEY_* constants introduced
8432	by linux kernel commit v4.7-rc6~32^2~6^2.
8433
84342016-07-04  Dmitry V. Levin  <ldv@altlinux.org>
8435
8436	Update RWF_* constants.
8437	* xlat/rwf_flags.in: Add RWF_DSYNC and RWF_SYNC introduced
8438	by linux kernel commit v4.7-rc1~158^2~1.
8439
84402016-07-07  Dmitry V. Levin  <ldv@altlinux.org>
8441
8442	Update BPF_MAP_TYPE_* constants.
8443	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_TRACEPOINT introduced
8444	by linux kernel commit v4.7-rc1~154^2~332^2~6.
8445
84462016-07-03  Dmitry V. Levin  <ldv@altlinux.org>
8447
8448	msghdr.c: limit output when printing excessively large messages.
8449	Limit output of struct msghdr.msg_control when
8450	struct msghdr.msg_controllen is greater than the maximum ancillary
8451	buffer size specified in /proc/sys/net/core/optmem_max file.
8452
8453	* configure.ac (AC_CHECK_FUNCS): Add open64.
8454	* defs.h (read_int_from_file): New prototype.
8455	* util.c (read_int_from_file): New function.
8456	* msghdr.c (get_optmem_max): New function based on read_int_from_file.
8457	(decode_msg_control): Use it to check control_len argument.
8458	* tests/msg_control.c (test_big_len): New function.
8459	(main): Use it to test printing of excessively large messages.
8460
84612016-07-03  Dmitry V. Levin  <ldv@altlinux.org>
8462
8463	tests: add read_int_from_file function to libtests.
8464	* tests/overflowuid.c (read_int_from_file): New function.
8465	(check_overflow_id): Use it.
8466	* tests/tests.h (read_int_from_file): New prototype.
8467
84682016-07-02  Dmitry V. Levin  <ldv@altlinux.org>
8469
8470	msghdr.c: limit IP_RECVOPTS/IP_RETOPTS output in abbrev mode.
8471	* msghdr.c (print_cmsg_ip_opts): Do not print more than max_strlen
8472	bytes of ip options in abbrev mode.
8473	* tests/msg_control.c (print_ip_opts): Use DEFAULT_STRLEN.
8474	(test_sol_ip): Test IP_RETOPTS output in abbrev mode.
8475
8476	msghdr.c: limit SCM_RIGHTS output in abbrev mode.
8477	* msghdr.c (print_scm_rights): Do not print more than max_strlen
8478	descriptors in abbrev mode.
8479	* tests/msg_control.c (DEFAULT_STRLEN): New macro.
8480	(print_fds): Use it.
8481	(test_scm_rights3): New function.
8482	(main): Use it to test SCM_RIGHTS output in abbrev mode.
8483	* tests/msg_control-v.c: New file.
8484	* tests/msg_control-v.test: New test.
8485	* tests/.gitignore: Add msg_control-v.
8486	* tests/Makefile.am (check_PROGRAMS): Likewise.
8487	(DECODER_TESTS): Add msg_control-v.test.
8488
84892016-07-01  Dmitry V. Levin  <ldv@altlinux.org>
8490
8491	tests: check decoding of struct msghdr ancillary data.
8492	* tests/msg_control.c: New file.
8493	* tests/msg_control.test: New test.
8494	* tests/.gitignore: Add msg_control.
8495	* tests/Makefile.am (check_PROGRAMS): Likewise.
8496	(DECODER_TESTS): Add msg_control.test.
8497
84982016-06-30  Dmitry V. Levin  <ldv@altlinux.org>
8499
8500	msghdr.c: reorganize struct cmsghdr handler.
8501	* msghdr.c (sock_ee): New structure.
8502	(print_scm_rights, print_scm_creds, print_scm_security,
8503	print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_ip_opts,
8504	print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr): Remove data_len
8505	argument validity check, don't print ", cmsg_data=" prefix here.
8506	(print_cmsg_ip_tos): Likewise.  Rename to print_cmsg_uint8_t.
8507	(cmsg_printer): New type.
8508	(cmsg_socket_printers, cmsg_ip_printers): New arrays.
8509	(print_cmsg_type_data): Use them to handle struct cmsghdr
8510	and its cmsg_data.
8511
8512	msghdr.c: merge print_cmsg_ip_ttl and print_cmsg_ip_checksum.
8513	* msghdr.c (print_cmsg_ip_ttl): Rename to print_cmsg_uint.
8514	(print_cmsg_ip_checksum): Remove.
8515	(print_cmsg_type_data): Replace print_cmsg_ip_ttl
8516	and print_cmsg_ip_checksum with print_cmsg_uint.
8517
8518	msghdr.c: enhance representation of unprintable part of msg_control array
8519	* msghdr.c (decode_msg_control): When msg_control array has an
8520	unprintable part, print its address.
8521
8522	msghdr.c: apply a sane limit to the length of IP_ORIGDSTADDR address.
8523	* msghdr.c (print_cmsg_ip_origdstaddr): Limit address length to the size
8524	of struct sockaddr_storage.
8525
8526	msghdr.c: fix printing SCM_RIGHTS array.
8527	* msghdr.c (print_scm_rights): Do not print array elements outside
8528	bounds defined by struct cmsghdr.cmsg_len.
8529
8530	msghdr.c: print unrecognized struct cmsghdr.cmsg_type in hex.
8531	* msghdr.c (print_cmsg_type_data): Use %#x format when printing
8532	struct cmsghdr.cmsg_type as an integer.
8533
8534	msghdr.c: fix printing of struct in_pktinfo.
8535	* msghdr.c (print_cmsg_ip_pktinfo): Fix printing
8536	of struct in_pktinfo.ipi_addr.
8537
8538	msghdr.c: fix representation of struct cmsghdr.cmsg_data integer arrays.
8539	* msghdr.c (print_cmsg_ip_opts): Print struct cmsghdr.cmsg_data
8540	as an array of hexadecimal integers.
8541	* tests/inet-cmsg.c (print_opts): Update expected output.
8542
8543	msghdr.c: fix representation of integer struct cmsghdr.cmsg_data values.
8544	* msghdr.c (print_cmsg_ip_ttl, print_cmsg_ip_tos,
8545	print_cmsg_ip_checksum): Print struct cmsghdr.cmsg_data value as an
8546	array element.
8547	* tests/inet-cmsg.c (print_ttl, print_tos): Update expected output.
8548
8549	msghdr.c: when printing struct struct cmsghdr.cmsg_data, also print its name
8550	* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
8551	print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
8552	print_cmsg_ip_checksum, print_cmsg_ip_opts, print_cmsg_ip_recverr,
8553	print_cmsg_ip_origdstaddr): Print "cmsg_data=" before its contents.
8554	* tests/inet-cmsg.c (print_pktinfo, print_ttl, print_tos, print_opts,
8555	print_origdstaddr): Update expected output.
8556	* tests/scm_rights-fd.test: Likewise.
8557
85582016-06-27  Dmitry V. Levin  <ldv@altlinux.org>
8559
8560	msghdr.c: print struct mmsghdr as a regular structure.
8561	* msghdr.c (decode_mmsghdr): Print names of msg_hdr and msg_len fields.
8562	* tests/mmsg.c (main): Update expected output.
8563
8564	net.c: move all msghdr and mmsghdr parsers to a separate file.
8565	* defs.h (msg_flags, socketlayers, decode_msghdr, decode_mmsg):
8566	New prototypes.
8567	* msghdr.c: New file.
8568	* Makefile.am (strace_SOURCES): Add it.
8569	* net.c: Move all msghdr and mmsghdr parsers to msghdr.c.
8570
8571	Mpersify fetchers of struct msghdr and struct mmsghdr.
8572	* fetch_struct_msghdr.c: New file.
8573	* fetch_struct_mmsghdr.c: Likewise.
8574	* Makefile.am (strace_SOURCES): Add them.
8575	* net.c (struct msghdr32, struct mmsghdr32, copy_from_msghdr32,
8576	fetch_msghdr, fetch_mmsghdr): Remove.
8577	(decode_msghdr, dumpiov_in_msghdr): Use fetch_struct_msghdr instead
8578	of fetch_msghdr.
8579	(decode_mmsghdr): Change msg_len argument to use_msg_len.
8580	Use fetch_struct_mmsghdr instead of fetch_mmsghdr.
8581	Return fetch_struct_mmsghdr's return code.
8582	(decode_mmsg): Rename to decode_mmsgvec.  Take addr and len arguments.
8583	Do not print vlen and flags.  Check decode_mmsghdr's return code.
8584	Print mmsghdr array using square brackets.
8585	(dumpiov_in_mmsghdr): Use fetch_struct_mmsghdr instead of fetch_mmsghdr.
8586	(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Use decode_mmsgvec instead
8587	of decode_mmsg.  Print vlen and flags.
8588	* tests/mmsg.c (main): Update expected output.
8589
8590	net.c: move fallback definition of struct mmsghdr to a separate file.
8591	* msghdr.h: New file.
8592	* Makefile.am (strace_SOURCES): Add it.
8593	* net.c: Include it.  Move fallback definition of struct mmsghdr there.
8594	* tests/mmsg.c: Include "msghdr.h".  Remove fallback definition
8595	of struct mmsghdr.
8596
85972016-06-26  Dmitry V. Levin  <ldv@altlinux.org>
8598
8599	net.c: print struct msghdr as a regular structure.
8600	* net.c (print_msghdr): Print msg_name, msg_namelen, msg_iov,
8601	and msg_iovlen fields like other regular fields.
8602	* tests/inet-cmsg.c (main): Update expected output.
8603	* tests/mmsg.c (main): Likewise.
8604	* tests/recvmsg.c (main): Likewise.
8605	* tests/scm_rights-fd.test: Likewise.
8606
8607	net.c: rename some internal functions for consistency and readability.
8608	* net.c (printcmsghdr): Rename to decode_msg_control.
8609	(do_msghdr): Rename to print_msghdr.
8610	(extractmsghdr): Rename to fetch_msghdr.
8611	(extractmmsghdr): Rename to fetch_mmsghdr.
8612	(printmsghdr): Rename to decode_msghdr.
8613	(printmmsghdr): Rename to decode_mmsghdr.
8614	All callers updated.
8615
8616	net.c: when printing struct msghdr.msg_control, also print its name.
8617	* net.c (printcmsghdr): Skip control messages of zero length.
8618	Always print "msg_control=" before the control message.
8619	(do_msghdr): Print control message before its length, not after.
8620	* tests/inet-cmsg.c (main): Update expected output.
8621	* tests/scm_rights-fd.test: Likewise.
8622
8623	Assume that libc provides struct msghdr.msg_control.
8624	* configure.ac (AC_CHECK_MEMBERS): Remove struct msghdr.msg_control.
8625	* net.c (do_msghdr): Remove HAVE_STRUCT_MSGHDR_MSG_CONTROL check.
8626
86272016-06-25  Dmitry V. Levin  <ldv@altlinux.org>
8628
8629	net.c: move all sockaddr parsers to a separate file.
8630	* sockaddr_ll.c: Rename to sockaddr.c
8631	(print_sockaddr_data_ll): Add static keyword.
8632	* Makefile.am (strace_SOURCES): Likewise.
8633	* defs.h (print_sockaddr_data_ll): Remove.
8634	(addrfams): New prototype.
8635	* net.c: Move all sockaddr parsers to sockaddr.c.
8636
8637	net.c: rename printsock to decode_sockaddr.
8638	* defs.h (printsock): Rename to decode_sockaddr.
8639	* net.c (printsock): Likewise.
8640	(do_msghdr, SYS_FUNC(bind), do_sockname, SYS_FUNC(sendto),
8641	SYS_FUNC(recvfrom)): Replace printsock with decode_sockaddr.
8642
8643	defs.h: remove unused prototype.
8644	* defs.h (print_sock_optmgmt): Remove.
8645
8646	tests: check decoding of sockaddr structures.
8647	* tests/net-sockaddr.c: New file.
8648	* tests/net-sockaddr.test: New test.
8649	* tests/.gitignore: Add net-sockaddr.
8650	* tests/Makefile.am (check_PROGRAMS): Likewise.
8651	(DECODER_TESTS): Add net-sockaddr.test.
8652
86532016-06-24  Dmitry V. Levin  <ldv@altlinux.org>
8654
8655	net.c: fix printing AF_PACKET socket addresses.
8656	* defs.h (print_ifindex, print_sockaddr_data_ll): New prototypes.
8657	* net.c: Stop including "xlat/af_packet_types.h".
8658	(print_ifindex): Remove static keyword.
8659	(print_sockaddr_data_l): Remove.
8660	* sockaddr_ll.c: New file.
8661	* Makefile.am (strace_SOURCES): Add it.
8662	* xlat/arp_hardware_types.in: New file.
8663	* xlat/ethernet_protocols.in: Likewise.
8664
8665	net.c: skip details of too short socket addresses, part 2.
8666	* net.c (sa_printers): Add minimal address length for each socket family.
8667	(print_sockaddr): Call socket family specific sockaddr printer
8668	only when socket address length is greater or equal
8669	the minimal address length for the socket family.
8670
8671	net.c: fix printing AF_BLUETOOTH socket addresses.
8672	* xlat/hci_channels.in: New file.
8673	* net.c (print_sockaddr_data_raw): New function.
8674	(print_sockaddr): Use it.
8675	[HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/hci_channels.h".
8676	[HAVE_BLUETOOTH_BLUETOOTH_H] (print_sockaddr_data_bt): Fix printing
8677	sockaddr_hci, sockaddr_sco, sockaddr_rc, and sockaddr_l2 structures.
8678
8679	net.c: fix printing AF_IPX sockets addresses, part 2.
8680	* net.c (print_sockaddr_data_ipx): Print sockaddr_ipx.sipx_network
8681	using %#08x format.  Print elements of sockaddr_ipx.sipx_node array
8682	and sockaddr_ipx.sipx_type using %#02x format.
8683
86842016-06-24  Dmitry V. Levin  <ldv@altlinux.org>
8685
8686	net.c: fix printing AF_UNIX abstract socket addresses.
8687	AF_UNIX abstract socket address specified by sockaddr_un.sun_path
8688	is not a NUL-terminated string.
8689
8690	* net.c (SIZEOF_SA_FAMILY): New macro.
8691	(print_sockaddr_data_un): Use it.  Specify actual address length
8692	in print_quoted_string calls.  Do not set QUOTE_0_TERMINATED flag
8693	when printing an abstract socket address.
8694
86952016-06-24  Dmitry V. Levin  <ldv@altlinux.org>
8696
8697	net.c: fix printing field names of struct sockaddr_nl.
8698	* net.c (print_sockaddr_data_nl): Change "pid" to "nl_pid", "groups"
8699	to "nl_groups".  Print sockaddr_nl.nl_groups using %#08x format.
8700	* tests/net-yy-netlink.c (main): Update.
8701
8702	net.c: fix printing struct sockaddr_in6.sin6_flowinfo.
8703	* net.c (print_sockaddr_data_in6): Convert sockaddr_in6.sin6_flowinfo
8704	from network order to host order before printing.
8705
87062016-06-23  Dmitry V. Levin  <ldv@altlinux.org>
8707
8708	net.c: do not print sockaddr_in6.sin6_scope_id unnecessarily.
8709	Prior to RFC2553, struct sockaddr_in6 had no sin6_scope_id field.
8710	As the kernel still accepts RFC2133 editions of struct sockaddr_in6,
8711	print sockaddr_in6.sin6_scope_id only when it is specified.
8712
8713	* net.c (SIN6_MIN_LEN): New macro.
8714	(print_sockaddr_data_in6): Print sockaddr_in6.sin6_scope_id only when
8715	socket address length exceeds SIN6_MIN_LEN.
8716
87172016-06-23  Dmitry V. Levin  <ldv@altlinux.org>
8718
8719	net.c: fix printing raw data of socket addresses.
8720	* net.c (print_sockaddr): When printing socket address raw data, read
8721	exactly the number of data bytes specified for the socket addess.
8722
8723	net.c: skip details of too short socket addresses.
8724	* net.c (print_sockaddr): Print socket address details only when
8725	the address size is greater than sizeof(struct sockaddr.sa_family).
8726	(print_sockaddr_data_un): Remove handling of addrlen == 2.
8727	* tests/net-y-unix.c (main): Update expected pattern.
8728	* tests/net-yy-unix.c (main): Likewise.
8729	* tests/net.expected: Likewise.
8730
87312016-06-22  Dmitry V. Levin  <ldv@altlinux.org>
8732
8733	Assume that libc provides struct sockaddr_in6.sin6_scope_id.
8734	* configure.ac (AC_CHECK_MEMBERS): Remove
8735	struct sockaddr_in6.sin6_scope_id.
8736	* net.c (print_sockaddr_data_in6): Remove
8737	HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID check.
8738
8739	Split print_sockaddr.
8740	* net.c (sockaddr_buf_t): Remove.
8741	(sockaddr_printer): New type.
8742	(sa_printers): New array of sockaddr_printer.
8743	(print_sockaddr): Use it.  Move printers of family specific
8744	sockaddr data to separate funcions.
8745
87462016-06-22  Fabien Siron  <fabien.siron@epita.fr>
8747
8748	Add a enum for decoding to tprint_iov() and tprint_iov_upto()
8749	Introduce a new type iov_decode which will be used instead of the integer
8750	"decode" as a parameter.
8751
8752	* defs.h (iov_decode): New enum.
8753	(tprint_iov, tprint_iov_upto): Change type of "decode_iov" to enum iov_decode.
8754	* aio.c (print_iocb): Change type of "decode_iov" to enum iov_decode in
8755	tprint_iov() call.
8756	* keyctl.c (keyctl_instantiate_key_iov): Likewise.
8757	* process.c (ptrace): Likewise.
8758	* process_vm.c (process_vm_readv, process_vm_writev): Likewise.
8759	* io.c (writev, do_pwritev, vmsplice): Likewise.
8760	(print_iovec): Replace the condition with a switch.
8761	(tprint_iov_upto): Change type of "decode_iov" to enum iov_decode.
8762	(readv, do_preadv): Change type of "decode_iov" to enum iov_decode in
8763	tprint_iov_upto() call.
8764	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
8765	print_sg_io_v4_res): Likewise.
8766	* net.c (do_msghdr): Adapt call of tprint_iov_upto().
8767
87682016-06-22  Dmitry V. Levin  <ldv@altlinux.org>
8769
8770	printsock: fix zero padding of sockaddr buffer.
8771	Before this change printsock used to erroneously clear the last byte
8772	of sockaddr buffer.
8773
8774	* net.c (printsock): Use struct sockaddr_storage as a sockaddr buffer.
8775	Reserve additional byte after the sockaddr buffer for zero padding.
8776	Do not clear memory that is going to be overwritten by umoven.
8777	Clear the tail of sockaddr buffer that was not overwritten by umoven.
8778
87792016-06-21  Fabien Siron  <fabien.siron@epita.fr>
8780
8781	Change printsock to return socket family.
8782	* defs.h (printsock): Change return type to int.
8783	* net.c (printsock): Likewise.  Return socket family on success
8784	and -1 in case of an error.
8785
87862016-06-21  Dmitry V. Levin  <ldv@altlinux.org>
8787
8788	Unexport addrfams.
8789	* defs.h (addrfams): Remove.
8790
8791	sock.c: use print_sockaddr.
8792	* sock.c (print_ifreq_addr): Remove.
8793	(PRINT_IFREQ_ADDR): New macro.
8794	(print_ifreq, decode_ifconf): Use it instead of print_ifreq_addr.
8795
8796	Export print_sockaddr function.
8797	* defs.h (print_sockaddr): New prototype.
8798	* net.c (print_sockaddr): Remove static keyword.
8799	Change type of address pointer to "const void *".
8800	(print_cmsg_ip_recverr, print_group_req): Remove redundant casts
8801	in print_sockaddr invocations.
8802
8803	xlat/addrfams.in: provide fallback definitions.
8804	* xlat/addrfams.in: add fallback definitions for constants.
8805
8806	Update AF_* constants.
8807	* xlat/addrfams.in: Add AF_QIPCRTR.
8808
8809	Assume that libc provides inet_ntop and inet_pton.
8810	* configure.ac (AC_CHECK_FUNCS): Remove inet_ntop and inet_pton.
8811	* net.c (sockaddr_buf_t, print_sockaddr, print_mreq6): Remove
8812	HAVE_INET_NTOP checks.
8813	* tests/ip_mreq.c: Remove HAVE_INET_PTON check.
8814
8815	net.c: use SO_LINGER unconditionally.
8816	* net.c (print_linger, print_getsockopt, print_setsockopt): Do not check
8817	for SO_LINGER availability.
8818
8819	net.c: use AF_BLUETOOTH unconditionally.
8820	* net.c (print_sockaddr, SYS_FUNC(socket)): Do not check
8821	for AF_BLUETOOTH availability.
8822
88232016-06-20  Dmitry V. Levin  <ldv@altlinux.org>
8824
8825	Consistently use AF_UNIX over AF_LOCAL.
8826	As these constants have the same value 1, let's use and print only one
8827	of them, e.g. AF_UNIX.
8828
8829	* xlat/addrfams.in (AF_LOCAL): Remove.
8830	* tests/net-accept-connect.c (main): Replace AF_LOCAL with AF_UNIX.
8831	* tests/net-y-unix.c: Likewise.
8832	* tests/net-yy-unix.c: Likewise.
8833	* tests/netlink_unix_diag.c: Likewise.
8834
88352016-06-19  Dmitry V. Levin  <ldv@altlinux.org>
8836
8837	net.c: fix printing AF_IPX sockets.
8838	* net.c (print_sockaddr): Print sockaddr_ipx as a regular structure.
8839	(SYS_FUNC(socket)): Remove special handling of AF_IPX.
8840
8841	net.c: use AF_IPX unconditionally.
8842	* net.c (sockaddr_buf_t, print_sockaddr, SYS_FUNC(socket)): Do not check
8843	for AF_IPX availability.
8844
8845	Cleanup netipx/ipx.h availability check.
8846	* configure.ac (AC_CHECK_HEADERS): Add netipx/ipx.h.
8847	* net.c: Check for HAVE_NETIPX_IPX_H instead of __GLIBC__.
8848
88492016-06-19  Fabien Siron  <fabien.siron@epita.fr>
8850
8851	Make getfdproto return enum instead of string.
8852	Introduce a new enum type sock_proto and use it instead of strings for socket
8853	protocols identification.
8854
8855	* defs.h (sock_proto): New enum.
8856	(get_proto_by_name): New function.
8857	* socketutils.c (protocols): New static table.
8858	(print_sockaddr_by_inode): Use it.  Change type of "proto" argument
8859	to sock_proto.
8860	(get_proto_by_name): New function.
8861	* util.c (getfdproto): Use it.  Change return type to sock_proto.
8862	(printfd): Update.
8863
88642016-06-18  Dmitry V. Levin  <ldv@altlinux.org>
8865
8866	Split travis-ci.sh.
8867	* travis-ci.sh: Split into travis-build.sh, travis-install.sh,
8868	and travis-success.sh files.
8869	* .travis.yml (before_install, after_success, git): New mappings.
8870	(script): Change to travis-build.sh.
8871	(addons, install): Remove.
8872	(env): Remove matrix.
8873	(matrix): Replace exclude list with include list.
8874
88752016-06-17  Dmitry V. Levin  <ldv@altlinux.org>
8876
8877	Introduce HAVE_STRUCT_TCB_EXT_ARG macro.
8878	Check for "if HAVE_STRUCT_TCB_EXT_ARG" instead of
8879	"if defined LINUX_MIPSN32 || defined X32".
8880
8881	* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Define for LINUX_MIPSN32 || X32.
8882	(struct tcb): Check it instead of LINUX_MIPSN32 || X32.
8883	(RVAL_LUDECIMAL): Likewise.
8884	* io.c (print_lld_from_low_high_val): Likewise.
8885	* lseek.c (SYS_FUNC(lseek)): Likewise.
8886	* mem.c (SYS_FUNC(mmap)): Likewise.
8887	* syscall.c (trace_syscall_exiting): Likewise.
8888	* util.c (getllval): Likewise.
8889
88902016-06-17  Dmitry V. Levin  <ldv@altlinux.org>
8891
8892	btrfs: fix build with fresh linux/btrfs.h.
8893	Fix build with fresh <linux/btrfs.h> that provides a slightly different
8894	definition of struct btrfs_ioctl_defrag_range_args.
8895
8896	* btrfs.c (btrfs_ioctl): Cast "len" member of
8897	struct btrfs_ioctl_defrag_range_args to uint64_t.
8898	* tests/btrfs.c (btrfs_print_defrag_range_args): Cast "start" and "len"
8899	members of struct btrfs_ioctl_defrag_range_args to uint64_t.
8900
89012016-06-17  Dmitry V. Levin  <ldv@altlinux.org>
8902
8903	btrfs: provide fallback definitions for BTRFS_IOC_QUOTA_RESCAN*
8904	<linux/btrfs.h> was introduced in linux v3.9-rc1 while some
8905	of btrfs ioctls were added later, e.g. BTRFS_IOC_QUOTA_RESCAN
8906	and BTRFS_IOC_QUOTA_RESCAN_STATUS in v3.10-rc2,
8907	or BTRFS_IOC_QUOTA_RESCAN_WAIT in v3.11-rc1.
8908
8909	* btrfs.c [!BTRFS_IOC_QUOTA_RESCAN]
8910	(struct btrfs_ioctl_quota_rescan_args): New structure.
8911	(BTRFS_IOC_QUOTA_RESCAN, BTRFS_IOC_QUOTA_RESCAN_STATUS): New macros.
8912	[!BTRFS_IOC_QUOTA_RESCAN_WAIT] (BTRFS_IOC_QUOTA_RESCAN_WAIT): New macro.
8913	* tests/btrfs.c: Likewise.
8914
8915	Reported-by: Li Er <phoooyb@gmail.com>
8916
89172016-06-17  Dmitry V. Levin  <ldv@altlinux.org>
8918
8919	configure.ac: fix checks for btrfs specific structures.
8920	* configure.ac (AC_CHECK_MEMBERS): Fix typo in the check for
8921	struct btrfs_ioctl_defrag_range_args.start and
8922	struct btrfs_ioctl_search_args_v2.buf_size.
8923
89242016-06-16  Elvira Khabirova  <lineprinter0@gmail.com>
8925
8926	README: add system requirements and beautify the file.
8927
89282016-06-16  Fei Jie  <feij.fnst@cn.fujitsu.com>
8929
8930	tests: add signal_receive.test.
8931	* tests/signal_receive.c: New file.
8932	* tests/signal_receive.test: New test.
8933	* tests/.gitignore: Add signal_receive.
8934	* tests/Makefile.am (check_PROGRAMS): Likewise.
8935	(MISC_TESTS): Add signal_receive.test.
8936
8937	tests: add signal2name function to libtests.
8938	* tests/tests.h (signal2name): New prototype.
8939	* tests/signal2name.c: New file.
8940	* tests/Makefile.am (libtests_a_SOURCES): Add it.
8941
89422016-06-16  Dmitry V. Levin  <ldv@altlinux.org>
8943
8944	net.c: use AF_INET6 unconditionally.
8945	* net.c (SYS_FUNC(socket)): Do not check for AF_INET6 availability.
8946
89472016-06-16  Dmitry V. Levin  <ldv@altlinux.org>
8948
8949	configure.ac: do not check for linux/in6.h.
8950	The last user of <linux/in6.h> was removed by commit v4.9-252-gf362a33.
8951
8952	* configure.ac (AC_CHECK_HEADERS): Remove linux/in6.h.
8953
89542016-06-16  Dmitry V. Levin  <ldv@altlinux.org>
8955
8956	net.c: use AF_PACKET unconditionally.
8957	* net.c: Do not check for AF_PACKET availability.
8958
8959	net.c: include <linux/if_packet.h> unconditionally.
8960	* configure.ac (AC_CHECK_HEADERS): Remove linux/if_packet.h.
8961	* net.c: Include <linux/if_packet.h> unconditionally.
8962
8963	net.c: use ICMP_FILTER unconditionally.
8964	* net.c: Do not check for ICMP_FILTER availability.
8965
8966	net.c: include <linux/icmp.h> unconditionally.
8967	* configure.ac (AC_CHECK_HEADERS): Remove linux/icmp.h.
8968	* net.c: Follow the example of tests/net-icmp_filter.c and include
8969	<linux/icmp.h> unconditionally.
8970
89712016-06-14  Dmitry V. Levin  <ldv@altlinux.org>
8972
8973	net.c: use AF_NETLINK unconditionally.
8974	* net.c: Do not check for AF_NETLINK availability.
8975
8976	net.c: include <linux/netlink.h> unconditionally.
8977	* configure.ac (AC_CHECK_HEADERS): Remove linux/netlink.h.
8978	* net.c: Follow the example of socketutils.c and include
8979	<linux/netlink.h> unconditionally.
8980
89812016-06-14  Elvira Khabirova  <lineprinter0@gmail.com>
8982
8983	Remove UNDEFINED_SCNO.
8984	Since UNDEFINED_SCNO is set if and only if !SCNO_IS_VALID
8985	and since tcp->s_ent can only be set to &sysent[tcp->scno]
8986	(or to &unknown, but only when !SCNO_IS_VALID), there is no need
8987	to check for UNDEFINED_SCNO before calling syscall_name(tcp->scno).
8988
8989	* defs.h (UNDEFINED_SCNO): Remove.
8990	* syscall.c (get_scno, trace_syscall_entering, trace_syscall_exiting):
8991	Remove checks for UNDEFINED_SCNO.
8992
89932016-06-14  Dmitry V. Levin  <ldv@altlinux.org>
8994
8995	tests/attach-f-p.c: fix typo in comment.
8996
89972016-06-14  Elvira Khabirova  <lineprinter0@gmail.com>
8998
8999	strace.c: fix style in function definition.
9000	* strace.c (kill_save_errno): Move the type of return value
9001	to another line.
9002
9003	Turn on more compiler warnings.
9004	* configure.ac (gl_WARN_ADD): Add -Wempty-body, -Wformat-security,
9005	-Wignored-qualifiers, -Winit-self, -Wlogical-op,
9006	-Wmissing-parameter-type, -Wnested-externs, -Wold-style-declaration,
9007	-Wold-style-definition, -Wtype-limits.
9008
9009	strace.c: fix a warning reported by -Wold-style-definition.
9010	* strace.c (usage): Add void to the list of function argments.
9011
90122016-06-14  Dmitry V. Levin  <ldv@altlinux.org>
9013
9014	tests/ioctl_evdev.c: fix typo in comment.
9015
90162016-06-14  Elvira Khabirova  <lineprinter0@gmail.com>
9017
9018	Move printargs* functions to util.c.
9019	* syscall.c (printargs, printargs_u, printargs_d): Move ...
9020	* util.c: ... here.
9021
9022	tests/xgetrlimit.c: fix a warning reported by -Wtype-limits.
9023	* tests/xgetrlimit.c (sprint_rlim): Explicitly cast constants
9024	to the type of argument.
9025
90262016-06-11  Dmitry V. Levin  <ldv@altlinux.org>
9027
9028	Consistently use printaddr for printing addresses.
9029	* bjm.c (SYS_FUNC(init_module)): Use printaddr.
9030	* clone.c (SYS_FUNC(clone)): Likewise.
9031	* evdev.c (ff_effect_ioctl): Likewise.
9032	* mtd.c (decode_mtd_oob_buf): Likewise.
9033	* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
9034	Likewise.
9035	* print_sigevent.c (print_sigevent): Likewise.
9036	* printsiginfo.c (printsigval, print_si_info): Likewise.
9037	* signal.c (decode_new_sigaction): Likewise.
9038	* sysmips.c (SYS_FUNC(sysmips)): Likewise.
9039	* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
9040	* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
9041	umoven_or_printaddr_ignore_syserror): Likewise.
9042	* tests/net-icmp_filter.c (main): Update.
9043
9044	Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.
9045
90462016-06-10  Dmitry V. Levin  <ldv@altlinux.org>
9047
9048	tests/attach-p-cmd-p.c: cleanup.
9049	* attach-p-cmd-p.c (handler): Move code ...
9050	(main): ... here.  Unblock SIGALRM only.
9051	Use alarm() instead of setitimer().
9052	Replace endless loop with a pause() call.
9053	Check that chdir() returns ENOENT.
9054
9055	tests: enhance test coverage of SIGCHLD siginfo_t.
9056	* tests/siginfo.c: New file.
9057	* tests/siginfo.test: New test.
9058	* tests/wait.c: Remove.
9059	* tests/wait.expected: Remove.
9060	* tests/wait.test: Remove.
9061	* tests/.gitignore: Add siginfo, remove wait.
9062	* tests/Makefile.am (check_PROGRAMS): Likewise.
9063	(DECODER_TESTS): Add siginfo.test, remove wait.test.
9064	(EXTRA_DIST): Remove wait.expected.
9065
9066	tests: extend test coverage of waitid syscall.
9067	* tests/waitid.c: New file.
9068	* tests/waitid-v.c: Likewise.
9069	* tests/waitid.test: New test.
9070	* tests/waitid-v.test: Likewise.
9071	* tests/.gitignore: Add waitid and waitid-v.
9072	* tests/Makefile.am (check_PROGRAMS): Likewise.
9073	(DECODER_TESTS): Add waitid.test and waitid-v.test.
9074
9075	tests: extend test coverage of wait4 syscall.
9076	* tests/wait4.c: New file.
9077	* tests/wait4-v.c: Likewise.
9078	* tests/wait4.test: New test.
9079	* tests/wait4-v.test: Likewise.
9080	* tests/.gitignore: Add wait4 and wait4-v.
9081	* tests/Makefile.am (check_PROGRAMS): Likewise.
9082	(DECODER_TESTS): Add wait4.test and wait4-v.test.
9083
9084	tests: add widen_to_ull macro to tests.h.
9085	* tests.h (widen_to_ull): New macro, copied from defs.h
9086
9087	Fix sign extension issues in the parser of struct rusage.
9088	* printrusage.c (printrusage): Do not cast members of struct rusage
9089	to type long, use widen_to_ull instead.
9090
90912016-06-09  Dmitry V. Levin  <ldv@altlinux.org>
9092
9093	tests: check decoding of waitpid syscall.
9094	* tests/waitpid.c: New file.
9095	* tests/waitpid.test: New test.
9096	* tests/.gitignore: Add waitpid.
9097	* tests/Makefile.am (check_PROGRAMS): Likewise.
9098	(DECODER_TESTS): Add waitpid.test.
9099
91002016-06-09  Fei Jie  <feij.fnst@cn.fujitsu.com>
9101
9102	tests: add strace-E.test.
9103	* tests/strace-E.expected: New file.
9104	* tests/strace-E.test: New test.
9105	* tests/Makefile.am (MISC_TESTS): Add it.
9106	(EXTRA_DIST): Add strace-E.expected.
9107
91082016-06-08  Dmitry V. Levin  <ldv@altlinux.org>
9109
9110	strace.spec.in: enable libunwind on more platforms.
9111	* strace.spec.in: Add libunwind-devel to BuildRequires for RHEL8 family.
9112
91132016-06-08  Dmitry V. Levin  <ldv@altlinux.org>
9114
9115	make-dist: generate strace-*.tar.gz, strace.dsc, and strace.spec.
9116	Change make-dist to generate strace-*.tar.gz, strace.dsc,
9117	and strace.spec in addition to strace-*.tar.xz.
9118
9119	* configure.ac (AM_INIT_AUTOMAKE): Remove no-dist-gzip.
9120	* make-dsc: New file.
9121	* make-dist: Use it.
9122	* .gitignore: Add strace-*.tar.gz, strace.dsc, and strace.spec.
9123
91242016-06-08  Dmitry V. Levin  <ldv@altlinux.org>
9125
9126	Parametrize debian/changelog.
9127	* configure.ac (CHANGELOGTIME): Rename to RPM_CHANGELOGTIME.
9128	(DEB_CHANGELOGTIME): New variable.
9129	(AC_CONFIG_FILES): Add debian/changelog.
9130	* strace.spec.in: Rename CHANGELOGTIME to RPM_CHANGELOGTIME.
9131	* debian/changelog: Rename to ...
9132	* debian/changelog.in: ... this file.  Add parametrized entry.
9133	* debian/.gitignore: New file.
9134
9135	git-version-gen: replace '-' with '.' in generated version.
9136	* git-version-gen: Replace '-' with '.' so version conforms to policies
9137	* configure.ac (SPEC_VERSION): Remove.
9138	* strace.spec.in: Replace SPEC_VERSION with PACKAGE_VERSION.
9139	Remove %srcname.
9140
91412016-06-07  Dmitry V. Levin  <ldv@altlinux.org>
9142
9143	Parametrize strace.spec.
9144	* configure.ac (SPEC_VERSION, CHANGELOGTIME): Define.
9145	(AC_CONFIG_FILES): Add strace.spec.
9146	* strace.spec: Rename to ...
9147	* strace.spec.in: ... this file.  Parametrize Version, srcname,
9148	and the last %changelog entry.  Initialize .tarball-version file.
9149
9150	strace.spec: adopt for OBS.
9151	* strace.spec: Parametrize libunwind-devel BRs, BuildRoot, and %defattr.
9152
91532016-06-07  Dmitry V. Levin  <ldv@altlinux.org>
9154
9155	tests: remove obsolete strace-f.test.
9156	strace-f.test is too inexact while fork-f.test does the right thing.
9157
9158	* tests/strace-f.test: Remove.
9159	* tests/Makefile.am (MISC_TESTS): Remove it.
9160	* strace.spec (BuildRequires): Remove time.
9161
91622016-06-07  Dmitry V. Levin  <ldv@altlinux.org>
9163
9164	tests: always distribute strace-k.test.
9165	Fix distribution of tests/strace-k.test file when configured
9166	without libunwind.
9167
9168	* tests/Makefile.am (EXTRA_DIST): Add strace-k.test.
9169
91702016-06-07  Dmitry V. Levin  <ldv@altlinux.org>
9171
9172	make-dist: skip news-check for non-releases.
9173	* make-dist: Run news-check only when the commit being built
9174	matches a release tag.
9175
91762016-06-06  Dmitry V. Levin  <ldv@altlinux.org>
9177
9178	tests: check decoding of setrlimit, getrlimit, and ugetrlimit syscalls.
9179	* tests/getrlimit.c: New file.
9180	* tests/setrlimit.c: Likewise.
9181	* tests/ugetrlimit.c: Likewise.
9182	* tests/xgetrlimit.c: Likewise.
9183	* tests/getrlimit.test: New test.
9184	* tests/setrlimit.test: Likewise.
9185	* tests/ugetrlimit.test: Likewise.
9186	* tests/.gitignore: Add getrlimit, setrlimit, and ugetrlimit.
9187	* tests/Makefile.am (check_PROGRAMS): Likewise.
9188	(DECODER_TESTS): Add getrlimit.test, setrlimit.test,
9189	and ugetrlimit.test.
9190	(EXTRA_DIST): Add xgetrlimit.c.
9191
9192	tests: check decoding of prlimit64 syscall.
9193	* tests/prlimit64.c: New file.
9194	* tests/prlimit64.test: New test.
9195	* tests/.gitignore: Add prlimit64.
9196	* tests/Makefile.am (check_PROGRAMS): Likewise.
9197	(DECODER_TESTS): Add prlimit64.test.
9198
9199	Fix decoding of pid_t argument of prlimit64 syscall.
9200	* resource.c (SYS_FUNC(prlimit64)): Print pid_t syscall
9201	argument using %d format.
9202
92032016-06-06  Dmitry V. Levin  <ldv@altlinux.org>
9204
9205	Do not check for old sysctl enums.
9206	Assume that sysctl enums defined since linux v2.6 are always defined,
9207	with a signle exception: check for CTL_PROC which definition was removed
9208	in v2.6.18 and restored later in v2.6.23.
9209
9210	* configure.ac (AC_CHECK_DECLS): Remove old constants.
9211	* xlat/sysctl_kern.in: Mark constants older than KERN_PRINTK_RATELIMIT
9212	as unconditional.
9213	* xlat/sysctl_net.in: Mark constants older than NET_LLC
9214	as unconditional.
9215	* xlat/sysctl_net_core.in: Mark constants older than NET_CORE_BUDGET
9216	as unconditional.
9217	* xlat/sysctl_net_ipv4.in: Mark constants older than
9218	NET_IPV4_IGMP_MAX_MSF as unconditional.
9219	* xlat/sysctl_net_ipv4_conf.in: Mark constants older than
9220	NET_IPV4_CONF_FORCE_IGMP_VERSION as unconditional.
9221	* xlat/sysctl_net_ipv4_route.in: Mark constants older than
9222	NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS as unconditional.
9223	* xlat/sysctl_net_ipv6.in: Mark constants older than
9224	NET_IPV6_MLD_MAX_MSF as unconditional.
9225	* xlat/sysctl_net_ipv6_route.in: Mark constants older than
9226	NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS as unconditional.
9227	* xlat/sysctl_net_unix.in: Mark all constants as unconditional.
9228	* xlat/sysctl_root.in: Mark constants older than CTL_ARLAN
9229	as unconditional.
9230	* xlat/sysctl_vm.in: Mark constants older than VM_MAX_MAP_COUNT
9231	as unconditional.
9232
92332016-06-06  Dmitry V. Levin  <ldv@altlinux.org>
9234
9235	xlat: extend syntax.
9236	* xlat/gen.sh: Implement #conditional directive that turns on
9237	preprocessor checks turned off earlier by #unconditional directive.
9238
92392016-06-06  Elvira Khabirova  <lineprinter0@gmail.com>
9240
9241	mpers.awk: remove unnecessary type attribute retrieval.
9242	* mpers.awk (what_is): Do not retrieve "type" attribute
9243	for "enumeration_type".
9244
9245	tests/ptrace.c: fix fork() return value check.
9246	* tests/ptrace.c (test_peeksiginfo): Explicitly cast fork() return value
9247	to pid_t.
9248
9249	.gitignore: add missing files that should be ignored.
9250	* .gitignore: Add ioctl_redefs[12].h and libstrace.a.
9251
92522016-06-06  Dmitry V. Levin  <ldv@altlinux.org>
9253
9254	debian: sync with the package.
9255	* debian/control (Build-Depends) [amd64]: Remove libunwind-dev.
9256	* debian/changelog: Sync with 4.12-3.
9257	* debian/rules: Likewise.
9258
92592016-06-06  Dmitry V. Levin  <ldv@altlinux.org>
9260
9261	tests/strace-S.test: fix testing 64-bit strace using a 32-bit userspace.
9262	* tests/strace-S.test: Measure wall clock time instead of system time.
9263	Use local "./readv" instead of system "date" as a sample executable.
9264
9265	Reported-by: Steve McIntyre <steve@einval.com>
9266
92672016-06-06  Dmitry V. Levin  <ldv@altlinux.org>
9268
9269	tests/strace-S.test: enhance error diagnostics.
9270	* tests/strace-S.test: If strace output does not meet expectations,
9271	print the output.
9272
92732016-06-02  Dmitry V. Levin  <ldv@altlinux.org>
9274
9275	.gitignore: sort the list of ignored patterns.
9276	* .gitignore: Sort.
9277
92782016-06-01  Dmitry V. Levin  <ldv@altlinux.org>
9279
9280	maint: post-release administrivia.
9281	* NEWS: Add header line for the next release.
9282
92832016-05-31  Dmitry V. Levin  <ldv@altlinux.org>
9284
9285	Prepare for 4.12 release.
9286	* NEWS: Update for 4.12 release.
9287	* debian/changelog: 4.12-1.
9288	* strace.spec: 4.12-1.
9289
9290	Sync strace.spec and debian/changelog with packages.
9291	* debian/changelog: Sync with 4.11-1.
9292	* strace.spec: Sync with 4.11.0.163.9720-2.
9293
92942016-05-30  Dmitry V. Levin  <ldv@altlinux.org>
9295
9296	Mpersify hdio.c.
9297	* defs.h (hdio_ioctl): Remove.
9298	* hdio.c: Mpersify struct hd_geometry.
9299	(hdio_ioctl): Mpersify.
9300
93012016-05-29  Dmitry V. Levin  <ldv@altlinux.org>
9302
9303	loop.c: decode LOOP_SET_DIRECT_IO.
9304	* loop.c (loop_ioctl) [LOOP_SET_DIRECT_IO] : Handle LOOP_SET_DIRECT_IO.
9305
9306	loop.c: fix printing of arrays.
9307	* loop.c (decode_loop_info): Use square brackets to print
9308	struct loop_info.lo_init and struct loop_info.reserved arrays.
9309	(decode_loop_info64): Use square brackets to print
9310	struct loop_info64.lo_init array.
9311
9312	loop.c: fix printing of structure members' names.
9313	* loop.c (decode_loop_info, decode_loop_info64): Do not strip "lo_"
9314	prefix from printed names.
9315
9316	loop.c: optimize decoding of paired ioctls.
9317	* loop.c (loop_ioctl): Optimize decoding of LOOP_[GS]ET_STATUS
9318	and LOOP_[GS]ET_STATUS64 ioctl pairs.
9319
93202016-05-28  Dmitry V. Levin  <ldv@altlinux.org>
9321
9322	tests/ioctl_evdev.c: check EVIOCGUNIQ decoding.
9323	* tests/ioctl_evdev.c (main): Check EVIOCGUNIQ(0) decoding.
9324
9325	tests/ioctl_mtd.c: fix build with musl.
9326	* tests/ioctl_mtd.c: Include <linux/ioctl.h>.
9327
9328	tests: check decoding of 'M' type ioctls.
9329	* tests/ioctl_mtd.c: New file.
9330	* tests/ioctl_mtd.test: New test.
9331	* tests/.gitignore: Add ioctl_mtd.
9332	* tests/Makefile.am (check_PROGRAMS): Likewise.
9333	(DECODER_TESTS): Add ioctl_mtd.test.
9334
9335	Mpersify mtd.c.
9336	* defs.h (mtd_ioctl): Remove.
9337	* mtd.c: Mpersify struct mtd_oob_buf and ioctl numbers.
9338	(mtd_ioctl): Mpersify.
9339
9340	mtd.c: refactor.
9341	* mtd.c (mtd_ioctl): Move parsers of structures to separate functions.
9342
9343	Move parser of UBI_* ioctls to a separate file.
9344	* mtd.c (ubi_ioctl): Move to ...
9345	* ubi.c: ... new file.
9346	* Makefile.am (strace_SOURCES): Add it.
9347
9348	tests: check decoding of EVIOC* ioctls.
9349	* tests/ioctl_evdev.c: New file.
9350	* tests/ioctl_evdev-v.c: Likewise.
9351	* tests/ioctl_evdev.test: New test.
9352	* tests/ioctl_evdev-v.test: Likewise.
9353	* tests/.gitignore: Add ioctl_evdev and ioctl_evdev-v.
9354	* tests/Makefile.am (check_PROGRAMS): Likewise.
9355	(DECODER_TESTS): Add ioctl_evdev.test and ioctl_evdev-v.test.
9356
9357	Mpersify EVIOC* ioctl parser.
9358	* defs.h (evdev_abs): New xlat prototype.
9359	(evdev_ioctl): Remove.
9360	* evdev.c: Do not include "xlat/evdev_abs.h".
9361	Mpersify struct ff_effect and ioctl numbers.
9362	(evdev_ioctl): Mpersify.
9363	* NEWS: Mention this enhancement.
9364
9365	evdev.c: fix printing of unrecognized event type passed to EVIOCGBIT.
9366	* evdev.c (bit_ioctl): If event type is not unrecognized,
9367	print the argument as an address.
9368
9369	evdev.c: fix printing of EV_PWR's argument.
9370	* evdev.c (bit_ioctl): Fix printing of comma before EV_PWR's argument.
9371
9372	evdev.c: fix indentation.
9373	* evdev.c: Fix indentation of print formats.
9374
9375	evdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ.
9376	* evdev.c (evdev_read_ioctl): Fix printing of the string returned
9377	in response to EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ requests.
9378
9379	evdev.c: fix EVIOCGVERSION decoding.
9380	* evdev.c (evdev_read_ioctl): Print EVIOCGVERSION's argument
9381	using #x format.
9382
9383	evdev.c: fix EVIOCGMTSLOTS decoding.
9384	* evdev.c (mtslots_ioctl): Use umove_or_printaddr.
9385
9386	evdev.c: fix bitset decoding.
9387	* evdev.c (decode_bitset): Use umove_or_printaddr.
9388
9389	evdev.c: fix decoding of struct input_id.
9390	* evdev.c (getid_ioctl): Use umove_or_printaddr.
9391
9392	evdev.c: fix decoding of struct input_keymap_entry.
9393	* evdev.c (keycode_V2_ioctl): Use umove_or_printaddr.
9394
9395	evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE.
9396	* evdev.c (keycode_ioctl): Use umove_or_printaddr.
9397
9398	evdev.c: fix decoding of struct input_absinfo.
9399	* evdev.c (abs_ioctl): Use umove_or_printaddr.
9400
9401	evdev.c: fix decoding of struct ff_effect.
9402	* evdev.c (ff_effect_ioctl): Use umove_or_printaddr.
9403	Fix printing of struct ff_effect.u member names.
9404
9405	evdev.c: fix printing of struct ff_envelope.fade_level.
9406	* evdev.c (decode_envelope): Print struct ff_envelope.fade_level
9407	using #x format.
9408
9409	evdev.c: fix decoding of EVIOCGRAB and EVIOCREVOKE.
9410	* evdev.c (evdev_write_ioctl): Print argument of EVIOCGRAB
9411	and EVIOCREVOKE as unsigned long.
9412
9413	evdev.c: fix EVIOCRMFF decoding.
9414	* evdev.c (evdev_write_ioctl): Print EVIOCRMFF's argument as int.
9415
9416	evdev.c: move handling of EVIOCGBIT to a separate function.
9417	* evdev.c (evdev_read_ioctl): Move EVIOCGBIT handling to ...
9418	(bit_ioctl): ... new function.
9419
94202016-05-28  Dmitry V. Levin  <ldv@altlinux.org>
9421
9422	evdev.c: reorder ioctl command checks.
9423	Change the order of ioctl command cheks to match the kernel:
9424	1st, check for fixed-number fixed-length commands,
9425	2nd, check for fixed-number variable-length commands,
9426	3rd, check for multi-number fixed-length commands,
9427	4thm check for multi-number variable-length commands.
9428
9429	* evdev.c (evdev_read_ioctl, evdev_write_ioctl): Reorder
9430	ioctl command checks.
9431
94322016-05-28  Dmitry V. Levin  <ldv@altlinux.org>
9433
9434	evdev.c: decode all directions except _IOC_READ on entering syscall.
9435	* evdev.c (evdev_write_ioctl): Remove exiting check.
9436	(evdev_read_ioctl): Move entering check ...
9437	(evdev_ioctl): ... here.  Add RVAL_DECODED to return code in _IOC_WRITE
9438	and default cases.
9439
9440	evdev.c: fix indentation of preprocessor directives.
9441	* evdev.c: Fix indentation of preprocessor directives.
9442	Move inclusion of <linux/ioctl.h> into [HAVE_LINUX_INPUT_H].
9443
94442016-05-28  Jeff Mahoney  <jeffm@suse.com>
9445
9446	file_ioctl.c: print first two extents for FIDEDUPERANGE in abbrev mode.
9447	* file_ioctl.c (file_ioctl, print_file_dedupe_range_info): Print first
9448	two elements of info array in abbrev mode.
9449	* tests/btrfs.c (btrfs_test_extent_same_ioctl): Handle newly
9450	printed elements.
9451
94522016-05-27  Dmitry V. Levin  <ldv@altlinux.org>
9453
9454	ioctl.c: fix typo in decoding of EVIOCSABS's parameter.
9455	* ioctl.c (evdev_decode_number): Fix typo in printxval default value.
9456
94572016-05-27  Jeff Mahoney  <jeffm@suse.com>
9458
9459	tests: check decoding of btrfs RDWR ioctls returned data.
9460	* tests/btrfs-vw.test: New file.
9461	* tests/btrfs-w.test: New file.
9462	* tests/Makefile.am (DECODER_TESTS): Add them.
9463
9464	tests/btrfs.c: fix live btrfs_test_search_ioctls output.
9465	* tests/btrfs.c (btrfs_test_search_ioctls): Use print_tree_search_buf
9466	for BTRFS_IOC_TREE_SEARCH and fix missing whitespace.
9467
9468	btrfs.c: don't use print_array in btrfs_print_tree_search.
9469	* btrfs.c (btrfs_print_tree_search): Don't use print_array.  The buffer
9470	represents a series of variable sized records, not an array.
9471
9472	btrfs.c: fix print_array usage in btrfs_print_logical_ino_container.
9473	* btrfs.c: (btrfs_print_logical_ino_container) Fix the element count
9474	to reflect the number of records rather than the number of items.
9475
94762016-05-26  Jeff Mahoney  <jeffm@suse.com>
9477
9478	tests/btrfs.c: fix btrfs-v for BTRFS_IOC_TREE_SEARCH.
9479	* tests/btrfs.c (btrfs_test_send_ioctl): Assign key_reference
9480	to search_args for BTRFS_IOC_TREE_SEARCH ioctl tests.
9481
94822016-05-26  Fabien Siron  <fabien.siron@epita.fr>
9483
9484	Fix -yy documentation.
9485	* strace.c (usage): Fix description of -yy option.
9486	* strace.1: Likewise.
9487
94882016-05-26  Dmitry V. Levin  <ldv@altlinux.org>
9489
9490	tests/ioctl_block.c: tweak magic constants to make the test more reliable
9491	* tests/ioctl_block.c (main): Change bad pointer to make
9492	its lower 32-bit part closer to -1U.
9493
9494	tests/btrfs.c: check basic decoding of read-only ioctls.
9495	* tests/btrfs.c (btrfs_test_read_ioctls): New function.
9496	(main): Use it.
9497
9498	tests: check decoding of BLK* ioctls.
9499	* configure.ac (AC_CHECK_TYPES): Add struct blk_user_trace_setup.
9500	* tests/ioctl_block.c: New file.
9501	* tests/ioctl_block.test: New test.
9502	* tests/.gitignore: Add ioctl_block.
9503	* tests/Makefile.am (check_PROGRAMS): Likewise.
9504	(DECODER_TESTS): Add ioctl_block.test.
9505
9506	Mpersify BLK* ioctl parser.
9507	* defs.h (block_ioctl): Remove.
9508	* block.c: Mpersify struct blk_user_trace_setup,
9509	struct blkpg_ioctl_arg, struct blkpg_partition, and ioctl numbers.
9510	(block_ioctl): Mpersify.
9511	* NEWS: Mention this enhancement.
9512
9513	block.c: optimize decoding of paired ioctls.
9514	* block.c (block_ioctl): Optimize decoding of commands that return
9515	a signed int.
9516
9517	block.c: fix printing of uint64_t pairs.
9518	* block.c (block_ioctl): Print uint64_t values using PRIu64 format.
9519
9520	block.c: fix printing of struct blk_user_trace_setup.
9521	* block.c (block_ioctl): Fix printing of comma before
9522	struct blk_user_trace_setup.name on exiting syscall.
9523
9524	Move parser of 'X' type ioctls to a separate file.
9525	* fs_x_ioctl.c: New file.
9526	* Makefile.am (strace_SOURCES): Add it.
9527	* block.c: (block_ioctl): Move parser of FITRIM, FIFREEZE, and FITHAW
9528	to fs_x_ioctl.c.
9529	* defs.h (fs_x_ioctl): New prototype.
9530	* ioctl.c (ioctl_decode): Call fs_x_ioctl for ioctl type 'X'.
9531
9532	Move parser of HDIO_* ioctls to a separate file.
9533	* hdio.c: New file.
9534	* Makefile.am (strace_SOURCES): Add it.
9535	* block.c: Do not include <linux/hdreg.h>.
9536	(block_ioctl): Move parser of HDIO_GETGEO to hdio.c.
9537	* defs.h (hdio_ioctl): New prototype.
9538	* ioctl.c (ioctl_decode): Call hdio_ioctl for ioctl type 0x03.
9539
9540	Fix explicit casts of signed integer types to unsigned long long.
9541	* defs.h (widen_to_ull): New macro.
9542	* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Use it in place
9543	of explicit casts to unsigned long long.
9544	* io.c (print_lld_from_low_high_val): Likewise.
9545	* lseek.c (SYS_FUNC(llseek)): Likewise.
9546	* printsiginfo.c (print_si_info): Likewise.
9547	* printstat.h (DO_PRINTSTAT): Likewise.
9548	* sysinfo.c (SYS_FUNC(sysinfo)): Likewise.
9549	* times.c (SYS_FUNC(times)): Likewise.
9550	* fetch_struct_statfs.c (ASSIGN_NUMBER): Remove.
9551	(fetch_struct_statfs, fetch_struct_statfs64): Replace ASSIGN_NUMBER
9552	with widen_to_ull.
9553
9554	scsi.c: print __u64 types using PRI__u64 format.
9555	* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Remove explicit casts
9556	to unsigned long long, print fields of type __u64 using PRI__u64 format.
9557
95582016-05-25  Dmitry V. Levin  <ldv@altlinux.org>
9559
9560	tests: check decoding of RTC_* ioctls.
9561	* configure.ac (AC_CHECK_FUNCS): Add ioctl_rtc.
9562	* tests/ioctl_rtc.c: New file.
9563	* tests/ioctl_rtc-v.c: Likewise.
9564	* tests/ioctl_rtc.test: New test.
9565	* tests/ioctl_rtc-v.test: Likewise.
9566	* tests/.gitignore: Add ioctl_rtc and ioctl_rtc-v.
9567	* tests/Makefile.am (check_PROGRAMS): Likewise.
9568	(DECODER_TESTS): Add ioctl_rtc.test and ioctl_rtc-v.test.
9569
9570	Mpersify RTC_* ioctl parser.
9571	* defs.h (rtc_ioctl): Remove.
9572	* rtc.c: Mpersify struct rtc_pll_info and ioctl numbers.
9573	(rtc_ioctl): Mpersify.
9574	* NEWS: Mention this enhancement.
9575
9576	rtc.c: fix decoding of struct rtc_wkalrm.
9577	* rtc.c (decode_rtc_wkalrm): Print field name of struct rtc_wkalrm.time.
9578
9579	file_ioctl.c: print file descriptors using printfd.
9580	* file_ioctl.c (print_file_dedupe_range_info): Print
9581	struct file_dedupe_range_info.dest_fd using printfd.
9582	(file_ioctl): Print struct file_clone_range.src_fd using printfd.
9583
9584	rtc.c: do not print argument of ioctls that have no arguments.
9585	* rtc.c (rtc_ioctl): Do not print argument of RTC_{A,U,P,W}IE_{ON,OFF}
9586	and RTC_VL_CLR ioctls.
9587
9588	rtc.c: decode RTC_PLL_GET and RTC_PLL_SET.
9589	* rtc.c (rtc_ioctl): Decode RTC_PLL_GET and RTC_PLL_SET
9590
9591	rtc.c: optimize decoding of paired ioctls.
9592	* rtc.c (rtc_ioctl): Optimize decoding of RTC_ALM_READ/RTC_ALM_SET,
9593	RTC_RD_TIME/RTC_SET_TIME, and RTC_WKALM_RD/RTC_WKALM_SET ioctl pairs.
9594
9595	block.c: handle BLKDAXGET.
9596	* block.c [!BLKDAXGET] (BLKDAXGET): Define.
9597	(block_ioctl): Handle it.
9598
9599	tests: check decoding of mount syscall.
9600	* tests/mount.c: New file.
9601	* tests/mount.test: New test.
9602	* tests/.gitignore: Add mount.
9603	* tests/Makefile.am (check_PROGRAMS): Likewise.
9604	(DECODER_TESTS): Add mount.
9605
96062016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9607
9608	tests/vhangup.c: diassociate from the controlling terminal first.
9609	* tests/vhangup.c (main): Call setsid before vhangup.
9610
96112016-05-24  Fei Jie  <feij.fnst@cn.fujitsu.com>
9612
9613	tests: add vhangup.test.
9614	* tests/vhangup.c: New file.
9615	* tests/vhangup.test: New test.
9616	* tests/.gitignore: Add vhangup.
9617	* tests/Makefile.am (check_PROGRAMS): Likewise.
9618	(DECODER_TESTS): Add vhangup.test.
9619
96202016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9621
9622	NEWS: Prepare for 4.12 release.
9623
96242016-05-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
9625
9626	tests/btrfs.c: fix build on x32.
9627	* tests/btrfs.c (btrfs_test_ino_path_ioctls): Fix printing of st_ino.
9628
96292016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9630
9631	tests/btrfs.c: fix build with u64 based BTRFS_IOC_DEFAULT_SUBVOL.
9632	* tests/btrfs.c: Fix build on systems where BTRFS_IOC_DEFAULT_SUBVOL
9633	is defined using unexported type "u64".
9634
9635	btrfs.c: fix build on systems without BTRFS_IOC_FILE_EXTENT_SAME.
9636	* btrfs.c (btrfs_ioctl): Skip BTRFS_IOC_FILE_EXTENT_SAME case
9637	if this constant is not defined.
9638	* tests/btrfs.c (btrfs_test_extent_same_ioctl): Skip this part
9639	of the test if BTRFS_IOC_FILE_EXTENT_SAME is not defined.
9640
9641	tests/btrfs.c: fix printing struct btrfs_ioctl_clone_range_args.
9642	* tests/btrfs.c (btrfs_test_clone_ioctls): Print __u64 members
9643	of struct btrfs_ioctl_clone_range_args using PRI__u64 format.
9644
9645	tests/btrfs.c: tweak magic constants to make the test more reliable.
9646	* tests/btrfs.c (btrfs_test_sync_ioctls): Change u64val
9647	to 0xdeadbeefbadc0ded.
9648	(btrfs_test_subvol_ioctls): Likewise.  Change bad_pointer
9649	to make their lower 32-bit parts closer to -1U.
9650
9651	btrfs.c: print file descriptors using printfd.
9652	* btrfs.c (btrfs_ioctl): Print struct btrfs_ioctl_send_args.send_fd,
9653	struct btrfs_ioctl_vol_args.fd, and struct btrfs_ioctl_vol_args_v2.fd
9654	using printfd.
9655	* tests/btrfs.c (btrfs_print_vol_args_v2, btrfs_test_subvol_ioctls,
9656	btrfs_test_device_ioctls, btrfs_test_clone_ioctls,
9657	btrfs_test_send_ioctl): Update.
9658
9659	tests/btrfs.c: do not print errno in case of fs type mismatch.
9660	* tests/btrfs.c (main): Use error_msg_and_fail instead of
9661	perror_msg_and_fail when the fs type of the given directory
9662	is not BTRFS_SUPER_MAGIC.
9663
9664	tests/btrfs.c: fix indentation.
9665	* tests/btrfs.c: Fix indentation of preprocessor directives
9666	and function prototypes.
9667
9668	tests/btrfs.c: sort included headers.
9669	* tests/btrfs.c: Sort included headers.
9670
9671	tests/btrfs.c: do not use alloca.
9672	* tests/btrfs.c: Don't include <alloca.h>.
9673	(btrfs_test_subvol_ioctls): Allocate
9674	struct btrfs_ioctl_vol_args_v2.qgroup_inherit using tail_alloc.
9675
9676	tests/btrfs.c: fix build on systems without <linux/btrfs.h> or <linux/fiemap.h>
9677	* tests/btrfs.c: Include "tests.h" first.
9678	Skip the test if [!HAVE_LINUX_BTRFS_H].  Skip parts of the test
9679	that use struct fiemap if [!HAVE_LINUX_FIEMAP_H].
9680
96812016-05-24  Jeff Mahoney  <jeffm@suse.com>
9682
9683	tests: add testing for btrfs ioctls.
9684	* tests/btrfs.c: New file.
9685	* tests/btrfs.test: New test.
9686	* tests/btrfs-v.test: Likewise.
9687	* tests/.gitignore: Add btrfs.
9688	* tests/Makefile.am (check_PROGRAMS): Likewise.
9689	(DECODER_TESTS): Add btrfs.test and btrfs-v.test.
9690
96912016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9692
9693	tests/file_ioctl.c: use tail_alloc.
9694	* tests/file_ioctl.c (main): Allocate struct fiemap using tail_alloc.
9695
9696	tests/file_ioctl.c: fix build on systems without <linux/fiemap.h>
9697	* tests/file_ioctl.c: Include "tests.h" first.
9698	Skip the test if [!HAVE_LINUX_FIEMAP_H].
9699
97002016-05-24  Jeff Mahoney  <jeffm@suse.com>
9701
9702	tests: add testing for FS_IOC_FIEMAP.
9703	This is limited to FIEMAP.  FICLONE* and FIDEDUPERANGE originated in
9704	btrfs and will be tested there.
9705
9706	* tests/file_ioctl.c: New file.
9707	* tests/file_ioctl.test: New test.
9708	* tests/.gitignore: Add file_ioctl.
9709	* tests/Makefile.am (check_PROGRAMS): Likewise.
9710	(DECODER_TESTS): Add file_ioctl.test.
9711
97122016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9713
9714	Mpersify btrfs.c.
9715	* btrfs.c: Mpersify 3 arch-specific structures
9716	and corresponding ioctl numbers.
9717	(btrfs_ioctl): Mpersify.
9718	* defs.h (btrfs_ioctl): Remove.
9719
9720	btrfs.c: use print_array.
9721	* btrfs.c (print_btrfs_data_container_logical_ino,
9722	print_btrfs_data_container_ino_path, print_uint64,
9723	print_btrfs_ioctl_search_header, print_objectid_callback,
9724	print_btrfs_ioctl_space_info): New functions.
9725	(btrfs_print_logical_ino_container, btrfs_print_ino_path_container):
9726	Rewrite printers of struct btrfs_data_container.val array
9727	using print_array.
9728	(btrfs_print_qgroup_inherit): Rewrite printer of
9729	struct btrfs_qgroup_inherit.qgroups array using print_array.
9730	(btrfs_print_tree_search): Rewrite printer of
9731	struct btrfs_ioctl_search_header array using print_array.
9732	(btrfs_ioctl): Rewrite printer of
9733	struct btrfs_ioctl_send_args.clone_sources and
9734	struct btrfs_ioctl_space_args.spaces using print_array.
9735
9736	btrfs.c: simplify BTRFS_IOC_GET_FSLABEL parser.
9737	* btrfs.c (btrfs_ioctl): Share code of parser of BTRFS_IOC_SET_FSLABEL
9738	with parser of BTRFS_IOC_GET_FSLABEL only on BTRFS_IOC_GET_FSLABEL's
9739	entering.
9740
9741	btrfs.c: fix BTRFS_IOC_TREE_SEARCH_V2 output.
9742	* btrfs.c (btrfs_ioctl): Fix BTRFS_IOC_TREE_SEARCH_V2 output
9743	in case of EOVERFLOW and failed umove.
9744
9745	btrfs.c: cleanup use of tcp->auxstr.
9746	* btrfs.c (btrfs_ioctl): Reset tcp->auxstr only if it is set.
9747
9748	btrfs.c: cleanup struct btrfs_ioctl_get_dev_stats.nr_items check.
9749	* btrfs.c (btrfs_ioctl): Cleanup check of iterator of
9750	btrfs_ioctl_get_dev_stats.values array.
9751
9752	btrfs.c: do not use BTRFS_SUBVOL_NAME_MAX.
9753	* btrfs.c [BTRFS_SUBVOL_NAME_MAX]: Remove.
9754	(btrfs_ioctl): Use sizeof(struct btrfs_ioctl_vol_args_v2.name)
9755	instead of BTRFS_SUBVOL_NAME_MAX + 1.
9756
9757	btrfs.c: mark some function arguments as const.
9758	* btrfs.c (btrfs_print_balance_args, btrfs_print_features,
9759	btrfs_print_qgroup_limit, btrfs_print_data_container_header,
9760	btrfs_print_logical_ino_container, btrfs_print_ino_path_container,
9761	btrfs_print_qgroup_inherit): Mark some function arguments as const.
9762
9763	btrfs.c: use umove instead of umoven.
9764	* btrfs.c: Use umove instead of umoven and umove_or_printaddr
9765	instead of umoven_or_printaddr.
9766
9767	btrfs.c: remove unused variable.
9768	* btrfs.c (btrfs_ioctl): Remove "ret" variable.
9769
9770	btrfs.c: use printxval/printxval64 instead of printxvals.
9771	* btrfs.c (btrfs_ioctl): Do not call printxvals directly,
9772	use printxval/printxval64 wrappers that do the right thing.
9773
9774	btrfs.c: fix indentation.
9775	* btrfs.c: Fix indentation of preprocessor directives and print formats.
9776
9777	xlat/btrfs_dev_stats_values.in: cleanup.
9778	* xlat/btrfs_dev_stats_values.in: Remove HAVE_DECL_* defines,
9779	use #unconditional instead.
9780
9781	file_ioctl.c: use print_array.
9782	* file_ioctl.c (file_ioctl): Rewrite printers of
9783	struct file_dedupe_range_info and struct fiemap_extent arrays
9784	using print_array.
9785
9786	file_ioctl.c: fix indentation.
9787	* file_ioctl.c: Fix indentation of preprocessor directives
9788	and print formats.
9789
97902016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9791
9792	file_ioctl.c: include <linux/ioctl.h> instead of <sys/ioctl.h>
9793	Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
9794	no benefits for this parser.
9795
9796	* file_ioctl.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
9797
97982016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9799
9800	file_ioctl.c: fix build on systems without <linux/fiemap.h>
9801	* configure.ac (AC_CHECK_HEADERS): Add linux/fiemap.h.
9802	* file_ioctl.c: Do not include <linux/fiemap.h> and xlat/fiemap_*.h
9803	if [!HAVE_LINUX_FIEMAP_H].
9804	(file_ioctl): Do not parse FS_IOC_FIEMAP if [!HAVE_LINUX_FIEMAP_H].
9805
9806	ioctl.c: fix build.
9807	* ioctl.c (ioctl_decode): Move definition of "ret" variable
9808	to [ALPHA || POWERPC] case.
9809	[ALPHA || POWERPC]: Fix syntax error.
9810
98112016-05-24  Jeff Mahoney  <jeffm@suse.com>
9812
9813	ioctl: add decoding for FS_IOC_FIEMAP.
9814	* file_ioctl.c: Include <linux/fiemap.h>, "xlat/fiemap_flags.h",
9815	and "xlat/fiemap_extent_flags.h".
9816	(file_ioctl): Handle FS_IOC_FIEMAP.
9817	* ioctl.c (ioctl_decode): Use file_ioctl for decoding 'f' code ioctls.
9818
98192016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9820
9821	Add xlat/fiemap_flags.in and xlat/fiemap_extent_flags.in.
9822	* xlat/fiemap_flags.in: New file.
9823	* xlat/fiemap_extent_flags.in: Likewise.
9824
98252016-05-24  Jeff Mahoney  <jeffm@suse.com>
9826
9827	ioctl: add decoding support for btrfs ioctls.
9828	* btrfs.c: New file.
9829	* file_ioctl.c: Likewise.
9830	* Makefile.am (strace_SOURCES): Add them.
9831	* configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h.
9832	(AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags,
9833	struct btrfs_ioctl_fs_info_args.nodesize,
9834	struct btrfs_ioctl_defrag_range_args.start,
9835	and struct btrfs_ioctl_search_args_v2.buf_size.
9836	(AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums.
9837	* defs.h (btrfs_ioctl, file_ioctl): New prototypes.
9838	* ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl.
9839	* xlat/btrfs_balance_args.in: New file.
9840	* xlat/btrfs_balance_ctl_cmds.in: Likewise.
9841	* xlat/btrfs_balance_flags.in: Likewise.
9842	* xlat/btrfs_balance_state.in: Likewise.
9843	* xlat/btrfs_compress_types.in: Likewise.
9844	* xlat/btrfs_defrag_flags.in: Likewise.
9845	* xlat/btrfs_dev_replace_cmds.in: Likewise.
9846	* xlat/btrfs_dev_replace_results.in: Likewise.
9847	* xlat/btrfs_dev_replace_state.in: Likewise.
9848	* xlat/btrfs_dev_stats_flags.in: Likewise.
9849	* xlat/btrfs_dev_stats_values.in: Likewise.
9850	* xlat/btrfs_features_compat.in: Likewise.
9851	* xlat/btrfs_features_compat_ro.in: Likewise.
9852	* xlat/btrfs_features_incompat.in: Likewise.
9853	* xlat/btrfs_key_types.in: Likewise.
9854	* xlat/btrfs_qgroup_ctl_cmds.in: Likewise.
9855	* xlat/btrfs_qgroup_inherit_flags.in: Likewise.
9856	* xlat/btrfs_qgroup_limit_flags.in: Likewise.
9857	* xlat/btrfs_qgroup_status_flags.in: Likewise.
9858	* xlat/btrfs_scrub_flags.in: Likewise.
9859	* xlat/btrfs_send_flags.in: Likewise.
9860	* xlat/btrfs_snap_flags_v2.in: Likewise.
9861	* xlat/btrfs_space_info_flags.in: Likewise.
9862	* xlat/btrfs_tree_objectids.in: Likewise.
9863
98642016-05-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
9865
9866	x32: update ioctl entries from linux 4.6.
9867	* linux/x32/ioctls_inc0.h: Update from linux v4.6 using ioctls_gen.sh.
9868
98692016-05-24  Dmitry V. Levin  <ldv@altlinux.org>
9870
9871	tests/attach-f-p.c: sleep a bit more to let the tracer catch up.
9872	On noticeably lagging systems, the parent process may invoke its chdir
9873	call before the tracer gets notified about completion of its last child
9874	process.  Add extra sleep in the parent process to win the race.
9875
9876	* tests/attach-f-p.c (main): Change timerid into a static array.
9877	Arm a timer in the parent process and wait for it.
9878
98792016-05-23  Dmitry V. Levin  <ldv@altlinux.org>
9880
9881	tests/attach-p-cmd-cmd.c: fix potential errno clobbering.
9882	* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.
9883
9884	tests/net-yy-netlink.c: robustify against libc specific issues.
9885	* tests/net-yy-netlink.c (main): Use getsockname instead of recvmsg
9886	as the latter has notible implementation differences that make
9887	the test unreliable.
9888
9889	tests/net-yy-netlink.c: robustify against os specific issues.
9890	* tests/net-yy-netlink.c (main): Pass a pointer to a real struct msghdr
9891	as NULL doesn't work well on some systems.
9892
9893	tests/net-yy-{inet,netlink}.test: cleanup.
9894	* tests/net-yy-inet.test: Do not pass arguments to net-yy-inet
9895	as the latter does not accept them.
9896	* tests/net-yy-netlink.test: Do not pass arguments to net-yy-netlink
9897	as the latter does not accept them.
9898
98992016-05-22  Jeff Mahoney  <jeffm@suse.com>
9900
9901	tests: define PRI__[dux]64 macros to print __s64 and __u64 values.
9902	Rather than cast every __u64 or __s64 before printing,
9903	define printing helpers for those types directly.
9904
9905	This complements commit 1f3482bedad505a41caf1d61b3a4e7e09a2f4330.
9906
9907	* tests/tests.h (PRI__d64, PRI__u64, PRI__x64): New macros.
9908
99092016-05-22  Dmitry V. Levin  <ldv@altlinux.org>
9910
9911	tests: remove manual creation of memory mapping holes.
9912	We used to call tail_alloc(1) to create memory mapping holes around
9913	regular tail_alloc allocations.  This is no longer needed since regular
9914	tail_alloc allocations create additional memory mapping holes.
9915
9916	* tests/clock_adjtime.c (main): Remove creation of memory mapping holes
9917	using tail_alloc(1).
9918	* tests/futimesat.c (main): Likewise.
9919	* tests/get_mempolicy.c (print_nodes, main): Likewise.
9920	* tests/getgroups.c (main): Likewise.
9921	* tests/getresugid.c (main): Likewise.
9922	* tests/ioctl_uffdio.c (main): Likewise.
9923	* tests/ioctl_v4l2.c (main): Likewise.
9924	* tests/move_pages.c (main): Likewise.
9925	* tests/net-icmp_filter.c (main): Likewise.
9926	* tests/ptrace.c (test_peeksiginfo, main): Likewise.
9927	* tests/pwritev.c (main): Likewise.
9928	* tests/set_mempolicy.c (print_nodes): Likewise.
9929	* tests/setgroups.c (main): Likewise.
9930	* tests/umovestr3.c (main): Likewise.
9931	* tests/utimes.c (main): Likewise.
9932	* tests/xattr.c (main): Likewise.
9933
99342016-05-22  Dmitry V. Levin  <ldv@altlinux.org>
9935
9936	tests: make tail_alloc create additional memory mapping holes.
9937	* tests/tail_alloc.c (tail_alloc): Create additional memory mapping
9938	holes before and after the allocated memory.
9939
99402016-05-21  Dmitry V. Levin  <ldv@altlinux.org>
9941
9942	mpers: add support of conditionally compiled printers.
9943	We used to declare and define all printers marked with
9944	MPERS_PRINTER_DECL, including ifdef'ed ones.  That approach left us
9945	no way to conditionally compile mpersified printers, which was not
9946	a problem until btrfs ioctls appeared on the horizon.
9947
9948	With this change, those mpersified printers that are not going
9949	to be compiled are also won't be declared and won't be added to
9950	struct_printers.
9951
9952	This is implemented by filtering all source files containing
9953	MPERS_PRINTER_DECL markers through CPP.  As a nice side effect, this
9954	also lifts an ugly requirement of writing all MPERS_PRINTER_DECL
9955	declarations in a single line.
9956
9957	* README-mpers: Update description of MPERS_PRINTER_DECL syntax.
9958	* defs.h [IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into
9959	a recursive variadic macro.
9960	[!IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a variadic macro.
9961	All callers changed.
9962	* Makefile.am (mpers_preproc_files, mpers_printer_decl_pattern):
9963	New variables.
9964	(CLEANFILES): Add $(mpers_preproc_files).
9965	(%.c.mpers.i): New rule.
9966	(printers.h, %_printer_decls.h, %_printer_defs.h): Use
9967	mpers_preproc_files instead of srcdir_mpers_source_files,
9968	use mpers_printer_decl_pattern.
9969	* .gitignore: Add /*.mpers.i.
9970
99712016-05-20  Dmitry V. Levin  <ldv@altlinux.org>
9972
9973	Remove redundant declaration of v4l2_ioctl.
9974	There is no need to declare mpers printers in defs.h because
9975	they are already declared in printers.h or native_printer_decls.h.
9976
9977	This complements commit 1e56814f77594a22a74ddee629639eb0bb7edf3a.
9978
9979	* defs.h (v4l2_ioctl): Remove.
9980
99812016-05-21  Dmitry V. Levin  <ldv@altlinux.org>
9982
9983	Fix one more code pattern that might break gcc strict aliasing rules.
9984	* socketutils.c (receive_responses): Turn static buffer into a union
9985	to avoid breaking of gcc strict aliasing rules.
9986	* tests/netlink_inet_diag.c (check_responses): Likewise.
9987	* tests/netlink_netlink_diag.c (check_responses): Likewise.
9988	* tests/netlink_unix_diag.c (check_responses): Likewise.
9989
99902016-05-21  Fabien Siron  <fabien.siron@epita.fr>
9991
9992	tests: add check for netlink protocol decoding with -yy option.
9993	* tests/netlink_netlink_diag.c: New file.
9994	* tests/net-yy-netlink.c: New file.
9995	* tests/net-yy-netlink.test: New test.
9996	* tests/.gitignore: Add net-yy-netlink and netlink_netlink_diag
9997	* tests/Makefile.am (check_PROGRAMS): Likewise.
9998	(TESTS): Add net-yy-netlink.test.
9999
100002016-05-18  Fabien Siron  <fabien.siron@epita.fr>
10001
10002	Add netlink domain sockets support to socketutils.
10003	* linux/netlink_diag.h: New file.
10004	* Makefile.am (EXTRA_DIST): Add it.
10005	* socketutils.c: Include it and "xlat/netlink_protocols.h".
10006	(netlink_send_query, netlink_parse_response, netlink_print): New
10007	functions.
10008	(print_sockaddr_by_inode): Hook up netlink_print.
10009
100102016-05-18  Dmitry V. Levin  <ldv@altlinux.org>
10011
10012	tests/pread64-pwrite64.c: robustify against os specific issues.
10013	Do not assume that pwrite64 syscall fails when only part of the
10014	specified memory buffer is accessible.  With some kernels, one
10015	accessible byte at the end of page is enough for pwrite64 syscall
10016	to return 1.
10017
10018	* tests/pread64-pwrite64.c (main): Tweak the test that can lead
10019	to a partial write.
10020
100212016-05-18  Dmitry V. Levin  <ldv@altlinux.org>
10022
10023	tests/read-write.c: robustify against os specific issues.
10024	Do not assume that write syscall fails when only part of the specified
10025	memory buffer is accessible.  With some kernels, one accessible byte
10026	at the end of page is enough for write syscall to return 1.
10027
10028	* tests/read-write.c (main): Tweak the test that can lead to a partial
10029	write.
10030
100312016-05-18  Dmitry V. Levin  <ldv@altlinux.org>
10032
10033	umovestr3.test: extend test coverage.
10034	* tests/umovestr3.c: Include <sys/param.h>.
10035	(main): Test with each number between PATH_MAX-1 and 0.
10036
10037	tests/timer_create.c: robustify against os specific issues.
10038	* tests/timer_create.c (main): Do not assume any specific error code
10039	returned by timer_create, print whatever it is.
10040
10041	Fix some compilation warnings on older systems.
10042	* print_statfs.c (print_statfs_flags): Define only
10043	for [HAVE_STRUCT_STATFS_F_FLAGS || HAVE_STRUCT_STATFS64_F_FLAGS].
10044	* tests/inet-cmsg.c (print_origdstaddr): Define only
10045	for [IP_ORIGDSTADDR].
10046
10047	Update generic ioctl entries from linux 4.6.
10048	* linux/64/ioctls_inc.h: Update from linux v4.6 using ioctls_gen.sh.
10049	* linux/32/ioctls_inc_align32.h: Likewise.
10050	* linux/32/ioctls_inc_align64.h: Likewise.
10051	* NEWS: Mention this.
10052
10053	maint: update for linux 4.6.
10054	* maint/ioctls_sym.sh: Update workarounds for linux/kvm.h.
10055
10056	Update SOL_* constants.
10057	* xlat/socketlayers.in: Add SOL_KCM.
10058
10059	Update MSG_* constants.
10060	* xlat/msg_flags.in: Add MSG_BATCH.
10061
10062	Update AF_* constants.
10063	* xlat/addrfams.in: Add AF_KCM.
10064
100652016-05-17  Fei Jie  <feij.fnst@cn.fujitsu.com>
10066
10067	tests: add brk.test.
10068	* tests/brk.c: New file.
10069	* tests/brk.test: New test.
10070	* tests/.gitignore: Add brk.
10071	* tests/Makefile.am (check_PROGRAMS): Likewise.
10072	(DECODER_TESTS): Add brk.test.
10073
100742016-05-17  Dmitry V. Levin  <ldv@altlinux.org>
10075
10076	Fix printing of invalid arguments of term ioctls.
10077	* term.c (term_ioctl): Print arguments of TCXONC and TCFLSH ioctls
10078	using printxval_long.
10079
10080	mips: fix printing of invalid operations argument of sysmips syscall.
10081	* sysmips.c (SYS_FUNC(sysmips)): Print 1st argument of syscall using
10082	printxval_long.
10083
10084	bfin: fix printing of invalid flags argument of sram_alloc syscall.
10085	* sram_alloc.c (SYS_FUNC(sram_alloc)): Print 2nd argument using
10086	printflags_long.
10087
100882016-05-16  Dmitry V. Levin  <ldv@altlinux.org>
10089
10090	Fix printing of invalid arguments of prctl syscall.
10091	* prctl.c (SYS_FUNC(prctl)): Print 2nd syscall argument
10092	of PR_CAPBSET_DROP, PR_CAPBSET_READ, PR_CAP_AMBIENT, PR_MCE_KILL,
10093	and PR_SET_SECCOMP using printxval_long.
10094	Print 2nd syscall argument of PR_SET_SECUREBITS using printflags_long.
10095	Print 3rd syscall argument of PR_CAP_AMBIENT and PR_MCE_KILL using
10096	printxval_long.
10097	* tests/prctl-seccomp-strict.c (main): Update.
10098
10099	Fix printing of invalid flags argument of perf_event_open syscall.
10100	* numa.c (SYS_FUNC(perf_event_open)): Print 5th argument of syscall
10101	using printflags_long.
10102
10103	or1k: fix printing of invalid 1st argument of or1k_atomic syscall.
10104	* or1k_atomic.c (SYS_FUNC(or1k_atomic)): Print 1st argument using
10105	printxval_long.
10106
10107	Fix printing of invalid flags argument of get_mempolicy syscall.
10108	* numa.c (SYS_FUNC(get_mempolicy)): Print 5th argument of syscall
10109	using printxval_long.
10110
10111	Fix printing of invalid mode argument of mbind syscall.
10112	* numa.c (SYS_FUNC(mbind)): Print 3rd argument of syscall
10113	using printxval_long.
10114	* tests/mbind.c (main): Update.
10115
10116	Fix printing of invalid argument of MTDFILEMODE ioctl.
10117	* mtd.c (mtd_ioctl): Print 3rd argument of MTDFILEMODE ioctl
10118	using printflags_long.
10119
10120	Fix printing of invalid flags argument of mount syscall.
10121	* mount.c (SYS_FUNC(mount)): Print 1st argument using printflags_long.
10122
10123	Fix printing of invalid arguments of memory mapping related syscalls.
10124	* mem.c (print_mmap): Print 3rd and 4th arguments of syscall
10125	using printflags_long.
10126	(SYS_FUNC(mprotect)): Print 3rd argument of syscall using
10127	printflags_long.
10128	(SYS_FUNC(mremap)): Print 4th argument of syscall using printflags_long.
10129	(SYS_FUNC(remap_file_pages)): Print 3rd and 4th arguments of syscall
10130	using printflags_long.
10131	* tests/remap_file_pages.c (main): Update.
10132
10133	Fix printing of invalid flags argument of kexec_load and kexec_file_load
10134	* kexec.c (SYS_FUNC(kexec_load), SYS_FUNC(kexec_file_load)): Print
10135	flags argument using printflags_long.
10136
10137	Fix printing of invalid 3rd argument of fcntl/fcntl64 syscall.
10138	* fcntl.c (print_fcntl): Print 3rd argument of F_NOTIFY, F_SETLEASE, and
10139	F_ADD_SEALS operations using printflags_long.
10140
10141	Fix printing of invalid flags argument of unshare syscall.
10142	* clone.c (SYS_FUNC(unshare)): Print 1st argument using printflags_long.
10143
10144	Introduce printflags_long and printxval_long.
10145	* defs.h (printflags_long, printxval_long): New static inline functions.
10146
10147	Fix printing of invalid struct xfs_dqblk.d_flags.
10148	* quota.c (decode_cmd_data): Explicitly cast struct xfs_dqblk.d_flags
10149	to uint8_t to avoid potential sign-extension bug when printing
10150	invalid struct xfs_dqblk.d_flags.
10151
10152	Fix printing of invalid struct ubi_mkvol_req.vol_type.
10153	* mtd.c (ubi_ioctl): Explicitly cast struct ubi_mkvol_req.vol_type
10154	to unsigned short to avoid potential sign-extension bug when printing
10155	invalid struct ubi_mkvol_req.vol_type.
10156
101572016-05-16  Dmitry V. Levin  <ldv@altlinux.org>
10158
10159	Fix decoding of prctl/arch_prctl operation argument.
10160	Consistently treat operation argument of prctl/arch_prctl syscalls
10161	as int to match the kernel behaviour.
10162
10163	* prctl.c (SYS_FUNC(prctl), SYS_FUNC(arch_prctl)): Assign 1st argument
10164	of syscalls to a variable of type unsigned int and use it in all
10165	subsequent checks and lookups.
10166
101672016-05-16  Dmitry V. Levin  <ldv@altlinux.org>
10168
10169	Fix printing of struct sched_attr.sched_flags.
10170	* sched.c (print_sched_attr): Print sched_flags using printflags64.
10171
10172	Fix printing of struct statfs.f_flags.
10173	* print_statfs.c (print_statfs_flags): Print flags using printflags64.
10174
10175	Fix printing of invalid struct ifreq.ifr_flags.
10176	* sock.c (print_ifreq): Explicitly cast struct ifreq.ifr_flags
10177	to unsigned short to avoid potential sign-extension bug when printing
10178	invalid struct ifreq.ifr_flags.
10179
10180	Fix printing of invalid struct pollfd.events.
10181	* poll.c (print_pollfd): Explicitly cast struct pollfd.events
10182	to unsigned short to avoid potential sign-extension bug when printing
10183	invalid struct pollfd.events.
10184
10185	Fix printing of invalid struct sembuf.sem_flg.
10186	* ipc_sem.c (print_sembuf): Explicitly cast struct sembuf.sem_flg
10187	to unsigned short to avoid potential sign-extension bug when printing
10188	invalid struct sembuf.sem_flg.
10189
10190	Fix printing of invalid l_type and l_whence in fcntl/fcntl64 syscalls.
10191	* fcntl.c (print_struct_flock64): Explicitly cast l_type and l_whence
10192	fields to unsigned short to avoid potential sign-extension bug when
10193	printing invalid l_type or l_whence fields.
10194
10195	Fix printing of fanotify_mark mask argument.
10196	* fanotify.c (SYS_FUNC(fanotify_mark)): Print mask using printflags64.
10197
101982016-05-16  Dmitry V. Levin  <ldv@altlinux.org>
10199
10200	Fix decoding of epoll_ctl operation argument.
10201	Consistently treat operation argument of epoll_ctl syscall as int
10202	to match the kernel behaviour.
10203
10204	* epoll.c (SYS_FUNC(epoll_ctl)): Assign 2nd argument of syscall
10205	to a variable of type unsigned int and use it in all subsequent
10206	checks and lookups.
10207	* tests/epoll_ctl.c (invoke_syscall): New function.
10208	(main): Use it.
10209
102102016-05-16  Dmitry V. Levin  <ldv@altlinux.org>
10211
10212	Fix printing of invalid d_type in getdents syscall.
10213	* dirent.c (SYS_FUNC(getdents)): Treat d_type as unsigned char to avoid
10214	potential sign-extension bug when printing invalid d_type.
10215
10216	bfin: fix decoding of cacheflush syscall.
10217	* cacheflush.c (SYS_FUNC(cacheflush)): Print 2nd argument
10218	using %lu format.  Print 3rd argument as flags.
10219
10220	Fix decoding of BPF_MAP_UPDATE_ELEM flags.
10221	* bpf.c (bpf_map_update_elem): Print attr.flags using printxval64.
10222
102232016-05-16  Dmitry V. Levin  <ldv@altlinux.org>
10224
10225	Fix decoding of fcntl/fcntl64 operation argument.
10226	Consistently treat operation argument of fcntl/fcntl64 syscalls as int
10227	to match the kernel behaviour.
10228
10229	* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Assign
10230	2nd argument of syscall to a variable of type unsigned int
10231	and use it in all subsequent checks and lookups.
10232	* tests/struct_flock.c (invoke_test_syscall): New function.
10233	(test_flock_einval, test_flock): Use it.
10234	* tests/fcntl.c (test_flock64_einval): Use it.
10235	* tests/fcntl64.c (test_flock64_einval, test_flock64): Use it.
10236
102372016-05-15  Dmitry V. Levin  <ldv@altlinux.org>
10238
10239	Rename sprintflags64 to sprintflags.
10240	* defs.h (sprintflags): Remove.
10241	(sprintflags64): Rename to sprintflags.
10242	* util.c (sprintflags64): Rename to sprintflags.
10243
10244	Prepare for transition from sprintflags64 to sprintflags.
10245	* fcntl.c (print_fcntl): Cast 3rd argument of sprintflags
10246	to unsigned long.
10247	* membarrier.c (SYS_FUNC(membarrier)): Likewise.
10248	* prctl.c (SYS_FUNC(prctl)): Likewise.
10249	* poll.c (decode_poll_exiting): Cast 3rd argument of sprintflags
10250	to unsigned short.
10251
102522016-05-14  Dmitry V. Levin  <ldv@altlinux.org>
10253
10254	Rename xlookup64 to xlookup.
10255	* defs.h (xlookup): Remove.
10256	(xlookup64): Rename to xlookup.
10257	* util.c (xlookup64): Rename to xlookup.
10258
10259	Prepare for transition from xlookup64 to xlookup.
10260	* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)):
10261	Cast 2nd argument of xlookup to unsigned long.
10262	* prctl.c (SYS_FUNC(prctl)): Likewise.
10263	* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
10264	* time.c (do_adjtimex): Likewise.
10265	* ioprio.c (sprint_ioprio): Change type of the argument
10266	and local variables from int to unsigned int.
10267	* keyctl.c (print_keyring_serial_number): Cast 2nd argument
10268	of xlookup to unsigned int.
10269	* net.c (tprint_sock_type): Change type of the argument to unsigned int.
10270	* printmode.c (sprintmode): Likewise.
10271	* printsiginfo.c (printsigval):  Change type of si_code argument
10272	to unsigned int.
10273
102742016-05-14  Dmitry V. Levin  <ldv@altlinux.org>
10275
10276	v4l2: fix build with old kernel headers.
10277	Prior to v2.6.25-rc3, <linux/videodev2.h> didn't include all
10278	required headers, resulting to omission of V4L2_* constants.
10279
10280	This issue doesn't arise in v4l2.c and tests/ioctl_v4l2.c files
10281	because they already include all necessary headers themselves.
10282
10283	* configure.ac (AC_CHECK_DECLS): Include <sys/time.h>, <linux/ioctl.h>,
10284	and <linux/types.h> before <linux/videodev2.h>.
10285
102862016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10287
10288	configure.ac: do not check for sys/ioctl.h and ioctls.h.
10289	Since sys/ioctl.h is included unconditionally when needed
10290	and ioctls.h doesn't exist, these checks are redundant.
10291
10292	* configure.ac (AC_CHECK_HEADERS): Remove ioctls.h and sys/ioctl.h.
10293
102942016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10295
10296	sock.c: include <linux/ioctl.h> instead of <sys/ioctl.h> or <ioctls.h>
10297	Include <linux/ioctl.h> for <linux/sockios.h> on alpha, sh, and sh64
10298	architectures because their <asm/sockios.h> use _IOR and _IOW macros
10299	but don't include anything that would define these macros.
10300
10301	Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
10302	no benefits in this case.  <ioctls.h> simply doesn't exist.
10303
10304	* sock.c [ALPHA || SH || SH64]: Include <linux/ioctl.h>
10305	instead of <sys/ioctl.h> or <ioctls.h>.
10306
103072016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10308
10309	v4l2: include <linux/ioctl.h> instead of <sys/ioctl.h>
10310	Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
10311	no benefits for parser of VIDIOC_* ioctls.
10312
10313	* v4l2.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
10314
103152016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10316
10317	printsiginfo: remove "verbose" argument.
10318	Remove erroneous use of verbose(tcp) as a printing limit
10319	for already fetched members of siginfo_t structure.
10320
10321	* printsiginfo.h (printsiginfo): Remove boolean argument.
10322	* printsiginfo.c (printsigval): Remove boolean argument, print
10323	si_int and si_ptr members unconditionally.  All callers changed.
10324	(print_si_info): Remove boolean argument, print si_utime and si_stime
10325	members unconditionally.  All callers changed.
10326	(printsiginfo): Remove boolean argument.  All callers changed.
10327
103282016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10329
10330	tests/ptrace.c: tweak magic constants to make the test more reliable.
10331	* tests/ptrace.c (main): Change bad_request and bad_data to make they
10332	lower 32-bit parts closer to -1U.
10333
103342016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10335
10336	tests/ioctl_v4l2.c: fix build on older systems.
10337	Fix build on systems without HAVE_DECL_V4L2_CTRL_TYPE_STRING or
10338	V4L2_CTRL_CLASS_CAMERA.
10339
10340	* tests/ioctl_v4l2.c (main) [VIDIOC_S_EXT_CTRLS]: Disable part of the
10341	test if [!HAVE_DECL_V4L2_CTRL_TYPE_STRING].
10342	Replace V4L2_CTRL_CLASS_CAMERA with V4L2_CTRL_CLASS_USER.
10343
103442016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10345
10346	Do not use htole32 function.
10347	htole32 function is not portable enough.
10348
10349	* v4l2.c (print_pixelformat): Rewrite initialization of pixel format
10350	union without using of htole32.
10351	* tests/ioctl_v4l2.c (main): Likewise.
10352
103532016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10354
10355	tests/ioctl_v4l2.c: fix typo.
10356	* tests/ioctl_v4l2.c (main)
10357	[!HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE]: Fix typo in expected
10358	output string.
10359
10360	tests: check decoding of ptrace syscall.
10361	* tests/ptrace.c: New file.
10362	* tests/ptrace.test: New test.
10363	* tests/.gitignore: Add ptrace.
10364	* tests/Makefile.am (check_PROGRAMS): Likewise.
10365	(DECODER_TESTS): Add ptrace.
10366
103672016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10368
10369	ptrace: decode data argument of PTRACE_PEEKSIGINFO request.
10370	The data argument of PTRACE_PEEKSIGINFO request is a pointer
10371	to siginfo_t array.
10372
10373	* printsiginfo.c (print_siginfo_t): New function.
10374	(print_siginfo_array): New mpers printer.
10375	* process.c (SYS_FUNC(ptrace)): Print data argument of
10376	PTRACE_PEEKSIGINFO request using print_siginfo_array.
10377
103782016-05-13  Dmitry V. Levin  <ldv@altlinux.org>
10379
10380	ptrace: decode data argument of PTRACE_SECCOMP_GET_FILTER request.
10381	* process.c (SYS_FUNC(ptrace)): Print data argument of
10382	PTRACE_SECCOMP_GET_FILTER request on exiting using print_seccomp_fprog.
10383
10384	ptrace: decode argument of PTRACE_GETEVENTMSG request.
10385	* process.c (SYS_FUNC(ptrace)): Print data argument of
10386	PTRACE_GETEVENTMSG request on exiting using printnum_ulong.
10387
10388	ptrace: decode arguments of PTRACE_[GS]ETSIGMASK requests.
10389	* process.c (SYS_FUNC(ptrace)): Print arguments of PTRACE_GETSIGMASK
10390	and PTRACE_SETSIGMASK requests using print_sigset_addr_len.
10391
10392	ptrace: return RVAL_DECODED for requests decoded on entering.
10393	* process.c (SYS_FUNC(ptrace)): Return RVAL_DECODED on entering for all
10394	ptrace requests except those that are partially decoded in exiting,
10395
103962016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10397
10398	ptrace: print PTRACE_O_* flags using printflags64.
10399	As flags argument has a long integer type, print it using printflags64
10400	because printflags takes unsigned int argument.
10401
10402	* process.c (SYS_FUNC(ptrace)): Print PTRACE_O_* flags
10403	using printflags64.
10404
104052016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10406
10407	ptrace: print data argument of PTRACE_SEIZE et al requests as flags.
10408	* process.c (SYS_FUNC(ptrace)): Print data argument of
10409	PTRACE_SEIZE and PTRACE_OLDSETOPTIONS as PTRACE_O_* flags.
10410
10411	ptrace: print data argument of PTRACE_SINGLEBLOCK et al requests as signo
10412	* process.c (SYS_FUNC(ptrace)): Print data argument of
10413	PTRACE_SINGLEBLOCK, PTRACE_SYSEMU, and PTRACE_SYSEMU_SINGLESTEP requests
10414	as a signal number.
10415
104162016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10417
10418	ptrace: decode addr argument of PTRACE_PEEKSIGINFO request.
10419	The addr argument of PTRACE_PEEKSIGINFO request is a pointer to
10420	a struct ptrace_peeksiginfo_args.
10421
10422	* process.c: Include "xlat/ptrace_peeksiginfo_flags.h".
10423	(SYS_FUNC(ptrace)): Print addr argument of PTRACE_PEEKSIGINFO request
10424	as a struct ptrace_peeksiginfo_args.
10425	* xlat/ptrace_peeksiginfo_flags.in: New file.
10426
104272016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10428
10429	ptrace: fix printing addr argument of PTRACE_GETSIGMASK et al requests.
10430	For PTRACE_GETSIGMASK and PTRACE_SETSIGMASK requests, addr argument
10431	contains the size of the buffer pointed to by data argument.
10432	For PTRACE_SECCOMP_GET_FILTER request, addr argument contains
10433	an offset counter.
10434
10435	* process.c (SYS_FUNC(ptrace)): Print addr argument of
10436	PTRACE_GETSIGMASK, PTRACE_SETSIGMASK, and PTRACE_SECCOMP_GET_FILTER
10437	requests using %lu format.
10438
104392016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10440
10441	ptrace: do not print data argument of some requests on sparc.
10442	On sparc, kernel ignores data argument of PTRACE_GETREGS,
10443	PTRACE_SETREGS, PTRACE_GETFPREGS, and PTRACE_SETFPREGS requests.
10444
10445	* process.c (SYS_FUNC(ptrace)) [SPARC || SPARC64]: Return RVAL_DECODED
10446	right after printing addr argument if request is one of PTRACE_GETREGS,
10447	PTRACE_SETREGS, PTRACE_GETFPREGS, or PTRACE_SETFPREGS.
10448
104492016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10450
10451	ptrace: do not print addr and data arguments of PTRACE_ATTACH-like requests
10452	As kernel ignores addr and data arguments of PTRACE_ATTACH,
10453	PTRACE_INTERRUPT, PTRACE_KILL, and PTRACE_LISTEN request,
10454	we do not print them either.
10455
10456	* process.c (SYS_FUNC(ptrace)): After printing pid argument, return
10457	RVAL_DECODED if request is one of PTRACE_ATTACH, PTRACE_INTERRUPT,
10458	PTRACE_KILL, or PTRACE_LISTEN.
10459
104602016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10461
10462	ptrace: do not print arguments of PTRACE_TRACEME request.
10463	As kernel ignores arguments of PTRACE_TRACEME request,
10464	we do not print them either.
10465
10466	* process.c (SYS_FUNC(ptrace)): If request is PTRACE_TRACEME,
10467	return early with RVAL_DECODED.
10468
104692016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10470
10471	ptrace: print request using printxval64.
10472	As first argument of ptrace syscall has a long integer type, print
10473	it using printxval64 because printxval takes unsigned int argument.
10474
10475	* process.c (SYS_FUNC(ptrace)): Change type of "request" variable
10476	from "long" to "unsigned long", print it using printxval64 instead
10477	of printxval.
10478
104792016-05-12  Dmitry V. Levin  <ldv@altlinux.org>
10480
10481	Do not sign-extend siginfo_t.si_syscall.
10482	* printsiginfo.c (print_si_info): Explicitly cast si_syscall member
10483	of siginfo_t that has type "int" to "unsigned int", to avoid sign
10484	extension when passed to syscall_name function.
10485
10486	Export print_seccomp_fprog for further use in parser of ptrace syscall.
10487	* defs.h (print_seccomp_fprog): New prototype.
10488	* seccomp.c (print_seccomp_fprog): Remove "static" keyword.
10489	Move printing of struct seccomp_fprog fields ...
10490	(print_seccomp_filter): ... here.
10491
104922016-05-11  Fei Jie  <feij.fnst@cn.fujitsu.com>
10493
10494	tests: add munlockall.test.
10495	* tests/munlockall.c: New file.
10496	* tests/munlockall.test: New test.
10497	* tests/.gitignore: Add munlockall.
10498	* tests/Makefile.am (check_PROGRAMS): Likewise.
10499	(DECODER_TESTS): Add munlockall.test.
10500
10501	tests: add link.test.
10502	* tests/link.c: New file.
10503	* tests/link.test: New test.
10504	* tests/.gitignore: Add link.
10505	* tests/Makefile.am (check_PROGRAMS): Likewise.
10506	(DECODER_TESTS): Add link.test.
10507
105082016-05-11  Dmitry V. Levin  <ldv@altlinux.org>
10509
10510	tests: check decoding and dumping of preadv2 and pwritev2 syscalls.
10511	* tests/preadv2-pwritev2.c: New file.
10512	* tests/preadv2-pwritev2.test: New test.
10513	* tests/.gitignore: Add preadv2-pwritev2.
10514	* tests/Makefile.am (check_PROGRAMS): Likewise.
10515	(DECODER_TESTS): Add preadv2-pwritev2.
10516
10517	Implement decoding of preadv2 and pwritev2 syscalls.
10518	* io.c: Include "xlat/rwf_flags.h".
10519	(do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)):
10520	New functions.
10521	(SYS_FUNC(preadv)): Use do_preadv.
10522	(SYS_FUNC(pwritev)): Use do_pwritev.
10523	* linux/32/syscallent.h (preadv2, pwritev2): New entries.
10524	* linux/64/syscallent.h: Likewise.
10525	* linux/arm/syscallent.h: Likewise.
10526	* linux/hppa/syscallent.h: Likewise.
10527	* linux/i386/syscallent.h: Likewise.
10528	* linux/ia64/syscallent.h: Likewise.
10529	* linux/m68k/syscallent.h: Likewise.
10530	* linux/mips/syscallent-n32.h: Likewise.
10531	* linux/mips/syscallent-n64.h: Likewise.
10532	* linux/mips/syscallent-o32.h: Likewise.
10533	* linux/powerpc/syscallent.h: Likewise.
10534	* linux/powerpc64/syscallent.h: Likewise.
10535	* linux/s390/syscallent.h: Likewise.
10536	* linux/s390x/syscallent.h: Likewise.
10537	* linux/sparc/syscallent.h: Likewise.
10538	* linux/sparc64/syscallent.h: Likewise.
10539	* linux/x32/syscallent.h: Likewise.
10540	* linux/x86_64/syscallent.h: Likewise.
10541	* syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2.
10542	* xlat/rwf_flags.in: New file.
10543	* NEWS: Mention parsers of new syscalls.
10544
105452016-05-10  Dmitry V. Levin  <ldv@altlinux.org>
10546
10547	tests: extend test coverage of xattr family syscalls.
10548	* tests/xattr.c: Check decoding of all xattr family syscalls.
10549	* tests/xattr.test: Use run_strace_match_diff.
10550	* tests/xattr.expected: Remove.
10551	* tests/Makefile.am (EXTRA_DIST): Remove it.
10552
10553	tests: add print_quoted_memory function to libtests.
10554	* tests/print_quoted_string.c (print_quoted_memory): New function.
10555	(print_quoted_string): Use it.
10556	* tests/tests.h (print_quoted_memory): New prototype.
10557
10558	Fix corner cases of xattr family syscalls decoding.
10559	* xattr.c (print_xattr_val): Do not take insize into account, print it
10560	as unsigned long.
10561	Do not decode xattr values of size larger than XATTR_SIZE_MAX.
10562	Use static buffer for fetching xattr values.
10563	(print_xattr_list): Do not decode string when size is zero.
10564
105652016-05-10  Dr. David Alan Gilbert  <dgilbert@redhat.com>
10566
10567	userfaultfd: Add ioctl tests.
10568	* tests/ioctl_uffdio.c: New file.
10569	* tests/ioctl_uffdio.test: New test.
10570	* tests/.gitignore: Add ioctl_uffdio.
10571	* tests/Makefile.am (check_PROGRAMS):  Likewise.
10572	(DECODER_TESTS): Add ioctl_uffdio.test.
10573
105742016-05-10  Dr. David Alan Gilbert  <dgilbert@redhat.com>
10575
10576	Decode UFFDIO_* ioctls.
10577	Decode the ioctls associated with the userfaultfd fd.
10578	Note that they tend to read from and also return result in it's data
10579	structure.
10580
10581	* configure.ac (AC_CHECK_HEADERS): Add linux/userfaultfd.h.
10582	* userfaultfd.c [HAVE_LINUX_USERFAULTFD_H]: Add ioctl decoder.
10583	* defs.h (uffdio_ioctl): New prototype.
10584	* ioctl.c (ioctl_decode) [HAVE_LINUX_USERFAULTFD_H]: Wire in
10585	uffdio_ioctl.
10586	* xlat/uffd_*.in: Create flag xlat for all the IOCTLs.
10587
105882016-05-10  Dmitry V. Levin  <ldv@altlinux.org>
10589
10590	Update AX_CODE_COVERAGE.
10591	* m4/ax_code_coverage.m4: Update to serial 16.
10592	* Makefile.am (CODE_COVERAGE_LCOV_OPTIONS): Remove.
10593	(CODE_COVERAGE_GENHTML_OPTIONS): Update, add prefix.
10594	(CODE_COVERAGE_BRANCH_COVERAGE): Set to 1.
10595
10596	strace-ff.test: fix race condition.
10597	* tests/strace-ff.test: Wait for completion of PR_SET_PTRACER command.
10598
10599	tests/epoll_pwait.c: fix for x32.
10600	* tests/epoll_pwait.c (main): Explicitly cast last syscall argument
10601	to kernel_ulong_t.
10602
10603	strace-S.test: check "-S name"
10604	* tests/strace-S.test: Add a check for "-c -S name" output.
10605
10606	Fix NULL dereference in "-S name" when syscall table has holes.
10607	* count.c (syscall_cmp): Do not pass NULL to strcmp.
10608
10609	strace-S.test: cleanup.
10610	* tests/strace-S.test: Rewrite using sed.
10611
106122016-05-09  Fei Jie  <feij.fnst@cn.fujitsu.com>
10613
10614	tests: add strace-S.test.
10615	* tests/strace-S.test: New test.
10616	* tests/Makefile.am (MISC_TESTS): Add it.
10617
106182016-05-09  Dmitry V. Levin  <ldv@altlinux.org>
10619
10620	strace-ff.test: check that -ff does not create unexpected output files.
10621	* tests/strace-ff.expected: New file.
10622	* tests/Makefile.am (EXTRA_DIST): Add it.
10623	* tests/strace-ff.test: Use it.  Check that no other output files
10624	have been created.
10625
106262016-05-09  Fei Jie  <feij.fnst@cn.fujitsu.com>
10627
10628	tests: add strace-ff.test.
10629	* tests/strace-ff.test: New test.
10630	* tests/Makefile.am (MISC_TESTS): Add it.
10631
106322016-05-09  Dmitry V. Levin  <ldv@altlinux.org>
10633
10634	strace-V.test: cleanup.
10635	* tests/strace-V.test: Move config.h parser to a function.
10636	Rename $OUT to $EXP, swap arguments passed to match_diff.
10637
106382016-05-09  Fei Jie  <feij.fnst@cn.fujitsu.com>
10639
10640	tests: add strace-V.test.
10641	* tests/strace-V.test: New test.
10642	* tests/Makefile.am (MISC_TESTS): Add it.
10643
106442016-05-09  Dmitry V. Levin  <ldv@altlinux.org>
10645
10646	tests: check decoding of epoll_pwait syscall.
10647	* tests/epoll_pwait.c: New file.
10648	* tests/epoll_pwait.test: New test.
10649	* tests/.gitignore: Add epoll_pwait.
10650	* tests/Makefile.am (check_PROGRAMS): Likewise.
10651	(DECODER_TESTS): Add epoll_pwait.test.
10652
106532016-05-09  Dmitry V. Levin  <ldv@altlinux.org>
10654
10655	Assume that sys/epoll.h exists.
10656	This header file was added in glibc-2.3.2,
10657	so it's safe to assume its availability.
10658
10659	* configure.ac (AC_CHECK_HEADERS): Remove sys/epoll.h.
10660	* epoll.c: Include <sys/epoll.h> unconditionally.
10661	Compile [HAVE_SYS_EPOLL_H] code unconditionally.
10662	* tests/epoll_ctl.c: Do not check for HAVE_SYS_EPOLL_H.
10663	* tests/epoll_wait.c: Likewise.
10664
106652016-05-08  Fabien Siron  <fabien.siron@epita.fr>
10666
10667	Factorize send_query functions.
10668	* socketutils.c (send_query): New function.
10669	(inet_send_query, unix_send_query): Use it.
10670
106712016-05-08  Dmitry V. Levin  <ldv@altlinux.org>
10672
10673	tests: relax timings.
10674	Allow nanosleep(2) to spend 10% more time to make the test suite
10675	more reliable on slow systems.
10676
10677	* tests/count.test: Treat 1.1 seconds as valid output.
10678	* tests/strace-T.expected: Likewise.
10679	* tests/strace-r.expected: Likewise.
10680
106812016-05-07  Dmitry V. Levin  <ldv@altlinux.org>
10682
10683	tests/attach-f-p.c: increase timeouts.
10684	Increase timeouts to make the test more reliable on slow systems.
10685
10686	* tests/attach-f-p.c (its): Increase timeouts to 1, 2, and 3 seconds,
10687	respectively.
10688
106892016-05-07  Dmitry V. Levin  <ldv@altlinux.org>
10690
10691	Remove unused functions.
10692	* defs.h (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
10693	Remove.
10694	* util.c (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
10695	Likewise.
10696
10697	v4l2.c: use print_array function.
10698	* v4l2.c (print_v4l2_ext_control, umoven_or_printaddr_ignore_syserror):
10699	New functions.
10700	(print_v4l2_ext_controls): Use them via print_array.
10701
10702	uid.c: use print_array function.
10703	* uid.c (print_gid): New function.
10704	(print_groups): Use it via print_array.
10705
10706	seccomp.c: use print_array function.
10707	* seccomp.c (decode_filter, decode_seccomp_fprog): Remove.
10708	(print_bpf_filter): New function.
10709	(print_seccomp_fprog): Use it via print_array.
10710	* tests/seccomp-filter-v.c (main): Update.
10711
10712	scsi.c: use print_array function.
10713	* scsi.c (print_uchar): New function.
10714	(print_sg_io_buffer): Use it via print_array.
10715
10716	poll.c: use print_array function.
10717	* poll.c (print_pollfd): Change for use as print_array callback.
10718	(decode_poll_entering): Use print_array.
10719	* tests/poll.c: Update.
10720	* tests/poll.test: Update.
10721
10722	numa.c: use print_array function.
10723	* numa.c (print_node): New function.
10724	(print_nodemask): Use it via print_array.
10725	(print_page_array, print_int_array): Remove.
10726	(print_addr): New function.
10727	(print_status, print_int): Change for use as print_array callback.
10728	(SYS_FUNC(move_pages)): Use print_addr, print_int, and print_status
10729	via print_array.
10730	* tests/move_pages.c: Update.
10731	* tests/set_mempolicy.c: Likewise.
10732	* tests/set_mempolicy.test: Likewise.
10733
10734	mem.c: use print_array function.
10735	* mem.c [POWERPC] (print_protmap_entry): New function.
10736	[POWERPC] (SYS_FUNC(subpage_prot)): Use it via print_array.
10737
10738	kexec.c: use print_array function.
10739	* kexec.c (print_seg): Change for use as print_array callback.
10740	(print_kexec_segments): Use print_array.
10741
10742	ipc_sem.c: use print_array function.
10743	* ipc_sem.c (tprint_sembuf): Rename to print_sembuf, change signature
10744	for use as print_array callback.
10745	(tprint_sembuf_array): Use print_array.
10746
10747	io.c: use print_array function.
10748	* io.c (print_iovec_config): New structure.
10749	(print_iovec): New function.
10750	(tprint_iov_upto): Use print_array.
10751	* tests/preadv.c (main): Update.
10752	* tests/pwritev.c (print_iovec, main): Likewise.
10753
10754	epoll.c: use print_array function.
10755	* epoll.c (print_epoll_event): Change signature for use as print_array
10756	callback, all users updated.
10757	(print_epoll_event_array): Remove.
10758	(epoll_wait_common): Change to use print_array instead
10759	of print_epoll_event_array.
10760
10761	aio.c: use print_array function.
10762	* aio.c (print_iocbp): New function.
10763	(SYS_FUNC(io_submit)): Use it via print_array.  Use widen_to_long
10764	to process long int argument.
10765	(print_io_event): Change to print struct io_event fetched elsewhere.
10766	(SYS_FUNC(io_cancel)): Update use of print_io_event.
10767	(SYS_FUNC(io_getevents)): Use print_io_event via print_array.
10768	Use widen_to_long to print long int arguments.
10769	* tests/aio.c (main): Check decoding of io_submit with negative "nr".
10770
10771	Introduce print_array function for consistent decoding of arrays.
10772	* defs.h (print_array): New prototype.
10773	* util.c (print_array): New function.
10774
107752016-05-06  Dmitry V. Levin  <ldv@altlinux.org>
10776
10777	Fix corner cases of ICMP_FILTER decoding.
10778	* net.c (print_icmp_filter): Print icmp_filter for any positive length.
10779	* tests/net-icmp_filter.c: New file.
10780	* tests/net-icmp_filter.test: New test.
10781	* tests/.gitignore: Add net-icmp_filter.
10782	* tests/Makefile.am (check_PROGRAMS): Likewise.
10783	(DECODER_TESTS): Add net-icmp_filter.test.
10784
107852016-05-05  Dmitry V. Levin  <ldv@altlinux.org>
10786
10787	xlat: do not strip "1<<" prefix from xlat strings.
10788	* xlat/gen.sh (cond_xlat, gen_header): Do not strip "1<<" prefix
10789	from xlat strings to fix incorrect output.
10790	* tests/caps.awk: Update.
10791
10792	Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10793
107942016-05-05  Dmitry V. Levin  <ldv@altlinux.org>
10795
10796	tests/xstatfsx.c: fix mips o32 support.
10797	mips o32 differs from all other 32-bit architectures by defining
10798	__kernel_fsid_t structure as an array of long ints.
10799
10800	* tests/xstatfsx.c (print_statfs): Explicitly cast elements
10801	of PRINT_F_FSID array to unsigned int.
10802
108032016-05-05  Dmitry V. Levin  <ldv@altlinux.org>
10804
10805	Mpersify VIDIOC_* ioctl parser.
10806	* v4l2.c: Mpersify arch-specific structures.
10807	(v4l2_ioctl): Mpersify.
10808	* tests/ioctl_v4l2.c: New file.
10809	* tests/ioctl_v4l2.test: New test.
10810	* tests/.gitignore: Add ioctl_v4l2.
10811	* tests/Makefile.am (check_PROGRAMS): Likewise.
10812	(DECODER_TESTS): Add ioctl_v4l2.test.
10813
108142016-05-05  Dmitry V. Levin  <ldv@altlinux.org>
10815
10816	Mpersify ioctl macros.
10817	As values of some ioctl macros differ between personalities, these
10818	personality specific ioctl macros should be properly defined for
10819	mpersified code.  Implement this by redefining personality specific
10820	ioctl macros from ioctlent*.h for each file that includes MPERS_DEFS.
10821
10822	* Makefile.am (ioctl_macros_h): New variable.
10823	(ioctl_macros%.h): New rule.
10824	(BUILT_SOURCES, CLEANFILES): Add $(ioctl_macros_h).
10825	(m%_type_defs.h): #include MPERS_$(mpers_PREFIX)IOCTL_MACROS.
10826	* defs.h [HAVE_M32_MPERS] (MPERS_m32_IOCTL_MACROS): New macro.
10827	[HAVE_MX32_MPERS] (MPERS_mx32_IOCTL_MACROS): Likewise.
10828
10829	Acked-by: Elvira Khabirova <lineprinter0@gmail.com>
10830
108312016-05-05  Dmitry V. Levin  <ldv@altlinux.org>
10832
10833	Fix decoding of VIDIOC_* ioctls.
10834	* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
10835	* tests/ioctl.c (main): Update.
10836
108372016-05-05  Dmitry V. Levin  <ldv@altlinux.org>
10838
10839	nsyscalls.test: add mips o32 support.
10840	Out-of-range syscalls looks differently on mips o32.
10841
10842	* tests/nsyscalls.c (main): Handle LINUX_MIPSO32.
10843	* tests/nsyscalls.test: Trace syscall called "syscall" on mips.
10844
108452016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10846
10847	Remove initialization of big holes in syscallent.h files.
10848	There is no need to explicitly initialize big holes after conversion
10849	of syscallent.h files to use designated initializers.  For architectures
10850	that have some data at the end of syscallent.h this initialization of
10851	big holes is no-op, for others it just inflates the table unnecessarily.
10852
10853	* linux/arc/syscallent.h: Remove initialization of arch specific block
10854	at the end of table.
10855	* linux/metag/syscallent.h: Likewise.
10856	* linux/nios2/syscallent.h: Likewise.
10857	* linux/or1k/syscallent.h: Likewise.
10858	* linux/tile/syscallent.h: Likewise.
10859	* linux/tile/syscallent1.h: Likewise.
10860	* linux/arm/syscallent.h: Remove explicit initialization of a big hole
10861	before socket subcalls.
10862	* linux/i386/syscallent.h: Likewise.
10863	* linux/m68k/syscallent.h: Likewise.
10864	* linux/mips/syscallent-n32.h: Likewise.
10865	* linux/powerpc/syscallent.h: Likewise.
10866	* linux/powerpc64/syscallent.h: Likewise.
10867	* linux/s390/syscallent.h: Likewise.
10868	* linux/s390x/syscallent.h: Likewise.
10869	* linux/sh/syscallent.h: Likewise.
10870	* linux/sh64/syscallent.h: Likewise.
10871	* linux/sparc/syscallent.h: Likewise.
10872	* linux/sparc64/syscallent.h: Likewise.
10873	* linux/mips/syscallent-compat.h: Remove explicit initialization
10874	of big holes between different mips ABIs.
10875	* linux/mips/syscallent-n64.h: Remove explicit initialization
10876	of big holes before socket subcalls and between different mips ABIs.
10877	* linux/mips/syscallent-o32.h: Likewise.
10878
108792016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10880
10881	xlat: make "1<<val" syntax work with 64-bit values.
10882	* xlat/gen.sh(cond_xlat, gen_header): Generate 1UUL<<val
10883	for 1<<val syntax.
10884
10885	Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10886
108872016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10888
10889	Fix typo in XLAT_TYPE_PAIR.
10890	* xlat.h (XLAT_TYPE_PAIR): Take "type" parameter.
10891
10892	Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
10893
108942016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10895
10896	Fix decoding of move_pages syscall.
10897	* numa.c (print_page_array, print_status, print_int, print_int_array):
10898	New functions.
10899	(SYS_FUNC(move_pages)): Rewrite using these functions.
10900	* tests/move_pages.c: New file.
10901	* tests/move_pages.test: New test.
10902	* tests/.gitignore: Add move_pages.
10903	* tests/Makefile.am (check_PROGRAMS): Likewise.
10904	(DECODER_TESTS): Add move_pages.test.
10905
10906	tests: check decoding of mbind syscall.
10907	* tests/mbind.c: New file.
10908	* tests/mbind.test: New test.
10909	* tests/.gitignore: Add mbind.
10910	* tests/Makefile.am (check_PROGRAMS): Likewise.
10911	(DECODER_TESTS): Add mbind.test.
10912
109132016-04-29  Jeff Mahoney  <jeffm@suse.com>
10914
10915	Change type of struct xlat.val to uint64_t.
10916	Some ioctls have flags fields that are 64-bit.  A 32-bit val means
10917	these flags will never be matched or printed.
10918
10919	* xlat.h: Include <stdint.h>.
10920	(struct xlat): Change type of val to uint64_t.
10921
109222016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10923
10924	xlat: extend syntax with #val_type directive.
10925	When #val_type directive is encountered, gen.sh starts using
10926	XLAT_TYPE/XLAT_TYPE_PAIR macros instead of XLAT/XLAT_PAIR,
10927	with #val_type's argument as a type.
10928
10929	For example, "#val_type uint64_t" means values of type uint64_t.
10930
10931	* xlat/gen.sh (gen_header, print_xlat, print_xlat_pair):
10932	Add val_type support.
10933
109342016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10935
10936	xlat/gen.sh: prepare for adding #val_type directive support.
10937	This is essentially a no-op change that makes the following change
10938	easier to read.
10939
10940	* xlat/gen.sh (print_xlat, print_xlat_pair): New functions.
10941	(cond_xlat, gen_header): Use them.
10942
109432016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10944
10945	Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros.
10946	* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
10947	to the specified type instead of unsigned int.
10948	(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
10949	to the specified type instead of unsigned int.
10950
109512016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10952
10953	xlat: generate xlat pairs using new XLAT_PAIR macro.
10954	Before this change there were two forms of xlat entries: those that use XLAT
10955	or XLAT_END macros, and others verbatim entries.  This change converts
10956	the latter to use new XLAT_PAIR macro.
10957
10958	This is necessary for the upcoming change of xlat.val type.
10959
10960	* xlat.h (XLAT_PAIR): New macro.
10961	* xlat/gen.sh (cond_xlat, gen_header): Use it.
10962
109632016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10964
10965	Explicitly cast argument of XLAT macro to unsigned int.
10966	This is necessary for the upcoming change of xlat.val type.
10967
10968	* xlat.h (XLAT): Cast the argument to unsigned int.
10969
109702016-04-29  Dmitry V. Levin  <ldv@altlinux.org>
10971
10972	Change type of {s,t}print_open_modes's argument to unsigned.
10973	As "flags" argument of sprint_open_modes and tprint_open_modes is
10974	involved only in bit operations, change its type to unsigned.
10975
10976	* defs.h.c (sprint_open_modes, tprint_open_modes): Change type
10977	to unsigned int.
10978	* open.c (sprint_open_modes, tprint_open_modes): Likewise.
10979
109802016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
10981
10982	tests/remap_file_pages.c: fix for the upcoming change of xlat.val type.
10983	The "flags" argument of remap_file_page syscall has type "unsigned
10984	long", so it is not correct to load most significant bits with garbage
10985	ans assume they are going to be ignored.
10986
10987	* tests/remap_file_pages.c (main): Remove artificial garbage from flags.
10988
109892016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
10990
10991	Introduce printflags64 function.
10992	This is necessary for the upcoming change of xlat.val type.
10993
10994	* defs.h (printflags): Rename to printflags64, change type of integer
10995	argument to uint64_t.
10996	(printflags): New static inline function.
10997	* util.c (printflags): Rename to printflags64, change type of integer
10998	argument to uint64_t.  Print it using PRIx64 format.
10999	Based on patch by Jeff Mahoney <jeffm@suse.com>.
11000
110012016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11002
11003	Introduce sprintflags64 function.
11004	This is necessary for the upcoming change of xlat.val type.
11005
11006	* defs.h (sprintflags): Rename to sprintflags64, change type of integer
11007	argument to uint64_t.
11008	(sprintflags): New static inline function.
11009	* util.c (sprintflags): Rename to sprintflags64, change type of integer
11010	argument to uint64_t.  Print it using PRIx64 format.
11011	Based on patch by Jeff Mahoney <jeffm@suse.com>.
11012
110132016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11014
11015	printxvals: change type of integer argument to uint64_t.
11016	This is necessary for the upcoming change of xlat.val type.
11017	All users of printxvals are already prepared for this change.
11018
11019	* defs.h (printxvals): Change type of integer argument to uint64_t.
11020	* util.c (printxvals): Likewise.  Print it using PRIx64 format.
11021	Patch by Jeff Mahoney <jeffm@suse.com>.
11022
110232016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11024
11025	xlat_search: change type of integer argument to uint64_t.
11026	This is necessary for the upcoming change of xlat.val type.
11027	All users of addflags are already prepared for this change.
11028
11029	* defs.h (xlat_search): Change type of integer argument to uint64_t.
11030	* util.c (xlat_search): Likewise.  Pass it by pointer.
11031	(xlat_bsearch_compare): Treat first argument as a pointer.
11032	Patch by Jeff Mahoney <jeffm@suse.com>.
11033
110342016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11035
11036	Introduce xlookup64 function.
11037	This is necessary for the upcoming change of xlat.val type.
11038
11039	* defs.h (xlookup): Rename to xlookup64, change type of integer argument
11040	to uint64_t.
11041	(xlookup): New static inline function.
11042	* util.c (xlookup): Rename to xlookup64, change type of integer
11043	argument to uint64_t.
11044	Based on patch by Jeff Mahoney <jeffm@suse.com>.
11045
110462016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11047
11048	addflags: change type of integer argument to uint64_t.
11049	This is necessary for the upcoming change of xlat.val type.
11050	All users of addflags are already prepared for this change.
11051
11052	* defs.h (addflags): Change type of integer argument to uint64_t.
11053	* util.c (addflags): Likewise.  Print it using PRIx64 format.
11054	Based on patch by Jeff Mahoney <jeffm@suse.com>.
11055
110562016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11057
11058	Introduce printxval64 wrapper.
11059	This is necessary for the upcoming change of xlat.val type.
11060
11061	* defs.h (printxval64): New static inline function.
11062
110632016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11064
11065	Turn printxval macro into a static inline function.
11066	This is necessary for the upcoming change of xlat.val type.
11067
11068	* defs.h (printxval): Change to static inline function.
11069
110702016-04-28  Dmitry V. Levin  <ldv@altlinux.org>
11071
11072	tests: check decoding of migrate_pages syscall.
11073	* tests/migrate_pages.c: New file.
11074	* tests/migrate_pages.test: New test.
11075	* tests/.gitignore: Add migrate_pages.
11076	* tests/Makefile.am (check_PROGRAMS): Likewise.
11077	(DECODER_TESTS): Add migrate_pages.test.
11078
11079	Fix decoding of migrate_pages syscall.
11080	* numa.c (SYS_FUNC(migrate_pages)): Print syscall arguments
11081	in the right order.
11082
11083	tests: check decoding of set_mempolicy syscall.
11084	* tests/set_mempolicy.c: New file.
11085	* tests/set_mempolicy.test: New test.
11086	* tests/.gitignore: Add set_mempolicy.
11087	* tests/Makefile.am (check_PROGRAMS): Likewise.
11088	(DECODER_TESTS): Add set_mempolicy.test.
11089
11090	tests: check decoding of get_mempolicy syscall.
11091	* tests/get_mempolicy.c: New file.
11092	* tests/get_mempolicy.test: New test.
11093	* tests/.gitignore: Add get_mempolicy.
11094	* tests/Makefile.am (check_PROGRAMS): Likewise.
11095	(DECODER_TESTS): Add get_mempolicy.test.
11096
11097	numa: fix decoding of nodemask arrays.
11098	* numa.c (get_nodes): Rewrite an rename to print_nodemask.
11099	All callers updated.
11100	(SYS_FUNC(mbind), SYS_FUNC(set_mempolicy), SYS_FUNC(get_mempolicy)):
11101	Print a delimiter before nodemask argument.
11102
111032016-04-27  Dmitry V. Levin  <ldv@altlinux.org>
11104
11105	Fix decoding of policy argument of get_mempolicy syscall.
11106	* numa.c (SYS_FUNC(get_mempolicy)): Print policy argument in square
11107	brackets to indicate indirect access.
11108
11109	Fix decoding of pid_t argument of migrate_pages syscall.
11110	* numa.c (SYS_FUNC(migrate_pages)): Print pid_t syscall
11111	argument using %d format.
11112
11113	tests: add printxval function to libtests.
11114	* tests/tests.h (printxval): New prototype.
11115	* tests/printxval.c: New file.
11116	* tests/Makefile.am  (libtests_a_SOURCES): Add it.
11117
11118	tests: check decoding of remap_file_pages syscall.
11119	* tests/remap_file_pages.c: New file.
11120	* tests/remap_file_pages.test: New test.
11121	* tests/.gitignore: Add remap_file_pages.
11122	* tests/Makefile.am (check_PROGRAMS): Likewise.
11123	(DECODER_TESTS): Add remap_file_pages.test.
11124
111252016-04-27  Fei Jie  <feij.fnst@cn.fujitsu.com>
11126
11127	tests: add pause.test.
11128	* tests/pause.c: New file.
11129	* tests/pause.test: New test.
11130	* tests/.gitignore: Add pause.
11131	* tests/Makefile.am (check_PROGRAMS): Likewise.
11132	(DECODER_TESTS): Add pause.test.
11133
11134	tests: add kill.test.
11135	* tests/kill.c: New file.
11136	* tests/kill.test: New test.
11137	* tests/.gitignore: Add kill.
11138	* tests/Makefile.am (check_PROGRAMS): Likewise.
11139	(DECODER_TESTS): Add kill.test.
11140
111412016-04-27  Dmitry V. Levin  <ldv@altlinux.org>
11142
11143	Fix decoding of pid_t arguments of kill and tgkill syscalls.
11144	* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Print pid_t syscall
11145	arguments using %d format.
11146
111472016-04-27  Fei Jie  <feij.fnst@cn.fujitsu.com>
11148
11149	tests: add mlock.test.
11150	* tests/mlock.c: New file.
11151	* tests/mlock.test: New test.
11152	* tests/.gitignore: Add mlock.
11153	* tests/Makefile.am (check_PROGRAMS): Likewise.
11154	(DECODER_TESTS): Add mlock.test.
11155
111562016-04-27  Dmitry V. Levin  <ldv@altlinux.org>
11157
11158	Move parsers of NUMA related syscalls to numa.c.
11159	* mem.c (get_nodes, SYS_FUNC(mbind), SYS_FUNC(set_mempolicy),
11160	SYS_FUNC(get_mempolicy), SYS_FUNC(migrate_pages), SYS_FUNC(move_pages)):
11161	Move ...
11162	* numa.c: ... here.
11163	* Makefile.am (strace_SOURCES): Add numa.c
11164
11165	tests/umovestr3.c: robustify against os specific issues.
11166	* tests/umovestr3.c (main): Create extra gap before unreadable page.
11167
11168	tests: extend test coverage of umovestr short read condition.
11169	* tests/umovestr3.c: New file.
11170	* tests/umovestr3.test: New test.
11171	* tests/.gitignore: Add umovestr3.
11172	* tests/Makefile.am (check_PROGRAMS): Likewise.
11173	(DECODER_TESTS): Add umovestr3.test.
11174
11175	tests: check decoding of out-of-range syscalls.
11176	* tests/nsyscalls.c: New file.
11177	* tests/nsyscalls.test: New test.
11178	* tests/.gitignore: Add nsyscalls.
11179	* tests/Makefile.am (check_PROGRAMS): Likewise.
11180	(DECODER_TESTS): Add nsyscalls.test.
11181
111822016-04-26  Dmitry V. Levin  <ldv@altlinux.org>
11183
11184	Fix decoding of 3rd argument of getdents/getdents64 syscalls.
11185	* dirent.c (SYS_FUNC(getdents)): Always print 3rd syscall argument
11186	as unsigned int.
11187	* dirent64.c (SYS_FUNC(getdents64)): Likewise.
11188	* tests/getdents.c (main): Check it.
11189	* tests/getdents64.c (main): Likewise.
11190
11191	Fix decoding of LINUX_REBOOT_CMD_RESTART2 argument.
11192	* reboot.c (SYS_FUNC(reboot)): Cast numeric arguments to unsigned int.
11193
111942016-04-26  Dmitry V. Levin  <ldv@altlinux.org>
11195
11196	.travis.yml: raise sleep delay.
11197	Previous sleep delay value seems to be not enough nowadays.
11198
11199	.travis.yml (SLEEP_A_BIT): Raise sleep delay.
11200
112012016-04-26  Dmitry V. Levin  <ldv@altlinux.org>
11202
11203	Move definitions of MPOL_* constants to xlat files.
11204	* mem.c (MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, MPOL_INTERLEAVE):
11205	Move to xlat/policies.in.
11206	(MPOL_F_NODE, MPOL_F_ADDR): Move to xlat/mempolicyflags.in.
11207	(MPOL_MF_STRICT, MPOL_MF_MOVE, MPOL_MF_MOVE_ALL): Move
11208	to xlat/mbindflags.in.
11209
11210	tests: check decoding of renameat2 syscall.
11211	* tests/renameat2.c: New file.
11212	* tests/renameat2.test: New test.
11213	* tests/.gitignore: Add renameat2.
11214	* tests/Makefile.am (check_PROGRAMS): Likewise.
11215	(DECODER_TESTS): Add renameat2.test.
11216
11217	Add default values for RENAME_* constants.
11218	* xlat/rename_flags.in: Add default values.
11219
11220	tests: check decoding of utimes syscall.
11221	* tests/utimes.c: New file.
11222	* tests/utimes.test: New test.
11223	* tests/.gitignore: Add utimes.
11224	* tests/Makefile.am (check_PROGRAMS): Likewise.
11225	(DECODER_TESTS): Add utimes.test.
11226
11227	tests: check decoding of futimesat syscall.
11228	* tests/futimesat.c: New file.
11229	* tests/futimesat.test: New test.
11230	* tests/.gitignore: Add futimesat.
11231	* tests/Makefile.am (check_PROGRAMS): Likewise.
11232	(DECODER_TESTS): Add futimesat.test.
11233
11234	tests: extend test coverage of mknod syscall.
11235	* mknod.c (main): Check more corner cases of mode_t parser.
11236	* mknod.test: Update.
11237
112382016-04-26  Fei Jie  <feij.fnst@cn.fujitsu.com>
11239
11240	tests: add sched_yield.test.
11241	* tests/sched_yield.c: New file.
11242	* tests/sched_yield.test: New test.
11243	* tests/.gitignore: Add sched_yield.
11244	* tests/Makefile.am (check_PROGRAMS): Likewise.
11245	(DECODER_TESTS): Add sched_yield.test.
11246
11247	tests: add sync.test.
11248	* tests/sync.c: New file.
11249	* tests/sync.test: New test.
11250	* tests/.gitignore: Add sync.
11251	* tests/Makefile.am (check_PROGRAMS): Likewise.
11252	(DECODER_TESTS): Add sync.test.
11253
11254	tests: add mknodat.test.
11255	* tests/mknodat.c: New file.
11256	* tests/mknodat.test: New test.
11257	* tests/.gitignore: Add mknodat.
11258	* tests/Makefile.am (check_PROGRAMS): Likewise.
11259	(DECODER_TESTS): Add mknodat.test.
11260
11261	tests: add unlink.test.
11262	* tests/unlink.c: New file.
11263	* tests/unlink.test: New test.
11264	* tests/.gitignore: Add unlink.
11265	* tests/Makefile.am (check_PROGRAMS): Likewise.
11266	(DECODER_TESTS): Add unlink.test.
11267
11268	tests: add reboot.test.
11269	* tests/reboot.c: New file.
11270	* tests/reboot.test: New test.
11271	* tests/.gitignore: Add reboot.
11272	* tests/Makefile.am (check_PROGRAMS): Likewise.
11273	(DECODER_TESTS): Add reboot.test.
11274
112752016-04-26  Dmitry V. Levin  <ldv@altlinux.org>
11276
11277	Fix decoding of statfs family syscalls.
11278	Fix decoders of fstatfs, fstatfs64, statfs, and statfs64 syscalls
11279	by rewriting them using mpers infrastructure.
11280
11281	* fetch_struct_statfs.c: New file.
11282	* fstatfs.c: Likewise.
11283	* fstatfs64.c: Likewise.
11284	* print_statfs.c: Likewise.
11285	* statfs.h: Likewise.
11286	* statfs64.c: Likewise.
11287	* statfs.c: Remove everything except SYS_FUNC(statfs).
11288	* configure.ac: Remove the check for struct statfs64 in <sys/vfs.h>.
11289	Add checks for struct statfs and struct statfs64 in <asm/statfs.h>.
11290	Add checks for f_frsize and f_flags members of these structures.
11291	* defs.h (struct strace_statfs): New forward declaration.
11292	(print_struct_statfs, print_struct_statfs64): New prototypes.
11293	* Makefile.am (libstrace_a_SOURCES): Add fstatfs.c, fstatfs64.c,
11294	statfs.c, and statfs64.c.
11295	(strace_SOURCES): Add fetch_struct_statfs.c, print_statfs.c,
11296	and statfs.h.
11297	* NEWS: Mention this fix.
11298	* tests/fstatfs.c: New file.
11299	* tests/fstatfs64.c: Likewise.
11300	* tests/statfs64.c: Likewise.
11301	* tests/xstatfs.c: Likewise.
11302	* tests/xstatfs64.c: Likewise.
11303	* tests/xstatfsx.c: Likewise.
11304	* tests/fstatfs.test: New test.
11305	* tests/fstatfs64.test: Likewise.
11306	* tests/statfs64.test: Likewise.
11307	* tests/statfs.c: Rewrite using xstatfs.c.
11308	* tests/statfs.test: Update.
11309	* tests/.gitignore: Add fstatfs, fstatfs64, and statfs64.
11310	* tests/Makefile.am (check_PROGRAMS): Likewise.
11311	(DECODER_TESTS): Add  fstatfs.test, fstatfs64.test, and statfs64.test.
11312	(EXTRA_DIST): Add xstatfs.c, xstatfs64.c, and xstatfsx.c.
11313
113142016-04-26  Dmitry V. Levin  <ldv@altlinux.org>
11315
11316	tests: add printflags function to libtests.
11317	* tests/printflags.c: New file.
11318	* tests/tests.h (printflags): New prototype.
11319	* tests/Makefile.am (libtests_a_SOURCES): Add it.
11320
113212016-04-26  Dmitry V. Levin  <ldv@altlinux.org>
11322
11323	Move definition of struct xlat to a separate header file.
11324	Define struct xlat in a separate file so that it could be used later by
11325	tests without inclusion of defs.h header file.
11326
11327	* defs.h (struct xlat, XLAT, XLAT_END): Move ...
11328	* xlat.h: ... here.
11329	* Makefile.am (strace_SOURCES): Add xlat.h.
11330
113312016-04-25  Dmitry V. Levin  <ldv@altlinux.org>
11332
11333	alpha: decode osf_statfs64 and osf_fstatfs64 syscalls.
11334	* linux/alpha/syscallent.h (osf_statfs64, osf_fstatfs64): Set nargs
11335	and handler.
11336
113372016-04-25  Dmitry V. Levin  <ldv@altlinux.org>
11338
11339	alpha: fix decoding of osf_statfs and osf_fstatfs syscalls.
11340	Do not attempt to print struct osf_statfs as if it was the same as
11341	struct statfs.  Since struct osf_statfs has never been decoded properly,
11342	it is probably too late to implement a decoder, so let's just print the
11343	pointer.
11344
11345	* statfs.c [ALPHA] (SYS_FUNC(osf_statfs), SYS_FUNC(osf_fstatfs)): Move ...
11346	* alpha.c: ... here.  Replace printstatfs with printaddr.
11347
113482016-04-25  Dmitry V. Levin  <ldv@altlinux.org>
11349
11350	statfs: print f_flags field only when ST_VALID flag is set.
11351	* statfs.c (print_statfs_flags): New function.
11352	(printstatfs, printstatfs64, printcompat_statfs64): Use it.
11353	* xlat/statfs_flags.in (ST_VALID): Move to the head of the list.
11354	* tests/statfs.expected: Update.
11355
113562016-04-25  Fei Jie  <feij.fnst@cn.fujitsu.com>
11357
11358	tests: add symlink.test.
11359	* tests/symlink.c: New file.
11360	* tests/symlink.test: New test.
11361	* tests/.gitignore: Add symlink.
11362	* tests/Makefile.am (check_PROGRAMS): Likewise.
11363	(DECODER_TESTS): Add symlink.test.
11364
11365	tests: add rmdir.test.
11366	* tests/rmdir.c: New file.
11367	* tests/rmdir.test: New test.
11368	* tests/.gitignore: Add rmdir.
11369	* tests/Makefile.am (check_PROGRAMS): Likewise.
11370	(DECODER_TESTS): Add rmdir.test.
11371
11372	tests: add setdomainname.test.
11373	* tests/setdomainname.c: New file.
11374	* tests/setdomainname.test: New test.
11375	* tests/.gitignore: Add setdomainname.
11376	* tests/Makefile.am (check_PROGRAMS): Likewise.
11377	(DECODER_TESTS): Add setdomainname.test.
11378
11379	tests: add sched_rr_get_interval.test.
11380	* tests/sched_rr_get_interval.c: New file.
11381	* tests/sched_rr_get_interval.test: New test.
11382	* tests/.gitignore: Add sched_rr_get_interval.
11383	* tests/Makefile.am (check_PROGRAMS): Likewise.
11384	(DECODER_TESTS): Add sched_rr_get_interval.test.
11385
113862016-04-25  Dmitry V. Levin  <ldv@altlinux.org>
11387
11388	statfs: decode f_flags field of struct statfs.
11389	* xlat/statfs_flags.in: New file.
11390	* statfs.c: Include "xlat/statfs_flags.h".
11391	(printstatfs) [_STATFS_F_FLAGS]: Print statbuf.f_flags as flags.
11392	(printstatfs64) [_STATFS_F_FLAGS]: Likewise.
11393	(printcompat_statfs64): Likewise.
11394	* tests/statfs.expected: Update.
11395
113962016-04-25  Zev Weiss  <zev@bewilderbeest.net>
11397
11398	statfs: don't quote f_type macro names.
11399	* statfs.c (sprintfstype): Don't add double-quotes to fs magic macros.
11400	* tests/statfs.expected: Remove double-quotes.
11401
114022016-04-25  Dmitry V. Levin  <ldv@altlinux.org>
11403
11404	tests/shmxt.c: robustify against arch specific issues.
11405	Do not treat failed shmat(SHM_RND) as a test failure.
11406	This change partially reverts commit
11407	bea707377d2ee3e1950bfa43537ef928163a5fa6.
11408
11409	* tests/shmxt.c (main): Use SHM_RND in the second shmat call,
11410	do not treat its potential error as a test failure.
11411
114122016-04-23  Dmitry V. Levin  <ldv@altlinux.org>
11413
11414	Rename PRI__s64 to PRI__d64.
11415	As PRI__*64 macros mirror PRI*64 macros from inttypes.h, follow the
11416	principle of least astonishment and name these macros the same way.
11417
11418	* defs.h (PRI__s64): Rename to PRI__d64.
11419
114202016-04-23  Dmitry V. Levin  <ldv@altlinux.org>
11421
11422	Fix old_mmap output when mmap arguments are unfetchable.
11423	* mem.c (SYS_FUNC(old_mmap)): Use umove_or_printaddr instead of umoven
11424	to fetch mmap arguments, return RVAL_DECODED when umove_or_printaddr
11425	fails.
11426	* tests/old_mmap.c (main): Check it.
11427
114282016-04-22  Dmitry V. Levin  <ldv@altlinux.org>
11429
11430	aarch64: fix old_mmap output for arm personality.
11431	* mem.c (SYS_FUNC(old_mmap)) [AARCH64]: Fetch mmap arguments
11432	as 32-bit integers.
11433
11434	Define old_mmap parser only on architectures that use it.
11435	* mem.c (SYS_FUNC(old_mmap)): Define only on AARCH64, ARM, I386, X86_64,
11436	X32, M68K, S390, and S390X.
11437
114382016-04-22  Dmitry V. Levin  <ldv@altlinux.org>
11439
11440	tests: extend test coverage of mmap syscall.
11441	Check decoding of "old mmap" edition of mmap syscall
11442	on those architectures that define it.
11443
11444	* tests/old_mmap.c: New file.
11445	* tests/old_mmap.test: New test.
11446	* tests/.gitignore: Add old_mmap.
11447	* tests/Makefile.am (check_PROGRAMS): Likewise.
11448	(DECODER_TESTS): Add old_mmap.test.
11449
114502016-04-22  Dmitry V. Levin  <ldv@altlinux.org>
11451
11452	tests: extend test coverage of mincore syscall.
11453	* tests/mincore.c (print_mincore): New function.
11454	(test_mincore): Use it.  Check mincore with invalid vec address.
11455	Check mincore with length argument not a multiple of the page size.
11456	(main): Check with DEFAULT_STRLEN pages.
11457
114582016-04-22  Dmitry V. Levin  <ldv@altlinux.org>
11459
11460	Move parsers of sync_file_range and sync_file_range2 syscalls to libstrace
11461	For each given architecture only one of these two syscalls has a
11462	syscallent entry.  When each parser is placed into a separate file,
11463	moving to libstrace ensures that only one of them that is need
11464	is linked into strace executable.
11465
11466	* sync_file_range.c (SYS_FUNC(sync_file_range2)): Move ...
11467	* sync_file_range2.c: ... here.
11468	* Makefile.am (strace_SOURCES): Move sync_file_range.c ...
11469	(libstrace_a_SOURCES): ... here.  Add sync_file_range2.c.
11470	(strace_SOURCES_c): Add filtered libstrace_a_SOURCES.
11471
114722016-04-22  Dmitry V. Levin  <ldv@altlinux.org>
11473
11474	tests: check decoding of clock_adjtime syscall.
11475	* tests/clock_adjtime.c: New file.
11476	* tests/clock_adjtime.test: New test.
11477	* tests/.gitignore: Add clock_adjtime.
11478	* tests/Makefile.am (check_PROGRAMS): Likewise.
11479	(DECODER_TESTS): Add clock_adjtime.test.
11480
114812016-04-21  Dmitry V. Levin  <ldv@altlinux.org>
11482
11483	tests: do not include <assert.h> unnecessarily.
11484	Automatically change tests/*.c files using the following script:
11485
11486	for f in tests/*.c; do
11487		grep -q '\<assert(' "$f" ||
11488			sed -i '/# *include *<assert\.h>/d' "$f"
11489	done
11490
114912016-04-21  Dmitry V. Levin  <ldv@altlinux.org>
11492
11493	tests: do not include <errno.h> unnecessarily.
11494	Automatically change tests/*.c files using the following script:
11495
11496	for f in tests/*.c; do
11497		grep -Fv errno.h "$f" |
11498		grep -Ewq '(si_)?errno|SOCK_FILTER_DENY_SYSCALL' ||
11499			sed -i '/# *include *<errno\.h>/d' "$f"
11500	done
11501
115022016-04-21  Dmitry V. Levin  <ldv@altlinux.org>
11503
11504	tests/xetpriority.c: print syscall() result using %ld format.
11505
11506	tests/xetpgid.c: print syscall() result using %ld format.
11507
11508	tests/xchownx.c: use errno2name.
11509
11510	tests/userfaultfd.c: stop using assert.
11511
11512	tests/unlinkat.c: print syscall() result using %ld format.
11513
11514	tests/umount.c: use errno2name.
11515
11516	tests/truncate64.c: cleanup.
11517	* tests/truncate64.c (main): Use errno2name, stop using assert.
11518
11519	tests/truncate.c: cleanup.
11520	* tests/truncate.c (main): Use errno2name, stop using assert.
11521
11522	tests/tee.c: stop using assert.
11523
11524	tests/syslog.c: use errno2name.
11525
11526	tests/sync_file_range2.c: stop using assert.
11527
11528	tests/sync_file_range.c: stop using assert.
11529
11530	tests/symlinkat.c: cleanup.
11531
11532	tests/swap.c: cleanup.
11533	* tests/swap.c (error_msg): Remove.
11534	(main): Use errno2name.
11535
11536	tests/splice.c: stop using assert.
11537
11538	tests/setugid.c: cleanup.
11539
11540	tests/sethostname.c: use errno2name.
11541
11542	tests/setgroups.c: use errno2name.
11543	* tests/setgroups.c (errno2str): Remove.
11544	(main): Use errno2name.
11545
11546	tests/seccomp-strict.c: cleanup.
11547	* tests/seccomp-strict.c (main): Use errno2name, stop using assert.
11548
11549	tests/seccomp-filter.c: cleanup.
11550	* tests/seccomp-filter.c (main): Use errno2name, stop using assert.
11551
11552	tests/sched_xetscheduler.c: print syscall() result using %ld format.
11553
11554	tests/sched_xetparam.c: print syscall() result using %ld format.
11555
11556	tests/renameat.c: print syscall() result using %ld format.
11557
11558	tests/rename.c: print syscall() result using %ld format.
11559
11560	tests/readv.c: cleanup.
11561
11562	tests/pwritev.c: use errno2name.
11563
11564	tests/preadv-pwritev.c: cleanup.
11565
11566	tests/prctl-seccomp-strict.c: cleanup.
11567	* tests/prctl-seccomp-strict.c (main): Use errno2name,
11568	stop using assert.
11569
11570	tests/openat.c: use errno2name.
11571
11572	tests/open.c: use errno2name.
11573
11574	tests/mlockall.c: cleanup.
11575
11576	tests/mlock2.c: stop using assert.
11577
11578	tests/mknod.c: print syscall() result using %ld format.
11579
11580	tests/mkdirat.c: print syscall() result using %ld format.
11581
11582	tests/lseek.c: cleanup.
11583	* tests/lseek.c (main): Use errno2name, stop using assert.
11584
11585	tests/llseek.c: cleanup.
11586	* tests/llseek.c (main): Use errno2name, stop using assert.
11587
11588	tests/linkat.c: print syscall() result using %ld format.
11589
11590	tests/iopl.c: use errno2name.
11591
11592	tests/ioperm.c: use errno2name.
11593
11594	tests/getgroups.c: use errno2name.
11595	* tests/getgroups.c (errno2str): Remove.
11596	(main): Use errno2name.
11597
11598	tests/ftruncate64.c: cleanup.
11599	* tests/ftruncate64.c (main): Use errno2name, stop using assert.
11600
11601	tests/ftruncate.c: cleanup.
11602	* tests/ftruncate.c (main): Use errno2name, stop using assert.
11603
11604	tests/fsync.c: print syscall() result using %ld format.
11605
11606	tests/flock.c: print syscall() result using %ld format.
11607
11608	tests/file_handle.c: use errno2name.
11609
11610	tests/fdatasync.c: print syscall() result using %ld format.
11611
11612	tests/fchownat.c: use errno2name.
11613
11614	tests/fchmodat.c: use errno2name.
11615
11616	tests/fchmod.c: use errno2name.
11617
11618	tests/faccessat.c: print syscall() result using %ld format.
11619
11620	tests/epoll_wait.c: print syscall() result using %ld format.
11621
11622	tests/epoll_ctl.c: print syscall() result using %ld format.
11623
11624	tests/epoll_create1.c: cleanup.
11625	* tests/epoll_create1.c (main): Use errno2name, stop using assert.
11626
11627	tests/epoll_create.c: print syscall() result using %ld format.
11628
11629	tests/dup3.c: print syscall() result using %ld format.
11630
11631	tests/dup2.c: print syscall() result using %ld format.
11632
11633	tests/dup.c: cleanup.
11634
11635	tests/creat.c: stop using sys/stat.h.
11636
11637	tests/copy_file_range.c: stop using assert.
11638
11639	tests/chroot.c: use errno2name.
11640
11641	tests/aio.c: use errno2name.
11642
11643	tests: cleanup acct.test.
11644	* tests/acct.c (main): Use errno2name, stop using assert,
11645	change sample file name.
11646	* tests/acct.test: Update.
11647
11648	tests: use errno2name()
11649	Automatically change tests/*.c files using the following sed regexp:
11650	sed -i 's/errno == E[[:alnum:]]\+ ? "E[[:alnum:]]\+" : "E[[:alnum:]]\+"/errno2name()/g'
11651
11652	tests/dup.c: include "tests.h"
11653	This is going to be necessary for the following commit.
11654
116552016-04-21  Fei Jie  <feij.fnst@cn.fujitsu.com>
11656
11657	tests: add getpgrp.test.
11658	* tests/getpgrp.c: New file.
11659	* tests/getpgrp.test: New test.
11660	* tests/.gitignore: Add getpgrp.
11661	* tests/Makefile.am (check_PROGRAMS): Likewise.
11662	(DECODER_TESTS): Add getpgrp.test.
11663
11664	tests: add access.test.
11665	* tests/access.c: New file.
11666	* tests/access.test: New test.
11667	* tests/.gitignore: Add access.
11668	* tests/Makefile.am (check_PROGRAMS): Likewise.
11669	(DECODER_TESTS): Add access.test.
11670
11671	tests: add fchdir.test.
11672	* tests/fchdir.c: New file.
11673	* tests/fchdir.test: New test.
11674	* tests/.gitignore: Add fchdir.
11675	* tests/Makefile.am (check_PROGRAMS): Likewise.
11676	(DECODER_TESTS): Add fchdir.test.
11677
11678	tests: add mkdir.test.
11679	* tests/mkdir.c: New file.
11680	* tests/mkdir.test: New test.
11681	* tests/.gitignore: Add mkdir.
11682	* tests/Makefile.am (check_PROGRAMS): Likewise.
11683	(DECODER_TESTS): Add mkdir.test.
11684
11685	tests: add getsid.test.
11686	* tests/getsid.c: New file.
11687	* tests/getsid.test: New test.
11688	* tests/.gitignore: Add getsid.
11689	* tests/Makefile.am (check_PROGRAMS): Likewise.
11690	(DECODER_TESTS): Add getsid.test.
11691
116922016-04-21  Dmitry V. Levin  <ldv@altlinux.org>
11693
11694	tests: add errno2name function to libtests.
11695	Add a simple translator of errno to its name, so one could
11696	simply use errno2name() instead of complex expressions like
11697	errno == EINVAL ? "EINVAL" : "EFAULT".
11698
11699	* tests.h (errno2name): New prototype.
11700	* errno2name.c: New file.
11701	* Makefile.am (libtests_a_SOURCES): Add it.
11702
117032016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11704
11705	hppa: rename ECANCELLED to ECANCELED.
11706	hppa seems to be the only architecture that defines ECANCELLED synonym
11707	for ECANCELED constant, other architectures just define ECANCELED.
11708	Change the way how this constant is printed on hppa to be in line
11709	with other architectures.
11710
11711	* linux/hppa/errnoent.h [253]: Rename ECANCELLED to ECANCELED.
11712
117132016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11714
11715	Remove parser of unimplemented timerfd syscall.
11716	timerfd syscall was introduced in v2.6.22-rc1, but in v2.6.25-rc1
11717	it was replaced by timerfd_* syscall family.
11718
11719	* linux/avr32/syscallent.h (timerfd): Fix nargs.
11720	* linux/dummy.h (sys_timerfd): Add stub alias.
11721	* time.c (SYS_FUNC(timerfd)): Remove.
11722
117232016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11724
11725	tests: workaround kernel bugs in seccomp-strict.test and prctl-seccomp-strict.test
11726	If kernel implementation of strict seccomp mode is buggy, test programs
11727	will be killed by SIGKILL.  This is a known problem at least on
11728	x32 and mips.  Skip affected tests if this is the case.
11729
11730	This change partially revert commit 9c1a72cd3f3d52d573876ce474b620a5f141fb1b.
11731
11732	* tests/seccomp-strict.c (main): Remove workaround for x32.
11733	* tests/prctl-seccomp-strict.c: Likewise.
11734	* tests/seccomp-strict.test: Skip the test if the test program
11735	has been killed by SIGKILL.
11736	* tests/prctl-seccomp-strict.test: Likewise.
11737
117382016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11739
11740	tests/shmxt.c: do not use SHM_RND, it is unreliable.
11741	* tests/shmxt.c (main): Do not set SHM_RND flag.
11742
11743	tests/rt_sigpending.c: fix for systems where _NSIG > 16 * sizeof(long)
11744	* tests/rt_sigsuspend.c (iterate): Do not assume that size will be less
11745	than sizeof(long) on the second iteration.
11746
11747	prctl-seccomp-strict.test: robustify against unrelated prctl invocations
11748	* tests/prctl-seccomp-strict.test: Filter out PR_GET_* prctl calls.
11749
117502016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11751
11752	tests: adjust rt_sigpending to older kernels.
11753	With linux kernels older than v3.9-rc1, compat rt_sigpending syscall
11754	could fail with EFAULT in cases where on later kernels it succeeds.
11755	Adjust the test to handle both cases properly.
11756
11757	* tests/rt_sigpending.c (iterate): Stop iterations if rt_sigpending
11758	failed with EFAULT.
11759
117602016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11761
11762	tests: adjust readv/writev and preadv/pwritev tests to older kernels.
11763	With linux kernels older than v3.16-rc1, iovec based compat syscalls may
11764	return EINVAL in some cases where on later kernels they return EFAULT.
11765	Adjust tests to handle both cases properly.
11766
11767	* tests/preadv-pwritev.c: Include <errno.h>.
11768	(main): Print either "EINVAL" or "EFAULT" depending on errno.
11769	* tests/pwritev.c: Likewise.
11770	* tests/readv.c: Likewise.
11771
117722016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11773
11774	tests: remove obsolete non-strict uid tests.
11775	Recently added strict tests for uid/gid related syscalls
11776	made old uid tests obsolete.
11777
11778	* tests/uid.awk: Remove.
11779	* tests/uid.c: Remove.
11780	* tests/uid.test: Remove.
11781	* tests/uid16.c: Remove.
11782	* tests/uid16.test: Remove.
11783	* tests/uid32.c: Remove.
11784	* tests/uid32.test: Remove.
11785	* tests/.gitignore: Remove uid, uid16, and uid32.
11786	* tests/Makefile.am (check_PROGRAMS): Likewise.
11787	(DECODER_TESTS): Remove uid.test, uid16.test, and uid32.test.
11788	(EXTRA_DIST): Remove uid.awk.
11789
117902016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11791
11792	tests: extend test coverage of getuid/getgid family syscalls.
11793	Add strict tests for getuid, getuid32, getgid, getgid32, geteuid,
11794	geteuid32, getegid, and getegid32 syscalls.
11795
11796	* tests/getegid.c: New file.
11797	* tests/getegid.test: New test.
11798	* tests/getegid32.c: New file.
11799	* tests/getegid32.test: New test.
11800	* tests/geteuid.c: New file.
11801	* tests/geteuid.test: New test.
11802	* tests/geteuid32.c: New file.
11803	* tests/geteuid32.test: New test.
11804	* tests/getgid.c: New file.
11805	* tests/getgid.test: New test.
11806	* tests/getgid32.c: New file.
11807	* tests/getgid32.test: New test.
11808	* tests/getuid.c: New file.
11809	* tests/getuid.test: New test.
11810	* tests/getuid32.c: New file.
11811	* tests/getuid32.test: New test.
11812	* tests/.gitignore: Add getuid, getuid32, getgid, getgid32, geteuid,
11813	* geteuid32, getegid, and getegid32.
11814	* tests/Makefile.am (check_PROGRAMS): Likewise.
11815	(DECODER_TESTS): Add getegid.test, getegid32.test, geteuid.test,
11816	geteuid32.test, getgid.test, getgid32.test, getuid.test,
11817	and getuid32.test.
11818
118192016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11820
11821	tests: extend test coverage of getresgid32 syscall.
11822	* tests/getresgid32.c: New file.
11823	* tests/getresgid32.test: New test.
11824	* tests/.gitignore: Add getresgid32.
11825	* tests/Makefile.am (check_PROGRAMS): Likewise.
11826	(DECODER_TESTS): Add getresgid32.test.
11827
11828	tests: extend test coverage of getresgid syscall.
11829	* tests/getresgid.c: New file.
11830	* tests/getresgid.test: New test.
11831	* tests/.gitignore: Add getresgid.
11832	* tests/Makefile.am (check_PROGRAMS): Likewise.
11833	(DECODER_TESTS): Add getresgid.test.
11834
11835	tests: extend test coverage of getresuid32 syscall.
11836	* tests/getresuid32.c: New file.
11837	* tests/getresuid32.test: New test.
11838	* tests/.gitignore: Add getresuid32.
11839	* tests/Makefile.am (check_PROGRAMS): Likewise.
11840	(DECODER_TESTS): Add getresuid32.test.
11841
11842	tests: extend test coverage of getresuid syscall.
11843	* tests/getresugid.c: New file.
11844	* tests/getresuid.c: New file.
11845	* tests/getresuid.test: New test.
11846	* tests/.gitignore: Add getresuid.
11847	* tests/Makefile.am (check_PROGRAMS): Likewise.
11848	(DECODER_TESTS): Add getresuid.test.
11849	(EXTRA_DIST): Add getresugid.c.
11850
118512016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>
11852
11853	tests: add symlinkat.test.
11854	* tests/symlinkat.c: New file.
11855	* tests/symlinkat.test: New test.
11856	* tests/.gitignore: Add symlinkat.
11857	* tests/Makefile.am (check_PROGRAMS): Likewise.
11858	(DECODER_TESTS): Add symlinkat.test.
11859
11860	tests: add iopl.test.
11861	* tests/iopl.c: New file.
11862	* tests/iopl.test: New test.
11863	* tests/.gitignore: Add iopl.
11864	* tests/Makefile.am (check_PROGRAMS): Likewise.
11865	(DECODER_TESTS): Add iopl.test.
11866
118672016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11868
11869	mips o32, powerpc, powerpc64: fix decoding of iopl syscall.
11870	* linux/mips/syscallent-o32.h (iopl): Fix nargs.
11871	* linux/powerpc/syscallent.h (iopl): Fix nargs and sys_func.
11872	* linux/powerpc64/syscallent.h (iopl): Likewise.
11873
118742016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>
11875
11876	tests: add ioperm.test.
11877	* tests/ioperm.c: New file.
11878	* tests/ioperm.test: New test.
11879	* tests/.gitignore: Add ioperm.
11880	* tests/Makefile.am (check_PROGRAMS): Likewise.
11881	(DECODER_TESTS): Add ioperm.test.
11882
118832016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
11884
11885	Fix corner cases of getgroups and setgroups syscall decoders.
11886	* uid.c (print_groups): New function.
11887	(SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Use it.
11888	Print first syscall argument using %u format.
11889	* tests/getgroups.c: New file.
11890	* tests/getgroups.test: New test.
11891	* tests/getgroups32.c: New file.
11892	* tests/getgroups32.test: New test.
11893	* tests/setgroups.c: New file.
11894	* tests/setgroups.test: New test.
11895	* tests/setgroups32.c: New file.
11896	* tests/setgroups32.test: New test.
11897	* tests/.gitignore: Add getgroups, getgroups32, setgroups,
11898	and setgroups32.
11899	* tests/Makefile.am (check_PROGRAMS): Likewise.
11900	(DECODER_TESTS): Add getgroups.test, getgroups32.test,
11901	setgroups.test, and setgroups32.test.
11902
11903	Cleanup setfsuid syscall decoder.
11904	* uid.c (SYS_FUNC(setfsuid)): Remove redundant check.
11905
11906	tests: check decoding of setfsgid32 syscall.
11907	* tests/setfsgid32.c: New file.
11908	* tests/setfsgid32.test: New test.
11909	* tests/.gitignore: Add setfsgid32.
11910	* tests/Makefile.am (check_PROGRAMS): Likewise.
11911	(DECODER_TESTS): Add setfsgid32.test.
11912
11913	tests: check decoding of setfsgid syscall.
11914	* tests/setfsugid.c: New file.
11915	* tests/setfsgid.c: New file.
11916	* tests/setfsgid.test: New test.
11917	* tests/.gitignore: Add setfsgid.
11918	* tests/Makefile.am (check_PROGRAMS): Likewise.
11919	(DECODER_TESTS): Add setfsgid.test.
11920	(EXTRA_DIST): Add setfsugid.c.
11921
11922	tests: check decoding of setfsuid32 syscall.
11923	* tests/setfsuid32.c: New file.
11924	* tests/setfsuid32.test: New test.
11925	* tests/.gitignore: Add setfsuid32.
11926	* tests/Makefile.am (check_PROGRAMS): Likewise.
11927	(DECODER_TESTS): Add setfsuid32.test.
11928
11929	tests: check decoding of setfsuid syscall.
11930	* tests/setfsugid.c: New file.
11931	* tests/setfsuid.c: New file.
11932	* tests/setfsuid.test: New test.
11933	* tests/.gitignore: Add setfsuid.
11934	* tests/Makefile.am (check_PROGRAMS): Likewise.
11935	(DECODER_TESTS): Add setfsuid.test.
11936	(EXTRA_DIST): Add setfsugid.c.
11937
11938	tests: extend test coverage of setresgid32 syscall.
11939	* tests/setresgid32.c: New file.
11940	* tests/setresgid32.test: New test.
11941	* tests/.gitignore: Add setresgid32.
11942	* tests/Makefile.am (check_PROGRAMS): Likewise.
11943	(DECODER_TESTS): Add setresgid32.test.
11944
11945	tests: extend test coverage of setresgid syscall.
11946	* tests/setresgid.c: New file.
11947	* tests/setresgid.test: New test.
11948	* tests/.gitignore: Add setresgid.
11949	* tests/Makefile.am (check_PROGRAMS): Likewise.
11950	(DECODER_TESTS): Add setresgid.test.
11951
11952	tests: extend test coverage of setresuid32 syscall.
11953	* tests/setresuid32.c: New file.
11954	* tests/setresuid32.test: New test.
11955	* tests/.gitignore: Add setresuid32.
11956	* tests/Makefile.am (check_PROGRAMS): Likewise.
11957	(DECODER_TESTS): Add setresuid32.test.
11958
11959	tests: extend test coverage of setresuid syscall.
11960	* tests/setresugid.c: New file.
11961	* tests/setresuid.c: New file.
11962	* tests/setresuid.test: New test.
11963	* tests/.gitignore: Add setresuid.
11964	* tests/Makefile.am (check_PROGRAMS): Likewise.
11965	(DECODER_TESTS): Add setresuid.test.
11966	(EXTRA_DIST): Add setresugid.c.
11967
11968	tests: extend test coverage of setregid32 syscall.
11969	* tests/setregid32.c: New file.
11970	* tests/setregid32.test: New test.
11971	* tests/.gitignore: Add setregid32.
11972	* tests/Makefile.am (check_PROGRAMS): Likewise.
11973	(DECODER_TESTS): Add setregid32.test.
11974
11975	tests: extend test coverage of setregid syscall.
11976	* tests/setregid.c: New file.
11977	* tests/setregid.test: New test.
11978	* tests/.gitignore: Add setregid.
11979	* tests/Makefile.am (check_PROGRAMS): Likewise.
11980	(DECODER_TESTS): Add setregid.test.
11981
11982	tests: extend test coverage of setreuid32 syscall.
11983	* tests/setreuid32.c: New file.
11984	* tests/setreuid32.test: New test.
11985	* tests/.gitignore: Add setreuid32.
11986	* tests/Makefile.am (check_PROGRAMS): Likewise.
11987	(DECODER_TESTS): Add setreuid32.test.
11988
11989	tests: extend test coverage of setreuid syscall.
11990	* tests/setreugid.c: New file.
11991	* tests/setreuid.c: New file.
11992	* tests/setreuid.test: New test.
11993	* tests/.gitignore: Add setreuid.
11994	* tests/Makefile.am (check_PROGRAMS): Likewise.
11995	(DECODER_TESTS): Add setreuid.test.
11996	(EXTRA_DIST): Add setreugid.c.
11997
11998	tests: extend test coverage of setgid32 syscall.
11999	* tests/setgid32.c: New file.
12000	* tests/setgid32.test: New test.
12001	* tests/.gitignore: Add setgid32.
12002	* tests/Makefile.am (check_PROGRAMS): Likewise.
12003	(DECODER_TESTS): Add setgid32.test.
12004
12005	tests: extend test coverage of setgid syscall.
12006	* tests/setgid.c: New file.
12007	* tests/setgid.test: New test.
12008	* tests/.gitignore: Add setgid.
12009	* tests/Makefile.am (check_PROGRAMS): Likewise.
12010	(DECODER_TESTS): Add setgid.test.
12011
12012	tests: extend test coverage of setuid32 syscall.
12013	* tests/setuid32.c: New file.
12014	* tests/setuid32.test: New test.
12015	* tests/.gitignore: Add setuid32.
12016	* tests/Makefile.am (check_PROGRAMS): Likewise.
12017	(DECODER_TESTS): Add setuid32.test.
12018
12019	tests: extend test coverage of setuid syscall.
12020	* tests/setugid.c: New file.
12021	* tests/setuid.c: New file.
12022	* tests/setuid.test: New test.
12023	* tests/.gitignore: Add setuid.
12024	* tests/Makefile.am (check_PROGRAMS): Likewise.
12025	(DECODER_TESTS): Add setuid.test.
12026	(EXTRA_DIST): Add setugid.c.
12027
120282016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>
12029
12030	tests: add shmxt.test.
12031	* tests/shmxt.c: New file.
12032	* tests/shmxt.test: New test.
12033	* tests/.gitignore: Add shmxt.
12034	* tests/Makefile.am (check_PROGRAMS): Likewise.
12035	(DECODER_TESTS): Add shmxt.test.
12036
120372016-04-20  Dmitry V. Levin  <ldv@altlinux.org>
12038
12039	alpha: fix decoding of shmat syscall.
12040	On alpha, shmat syscall is known as osf_shmat.
12041
12042	* linux/alpha/syscallent.h (osf_shmat): Fix sys_flags and sys_func.
12043
120442016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>
12045
12046	tests: add semop.test.
12047	* tests/semop.c: New file.
12048	* tests/semop.test: New test.
12049	* tests/.gitignore: Add semop.
12050	* tests/Makefile.am (check_PROGRAMS): Likewise.
12051	(DECODER_TESTS): Add semop.test.
12052
120532016-04-18  Dmitry V. Levin  <ldv@altlinux.org>
12054
12055	prctl-seccomp-filter-v.test: robustify against unrelated prctl invocations
12056	* tests/prctl-seccomp-filter-v.test: Filter out PR_GET_* prctl calls.
12057
12058	Reported-by: Steve McIntyre <steve@einval.com>
12059
120602016-04-18  Dmitry V. Levin  <ldv@altlinux.org>
12061
12062	tests/pselect6.c: fix potential output mismatch.
12063	* tests/pselect6.c (main): In the last case of printing pselect6
12064	syscall, print the last argument the same way as in other cases.
12065
12066	Reported-by: Steve McIntyre <steve@einval.com>
12067
120682016-04-18  Dmitry V. Levin  <ldv@altlinux.org>
12069
12070	tests: check decoding of fchown32 syscall.
12071	* tests/fchown32.c: New file.
12072	* tests/fchown32.test: New test.
12073	* tests/.gitignore: Add fchown32.
12074	* tests/Makefile.am (check_PROGRAMS): Likewise.
12075	(DECODER_TESTS): Add fchown32.test.
12076
12077	tests: check decoding of fchown syscall.
12078	* tests/fchown.c: New file.
12079	* tests/fchown.test: New test.
12080	* tests/.gitignore: Add fchown.
12081	* tests/Makefile.am (check_PROGRAMS): Likewise.
12082	(DECODER_TESTS): Add fchown.test.
12083
12084	tests: check decoding of lchown32 syscall.
12085	* tests/lchown32.c: New file.
12086	* tests/lchown32.test: New test.
12087	* tests/.gitignore: Add lchown32.
12088	* tests/Makefile.am (check_PROGRAMS): Likewise.
12089	(DECODER_TESTS): Add lchown32.test.
12090
12091	tests: check decoding of lchown syscall.
12092	* tests/lchown.c: New file.
12093	* tests/lchown.test: New test.
12094	* tests/.gitignore: Add lchown.
12095	* tests/Makefile.am (check_PROGRAMS): Likewise.
12096	(DECODER_TESTS): Add lchown.test.
12097
12098	tests: check decoding of chown32 syscall.
12099	* tests/chown32.c: New file.
12100	* tests/chown32.test: New test.
12101	* tests/.gitignore: Add chown32.
12102	* tests/Makefile.am (check_PROGRAMS): Likewise.
12103	(DECODER_TESTS): Add chown32.test.
12104
12105	tests: check decoding of chown syscall.
12106	* tests/chown.c: New file.
12107	* tests/chown.test: New test.
12108	* tests/xchownx.c: New file.
12109	* tests/.gitignore: Add chown.
12110	* tests/Makefile.am (check_PROGRAMS): Likewise.
12111	(DECODER_TESTS): Add chown.test.
12112	(EXTRA_DIST): Add xchownx.c.
12113
12114	Fix decoding of 16-bit uid_t/git_t.
12115	* uid.c (printuid): Always cast value to uid_t.
12116
121172016-04-18  Dmitry V. Levin  <ldv@altlinux.org>
12118
12119	tests: move kernel uid overflow check to libtests.
12120	This code used in two different places, so move it to the library.
12121
12122	* tests/overflowuid.c: New file.
12123	* tests/Makefile.am (libtests_a_SOURCES): Add it.
12124	* tests/tests.h (check_overflowuid, check_overflowgid): New prototypes.
12125	* tests/uid.c (main): Use check_overflowuid.
12126	* tests/uid16.c (main): Likewise.
12127
121282016-04-12  Dmitry V. Levin  <ldv@altlinux.org>
12129
12130	tests: skip seccomp-strict.test and prctl-seccomp-strict.test on x32.
12131	As x86_64 kernel does not support x32 syscall numbers in
12132	SECCOMP_MODE_STRICT, skip affected tests on x32.
12133
12134	* tests/seccomp-strict.c (main) [__x86_64__ && __ILP32__]: Bail out
12135	using error_msg_and_skip.
12136	* tests/prctl-seccomp-strict.c: Likewise.
12137
121382016-04-12  Dmitry V. Levin  <ldv@altlinux.org>
12139
12140	tests: add seccomp-filter.test.
12141	* tests/seccomp-filter.c: New file.
12142	* tests/seccomp-filter.test: New test.
12143	* tests/.gitignore: Add seccomp-filter.
12144	* tests/Makefile.am (check_PROGRAMS): Likewise.
12145	(DECODER_TESTS): Add seccomp-filter.test.
12146
121472016-04-12  Dmitry V. Levin  <ldv@altlinux.org>
12148
12149	seccomp: fix decoding of sock_fprog and sock_filter structures.
12150	Always print struct sock_fprog.len.
12151	Fix printing of unfetchable elements in sock_filter array.
12152	Fix printing of large sock_filter arrays.
12153
12154	* seccomp.c (decode_fprog): Rewrite into decode_seccomp_fprog and
12155	print_seccomp_fprog.
12156	(print_seccomp_filter): Replace decode_fprog with print_seccomp_fprog.
12157	* tests/prctl-seccomp-filter-v.c (main): Update.
12158	* tests/seccomp-filter-v.c: New file.
12159	* tests/seccomp-filter-v.test: New test.
12160	* tests/.gitignore: Add seccomp-filter-v.
12161	* tests/Makefile.am (check_PROGRAMS): Likewise.
12162	(DECODER_TESTS): Add seccomp-filter-v.test.
12163
121642016-04-11  Dmitry V. Levin  <ldv@altlinux.org>
12165
12166	seccomp: print SECCOMP_* and BPF_* constants in a more compact way.
12167	* seccomp.c (decode_bpf_code, decode_bpf_stmt): Replace " | " with "|".
12168	* tests/prctl-seccomp-filter-v.c: Update.
12169
12170	tests: rename seccomp.test to prctl-seccomp-filter-v.test.
12171	* tests/.gitignore: Replace seccomp with prctl-seccomp-filter-v.
12172	* tests/Makefile.am (check_PROGRAMS): Likewise.
12173	(DECODER_TESTS): Replace seccomp.test with prctl-seccomp-filter-v.test.
12174	* tests/seccomp.c: Rename to tests/prctl-seccomp-filter-v.c.
12175	* tests/seccomp.test: Rename to tests/prctl-seccomp-filter-v.test.
12176
12177	tests: add seccomp-strict.test.
12178	* tests/seccomp-strict.c: New file.
12179	* tests/seccomp-strict.test: New test.
12180	* tests/.gitignore: Add seccomp-strict.
12181	* tests/Makefile.am (check_PROGRAMS): Likewise.
12182	(DECODER_TESTS): Add seccomp-strict.test.
12183
12184	tests: add prctl-seccomp-strict.test.
12185	* tests/prctl-seccomp-strict.c: New file.
12186	* tests/prctl-seccomp-strict.test: New test.
12187	* tests/.gitignore: Add prctl-seccomp-strict.
12188	* tests/Makefile.am (check_PROGRAMS): Likewise.
12189	(DECODER_TESTS): Add prctl-seccomp-strict.test.
12190
12191	tests: bring lists back to the sorted order.
12192
121932016-04-10  Dmitry V. Levin  <ldv@altlinux.org>
12194
12195	tests/epoll_create1.c: extend for the case of ENOSYS.
12196	* epoll_create1.c: Make the test work in case of epoll_create1
12197	returning ENOSYS.
12198
12199	tests/epoll_ctl.c: extend epoll_ctl coverage.
12200	* tests/epoll_ctl.c (main): Check EPOLL_CTL_DEL decoding.  Check
12201	decoding of long int descriptors and NULL struct epoll_event pointer.
12202
122032016-04-09  Dmitry V. Levin  <ldv@altlinux.org>
12204
12205	tests: add mlockall.test.
12206	* tests/mlockall.c: New file.
12207	* tests/mlockall.test: New test.
12208	* tests/.gitignore: Add mlockall.
12209	* tests/Makefile.am (check_PROGRAMS): Likewise.
12210	(DECODER_TESTS): Add mlockall.test.
12211
122122016-04-08  Fei Jie  <feij.fnst@cn.fujitsu.com>
12213
12214	tests: add epoll_wait.test.
12215	* tests/epoll_wait.c: New file.
12216	* tests/epoll_wait.test: New test.
12217	* tests/.gitignore: Add epoll_wait.
12218	* tests/Makefile.am (check_PROGRAMS): Likewise.
12219	(DECODER_TESTS): Add epoll_wait.test.
12220
12221	tests: add epoll_ctl.test.
12222	* tests/epoll_ctl.c: New file.
12223	* tests/epoll_ctl.test: New test.
12224	* tests/.gitignore: Add epoll_ctl.
12225	* tests/Makefile.am (check_PROGRAMS): Likewise.
12226	(DECODER_TESTS): Add epoll_ctl.test.
12227
12228	tests: add epoll_create.test.
12229	* tests/epoll_create.c: New file.
12230	* tests/epoll_create.test: New test.
12231	* tests/.gitignore: Add epoll_create.
12232	* tests/Makefile.am (check_PROGRAMS): Likewise.
12233	(DECODER_TESTS): Add epoll_create.test.
12234
122352016-04-08  Dmitry V. Levin  <ldv@altlinux.org>
12236
12237	tests/pread64-pwrite64.c: minor cleanup.
12238	* tests/pread64-pwrite64.c: Do not include <sys/uio.h>.
12239
122402016-04-07  Dmitry V. Levin  <ldv@altlinux.org>
12241
12242	Fix decoding of swapon flags.
12243	* swapon.c (SYS_FUNC(swapon)): Print priority regardless
12244	of SWAP_FLAG_PREFER flag being set.
12245	* tests/swap.c (error_msg): Handle EINVAL.
12246	(main): Check decoding of swapon flags.
12247
12248	tests/unlinkat.c: check AT_* decoding.
12249	* tests/unlinkat.c (main): Check decoding of AT_* constants.
12250
12251	tests/linkat.c: check AT_* decoding.
12252	* tests/linkat.c (main): Check decoding of AT_* constants.
12253
122542016-04-06  Elliott Hughes  <enh@google.com>
12255
12256	Improve decoding of Android's PR_SET_VMA prctl.
12257	Before:
12258
12259	  prctl(0x53564d41 /* PR_??? */, 0, 0x7f8ab53000, 4096,
12260	        "atexit handlers") = 0
12261
12262	After:
12263
12264	  prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x7fa8cbd000, 4096,
12265	        "atexit handlers") = 0
12266
12267	* prctl.c (SYS_FUNC(prctl)) [__ANDROID__]: Do not define PR_SET_VMA.
12268	* Hard-code PR_SET_VMA_ANON_NAME, the only current sub-option.
12269	* xlat/prctl_options.in: Add PR_SET_VMA.
12270
122712016-04-06  Fei Jie  <feij.fnst@cn.fujitsu.com>
12272
12273	tests: add mkdirat.test.
12274	* tests/mkdirat.c: New file.
12275	* tests/mkdirat.test: New test.
12276	* tests/.gitignore: Add mkdirat.
12277	* tests/Makefile.am (check_PROGRAMS): Likewise.
12278	(DECODER_TESTS): Add mkdirat.test.
12279
12280	tests: add swap.test.
12281	* tests/swap.c: New file.
12282	* tests/swap.test: New test.
12283	* tests/.gitignore: Add swap.
12284	* tests/Makefile.am (check_PROGRAMS): Likewise.
12285	(DECODER_TESTS): Add swap.test.
12286
12287	tests: add unlinkat.test.
12288	* tests/unlinkat.c: New file.
12289	* tests/unlinkat.test: New test.
12290	* tests/.gitignore: Add unlinkat.
12291	* tests/Makefile.am (check_PROGRAMS): Likewise.
12292	(DECODER_TESTS): Add unlinkat.test.
12293
12294	tests: add linkat.test.
12295	* tests/linkat.c: New file.
12296	* tests/linkat.test: New test.
12297	* tests/.gitignore: Add linkat.
12298	* tests/Makefile.am (check_PROGRAMS): Likewise.
12299	(DECODER_TESTS): Add linkat.test.
12300
123012016-04-06  Dmitry V. Levin  <ldv@altlinux.org>
12302
12303	tests: add sync_file_range.test and sync_file_range2.test.
12304	* configure.ac (AC_CHECK_FUNCS): Add sync_file_range.
12305	* tests/sync_file_range.c: New file.
12306	* tests/sync_file_range2.c: Likewise.
12307	* tests/sync_file_range.test: New test.
12308	* tests/sync_file_range2.test: Likewise.
12309	* tests/.gitignore: Add sync_file_range and sync_file_range2.
12310	* tests/Makefile.am (check_PROGRAMS): Likewise.
12311	(DECODER_TESTS): Add sync_file_range.test and sync_file_range2.test.
12312
123132016-04-05  Dmitry V. Levin  <ldv@altlinux.org>
12314
12315	Add default values for SYNC_FILE_RANGE_* constants.
12316	* xlat/sync_file_range_flags.in: Add default values.
12317
123182016-04-05  Elliott Hughes  <enh@google.com>
12319
12320	Fix sync_file_range2 output.
12321	Before:
12322
12323	  sync_file_range2(3SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|
12324	    SYNC_FILE_RANGE_WAIT_AFTER|0xfffffff8, 0, 0, )
12325
12326	After:
12327
12328	  sync_file_range2(3, SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|
12329	    SYNC_FILE_RANGE_WAIT_AFTER|0xfffffff8, 0, 0)
12330
12331	* sync_file_range.c (SYS_FUNC(sync_file_range2)): Output the ", "
12332	in the right place.
12333
123342016-04-04  Dmitry V. Levin  <ldv@altlinux.org>
12335
12336	Replace PF_* constants with AF_*
12337	AF_* constants appear to be more standardized, and in practice there's
12338	always a one to one relationship between AF_* and PF_*, so let's
12339	use AF_* instead of PF_*.
12340
12341	* xlat/domains.in: Remove.
12342	* net.c: Do not define PF_UNSPEC.  Stop including "xlat/domains.h".
12343	Replace PF_* with AF_*.  Replace domains with addrfams.
12344	* tests/inet-cmsg.c: Replace PF_INET with AF_INET.
12345	* tests/net-yy-inet.c: Likewise.
12346	* tests/netlink_inet_diag.c: Likewise.
12347	* tests/net-accept-connect.c: Replace PF_LOCAL with AF_LOCAL.
12348	* tests/net-y-unix.c: Likewise.
12349	* tests/net-yy-unix.c: Likewise.
12350	* tests/netlink_unix_diag.c: Likewise.
12351	* tests/net.expected: Replace PF_ with AF_.
12352
123532016-04-03  Dmitry V. Levin  <ldv@altlinux.org>
12354
12355	tests: add read-write.test.
12356	* tests/read-write.c: New file.
12357	* tests/read-write.test: New test.
12358	* tests/.gitignore: Add read-write.
12359	* tests/Makefile.am (check_PROGRAMS): Likewise.
12360	(DECODER_TESTS): Add read-write.test.
12361
123622016-04-02  Dmitry V. Levin  <ldv@altlinux.org>
12363
12364	tests/pread64-pwrite64.test: extend dumpio coverage.
12365	* tests/pread64-pwrite64.c (dump_str, print_hex, test_dump):
12366	New functions.
12367	(main): Use them to test dumping of various data.
12368	* tests/pread64-pwrite64.test: Update.
12369
12370	tests: add hexdump_memdup function to libtests.
12371	* tests/hexdump_strdup.c (hexdump_memdup): New function.
12372	(hexdump_strdup): Use it.
12373	* tests/tests.h (hexdump_memdup): New prototype.
12374
12375	tests: add fchownat.test.
12376	* tests/fchownat.c: New file.
12377	* tests/fchownat.test: New test.
12378	* tests/.gitignore: Add fchownat.
12379	* tests/Makefile.am (check_PROGRAMS): Likewise.
12380	(DECODER_TESTS): Add fchownat.test.
12381
12382	tests: add fchmodat.test.
12383	* tests/fchmodat.c: New file.
12384	* tests/fchmodat.test: New test.
12385	* tests/.gitignore: Add fchmodat.
12386	* tests/Makefile.am (check_PROGRAMS): Likewise.
12387	(DECODER_TESTS): Add fchmodat.test.
12388
12389	Fix printing of negative offsets in pread64 and pwrite64 syscalls.
12390	* io.c (SYS_FUNC(pread), SYS_FUNC(pwrite)): Print offset
12391	using %lld format string.
12392	* tests/pread64-pwrite64.c: New file.
12393	* tests/pread64-pwrite64.test: New test.
12394	* tests/.gitignore: Add pread64-pwrite64.
12395	* tests/Makefile.am (check_PROGRAMS): Likewise.
12396	(pread64_pwrite64_CPPFLAGS): New variable.
12397	(DECODER_TESTS): Add pread64-pwrite64.
12398
12399	tests/hexdump_strdup.c: add support for longer strings.
12400	* tests/hexdump_strdup.c (hexdump_strdup): Output extra space character
12401	before hexdumping of the 9th symbol.
12402
12403	tests/preadv-pwritev.c: fix typo in error diagnostics.
12404	* tests/preadv-pwritev.c (main): Fix typo in error message.
12405
124062016-04-01  Fei Jie  <feij.fnst@cn.fujitsu.com>
12407
12408	tests: add chroot.test.
12409	* tests/chroot.c: New file.
12410	* tests/chroot.test: New test.
12411	* tests/.gitignore: Add chroot.
12412	* tests/Makefile.am (check_PROGRAMS): Likewise.
12413	(DECODER_TESTS): Add chroot.test.
12414
12415	tests: add fdatasync.test.
12416	* tests/fdatasync.c: New file.
12417	* tests/fdatasync.test: New test.
12418	* tests/.gitignore: Add fdatasync.
12419	* tests/Makefile.am (check_PROGRAMS): Likewise.
12420	(DECODER_TESTS): Add fdatasync.test.
12421
12422	tests: add fsync.test.
12423	* tests/fsync.c: New file.
12424	* tests/fsync.test: New test.
12425	* tests/.gitignore: Add fsync.
12426	* tests/Makefile.am (check_PROGRAMS): Likewise.
12427	(DECODER_TESTS): Add fsync.test.
12428
12429	tests: add sethostname.test.
12430	* tests/sethostname.c: New file.
12431	* tests/sethostname.test: New test.
12432	* tests/.gitignore: Add sethostname.
12433	* tests/Makefile.am (check_PROGRAMS): Likewise.
12434	(DECODER_TESTS): Add sethostname.test.
12435
124362016-04-01  Dmitry V. Levin  <ldv@altlinux.org>
12437
12438	Consistently handle unsigned arguments of mmap* and remap_file_pages.
12439	Explicitly declare first 4 arguments of mmap* and all remap_file_pages
12440	arguments as unsigned to avoid potential sign extension issues.
12441
12442	* mem.c (print_mmap, SYS_FUNC(remap_file_pages)): Assign syscall
12443	arguments to local variables of appropriate types.
12444
124452016-04-01  Dmitry V. Levin  <ldv@altlinux.org>
12446
12447	Consistently handle 2nd and 3rd arguments of [gs]etsockopt as unsigned.
12448	The second (level) and third (optname) arguments of getsockopt and
12449	setsockopt syscalls are enums, so treat them consistently as enums:
12450	use "unsigned int" type to avoid potential sign extension issues.
12451
12452	* net.c (print_sockopt_fd_level_name, print_getsockopt,
12453	print_setsockopt): Change type of "level" and "name" arguments
12454	from "int" to "unsigned int".
12455
124562016-04-01  Dmitry V. Levin  <ldv@altlinux.org>
12457
12458	Add sentinel attribute to printxvals.
12459	* gcc_compat.h (ATTRIBUTE_SENTINEL): New macro.
12460	* defs.h (printxvals): Add ATTRIBUTE_SENTINEL.
12461
12462	Cleanup parser of ptrace syscall.
12463	* process.c (print_user_offset_addr): New function for printing offset
12464	address in the tracee's USER area.
12465	(SYS_FUNC(ptrace)): Assign syscall arguments to local variables with
12466	appropriate types.  Print pid argument as int.  Use switch statement
12467	in the code that handles address argument.  Use print_user_offset_addr
12468	to print address in PTRACE_PEEKUSER and PTRACE_POKEUSER requests.
12469
124702016-03-31  Jeff Mahoney  <jeffm@suse.com>
12471
12472	Define PRI__[uxs]64 macros to print __s64 and __u64 values.
12473	Rather than cast every __u64 or __s64 before printing,
12474	define printing helpers for those types directly.
12475
12476	* defs.h (PRI__s64, PRI__u64, PRI__x64): New macros.
12477
124782016-03-31  Dmitry V. Levin  <ldv@altlinux.org>
12479
12480	Implement dumping of preadv and pwritev syscalls.
12481	* syscall.c (dumpio): Add SEN_preadv and SEN_pwritev.
12482	* NEWS: Mention this.
12483	* tests/preadv-pwritev.c: New file.
12484	* tests/preadv-pwritev.test: New test.
12485	* tests/.gitignore: Add preadv-pwritev.
12486	* tests/Makefile.am (check_PROGRAMS): Likewise.
12487	(preadv_pwritev_CPPFLAGS): New variable.
12488	(DECODER_TESTS): Add preadv-pwritev.
12489
124902016-03-30  Dmitry V. Levin  <ldv@altlinux.org>
12491
12492	Fix decoding of preadv syscall in case of short read.
12493	* io.c (SYS_FUNC(preadv)): Call tprint_iov_upto instead
12494	of tprint_iov and specify syscall return value as a data size limit.
12495	* NEWS: Mention it.
12496	* tests/preadv.c (main): Add a test case for preadv short read.
12497
12498	Fix printing of negative offsets in preadv and pwritev syscalls.
12499	* io.c (print_llu_from_low_high_val): Rename to
12500	print_lld_from_low_high_val, all callers changed.
12501	Print value as a signed integer.
12502	* tests/preadv.c: New file.
12503	* tests/preadv.test: New test.
12504	* tests/pwritev.c: New file.
12505	* tests/pwritev.test: New test.
12506	* tests/.gitignore: Add preadv and pwritev.
12507	* tests/Makefile.am (check_PROGRAMS): Likewise.
12508	(preadv_CPPFLAGS, pwritev_CPPFLAGS): New variables.
12509	(DECODER_TESTS): Add preadv.test and pwritev.test.
12510
12511	Fix printing of unreadable struct iovec.
12512	* io.c (tprint_iov_upto): If the first element of iovec array is
12513	unreadable, print its address without array markup.
12514	* tests/readv.c (main): Check it.
12515
12516	tests: factor out a part common to many simply organized test scripts.
12517	* tests/init.sh (run_strace_match_diff): New function.
12518	* tests/acct.test: Rewrite using run_strace_match_diff.
12519	* tests/aio.test: Likewise.
12520	* tests/alarm.test: Likewise.
12521	* tests/chmod.test: Likewise.
12522	* tests/clock_nanosleep.test: Likewise.
12523	* tests/clock_xettime.test: Likewise.
12524	* tests/copy_file_range.test: Likewise.
12525	* tests/creat.test: Likewise.
12526	* tests/dup.test: Likewise.
12527	* tests/dup2.test: Likewise.
12528	* tests/dup3.test: Likewise.
12529	* tests/epoll_create1.test: Likewise.
12530	* tests/execveat-v.test: Likewise.
12531	* tests/execveat.test: Likewise.
12532	* tests/fchmod.test: Likewise.
12533	* tests/fcntl.test: Likewise.
12534	* tests/file_handle.test: Likewise.
12535	* tests/flock.test: Likewise.
12536	* tests/fork-f.test: Likewise.
12537	* tests/ftruncate.test: Likewise.
12538	* tests/ftruncate64.test: Likewise.
12539	* tests/getcwd.test: Likewise.
12540	* tests/getdents.test: Likewise.
12541	* tests/getdents64.test: Likewise.
12542	* tests/getrandom.test: Likewise.
12543	* tests/getrusage.test: Likewise.
12544	* tests/getxxid.test: Likewise.
12545	* tests/inet-cmsg.test: Likewise.
12546	* tests/init.sh: Likewise.
12547	* tests/membarrier.test: Likewise.
12548	* tests/mincore.test: Likewise.
12549	* tests/mknod.test: Likewise.
12550	* tests/mlock2.test: Likewise.
12551	* tests/mmsg.test: Likewise.
12552	* tests/nanosleep.test: Likewise.
12553	* tests/open.test: Likewise.
12554	* tests/openat.test: Likewise.
12555	* tests/pselect6.test: Likewise.
12556	* tests/readdir.test: Likewise.
12557	* tests/readlink.test: Likewise.
12558	* tests/readv.test: Likewise.
12559	* tests/recvmsg.test: Likewise.
12560	* tests/rename.test: Likewise.
12561	* tests/renameat.test: Likewise.
12562	* tests/rt_sigpending.test: Likewise.
12563	* tests/rt_sigprocmask.test: Likewise.
12564	* tests/rt_sigqueueinfo.test: Likewise.
12565	* tests/rt_sigsuspend.test: Likewise.
12566	* tests/rt_sigtimedwait.test: Likewise.
12567	* tests/rt_tgsigqueueinfo.test: Likewise.
12568	* tests/sched_get_priority_mxx.test: Likewise.
12569	* tests/sched_xetaffinity.test: Likewise.
12570	* tests/sched_xetparam.test: Likewise.
12571	* tests/sched_xetscheduler.test: Likewise.
12572	* tests/seccomp.test: Likewise.
12573	* tests/select.test: Likewise.
12574	* tests/sendfile.test: Likewise.
12575	* tests/sendfile64.test: Likewise.
12576	* tests/splice.test: Likewise.
12577	* tests/statx.sh: Likewise.
12578	* tests/sysinfo.test: Likewise.
12579	* tests/syslog.test: Likewise.
12580	* tests/tee.test: Likewise.
12581	* tests/time.test: Likewise.
12582	* tests/timer_create.test: Likewise.
12583	* tests/timer_xettime.test: Likewise.
12584	* tests/timerfd_xettime.test: Likewise.
12585	* tests/times-fail.test: Likewise.
12586	* tests/times.test: Likewise.
12587	* tests/truncate.test: Likewise.
12588	* tests/truncate64.test: Likewise.
12589	* tests/umask.test: Likewise.
12590	* tests/umount.test: Likewise.
12591	* tests/umount2.test: Likewise.
12592	* tests/userfaultfd.test: Likewise.
12593	* tests/vmsplice.test: Likewise.
12594	* tests/xet_robust_list.test: Likewise.
12595	* tests/xetitimer.test: Likewise.
12596	* tests/xetpgid.test: Likewise.
12597	* tests/xetpriority.test: Likewise.
12598	* tests/xettimeofday.test: Likewise.
12599
12600	tests: introduce $NAME.
12601	* tests/init.sh (NAME): New variable, defined to ${ME_%.test}.
12602	(run_prog, match_awk, match_diff, match_grep): Replace ${ME_%.test}
12603	with $NAME.
12604	* tests/fcntl.test: Likewise.
12605	* tests/fstat.test: Likewise.
12606	* tests/mmap.test: Likewise.
12607	* tests/net-y-unix.test: Likewise.
12608	* tests/net-yy-inet.test: Likewise.
12609	* tests/net-yy-unix.test: Likewise.
12610	* tests/open.test: Likewise.
12611	* tests/openat.test: Likewise.
12612	* tests/poll.test: Likewise.
12613	* tests/ppoll.test: Likewise.
12614	* tests/readlink.test: Likewise.
12615	* tests/select.test: Likewise.
12616	* tests/statx.sh: Likewise.
12617	* tests/uname.test: Likewise.
12618
126192016-03-30  Dmitry V. Levin  <ldv@altlinux.org>
12620
12621	tests: move definitions of $OUT and $ERR to init.sh.
12622	As virtually every test defines either one or both of OUT and ERR
12623	variables and these definitions are exactly the same, move definitions
12624	of these variables from individual tests to init.sh.
12625
12626	* tests/init.sh (OUT, ERR): New variables.
12627	* tests/ipc.sh: Remove initialization of OUT variable.
12628	* tests/statx.sh: Likewise.
12629	* tests/*.test: Remove initialization of OUT and ERR variables.
12630
126312016-03-29  Dmitry V. Levin  <ldv@altlinux.org>
12632
12633	tests: simplify sendfile.test and sendfile64.test.
12634	Use the executable itself for input by default.
12635
12636	* tests/sendfile.c (main): Use av[0] instead of av[1] for input.
12637	* tests/sendfile64.c (main): Likewise.
12638	* tests/sendfile.test: Invoke run_prog without arguments.
12639	* tests/sendfile64.test: Likewise.
12640
126412016-03-29  Dmitry V. Levin  <ldv@altlinux.org>
12642
12643	open.test, openat.test: lift /proc requirement.
12644	While -P option needs /proc to match descriptors, it does not use
12645	/proc to match pathnames.  As these tests do not need descriptor
12646	match, the /proc requirement can be safely lifted.
12647
12648	* tests/open.test: Lift /proc/self/fd/ requirement.
12649	* tests/openat.test: Likewise.
12650
126512016-03-29  Dmitry V. Levin  <ldv@altlinux.org>
12652
12653	quotactl: add decoding of Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA.
12654	* quota.c (if_nextdqblk): New structure.
12655	(decode_cmd_data): Handle Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA.
12656
12657	Update Q_* constants.
12658	* xlat/quotacmds.in: Add Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA introduced
12659	by linux kernel commits v4.6-rc1~65^2~9^2~5 and v4.6-rc1~65^2~9^2~6.
12660
12661	Update CLONE_* constants.
12662	* xlat/clone_flags.in: Rename CLONE_STOPPED to CLONE_NEWCGROUP.
12663	The former was removed by linux kernel commit v2.6.38-rc1~217.
12664	The latter was introduced by linux kernel commit v4.6-rc1~67^2~8.
12665
12666	Update BPF_MAP_TYPE_* constants.
12667	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERCPU_HASH,
12668	BPF_MAP_TYPE_PERCPU_ARRAY, and BPF_MAP_TYPE_STACK_TRACE introduced by
12669	linux kernel commits v4.6-rc1~91^2~326^2~5, v4.6-rc1~91^2~326^2~4, and
12670	v4.6-rc1~91^2~212^2~1, respectively.
12671
12672	Update SO_* constants.
12673	* xlat/sockoptions.in: Add SO_CNX_ADVICE introduced by linux kernel
12674	commit v4.6-rc1~91^2~176.
12675
12676	Update SEGV_* constants.
12677	* xlat/sigsegv_codes.in: Add SEGV_PKUERR introduced by linux kernel
12678	commit v4.6-rc1~68^2~23.
12679
12680	avr32: wire up copy_file_range syscall.
12681	* linux/avr32/syscallent.h [325]: Add copy_file_range entry.
12682
126832016-03-28  JayRJoshi  <jay.r.joshi100@gmail.com>
12684
12685	tests/uname.test: check abbreviated output, use print_quoted_string.
12686	* tests/uname.c (main): Use print_quoted_string to print
12687	utsname members.  Add abbrev check.
12688	* tests/uname.test: Add abbrev check.
12689
126902016-03-28  Dmitry V. Levin  <ldv@altlinux.org>
12691
12692	faccessat.test: robustify against libcs invoking faccessat syscall on their own
12693	* tests/faccessat.c (TMP_FILE): Rename to sample, change its value
12694	to "faccessat.sample".
12695	* tests/faccessat.test: Rewrite using openat.test.
12696
12697	openat.test: robustify against libcs invoking openat syscall on their own
12698	* tests/openat.c (main): Rename fname to sample, change its value
12699	to "openat.sample".
12700	* tests/openat.test: Use -P option to filter out openat syscalls
12701	made by libc and dynamic linker.
12702
12703	tests: add open.test.
12704	* tests/open.c: New file.
12705	* tests/open.test: New test.
12706	* tests/.gitignore: Add open.
12707	* tests/Makefile.am (check_PROGRAMS): Likewise.
12708	(DECODER_TESTS): Add open.test.
12709
127102016-03-27  Dmitry V. Levin  <ldv@altlinux.org>
12711
12712	Update generic ioctl entries from linux 4.5.
12713	* linux/64/ioctls_inc.h: Update from linux v4.5 using ioctls_gen.sh.
12714	* linux/32/ioctls_inc_align32.h: Likewise.
12715	* linux/32/ioctls_inc_align64.h: Likewise.
12716	* NEWS: Mention this.
12717
127182016-03-26  Dmitry V. Levin  <ldv@altlinux.org>
12719
12720	maint: update for linux 4.5.
12721	* maint/ioctls_sym.sh: Update workarounds for drm/*_drm.h files.
12722	Add workarounds for xen/gntdev.h and net/nfc/nci_core.h files.
12723	Update path of saa6588.h and exynos-fimc.h files.
12724
127252016-03-25  Dmitry V. Levin  <ldv@altlinux.org>
12726
12727	Fix decoding of device numbers in mknod and mknodat syscalls.
12728	* mknod.c (decode_mknod): Treat device number argument as unsigned int.
12729	* tests/mknod.c: Include <sys/sysmacros.h> or <sys/mkdev.h>
12730	for definition of makedev macro.
12731	(main): Add a check for a character special file.
12732
127332016-03-25  Dmitry V. Levin  <ldv@altlinux.org>
12734
12735	sparc64: fix decoding of mknod and mknodat syscalls for sparc personality
12736	Remove remnants of solaris personality support in mknod parser
12737	that resulted to sparc personality being decoded as old solaris
12738	personality.  This complements commit v4.10-45-gdf4dd8b and fixes
12739	commit v4.10-46-g588a90f.
12740
12741	* mknod.c (decode_mknod) [SPARC || SPARC64]: Remove.
12742
127432016-03-25  Katerina Koukiou  <k.koukiou@googlemail.com>
12744
12745	tests: add openat.test.
12746	* tests/openat.c: New file.
12747	* tests/openat.test: New test.
12748	* tests/.gitignore: Add openat.
12749	* tests/Makefile.am (check_PROGRAMS): Likewise.
12750	(DECODER_TESTS): Add openat.test.
12751
127522016-03-25  Fei Jie  <feij.fnst@cn.fujitsu.com>
12753
12754	tests: add renameat.test.
12755	* tests/renameat.c: New file.
12756	* tests/renameat.test: New test.
12757	* tests/.gitignore: Add renameat.
12758	* tests/Makefile.am (check_PROGRAMS): Likewise.
12759	(DECODER_TESTS): Add renameat.test.
12760
12761	tests: add faccessat.test.
12762	* tests/faccessat.c: New file.
12763	* tests/faccessat.test: New test.
12764	* tests/.gitignore: Add faccessat.
12765	* tests/Makefile.am (check_PROGRAMS): Likewise.
12766	(DECODER_TESTS): Add faccessat.test.
12767
12768	tests: add creat.test.
12769	* tests/creat.c: New file.
12770	* tests/creat.test: New test.
12771	* tests/.gitignore: Add creat.
12772	* tests/Makefile.am (check_PROGRAMS): Likewise.
12773	(DECODER_TESTS): Add creat.test.
12774
12775	tests: add mknod.test.
12776	* tests/mknod.c: New file.
12777	* tests/mknod.test: New test.
12778	* tests/.gitignore: Add mknod.
12779	* tests/Makefile.am (check_PROGRAMS): Likewise.
12780	(DECODER_TESTS): Add mknod.test.
12781
12782	tests: add syslog.test.
12783	* tests/syslog.c: New file.
12784	* tests/syslog.test: New test.
12785	* tests/.gitignore: Add syslog.
12786	* tests/Makefile.am (check_PROGRAMS): Likewise.
12787	(DECODER_TESTS): Add syslog.test.
12788
127892016-03-23  JayRJoshi  <jay.r.joshi100@gmail.com>
12790
12791	tests/scm_rights-fd.test: fix pathname regex.
12792	Pathname containing >, }, or non-printable characters was resulting
12793	in failing of the test.
12794
12795	* tests/scm_rights-fd.test: Fix pathname regex and simplify things.
12796
127972016-03-24  Dmitry V. Levin  <ldv@altlinux.org>
12798
12799	tests: add strace-r.test.
12800	* tests/strace-r.expected: New file.
12801	* tests/strace-r.test: New test.
12802	* tests/Makefile.am (MISC_TESTS): Add it.
12803	(EXTRA_DIST): Add strace-r.expected.
12804
12805	tests: add strace-ttt.test.
12806	* tests/strace-ttt.test: New test.
12807	* tests/Makefile.am (MISC_TESTS): Add it.
12808
12809	tests: add strace-tt.test.
12810	* tests/strace-tt.test: New test.
12811	* tests/Makefile.am (MISC_TESTS): Add it.
12812
12813	tests: add strace-t.test.
12814	* tests/strace-t.test: New test.
12815	* tests/Makefile.am (MISC_TESTS): Add it.
12816
12817	tests: add strace-T.test.
12818	* tests/strace-T.expected: New file.
12819	* tests/strace-T.test: New test.
12820	* tests/Makefile.am (MISC_TESTS): Add it.
12821	(EXTRA_DIST): Add strace-T.expected.
12822
128232016-03-23  Dmitry V. Levin  <ldv@altlinux.org>
12824
12825	tests: split out tests of specific decoders.
12826	Split TESTS into three groups: tests of specific decoders, libunwind
12827	tests, and all other tests.
12828
12829	* tests/Makefile.am (TESTS): Move attach-f-p.test, attach-p-cmd.test,
12830	bexecve.test, count-f.test, count.test, detach-running.test,
12831	detach-sleeping.test, detach-stopped.test, dumpio.test,
12832	filter-unavailable.test, fork-f.test, ksysent.test, opipe.test,
12833	pc.test, qual_syscall.test, redirect.test, restart_syscall.test,
12834	strace-f.test, and vfork-f.test to MISC_TESTS.
12835	Move remaining tests except $(LIBUNWIND_TESTS) to DECODER_TESTS.
12836	Add $(DECODER_TESTS) and $(MISC_TESTS).
12837
128382016-03-23  JayRJoshi  <jay.r.joshi100@gmail.com>
12839
12840	tests: add getcwd.test.
12841	* tests/getcwd.c: New file.
12842	* tests/getcwd.test: New test.
12843	* tests/.gitignore: Add getcwd.
12844	* tests/Makefile.am (check_PROGRAMS): Likewise.
12845	(TESTS): Add getcwd.test.
12846
12847	tests: add print_quoted_string function to libtests.
12848	* tests/tests.h (print_quoted_string): New prototype.
12849	* tests/print_quoted_string.c: New file.
12850	* tests/Makefile.am (libtests_a_SOURCES): Add it.
12851
128522016-03-17  Fei Jie  <feij.fnst@cn.fujitsu.com>
12853
12854	tests: add xetpriority.test.
12855	* resource.c (SYS_FUNC(getpriority), SYS_FUNC(setpriority)): Print
12856	the second syscall argument using %d format.
12857	* tests/xetpriority.c: New file.
12858	* tests/xetpriority.test: New test.
12859	* tests/.gitignore: Add xetpriority.
12860	* tests/Makefile.am (check_PROGRAMS): Likewise.
12861	(TESTS): Add xetpriority.test.
12862
128632016-03-15  Fei Jie  <feij.fnst@cn.fujitsu.com>
12864
12865	tests: add flock.test.
12866	* tests/flock.c: New file.
12867	* tests/flock.test: New test.
12868	* tests/.gitignore: Add flock.
12869	* tests/Makefile.am (check_PROGRAMS): Likewise.
12870	(TESTS): Add flock.test.
12871
12872	tests: add sched_xetscheduler.test.
12873	* tests/sched_xetscheduler.c: New file.
12874	* tests/sched_xetscheduler.test: New test.
12875	* tests/.gitignore: Add sched_xetscheduler.
12876	* tests/Makefile.am (check_PROGRAMS): Likewise.
12877	(TESTS): Add sched_xetscheduler.test.
12878
128792016-03-15  Dmitry V. Levin  <ldv@altlinux.org>
12880
12881	alpha: fix SOCK_DIAG_BY_FAMILY tests.
12882	This complements commit v4.9-368-g301c65c.
12883
12884	* tests/netlink_inet_diag.c (check_responses): Align "buf"
12885	on sizeof(long) boundary.
12886	* tests/netlink_unix_diag.c (check_responses): Likewise.
12887
128882016-03-14  Dmitry V. Levin  <ldv@altlinux.org>
12889
12890	Update EPOLL* constants.
12891	* xlat/epollevents.in: Add EPOLLWAKEUP and EPOLLEXCLUSIVE.
12892
128932016-03-12  Dmitry V. Levin  <ldv@altlinux.org>
12894
12895	tests: add count-f.test.
12896	* tests/count-f.c: New file.
12897	* tests/count-f.expected: Likewise.
12898	* tests/count-f.test: New test.
12899	* tests/.gitignore: Add count-f.
12900	* tests/Makefile.am (check_PROGRAMS): Likewise.
12901	(count_f_LDADD): New variable.
12902	(EXTRA_DIST): Add count-f.expected.
12903	(TESTS): Add count-f.test.
12904
129052016-02-21  Dmitry V. Levin  <ldv@altlinux.org>
12906
12907	hppa: wire up copy_file_range syscall.
12908	* linux/hppa/syscallent.h [346]: Add copy_file_range entry.
12909
129102016-03-11  Fei Jie  <feij.fnst@cn.fujitsu.com>
12911
12912	tests: filter strace output in uname test.
12913	* tests/uname.test: Use uniq to filter strace output.
12914
129152016-03-10  Fei Jie  <feij.fnst@cn.fujitsu.com>
12916
12917	tests: add sched_xetparam.test.
12918	* tests/sched_xetparam.c: New file.
12919	* tests/sched_xetparam.test: New test.
12920	* tests/.gitignore: Add sched_xetparam.
12921	* tests/Makefile.am (check_PROGRAMS): Likewise.
12922	(TESTS): Add sched_xetparam.test.
12923
12924	tests: add sched_get_priority_mxx.test.
12925	* tests/sched_get_priority_mxx.c: New file.
12926	* tests/sched_get_priority_mxx.test: New test.
12927	* tests/.gitignore: Add sched_get_priority_mxx.
12928	* tests/Makefile.am (check_PROGRAMS): Likewise.
12929	(TESTS): Add sched_get_priority_mxx.test.
12930
12931	tests: add dup.test, dup2.test, and dup3.test.
12932	* tests/dup.c: New file.
12933	* tests/dup.test: New test.
12934	* tests/dup2.c: New file.
12935	* tests/dup2.test: New test.
12936	* tests/dup3.c: New file.
12937	* tests/dup3.test: New test.
12938	* tests/.gitignore: Add dup, dup2, and dup3.
12939	* tests/Makefile.am (check_PROGRAMS): Likewise.
12940	(TESTS): Add dup.test, dup2.test, and dup3.test.
12941
129422016-03-10  Fabien Siron  <fabien.siron@epita.fr>
12943
12944	tests: add fchmod.test.
12945	* tests/fchmod.c: New file.
12946	* tests/fchmod.test: New test.
12947	* tests/.gitignore: Add fchmod.
12948	* tests/Makefile.am (check_PROGRAMS): Likewise.
12949	(TESTS): Add fchmod.test.
12950
129512016-03-09  Fei Jie  <feij.fnst@cn.fujitsu.com>
12952
12953	tests: add acct.test.
12954	* tests/acct.c: New file.
12955	* tests/acct.test: New test.
12956	* tests/.gitignore: Add acct.
12957	* tests/Makefile.am (check_PROGRAMS): Likewise.
12958	(TESTS): Add acct.test.
12959
129602016-03-07  Anchit Jain  <anchitjain1234@gmail.com>
12961
12962	tests: add chmod.test.
12963	* tests/chmod.c: New file.
12964	* tests/chmod.test: New test.
12965	* tests/.gitignore: Add chmod.
12966	* tests/Makefile.am (check_PROGRAMS): Likewise.
12967	(TESTS): Add chmod.test.
12968
129692016-03-05  Nahim El Atmani  <naam@lse.epita.fr>
12970
12971	Reduce memory usage while managing tcbs allocation.
12972	* strace.c (init):  Remove initial memory allocation for tcbtab.
12973	(expand_tcbtab): Do initial memory allocation when tcbtabsize == 0.
12974
12975	Reviewed-By: Gabriel Laskar <gabriel@lse.epita.fr>
12976	Reported-by: haris iqbal <haris.phnx@gmail.com>
12977
129782016-03-01  Fei Jie  <feij.fnst@cn.fujitsu.com>
12979
12980	tests: add umask.test.
12981	* tests/umask.c: New file.
12982	* tests/umask.test: New test.
12983	* tests/.gitignore: Add umask.
12984	* tests/Makefile.am (check_PROGRAMS): Likewise.
12985	(TESTS): Add umask.test.
12986
12987	tests: add rename.test.
12988	* tests/rename.c: New file.
12989	* tests/rename.test: New test.
12990	* tests/.gitignore: Add rename.
12991	* tests/Makefile.am (check_PROGRAMS): Likewise.
12992	(TESTS): Add rename.test.
12993
12994	tests: add uname.test.
12995	* tests/uname.c: New file.
12996	* tests/uname.test: New test.
12997	* tests/.gitignore: Add uname.
12998	* tests/Makefile.am (check_PROGRAMS): Likewise.
12999	(TESTS): Add uname.test.
13000
130012016-02-20  Dmitry V. Levin  <ldv@altlinux.org>
13002
13003	mips: wire up copy_file_range syscall.
13004	* linux/mips/syscallent-n32.h [6324]: Add copy_file_range entry.
13005	* linux/mips/syscallent-n64.h [5320]: Likewise.
13006	* linux/mips/syscallent-o32.h [4360]: Likewise.
13007
130082016-02-19  Dmitry V. Levin  <ldv@altlinux.org>
13009
13010	tests: add rt_sigsuspend.test.
13011	* tests/rt_sigsuspend.c: New file.
13012	* tests/rt_sigsuspend.test: New test.
13013	* tests/.gitignore: Add rt_sigsuspend.
13014	* tests/Makefile.am (check_PROGRAMS): Likewise.
13015	(TESTS): Add rt_sigsuspend.test.
13016
13017	Print pid_t arguments of rt_sigqueueinfo and rt_tgsigqueueinfo as int.
13018	* signal.c (SYS_FUNC(rt_sigqueueinfo)): Print first syscall argument
13019	using %d format.
13020	(SYS_FUNC(rt_tgsigqueueinfo)): Print first and second syscall arguments
13021	using %d format.
13022	* tests/rt_tgsigqueueinfo.c: New file.
13023	* tests/rt_tgsigqueueinfo.test: New test.
13024	* tests/.gitignore: Add rt_tgsigqueueinfo.
13025	* tests/Makefile.am (check_PROGRAMS): Likewise.
13026	(TESTS): Add rt_tgsigqueueinfo.test.
13027
13028	getrusage.test: fix build on x32.
13029	* tests/getrusage.c: Include <stdint.h>
13030	(main): Print members of struct timeval using %ju format.
13031
130322016-02-19  Dmitry V. Levin  <ldv@altlinux.org>
13033
13034	getrusage.test: check that getrusage parser does not access extra memory
13035	Place struct rusage at the end of an allocated memory page followed by
13036	an inaccessible page.
13037
13038	* tests/getrusage.c (main): Use tail_alloc.
13039
130402016-02-19  Fei Jie  <feij.fnst@cn.fujitsu.com>
13041
13042	tests: add getrusage.test.
13043	* tests/getrusage.c: New file.
13044	* tests/getrusage.test: New test.
13045	* tests/.gitignore: Add getrusage.
13046	* tests/Makefile.am (check_PROGRAMS): Likewise.
13047	(TESTS): Add getrusage.test.
13048
130492016-02-19  Dmitry V. Levin  <ldv@altlinux.org>
13050
13051	Print rt_sigtimedwait return value as a signal name.
13052	* signal.c (SYS_FUNC(rt_sigtimedwait)): Decode return value.
13053	* tests/rt_sigtimedwait.c: New file.
13054	* tests/rt_sigtimedwait.test: New test.
13055	* tests/.gitignore: Add rt_sigtimedwait.
13056	* tests/Makefile.am (check_PROGRAMS): Likewise.
13057	(TESTS): Add rt_sigtimedwait.test.
13058
13059	tests: add rt_sigprocmask.test.
13060	* tests/rt_sigprocmask.c: New file.
13061	* tests/rt_sigprocmask.test: New test.
13062	* tests/.gitignore: Add rt_sigprocmask.
13063	* tests/Makefile.am (check_PROGRAMS): Likewise.
13064	(TESTS): Add rt_sigprocmask.test.
13065
13066	Fix corner cases of rt_sigpending syscall decoder.
13067	* signal (print_sigset_addr_len_limit): New function, cloned from
13068	print_sigset_addr_len with added minimal length argument.
13069	Treat length less than minimal length or greater than NSIG/8 as invalid.
13070	Do not align length to 4-byte boundary.  Align destination buffer
13071	to 4-byte boundary and initialize it with zeroes so that subsequent
13072	call to sprintsigmask_n will not access uninitialized data.
13073	(print_sigset_addr_len): Turn into a wrapper around
13074	print_sigset_addr_len_limit with current_wordsize
13075	as a minimal length argument.
13076	(SYS_FUNC(rt_sigpending)): Call print_sigset_addr_len_limit
13077	instead of print_sigset_addr_len with 1 as a minimal length argument.
13078	* tests/rt_sigpending.c: New file.
13079	* tests/rt_sigpending.test: New test.
13080	* tests/.gitignore: Add rt_sigpending.
13081	* tests/Makefile.am (check_PROGRAMS): Likewise.
13082	(TESTS): Add rt_sigpending.test.
13083
130842016-02-19  Dmitry V. Levin  <ldv@altlinux.org>
13085
13086	Change unix_diag requests back to use full dump instead of exact match.
13087	Unfortunately, 64-bit linux kernel has a bug in matching inode numbers
13088	greater than INT_MAX, so unix_diag exact match is not reliable.
13089
13090	This partially reverts commit 69bfc89770152033d4aa0bc5673fc46e65d89838.
13091
13092	* socketutils.c (unix_send_query): Add NLM_F_DUMP to nlmsg_flags,
13093	remove initialization of udiag_cookie.
13094	* tests/netlink_unix_diag.c (send_query): Remove "inode" argument,
13095	add NLM_F_DUMP to nlmsg_flags, remove initialization of udiag_ino
13096	and udiag_cookie.
13097	(check_responses): Remove "inode" argument and its use.
13098	(main): Remove invocation of inode_of_sockfd and passing of listening
13099	socket inode to send_query and check_responses.
13100
131012016-02-19  Michael Shigorin  <mike@altlinux.org>
13102
13103	tests: avoid using cpp -dD.
13104	-dD is less portable across some peculiar preprocessors.
13105
13106	tests/Makefile.am (ksysent.h): Use cpp -dM instead of cpp -dD.
13107
131082016-02-16  Dmitry V. Levin  <ldv@altlinux.org>
13109
13110	tests: add poll.test.
13111	* tests/poll.c: New file.
13112	* tests/poll.test: New test.
13113	* tests/.gitignore: Add poll.
13114	* tests/Makefile.am (check_PROGRAMS): Likewise.
13115	(TESTS): Add poll.test.
13116
13117	Fix abbreviated output of poll and ppoll decoders.
13118	* poll.c (decode_poll_entering, decode_poll_exiting): Fix corner cases
13119	of abbreviated output.
13120	* tests/ppoll-v.expected: Update.
13121	* tests/ppoll.expected: Update.
13122	* tests/ppoll.test: Update.
13123
13124	Print unfetchable address in poll and ppoll decoders.
13125	* poll.c (decode_poll_entering): Replace umove call with
13126	umove_or_printaddr.
13127	(decode_poll_exiting): Print unfetchable address when umove call fails.
13128
13129	Print offsets in lseek and _llseek syscalls as signed integers.
13130	* lseek.c (SYS_FUNC(lseek)): Print offset using %lld format.
13131	(SYS_FUNC(llseek)): Likewise.  Treat high and low components of offset
13132	as unsigned long integers.
13133	* tests/llseek.c (main): Check that negative offset is printed properly.
13134	* tests/lseek.c (main): Likewise.
13135
131362016-02-14  Dmitry V. Levin  <ldv@altlinux.org>
13137
13138	tests: add xetpgid.test.
13139	* tests/xetpgid.c: New file.
13140	* tests/xetpgid.test: New test.
13141	* tests/.gitignore: Add xetpgid.
13142	* tests/Makefile.am (check_PROGRAMS): Likewise.
13143	(TESTS): Add xetpgid.test.
13144
13145	tests: add alarm.test.
13146	* tests/alarm.c: New file.
13147	* tests/alarm.test: New test.
13148	* tests/.gitignore: Add alarm.
13149	* tests/Makefile.am (check_PROGRAMS): Likewise.
13150	(TESTS): Add alarm.test.
13151
13152	Replace printargs_lu and printargs_ld with printargs_u and printargs_d.
13153	* defs.h (printargs_lu): Rename to printargs_u.
13154	(printargs_ld): Rename to printargs_d.
13155	* syscall.c (printargs_lu): Rename to printargs_u.  Replace %lu with %u.
13156	(printargs_ld): Rename to printargs_d.  Replace %ld with %d.
13157	* linux/dummy.h (sys_getpgrp): Change to printargs.
13158	(sys_alarm): Change to printargs_u.
13159	(sys_getpgid, sys_getsid, sys_nice, sys_setpgid, sys_setpgrp,
13160	sys_timer_delete, sys_timer_getoverrun): Change to printargs_d.
13161
13162	Change printargs_lu and printargs_ld to return RVAL_DECODED.
13163	* syscall.c (printargs_lu, printargs_ld): Return RVAL_DECODED.
13164
13165	redirect.test: fix the way how strace output is discarded.
13166	* tests/redirect.test: Disable tracing of syscalls, signals,
13167	and exit status instead of redirecting strace output to /dev/null.
13168
13169	tests: extend coverage of struct iovec arrays.
13170	* tests/readv.c (main): Check decoding of empty, inaccessible,
13171	and partially inaccessible iovec arrays.
13172	* tests/readv.test: Update.
13173
13174	Implement dumping of vmsplice syscall.
13175	* syscall.c (dumpio): Add SEN_vmsplice.
13176	* NEWS: Mention this.
13177	* tests/vmsplice.c: New file.
13178	* tests/vmsplice.test: New test.
13179	* tests/.gitignore: Add vmsplice.
13180	* tests/Makefile.am (check_PROGRAMS): Likewise.
13181	(TESTS): Add vmsplice.test.
13182
13183	tests: add tee.test.
13184	* tests/tee.c: New file.
13185	* tests/tee.test: New test.
13186	* tests/.gitignore: Add tee.
13187	* tests/Makefile.am (check_PROGRAMS): Likewise.
13188	(TESTS): Add tee.test.
13189
13190	Fix printing of negative offsets in splice syscall.
13191	* io.c (SYS_FUNC(splice)): Use PRId64 instead of PRIu64 for printing
13192	offsets.
13193	* tests/splice.c: New file.
13194	* tests/splice.test: New test.
13195	* tests/.gitignore: Add splice.
13196	* tests/Makefile.am (check_PROGRAMS): Likewise.
13197	(TESTS): Add splice.test.
13198
13199	Implement copy_file_range syscall decoding.
13200	* copy_file_range.c: New file.
13201	* Makefile.am (strace_SOURCES): Add it.
13202	* linux/32/syscallent.h (copy_file_range): New entry.
13203	* linux/64/syscallent.h: Likewise.
13204	* linux/arm/syscallent.h: Likewise.
13205	* linux/i386/syscallent.h: Likewise.
13206	* linux/ia64/syscallent.h: Likewise.
13207	* linux/m68k/syscallent.h: Likewise.
13208	* linux/powerpc/syscallent.h: Likewise.
13209	* linux/powerpc64/syscallent.h: Likewise.
13210	* linux/s390/syscallent.h: Likewise.
13211	* linux/s390x/syscallent.h: Likewise.
13212	* linux/sparc/syscallent.h: Likewise.
13213	* linux/sparc64/syscallent.h: Likewise.
13214	* linux/x32/syscallent.h: Likewise.
13215	* linux/x86_64/syscallent.h: Likewise.
13216	* pathtrace.c (pathtrace_match): Add SEN_copy_file_range.
13217	* NEWS: Mention new syscall parser.
13218	* tests/copy_file_range.c: New file.
13219	* tests/copy_file_range.test: New test.
13220	* tests/.gitignore: Add copy_file_range.
13221	* tests/Makefile.am (check_PROGRAMS): Likewise.
13222	(TESTS): Add copy_file_range.test.
13223
13224	Update fs *_MAGIC constants.
13225	* xlat/fsmagic.in: Add CGROUP2_SUPER_MAGIC and OVERLAYFS_SUPER_MAGIC.
13226
13227	Update IPV6_* constants.
13228	* xlat/sockipv6options.in: Add IPV6_HDRINCL.
13229
13230	Update SO_* constants.
13231	* xlat/sockoptions.in: Add SO_ATTACH_REUSEPORT_CBPF
13232	and SO_ATTACH_REUSEPORT_EBPF.
13233
13234	Update MADV_* constants.
13235	* xlat/madvise_cmds.in: Add MAD_FREE.
13236
132372016-02-13  Dmitry V. Levin  <ldv@altlinux.org>
13238
13239	tests: robustify execve and execveat tests.
13240	* tests/execve.c (main): Use one page gap between two mapped regions
13241	for an address that is more likely to be not yet mapped.
13242	* tests/execveat.c (main): Likewise.
13243
13244	tests: simplify execve test.
13245	* tests/execve.c (main): Simplify the test assuming that execve syscall
13246	never returns ENOSYS.
13247
132482016-02-13  Dmitry V. Levin  <ldv@altlinux.org>
13249
13250	Fix numbers of syscall arguments in syscall tables.
13251	This semi-automatic change brings syscall tables in sync with kernel's
13252	include/linux/syscalls.h file.
13253
13254	* linux/aarch64/syscallent.h (recv): Fix nargs.
13255	* linux/alpha/syscallent.h (sigaltstack, init_module,
13256	sched_getscheduler, settimeofday): Likewise.
13257	* linux/arm/syscallent.h (signal, pciconfig_iobase, msgrcv, msgctl,
13258	shmat, shmdt, shmctl, semtimedop, get_mempolicy, set_mempolicy,
13259	timerfd_create): Likewise.
13260	* linux/bfin/syscallent.h (signal, delete_module): Likewise.
13261	* linux/hppa/syscallent.h (init_module, munlockall, sched_getscheduler,
13262	io_cancel, set_tid_address, listxattr, llistxattr, flistxattr,
13263	removexattr, lremovexattr, fremovexattr): Likewise.
13264	* linux/i386/syscallent.h (signal, mmap): Likewise.
13265	* linux/ia64/syscallent.h (init_module, readv, writev,
13266	sched_getscheduler): Likewise.
13267	* linux/m68k/syscallent.h (signal, request_key): Likewise.
13268	* linux/microblaze/syscallent.h (signal, clone, fstatfs64, vmsplice):
13269	Likewise.
13270	* linux/mips/syscallent-n32.h (getpgid, statfs, fstatfs, init_module,
13271	delete_module): Likewise.
13272	* linux/mips/syscallent-n64.h (getpgid, statfs, fstatfs, init_module,
13273	delete_module): Likewise.
13274	* linux/mips/syscallent-o32.h (signal, statfs, fstatfs, ioperm,
13275	fstatfs64): Likewise.
13276	* linux/powerpc/syscallent.h (signal, spu_run, spu_create): Likewise.
13277	* linux/powerpc64/syscallent.h (signal, pread64, pwrite64, readahead,
13278	fadvise64, lookup_dcookie, spu_run, spu_create, sync_file_range2,
13279	fallocate, preadv, pwritev, fanotify_mark): Likewise.
13280	* linux/s390/syscallent.h (signal, mmap, lookup_dcookie, ipc): Likewise.
13281	* linux/s390x/syscallent.h (signal, ipc): Likewise.
13282	* linux/sh/syscallent.h (signal, ipc, munlockall, fstatfs64, vmsplice):
13283	Likewise.
13284	* linux/sh64/syscallent.h (signal, ipc, msgrcv, msgctl, shmat, shmdt,
13285	shmctl, fstatfs64, vmsplice): Likewise.
13286	* linux/sparc/syscallent.h (ptrace, dup, signal, ipc): Likewise.
13287	* linux/sparc64/syscallent.h (ptrace, dup, signal, pread64, pwrite64,
13288	readahead, lookup_dcookie, fadvise64, fadvise64_64, ipc,
13289	sync_file_range, fallocate, preadv, pwritev, fanotify_mark): Likewise.
13290	* linux/x32/syscallent.h (64:recvmsg): Likewise.
13291	* linux/xtensa/syscallent.h (mremap, futex, reboot, init_module,
13292	delete_module, request_key, getcpu, ioprio_set, ioprio_get, utimensat,
13293	futimesat, fchmodat, faccessat): Likewise.
13294	* NEWS: Mention this fix.
13295
132962016-02-13  Dmitry V. Levin  <ldv@altlinux.org>
13297
13298	s390: decode fadvise64 and fadvise64_64.
13299	* linux/s390/syscallent.h (fadvise64): Set sys_func.
13300	(fadvise64_64): Set nargs and sys_func.
13301
13302	mips n64: use the most optimal parser for fadvise64 syscall.
13303	* linux/mips/syscallent-n64.h (fadvise64): Replace SEN(fadvise64_64)
13304	with SEN(fadvise64).
13305
13306	ia64: decode fstatfs64 and statfs64.
13307	* linux/ia64/syscallent.h (fstatfs64, statfs64): Set nargs and sys_func.
13308
133092016-02-13  Dmitry V. Levin  <ldv@altlinux.org>
13310
13311	alpha, ia64, mips, sh, sh64: fix the number of pipe syscall arguments.
13312	On alpha, ia64, mips, sh, sh64, sparc, and sparc64 architectures
13313	pipe syscall does not take arguments.
13314
13315	* linux/alpha/syscallent.h (pipe): Change nargs to 0.
13316	* linux/ia64/syscallent.h (pipe): Likewise.
13317	* linux/mips/syscallent-n32.h (pipe): Likewise.
13318	* linux/mips/syscallent-n64.h (pipe): Likewise.
13319	* linux/mips/syscallent-o32.h (pipe): Likewise.
13320	* linux/sh/syscallent.h (pipe): Likewise.
13321	* linux/sh64/syscallent.h (pipe): Likewise.
13322
133232016-02-13  Dmitry V. Levin  <ldv@altlinux.org>
13324
13325	alpha, ia64, mips, sh*, sparc*: fix error path decoding of pipe syscall.
13326	* net.c (do_pipe) [HAVE_GETRVAL2]: Remove.
13327	Always call decode_pair_fd on exiting.
13328	(SYS_FUNC(pipe)) [HAVE_GETRVAL2]: Call printpair_fd instead of do_pipe.
13329
13330	Fix pathtrace match for pipe2 syscall.
13331	* pathtrace.c (pathtrace_match): As pipe2 syscall has no descriptors
13332	or paths to test, move SEN_pipe2 to the appropriate category.
13333
13334	avr32: wire up missing syscalls.
13335	* linux/avr32/syscallent.h [322..324]: Add userfaultfd, membarrier,
13336	and mlock2 entries.
13337
133382016-02-12  Dmitry V. Levin  <ldv@altlinux.org>
13339
13340	tests: check decoding of madvise, mlockall, mremap, and msync syscalls.
13341	* tests/mmap.c (main): Change output format from regexp to verbatim.
13342	Add tests for madvise, mlockall, mremap, and msync syscalls.
13343	* tests/mmap.test: Convert from match_grep to match_diff.
13344	Add madvise, mlockall, mremap, and msync syscalls to syscall filter.
13345
133462016-02-11  Dmitry V. Levin  <ldv@altlinux.org>
13347
13348	Simplify decoding of waitpid and wait4 syscalls.
13349	* wait.c (printwaitn): Replace "n" and "bitness" integer arguments
13350	with a single print_rusage function pointer.  All callers updated.
13351
13352	waitid: print pid argument as int.
13353	* wait.c (SYS_FUNC(waitid)): As the type of second syscall argument
13354	in the kernel is pid_t, print it as int.
13355
13356	waitid: always print 5th argument.
13357	* wait.c (SYS_FUNC(waitid)): Do not check for tcp->s_ent->nargs
13358	as waitid syscall has 5 arguments.
13359
13360	socketutils: add const qualifier to variables.
13361	* socketutils.c (cache_and_print_inode_details): Make "details"
13362	parameter const.
13363	(print_sockaddr_by_inode_cached): Make "e" variable const.
13364	(inet_send_query): Make struct nlmsghdr and struct inet_diag_req_v2
13365	members const.  Make "msg" variable const.
13366	(inet_parse_response): Make "data" parameter and diag_msg variable const.
13367	(receive_responses): Make "h" and "rc" variables const.
13368	(unix_send_query): Make struct nlmsghdr and struct unix_diag_req
13369	members const.  Make "msg" variable const.
13370	(unix_print): Make all parameters const.
13371	(print_sockaddr_by_inode): Make proto_name parameter const.
13372
13373	print_sockaddr_by_inode: cleanup protocol lookup.
13374	* socketutils.c (tcp_v4_print, udp_v4_print, tcp_v6_print,
13375	udp_v6_print): New functions.
13376	(print_sockaddr_by_inode): Make "protocols" array static, replace
13377	"family" and "protocol" members with "print" in its underlying
13378	structure.  Iterate through protocols array when the protocol name
13379	is specified.
13380
133812016-02-09  Dmitry V. Levin  <ldv@altlinux.org>
13382
13383	tests: check that -f -p attaches to threads properly.
13384	Check that -f -p attaches and follows all threads of the given pid.
13385
13386	* tests/attach-f-p.c: New file.
13387	* tests/attach-f-p.test: New test.
13388	* tests/.gitignore: Add attach-f-p.
13389	* tests/Makefile.am (check_PROGRAMS): Likewise.
13390	(attach_f_p_LDADD): New variable.
13391	(TESTS): Add attach-f-p.test.
13392
133932016-02-09  Dmitry V. Levin  <ldv@altlinux.org>
13394
13395	Introduce libstrace.a for potentially conditional compilation units.
13396	Some files are used conditionally depending on architecture and
13397	configuration.  Create a library for the purpose of keeping such
13398	compilation units.
13399
13400	* Makefile.am (strace_LDADD, noinst_LIBRARIES): Add libstrace.a.
13401	(libstrace_a_CPPFLAGS): New variable, set to $(strace_CPPFLAGS).
13402	(libstrace_a_CFLAGS): New variable, set to $(strace_CFLAGS).
13403	(libstrace_a_SOURCES): New variable, set to upeek.c.
13404	* util.c (upeek): Move ...
13405	* upeek.c: ... here.
13406
134072016-02-08  Dmitry V. Levin  <ldv@altlinux.org>
13408
13409	travis-ci: pass more gcov arguments to codecov.
13410
13411	tests: extend coverage of struct itimerspec.
13412	* tests/timer_xettime.c (main): Check decoding of NULL struct itimerspec
13413	pointer.
13414
13415	tests: extend coverage of utimensat syscall.
13416	* tests/utimensat.c (main): Check decoding of NULL struct timespec
13417	pointer.
13418
13419	tests: extend coverage of time syscall.
13420	* tests/time.c (main): Check decoding of NULL time_t pointer.
13421
13422	tests: extend coverage of struct sigevent.
13423	* tests/timer_create.c (main): Check decoding of NULL struct sigevent
13424	pointer.  Check decoding of invalid sigev_notify value.
13425
134262016-02-08  Dmitry V. Levin  <ldv@altlinux.org>
13427
13428	tests: extend coverage of execve and execveat syscalls.
13429	Check decoding of inaccessible or partially inaccessible arrays.
13430
13431	* tests/execve-v.c: New file.
13432	* tests/execveat-v.c: Likewise.
13433	* tests/execve-v.test: New test.
13434	* tests/execveat-v.test: Likewise.
13435	* tests/execve.c: Rewrite.
13436	* tests/execveat.c: Likewise.
13437	* tests/execve.test: Likewise.
13438	* tests/execveat.test: Likewise.
13439	* tests/execve.expected: Remove.
13440	* tests/execve-v.expected: Likewise.
13441	* tests/execveat.expected: Likewise.
13442	* tests/execveat-v.expected: Likewise.
13443	* tests/.gitignore: Add execve-v and execveat-v.
13444	* tests/Makefile.am (check_PROGRAMS): Likewise.
13445	(TESTS): Add execve-v.test and execveat-v.test.
13446	(EXTRA_DIST): Remove execve.expected, execve-v.expected,
13447	execveat.expected, and execveat-v.expected.
13448
134492016-02-08  Dmitry V. Levin  <ldv@altlinux.org>
13450
13451	Fix decoding of execve and execveat syscalls with invalid input.
13452	* execve.c (printargv): Fix decoding of inaccessible or partially
13453	inaccessible array.
13454	(printargc): Diagnose inaccessible or partially inaccessible array.
13455	(decode_execve, SYS_FUNC(execv)): Update printargv and printargc callers.
13456
13457	tests: extend coverage of capget syscall.
13458	* tests/caps.c (main): Check decoding of inaccessible cap_user_header_t
13459	and/or cap_user_data_t.
13460	* tests/caps.awk: Update match patterns.
13461	* tests/caps.test: Update.
13462
13463	tests: extend coverage of sched_getaffinity syscall.
13464	* tests/sched_xetaffinity.c (main): Check decoding of pointer
13465	to inaccessible cpu_set_t.
13466
13467	tests: extend coverage of utime syscall.
13468	* tests/utime.c (main): Check decoding of NULL struct utimbuf pointer.
13469	Check decoding of struct utimbuf located at the end of page boundary.
13470	* tests/utime.test: Update.
13471
13472	tests: extend coverage of sysinfo syscall.
13473	* tests/sysinfo.c (main): Check decoding of NULL struct sysinfo pointer.
13474	Check decoding of struct sysinfo located at the end of page boundary.
13475	* tests/sysinfo.test: Update.
13476
13477	tests: extend coverage of adjtimex syscall.
13478	* tests/adjtimex.c (main): Check decoding of NULL struct timex pointer.
13479	Check decoding of struct timex located at the end of page boundary.
13480	* tests/adjtimex.test: Update.
13481
13482	tests: check that strace does not retain stdin and stdout descriptors.
13483	* tests/redirect.test: New test.
13484	* tests/Makefile.am (TESTS): Add it.
13485
13486	Create a dummy pipe descriptor instead of opening /dev/null.
13487	* strace.c (open_dev_null): Rename to open_dummy_desc.  All callers
13488	changed.  Create a pipe and return its first descriptor instead of
13489	opening /dev/null.
13490
134912016-02-08  Denys Vlasenko  <dvlasenk@redhat.com>
13492
13493	If stdin/stdout aren't open on startup, open them to /dev/null.
13494	Otherwise, -oLOGFILE may end up using one of them. This conflicts
13495	with the previous change, which closes stdin/out in strace.
13496
13497	* strace.c (init): If fcntl(F_GETFD) fails on stdin or stdout,
13498	sanitize them: open /dev/null and dup it until fds 0,1,2
13499	are all used up.
13500
135012016-02-08  Denys Vlasenko  <dvlasenk@redhat.com>
13502
13503	Close stdin/out after child is forked.
13504	Testcase:
13505
13506	{ sleep 1; yes | head -n99999; } | strace -o/dev/null sh -c 'exec <&-; sleep 9'
13507
13508	The writer (head) will be able to perform writes to write end of the pipe.
13509	With strace call removed, head will immediately get SIGPIPE.
13510
13511	This change fixes this: now writer immediately gets SIGPIPE with strace too.
13512
13513	* strace.c (startup_child): Close stdin/out and reopen them to /dev/null.
13514
135152016-02-05  Dmitry V. Levin  <ldv@altlinux.org>
13516
13517	tests: add opipe.test.
13518	Check that -o |pipe_command works.  In particular, check that
13519	strace waits for completion of piped command.
13520
13521	* tests/opipe.test: New test.
13522	* tests/Makefile.am (TESTS): Add it.
13523
135242016-02-05  Keith Owens  <kaos.ocs@gmail.com>
13525
13526	strace-graph: print the pid in the graph.
13527	* strace-graph: Prefix each command with its pid.
13528
13529	strace-graph: cope with clone immediately followed by exit.
13530	* strace-graph: A clone() followed by exit() with no intervening fork
13531	or execve resulted in the new pid having no seq key.  That breaks when
13532	trying to use seq as an array reference.  Ensure that clone populates
13533	the new pid with an empty seq entry.
13534
13535	strace-graph: handle recent strace output.
13536	* strace-graph: Fix regex for --SIG.  Ignore '+++ exited with <n> +++'
13537	lines.  Handle exit_group syscall as well as _exit.
13538
13539	strace-graph: handle strace -T.
13540	* strace-graph: Ignore extra ' <time.spent>' field added by strace -T.
13541
13542	strace-graph: use "strict" and "warnings" pragmas.
13543	* strace-graph: Set "use strict" and "use warnings" options.  Fix errors
13544	detected by strict/warnings.  $result is really a string, it can be "-1"
13545	followed by an error text.
13546
135472016-02-04  Dmitry V. Levin  <ldv@altlinux.org>
13548
13549	Add README.md file with links to build status and test coverage.
13550
13551	travis-ci: prepare and submit test coverage report.
13552
13553	tests: extend readlink and readlinkat coverage.
13554	* tests/readlink.c (PREFIX, TARGET, LINKPATH): New macros.
13555	(main): Allocate memory for string and buffer passed to the syscall
13556	being tested using tail_alloc mechanism.  Create and cleanup test
13557	symlink.  Test syscall error path output.  Print hexquoted strings
13558	using hexquote_strndup.
13559	* tests/readlinkat.c: Likewise.
13560	* tests/readlink.test: Remove creation and cleanup of test symlinks.
13561
13562	tests: add hexquote_strndup function to libtests.
13563	* tests/tests.h (hexquote_strndup): New prototype.
13564	* tests/hexquote_strndup.c: New file.
13565	* tests/Makefile.am (libtests_a_SOURCES): Add it.
13566
13567	readlinkat.test: use readlink.test.
13568	* tests/readlink.test (syscall): Initialize from $0.
13569	* tests/readlinkat.test: Source readlink.test.
13570
135712016-02-04  Gabriel Laskar  <gabriel@lse.epita.fr>
13572
13573	Add configure --enable-code-coverage option.
13574	* m4/ax_code_coverage.m4: New file.
13575	* configure.ac: Use AX_CODE_COVERAGE.
13576	* Makefile.am: Add @CODE_COVERAGE_RULES@.
13577	(CODE_COVERAGE_LCOV_OPTIONS, CODE_COVERAGE_GENHTML_OPTIONS,
13578	CODE_COVERAGE_IGNORE_PATTERN): New variables.
13579	(strace_CPPFLAGS): Add $(CODE_COVERAGE_CPPFLAGS).
13580	(strace_CFLAGS): Add $(CODE_COVERAGE_CFLAGS).
13581	(strace_LDADD): Add $(CODE_COVERAGE_LDFLAGS).
13582	* .gitignore: Add *.gcda and *.gcno.
13583
135842016-02-03  Dmitry V. Levin  <ldv@altlinux.org>
13585
13586	Makefile.am: introduce strace_CFLAGS and derivatives.
13587	* Makefile.am (strace_CFLAGS): New variable, set to $(AM_CFLAGS).
13588	(libmpers_CFLAGS): New variable, set to $(strace_CFLAGS).
13589	(libmpers_m32_a_CFLAGS, libmpers_mx32_a_CFLAGS): New variables,
13590	set to $(libmpers_CFLAGS).
13591
13592	Makefile.am: use strace_CPPFLAGS consistently.
13593	* Makefile.am (libmpers_CPPFLAGS): Replace $(AM_CPPFLAGS)
13594	with $(strace_CPPFLAGS).
13595
135962016-02-03  Dmitry V. Levin  <ldv@altlinux.org>
13597
13598	tests: replace net-fd.test with net-y-unix.test.
13599	Unlike the former test that was based on match_grep,
13600	the new one uses match_diff and does more rigorous testing.
13601
13602	* tests/net-y-unix.c: New file.
13603	* tests/net-y-unix.test: New test.
13604	* tests/net-fd.test: Remove.
13605	* tests/net-fd.expected: Remove.
13606	* tests/.gitignore: Add net-y-unix.
13607	* tests/Makefile.am (check_PROGRAMS): Likewise.
13608	(TESTS): Replace net-fd.test with net-y-unix.test.
13609	(net-fd.log): Remove.
13610	(EXTRA_DIST): Remove net-fd.expected.
13611
136122016-02-03  Dmitry V. Levin  <ldv@altlinux.org>
13613
13614	Implement caching of print_sockaddr_by_inode.
13615	As -yy parser, compared to -y, needs to do at least 5 extra syscalls
13616	(getxattr, socket, sendmsg, recvmsg, close) to print socket details,
13617	caching results of netlink conversations between strace and kernel
13618	noticeably reduces amount of system time spent by strace.
13619
13620	The caching is safe since sockets do not change their addresses after
13621	successful bind or connect syscall.
13622
13623	* defs.h (string_quote, print_sockaddr_by_inode_cached): New prototypes.
13624	* socketutils.c (cache_entry): New type.
13625	(CACHE_SIZE, CACHE_MASK): New macros.
13626	(cache): New static array.
13627	(cache_and_print_inode_details): New static function.
13628	(print_sockaddr_by_inode_cached): New function.
13629	(inet_parse_response, unix_parse_response): Use
13630	cache_and_print_inode_details.
13631	* util.c (printfd): Use string_quote and print_sockaddr_by_inode_cached.
13632	(string_quote): Remove static qualifier.
13633	* NEWS: Mention this improvement.
13634	* tests/unix-yy.c (main): Update.
13635
136362016-02-03  Dmitry V. Levin  <ldv@altlinux.org>
13637
13638	Change unix_diag requests to use exact match instead of full dump.
13639	* socketutils.c (unix_send_query): Remove NLM_F_DUMP from nlmsg_flags,
13640	initialize udiag_cookie.
13641	* tests/netlink_unix_diag.c (send_query): Remove "family" and "proto"
13642	arguments, add "inode" argument, remove NLM_F_DUMP from nlmsg_flags,
13643	initialize udiag_ino and udiag_cookie.
13644	(check_responses): Add "inode" argument, check inode match.
13645	(main): Pass listening socket inode to send_query and check_responses.
13646
13647	Robustify netlink response parsers.
13648	* socketutils.c (inet_parse_response, unix_parse_response): Change
13649	return type from bool to int, return -1 on all parse errors except
13650	inode mismatch.
13651	(receive_responses): Stop on the first nlmsg_type that is not
13652	SOCK_DIAG_BY_FAMILY, also stop when the parser returns -1.
13653	* tests/netlink_inet_diag.c (check_responses): Stop on short messages,
13654	on first nlmsg_type that is not SOCK_DIAG_BY_FAMILY, print more verbose
13655	diagnostics for NLMSG_ERROR.
13656	* tests/netlink_unix_diag.c (check_responses): Likewise.
13657
13658	inet_parse_response: add a safety check.
13659	* socketutils.c (inet_parse_response): Check that netlink message
13660	is large enough to contain a inet_diag_msg structure.
13661
13662	receive_responses: avoid potential hangup.
13663	* socketutils.c (receive_responses): Pass MSG_DONTWAIT to recvmsg after
13664	the first recvmsg call to avoid potential hangup.
13665
136662016-02-03  Dmitry V. Levin  <ldv@altlinux.org>
13667
13668	tests: replace net-yy.test with net-yy-inet.test.
13669	Unlike the former test that was based on match_awk,
13670	the new one uses match_diff and does more rigorous testing.
13671
13672	* tests/net-yy-inet.c: New file.
13673	* tests/net-yy-inet.test: New test.
13674	* tests/net-yy.test: Remove.
13675	* tests/net-yy-accept.awk: Remove.
13676	* tests/net-yy-connect.awk: Remove.
13677	* tests/inet-accept-connect-send-recv.c: Remove.
13678	* tests/.gitignore: Replace inet-accept-connect-send-recv
13679	with net-yy-inet.
13680	* tests/Makefile.am (check_PROGRAMS): Likewise.
13681	(TESTS): Replace net-yy.test with net-yy-inet.test.
13682	(EXTRA_DIST): Remove net-yy-accept.awk and net-yy-connect.awk.
13683
136842016-02-03  Dmitry V. Levin  <ldv@altlinux.org>
13685
13686	tests: replace unix-yy.test with net-yy-unix.test.
13687	Unlike the former test that was based on match_awk,
13688	the new one uses match_diff and does more rigorous testing.
13689
13690	* tests/net-yy-unix.c: New file.
13691	* tests/net-yy-unix.test: New test.
13692	* tests/unix-yy.test: Remove.
13693	* tests/unix-yy-accept.awk: Remove.
13694	* tests/unix-yy-connect.awk: Remove.
13695	* tests/.gitignore: Add net-yy-unix.
13696	* tests/Makefile.am (check_PROGRAMS): Likewise.
13697	(TESTS): Replace unix-yy.test with net-yy-unix.test.
13698	(EXTRA_DIST): Remove unix-yy-accept.awk and unix-yy-connect.awk.
13699
137002016-02-02  Dmitry V. Levin  <ldv@altlinux.org>
13701
13702	tests: add inode_of_sockfd function to libtests.
13703	* tests/tests.h (inode_of_sockfd): New prototype.
13704	* tests/inode_of_sockfd.c: New file.
13705	* tests/Makefile.am (libtests_a_SOURCES): Add it.
13706
13707	unix_parse_response: add a safety check.
13708	* socketutils.c (unix_parse_response): Check that netlink message
13709	is large enough to contain a unix_diag_msg structure.
13710
137112016-01-29  Dmitry V. Levin  <ldv@altlinux.org>
13712
13713	Fixed decoding of mincore syscall's last argument.
13714	* mem.c (SYS_FUNC(mincore)): Print only those bytes of the vector
13715	that were written by the kernel.
13716	* NEWS: Mention this fix.
13717	* tests/mincore.c: New file.
13718	* tests/mincore.test: New test.
13719	* tests/Makefile.am (check_PROGRAMS): Add mincore.
13720	(TESTS): Add mincore.test.
13721	* tests/.gitignore: Add mincore.
13722
137232016-01-23  Dmitry V. Levin  <ldv@altlinux.org>
13724
13725	Move fallback -yy socket print from printfd to print_sockaddr_by_inode.
13726	* util.c (printfd): In -yy mode, move fallback print of proto:[inode] ...
13727	* socketutils.c (to print_sockaddr_by_inode): ... here.
13728
137292016-01-22  Dmitry V. Levin  <ldv@altlinux.org>
13730
13731	Implement simultaneous use of -p option and tracing of a command.
13732	* strace.c (init): Allow -p option along with a command.
13733	(startup_child): In -D mode, record the parent of the tracer process
13734	as strace_child.
13735	(startup_attach): Save trace_tracer_pid before -D mode fork.
13736	When tracing a command in -f mode, do not check for the command's
13737	threads as it has no threads at this moment.
13738	Never attach to the tracer process.
13739	In -D mode, never attach to the parent of the tracer process,
13740	terminate that process only once at the end of startup_attach,
13741	and reset strace_child.
13742	* strace.1: Document that -p option can be used along with tracing
13743	of a command.
13744	* NEWS: Mention it.
13745	* tests/attach-p-cmd-cmd.c: New file.
13746	* tests/attach-p-cmd-p.c: Likewise.
13747	* tests/attach-p-cmd.test: New test.
13748	* tests/.gitignore: Add attach-p-cmd-cmd and attach-p-cmd-p.
13749	* tests/Makefile.am (check_PROGRAMS): Likewise.
13750	(TESTS): Add attach-p-cmd.test.
13751
13752	This fixes Debian bug #549942.
13753
137542016-01-22  Dmitry V. Levin  <ldv@altlinux.org>
13755
13756	strace.1: fix format of -P description.
13757	* strace.1 (-P): Write trailing using regular font.
13758
137592016-01-21  Dmitry V. Levin  <ldv@altlinux.org>
13760
13761	tests: use local nanosleep based sleep utility replacement.
13762	* tests/sleep.c: New file.
13763	* tests/.gitignore: Add sleep.
13764	* tests/Makefile.am (check_PROGRAMS): Likewise.
13765	* tests/count.test: Use it instead of system sleep utility.
13766
13767	tests: add error_msg_and_fail function to libtests.
13768	* tests/tests.h (error_msg_and_fail): New prototype.
13769	* tests/error_msg.c (error_msg_and_fail): New function.
13770
137712016-01-20  Dmitry V. Levin  <ldv@altlinux.org>
13772
13773	Fix dumping of recvmmsg syscall in case of short read.
13774	* net.c (dumpiov_in_mmsghdr): Call dumpiov_upto instead of dumpiov,
13775	pass data size limit to dumpiov_upto.
13776	* NEWS: Mention this fix.
13777	* tests/mmsg.c (main): Update.
13778
13779	Fix dumping of recvmsg syscall in case of short read.
13780	* defs.h (dumpiov_in_msghdr): Add unsigned long argument.
13781	* net.c (dumpiov_in_msghdr): Add data_size argument.  Call dumpiov_upto
13782	instead of dumpiov, pass data_size to dumpiov_upto.
13783	* syscall.c (dumpio): Pass data size limit to dumpiov_in_msghdr.
13784	* NEWS: Mention this fix.
13785	* tests/recvmsg.c: New file.
13786	* tests/recvmsg.test: New test.
13787	* tests/Makefile.am (check_PROGRAMS): Add recvmsg.
13788	(TESTS): Add recvmsg.test.
13789	* tests/.gitignore: Add recvmsg.
13790
13791	Fix decoding and dumping of readv syscall in case of short read.
13792	* defs.h (dumpiov_upto): New prototype.
13793	(dumpiov): Change to a wrapper around dumpiov_upto.
13794	* util.c (dumpiov): Rename to dumpiov_upto, add and check data_size
13795	argument.
13796	* io.c (SYS_FUNC(readv)): Call tprint_iov_upto instead
13797	of tprint_iov and specify syscall return value as a data size limit.
13798	* syscall.c (dumpio): In case of SEN_readv, call dumpiov_upto instead
13799	of dumpiov and specify syscall return value as a data size limit.
13800	* NEWS: Mention this fix.
13801	* tests/readv.c: New file.
13802	* tests/readv.test: New test.
13803	* tests/Makefile.am (check_PROGRAMS): Add readv.
13804	(TESTS): Add readv.test.
13805	* tests/.gitignore: Add readv.
13806
13807	tests/tests.h: add ARRAY_SIZE and LENGTH_OF macros.
13808	* tests/tests.h (ARRAY_SIZE, LENGTH_OF): New macros.
13809	* tests/aio.c (ARRAY_SIZE): Remove.
13810	* tests/mmsg.c (LENGTH_OF): Remove.
13811
13812	tests: add hexdump_strdup function to libtests.
13813	* tests/tests.h (hexdump_strdup): New prototype.
13814	* tests/hexdump_strdup.c: New file.
13815	* tests/Makefile.am (libtests_a_SOURCES): Add it.
13816
13817	tests: add tprintf function to libtests.
13818	* tests/tests.h (tprintf): New prototype.
13819	* tests/tprintf.c: New file.
13820	* tests/Makefile.am (libtests_a_SOURCES): Add it.
13821	* tests/mmsg.c: Use tprintf.
13822
138232016-01-19  Dmitry V. Levin  <ldv@altlinux.org>
13824
13825	quotactl: add Q_XGETQSTATV command decoding.
13826	* quota.c (fs_qfilestatv, fs_quota_statv): New structures.
13827	(decode_cmd_data): Handle Q_XGETQSTATV case.
13828
13829	quotactl: add decoding of if_dqinfo.dqi_flags constants.
13830	* xlat/if_dqinfo_flags.in: New file.
13831	* quota.c: Include "xlat/if_dqinfo_flags.h".
13832	(decode_cmd_data): Print struct if_dqinfo.dqi_flags using printflags.
13833
13834	quotactl: consistenly decode all write and unknown commands on entering.
13835	* quota.c (decode_cmd_data): Change return type to int.
13836	Return 0 on entering Q_GETQUOTA, Q_V1_GETQUOTA, Q_V2_GETQUOTA,
13837	Q_XGETQUOTA, Q_GETFMT, Q_GETINFO, Q_V2_GETINFO, Q_V1_GETSTATS,
13838	Q_V2_GETSTATS, and Q_XGETQSTAT commands, return RVAL_DECODED
13839	for any other command.
13840	(SYS_FUNC(quotactl)): On entering, print third argument of any command.
13841	For any command except Q_QUOTAON and Q_V1_QUOTAON, call decode_cmd_data
13842	and forward its return value.
13843
13844	quotactl: fix Q_QUOTAON command decoding.
13845	* quota.c (SYS_FUNC(quotactl)): Print Q_QUOTAON 4th argument as a path.
13846
13847	quotactl: print third argument as unsigned int.
13848	* quota.c (SYS_FUNC(quotactl)): Consistently print the third
13849	argument using "%u" format.
13850
13851	quotactl: fix Q_XQUOTAOFF command decoding.
13852	* quota.c (decode_cmd_data): Print xfs quota flags argument.
13853
13854	quotactl: fix Q_GETFMT and Q_XQUOTAON commands decoding.
13855	* quota.c (decode_cmd_data): As quota format value and xfs quota flags
13856	are in-memory constants, print it like an array of one element instead
13857	of a structure.
13858
138592016-01-17  Dmitry V. Levin  <ldv@altlinux.org>
13860
13861	Update quotactl constants.
13862	* xlat/quota_formats.in: Add QFMT_OCFS2 and QFMT_VFS_V1.
13863	* xlat/quotacmds.in: Add Q_XGETQSTATV.
13864	* xlat/quotatypes.in: Add PRJQUOTA.
13865	* xlat/xfs_quota_flags.in: Add FS_QUOTA_PDQ_ACCT and FS_QUOTA_PDQ_ENFD.
13866
138672016-01-19  Dmitry V. Levin  <ldv@altlinux.org>
13868
13869	Replace u_int{8,16,32,64} with uint{8,16,32,64}
13870	* util.c: Replace u_int{32,64} with uint{32,64}.
13871	* quota.c: Replace u_int{8,16,32,64} with uint{8,16,32,64}.
13872
13873	Move definitions of quotactl constants to xlat files.
13874	* quota.c (Q_*): Move to xlat/quotacmds.in.
13875	(USRQUOTA, GRPQUOTA): Move to xlat/quotatypes.in.
13876	(QFMT_VFS_OLD, QFMT_VFS_V0): Move to xlat/quota_formats.in.
13877	(XFS_QUOTA_*): Move to xlat/xfs_quota_flags.in.
13878	(XFS_*_QUOTA): Move to xlat/xfs_dqblk_flags.in.
13879	(QIF_*): Move to xlat/if_dqblk_valid.in.
13880	(IIF_*): Move to xlat/if_dqinfo_valid.in.
13881
138822016-01-15  Dmitry V. Levin  <ldv@altlinux.org>
13883
13884	llseek.test: robustify against libcs invoking _llseek syscall on their own
13885	* tests/llseek.test: Filter out _llseek calls made with non-negative
13886	descriptor arguments.
13887
13888	lseek.test: robustify against libcs invoking lseek syscall on their own.
13889	* tests/lseek.test: Filter out lseek calls made with non-negative
13890	descriptor arguments.
13891
138922016-01-14  Dmitry V. Levin  <ldv@altlinux.org>
13893
13894	mmsg.test: fix regression introduced by commit v4.11-138-g6e815ce.
13895	This fixes the test on platforms where both __NR_sendmmsg and
13896	HAVE_SENDMMSG are defined but the former is not implemented by the
13897	kernel and the second is implemented as an indirect syscall.
13898
13899	* tests/mmsg.c (LENGTH_OF): New macro.
13900	(send_mmsg, recv_mmsg): Print expected output in case of ENOSYS.
13901	(main): Redirect stdout to a new descriptor.  Use LENGTH_OF.
13902	Print expected output.
13903	* tests/mmsg.test: Update.
13904	* tests/mmsg.expected: Remove.
13905	* tests/Makefile.am (EXTRA_DIST): Remove mmsg.expected.
13906
139072016-01-13  Dmitry V. Levin  <ldv@altlinux.org>
13908
13909	aio.test: check memory access by aio decoders.
13910	* tests/aio.c (main): Place all objects passed to io_* syscalls
13911	at the end of memory pages followed by inaccessible pages.
13912
139132016-01-13  Dmitry V. Levin  <ldv@altlinux.org>
13914
13915	s390, s390x: fix printing of syscalls unknown to the kernel.
13916	On s390/s390x, syscalls with NR up to 255 can be implemented
13917	directly using "svc NR", for NR >= 256 "svc 0" with %r1=NR is used.
13918	The latter method is allowed for NR < 256, too.
13919
13920	When the syscall number specified directly or indirectly is recognized
13921	by the kernel, i.e. it is less than its NR_syscalls value, it is stored
13922	in %r2 and is available to arch_get_scno via s390_regset.gprs[2].
13923	For syscall numbers >= NR_syscalls this register is set to 0,
13924	but %r1 remains unchanged and could be used by arch_get_scno
13925	via s390_regset.gprs[1] to decide what the syscall number is.
13926
13927	* linux/s390/get_scno.c (arch_get_scno): If s390_regset.gprs[2] is zero,
13928	take syscall number from s390_regset.gprs[1].
13929	* NEWS: Mention this fix.
13930
13931	This fixes Debian bug #485979 and Fedora bug #1298294.
13932
139332016-01-13  Dmitry V. Levin  <ldv@altlinux.org>
13934
13935	s390, s390x: print all syscall arguments for syscall number 0.
13936	* linux/s390/syscallent.h [0]: Set nargs to MA.
13937	* linux/s390x/syscallent.h: Likewise.
13938
13939	mips o32: alias sys_syscall to printargs.
13940	* linux/dummy.h (sys_syscall): Alias to printargs.
13941	* syscall.c [LINUX_MIPSO32] (SYS_FUNC(syscall)): Remove.
13942
139432016-01-13  Dmitry V. Levin  <ldv@altlinux.org>
13944
13945	travis-ci: update build matrix.
13946	Add clang-3.6/x86_64, clang-3.6/x86, and musl-gcc/x86_64 to the matrix.
13947
13948	* .travis.yml (compiler): Add gcc, clang-3.6, and musl-gcc.
13949	(env): Add matrix, remove global ENABLE_GCC_WERROR.
13950	(matrix): Add exclude, remove include.
13951	* travis-ci.sh: Add support for clang and musl-gcc.
13952	Use --enable-gcc-Werror for gcc build unconditionally.
13953
139542016-01-13  Dmitry V. Levin  <ldv@altlinux.org>
13955
13956	mpers.awk: add support for DWARF files generated by clang.
13957	* mpers.awk: Define default_pointer_size.  Initialize byte_size
13958	for DW_TAG_pointer_type to default_pointer_size.  Set parent
13959	for DW_TAG_member only.  Handle DW_AT_count as an alternative
13960	to DW_AT_upper_bound.
13961
139622016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
13963
13964	configure.ac: reorder some statements for better readability.
13965	* configure.ac: Sort and group together AC_PROG_*, AC_C_*, AC_TYPE_*,
13966	AC_HEADER_*, AC_CHECK_FUNCS, AC_CHECK_TYPES, AC_CHECK_MEMBERS,
13967	and AC_CHECK_HEADERS.
13968
13969	scm_rights-fd.test: rewrite without fork.
13970	* tests/scm_rights.c (main): Rewrite without fork.
13971	Place all objects passed to sendmsg and recvmsg at the end
13972	of memory pages followed by inaccessible pages.
13973	* tests/scm_rights-fd.test: Update.
13974
13975	tests: fix clang "duplicate 'const' declaration specifier" warnings.
13976	* tests/ksysent.c (pstr_t): Remove second const specifier.
13977	* tests/mmsg.c (main): Remove second const specifier from one[], two[],
13978	and three[].
13979
13980	tests/times.c: fix clang compilation warning.
13981	* tests/times.c (main): Initialize dummy variable.
13982
139832016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
13984
13985	tests/mmsg.c: fix build on rhel6/ppc.
13986	There are weird platforms that define __NR_sendmmsg but at the same time
13987	do not define __NR_recvmmsg.  Add a workaround for them.
13988
13989	* configure.ac (AC_CHECK_FUNCS): Add recvmmsg.
13990	* tests/mmsg.c: Check for __NR_recvmmsg || HAVE_RECVMMSG.
13991
139922016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
13993
13994	s390: fix sigreturn decoding on recent kernels.
13995	Linux kernel commit v4.3-rc1-50-g8d4bd0e corrected uc_sigmask
13996	of the compat signal frame, so remove the old workaround.
13997
13998	* linux/s390/arch_sigreturn.c (arch_sigreturn) [S390]: Remove.
13999
140002016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14001
14002	Update PTRACE_* constants.
14003	* ptrace.h (PTRACE_SECCOMP_GET_FILTER): Define.
14004	* xlat/ptrace_cmds.in: Add PTRACE_SECCOMP_GET_FILTER.
14005
140062016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14007
14008	Fix struct sigevent decoding for musl.
14009	Do not rely on "struct sigevent.__pad" being located at the same address
14010	as "struct sigevent.sigev_notify_thread_id", it's not the case with musl
14011	libc.  Do not rely on struct sigevent definition at all to access
14012	sigev_notify_thread_id.
14013
14014	* configure.ac (AC_CHECK_MEMBERS): Remove struct sigevent._sigev_un._pad
14015	and struct sigevent.__pad.
14016	* sigevent.h: New file.
14017	* Makefile.am (strace_SOURCES): Add it.
14018	* print_sigevent.c: Include it.
14019	* print_sigevent.c (struct_sigevent): Remove.
14020	(print_sigevent): Update all struct_sigevent users.
14021	* tests/timer_create.c: Include "sigevent.h".
14022	(main): Use struct_sigevent instead of struct sigevent,
14023	all struct sigevent clients changed.
14024
140252016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14026
14027	syscall.c: include <signal.h>
14028	All users of NSIG macro must include <signal.h>.
14029	This complements commit v4.10-184-g0e946ab.
14030
14031	* syscall.c: Include <signal.h>.
14032
140332016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14034
14035	signal.c: fix musl libc compilation warning.
14036	musl libc defines SIGRTMAX to a function that returns signed int,
14037	which obviously makes gcc -Wsign-compare unhappy.
14038
14039	* signal.c (signame): Cast ASM_SIGRTMAX to unsigned int.
14040
140412016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14042
14043	tests: fix TEST_SYSCALL_{NR,STR} and STRUCT_STAT_STR macros for musl.
14044	The contents of TEST_SYSCALL_NAME and STRUCT_STAT macros was subject
14045	to macro expansion when used in definitions of TEST_SYSCALL_NR,
14046	TEST_SYSCALL_STR, and STRUCT_STAT_STR macros.
14047
14048	As some libcs, e.g. musl libc, define lfs64 names as macros
14049	(stat64 as stat, lstat64 as lstat, etc.), this might result to incorrect
14050	expansion of TEST_SYSCALL_NR, TEST_SYSCALL_STR, and STRUCT_STAT_STR
14051	macros.  To avoid this problem, define these macros directly and remove
14052	TEST_SYSCALL_NAME macro.
14053
14054	* tests/_newselect.c (TEST_SYSCALL_NAME): Remove.
14055	(TEST_SYSCALL_NR, TEST_SYSCALL_STR): New macros.
14056	* tests/fcntl.c: Likewise.
14057	* tests/fcntl64.c: Likewise.
14058	* tests/fstat.c: Likewise.
14059	* tests/fstatat64.c: Likewise.
14060	* tests/lstat.c: Likewise.
14061	* tests/newfstatat.c: Likewise.
14062	* tests/select.c: Likewise.
14063	* tests/stat.c: Likewise.
14064	* tests/fstat64.c (TEST_SYSCALL_NAME): Remove.
14065	(TEST_SYSCALL_NR, TEST_SYSCALL_STR, STRUCT_STAT_STR): New macros.
14066	* tests/lstat64.c: Likewise.
14067	* tests/stat64.c: Likewise.
14068	* tests/fstatx.c (TEST_SYSCALL_NR, nrify, nrify_): Remove.
14069	* tests/lstatx.c: Likewise.
14070	* tests/struct_flock.c (TEST_SYSCALL_NR, TEST_SYSCALL_STR, nrify,
14071	nrify_, stringify, stringify_): Remove.
14072	* tests/xselect.c: Likewise.
14073	* tests/xstatx.c: Check TEST_SYSCALL_STR instead of TEST_SYSCALL_NAME.
14074	(STRUCT_STAT_STR, TEST_SYSCALL_STR, stringify, stringify_): Remove.
14075	[!STRUCT_STAT] (STRUCT_STAT_STR): New macro.
14076
140772016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14078
14079	tests/struct_flock.c: fix musl libc compilation warnings.
14080	The size of off_t is not something one can rely upon.  For example,
14081	musl libc unconditionally defines it as an int64_t type on x86.
14082	A cast to the target type helps to avoid these libc differences.
14083
14084	* configure.ac: Call AC_C_TYPEOF.
14085	* tests/struct_flock.c (TYPEOF_FLOCK_OFF_T): New macro.
14086	(test_flock_einval): Use it instead of off_t.
14087
140882016-01-12  Dmitry V. Levin  <ldv@altlinux.org>
14089
14090	tests/inet-cmsg.c: fix musl libc compilation warnings.
14091	The types that are used to define msg_namelen member of struct msghdr
14092	and cmsg_len member of struct cmsghdr differ between libcs.
14093	For example, glibc defines them as size_t, while musl libc - as type
14094	socklen_t.  Print these fields using %lu format to avoid issues caused
14095	by libc differences.
14096
14097	* tests/inet-cmsg.c (main): Cast mh.msg_controllen and c->cmsg_len
14098	to unsigned long and print them using %lu format.
14099
141002016-01-11  Dmitry V. Levin  <ldv@altlinux.org>
14101
14102	aio.test: include <fcntl.h> instead of <sys/fcntl.h>
14103	* tests/aio.c: Include <fcntl.h> instead of <sys/fcntl.h>.
14104
14105	mmsg.test: check memory access by sendmmsg and recvmmsg decoders.
14106	* tests/tests.h (tail_memdup): New prototype.
14107	* tests/tail_alloc.c (tail_memdup): New function.
14108	* tests/mmsg.c (main): Place all objects passed to sendmmsg and recvmmsg
14109	at the end of memory pages followed by inaccessible pages.
14110
14111	mmsg.test: check decoding of flags passed to sendmmsg and recvmmsg.
14112	* tests/mmsg.c (main): Pass MSG_DONTROUTE|MSG_NOSIGNAL to sendmmsg.
14113	Pass MSG_DONTWAIT to recvmmsg.
14114	* tests/mmsg.expected: Update.
14115
141162016-01-11  Dmitry V. Levin  <ldv@altlinux.org>
14117
14118	mmsg.test: prefer direct sendmmsg/recvmmsg syscalls to libc wrappers.
14119	* tests/mmsg.c: Include <sys/syscall.h>.
14120	Check for __NR_sendmmsg as an alternative to HAVE_SENDMMSG.
14121	[!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
14122	(send_mmsg, recv_mmsg): New functions.
14123	(main): Use them instead of sendmmsg and recvmmsg.
14124
14125	Reported-by: Szabolcs Nagy <nsz@port70.net>
14126
141272016-01-10  Dmitry V. Levin  <ldv@altlinux.org>
14128
14129	sigreturn.test: use RT_5 signal number instead of RT_2.
14130	Make the test compatible with musl libc that uses RT_2 internally.
14131
14132	* tests/sigreturn.c (main): Replace RT_2 with RT_5.
14133	* tests/sigreturn.test: Likewise.
14134
14135	Reported-by: Szabolcs Nagy <nsz@port70.net>
14136
141372016-01-10  Dmitry V. Levin  <ldv@altlinux.org>
14138
14139	avr32: wire up accept4 syscall.
14140	* linux/avr32/syscallent.h [321]: Add accept4 entry.
14141
141422016-01-09  Dmitry V. Levin  <ldv@altlinux.org>
14143
14144	sparc64: fix names of {s,g}etres{u,g}id syscalls.
14145	* linux/sparc64/syscallent.h [108 ... 111]: Use sparc64 syscall names.
14146
14147	sparc64: remove sparc32 syscall entries.
14148	* linux/sparc64/syscallent.h [31, 32, 35, 44, 53, 56, 69, 70, 72, 77,
14149	82, 84, 87, 89, 91, 94, 112, 115, 155, 231]: Unassign.
14150
14151	sparc: remove sparc64 syscall entries.
14152	* linux/sparc/syscallent.h [52, 163]: Unassign.
14153
14154	sparc64: clone syscallent.h from sparc.
14155	* linux/sparc64/syscallent.h: Clone from linux/sparc/syscallent.h.
14156
14157	sparc: fix mlock2 sysentry, wire up bind, listen, and setsockopt syscalls
14158	* linux/sparc/syscallent.h [353]: Move mlock2 entry to 356.
14159	[353, 354, 355]: Add bind, listen, and setsockopt entries.
14160	* NEWS: Mention this.
14161
141622016-01-09  Dmitry V. Levin  <ldv@altlinux.org>
14163
14164	tests: do not use settimeofday wrapper provided by libc.
14165	Workaround limitations of settimeofday wrapper provided by musl libc.
14166
14167	* tests/xettimeofday.c (main): Call settimeofday using syscall().
14168
14169	Reported-by: Szabolcs Nagy <nsz@port70.net>
14170
141712016-01-09  Dmitry V. Levin  <ldv@altlinux.org>
14172
14173	ioctl.test: robustify against libcs invoking ioctl syscall on their own.
14174	* tests/ioctl.test: Filter out from the log ioctl calls with standard
14175	descriptor arguments.
14176
14177	Reported-by: Szabolcs Nagy <nsz@port70.net>
14178
141792016-01-09  Dmitry V. Levin  <ldv@altlinux.org>
14180
14181	alpha: enhance decoding of getxpid, getxuid, and getxgid syscalls.
14182	Print the second return value of getxpid, getxuid, and getxgid syscalls
14183	that return a pair of values using the same mechanism as pipe syscall.
14184
14185	* alpha.c: New file.
14186	* Makefile.am (strace_SOURCES): Add it.
14187	* linux/alpha/syscallent.h [20]: Change SEN(getpid) to SEN(getxpid).
14188	[24]: Change SEN(getuid) to SEN(getxuid).
14189	[47]: Change SEN(getgid) to SEN(getxgid).
14190	* NEWS: Mention this enhancement.
14191	* tests/uid.awk: Update for getxgid output change.
14192	* tests/uid.test: Cleanup.
14193	* tests/getxxid.c: New file.
14194	* tests/getxxid.test: New test.
14195	* tests/Makefile.am (check_PROGRAMS): Add getxxid.
14196	(TESTS): Add getxxid.test.
14197	* tests/.gitignore: Add getxxid.
14198
141992016-01-08  Dmitry V. Levin  <ldv@altlinux.org>
14200
14201	Cleanup parser of getpagesize syscall.
14202	* mem.c (SYS_FUNC(getpagesize)): Decode on entering syscall.
14203
14204	alpha: alias getdtablesize to printargs.
14205	* linux/dummy.h [ALPHA] (sys_getdtablesize): Alias to printargs.
14206	* desc.c [ALPHA] (SYS_FUNC(getdtablesize)): Remove.
14207
142082016-01-08  Dmitry V. Levin  <ldv@altlinux.org>
14209
14210	tests: change text marker in fork-f and vfork-f tests.
14211	Use chdir syscalls instead of pwrite64 syscalls as a method of inserting
14212	text markers into strace output because the former are more portable.
14213
14214	* tests/fork-f.c (logit): Rename to logit_. Use chdir instead of pwrite.
14215	(logit): New macro wrapper around logit_.
14216	(main): Update expected output.
14217	* tests/vfork-f.c: Likewise.
14218	* tests/fork-f.test: Update.
14219
142202016-01-07  Dmitry V. Levin  <ldv@altlinux.org>
14221
14222	Fix printing of 32-bit times syscall return value on 64-bit architectures
14223	This change complements commit v4.9-359-gd93d9f8 by fixing
14224	RVAL_UDECIMAL case.
14225	The only syscall that appears to be affected is the times syscall.
14226
14227	* syscall.c (trace_syscall_exiting): In case of RVAL_UDECIMAL,
14228	when current personality is 32-bit, print 32-bit return code.
14229	* NEWS: Mention this fix.
14230
14231	Reported-by: Steve McIntyre <steve@einval.com>
14232
142332016-01-07  Dmitry V. Levin  <ldv@altlinux.org>
14234
14235	tests/vfork-f.c: support platforms without vfork.
14236	On some platforms, e.g. hppa glibc, vfork() is implemented using fork
14237	syscall, so the test cannot rely on the parent process remaining blocked
14238	until the child process either terminates or calls execve.
14239
14240	* tests/vfork-f.c (main): Explicitly block the parent until the child
14241	either terminates or calls execve.
14242
142432016-01-07  Dmitry V. Levin  <ldv@altlinux.org>
14244
14245	Fix and enhance decoding of sched_[gs]etaffinity syscalls.
14246	Print cpu_set_t as a set of integers, similar to the way
14247	fd_set is printed as a set of descriptors.
14248
14249	* affinity.c: Include <sched.h>.
14250	(get_cpuset_size): New function.
14251	(print_affinitylist): Rewrite using get_cpuset_size and next_set_bit.
14252	(sched_getaffinity, sched_setaffinity): Print first two args as ints.
14253	* NEWS: Mention this enhancement.
14254	* tests/sched_xetaffinity.c: New file.
14255	* tests/sched_xetaffinity.test: New test.
14256	* tests/Makefile.am (check_PROGRAMS): Add sched_xetaffinity.
14257	(TESTS): Add sched_xetaffinity.test.
14258	* tests/.gitignore: Add sched_xetaffinity.
14259
14260	Reported-by: Joe Korty <joe.korty@ccur.com>
14261
142622016-01-06  Dmitry V. Levin  <ldv@altlinux.org>
14263
14264	tests: convert epoll_create1.test from match_grep to match_diff.
14265	* tests/epoll_create1.c (main): Print expected output.
14266	* tests/epoll_create1.test: Use match_diff instead of match_grep.
14267	* tests/epoll_create1.expected: Remove.
14268	* tests/Makefile.am (EXTRA_DIST): Remove epoll_create1.expected.
14269
14270	tests/struct_flock.c: use libtests.
14271	* tests/struct_flock.c (create_sample): Return void,
14272	all callers changed.  Use perror_msg_and_fail.
14273	* tests/fcntl.c: Use SKIP_MAIN_UNDEFINED.
14274	* tests/fcntl64.c: Likewise.
14275
14276	tests/file_handle.c: use libtests.
14277	* tests/file_handle.c: Use SKIP_MAIN_UNDEFINED.
14278	(main): Use assert and perror_msg_and_skip.
14279
14280	tests/uid32.c: use libtests.
14281	* tests/uid32.c: Use SKIP_MAIN_UNDEFINED.
14282
14283	tests/uid16.c: use libtests.
14284	* tests/uid16.c: Use SKIP_MAIN_UNDEFINED.
14285	(main): Use perror_msg_and_skip.
14286
14287	tests/uid.c: use libtests.
14288	* tests/uid.c: Use SKIP_MAIN_UNDEFINED.
14289	(main): Use perror_msg_and_skip.
14290
14291	tests/netlink_unix_diag.c: use libtests.
14292	* tests/netlink_unix_diag.c (send_query, check_responses, main):
14293	Use perror_msg_and_skip.
14294
14295	tests/netlink_inet_diag.c: use libtests.
14296	* tests/netlink_inet_diag.c (send_query, check_responses, main):
14297	Use perror_msg_and_skip.
14298
14299	tests/readdir.c: use libtests.
14300	* tests/readdir.c: Use SKIP_MAIN_UNDEFINED.
14301	(main): Use perror_msg_and_skip.
14302
14303	tests/getdents64.c: use libtests.
14304	* tests/getdents64.c: Use SKIP_MAIN_UNDEFINED.
14305	(main): Use perror_msg_and_skip.
14306
14307	tests/getdents.c: use libtests.
14308	* tests/getdents.c: Use SKIP_MAIN_UNDEFINED.
14309	(main): Use perror_msg_and_skip.
14310
14311	tests/ipc_shm.c: use libtests.
14312	* tests/ipc_shm.c (cleanup): New function.
14313	(main): Use it and perror_msg_and_skip.
14314
14315	tests/ipc_sem.c: use libtests.
14316	* tests/ipc_sem.c (cleanup): New function.
14317	(main): Use it and perror_msg_and_skip.
14318
14319	tests/ipc_msg.c: use libtests.
14320	* tests/ipc_msg.c (cleanup): New function.
14321	(main): Use it and perror_msg_and_skip.
14322
14323	tests/ipc_msgbuf.c: use libtests.
14324	* tests/ipc_msgbuf.c (cleanup): New function.
14325	(main): Use it and perror_msg_and_skip.
14326
14327	tests/mq.c: use libtests.
14328	* tests/mq.c: Use SKIP_MAIN_UNDEFINED.
14329	(main): Use perror_msg_and_skip.
14330
14331	tests/utimensat.c: use libtests.
14332	* tests/utimensat.c: Use SKIP_MAIN_UNDEFINED.
14333	(main): Use assert and perror_msg_and_skip.
14334
14335	tests/ppoll.c: use libtests.
14336	* tests/ppoll.c (main): Use assert, perror_msg_and_skip,
14337	and perror_msg_and_fail.
14338
14339	tests/mmsg.c: use libtests.
14340	* tests/mmsg.c: Use SKIP_MAIN_UNDEFINED.
14341	(main): Use perror_msg_and_skip.
14342
14343	tests/ip_mreq.c: use libtests.
14344	* tests/ip_mreq.c: Use SKIP_MAIN_UNDEFINED.
14345	(main): Use perror_msg_and_skip.
14346
14347	tests/ioctl.c: use libtests.
14348	* tests/ioctl.c: Use SKIP_MAIN_UNDEFINED.
14349	(main): Use %m printf format specifier.
14350
14351	tests/pipe.c: use libtests.
14352	* tests/pipe.c: Use SKIP_MAIN_UNDEFINED.
14353	(main): Use perror_msg_and_fail and perror_msg_and_skip.
14354
14355	tests/getrandom.c: use libtests.
14356	* tests/getrandom.c: Use SKIP_MAIN_UNDEFINED.
14357	(main): Use perror_msg_and_skip.
14358
14359	tests/signalfd.c: use libtests.
14360	* tests/signalfd.c: Use SKIP_MAIN_UNDEFINED.
14361	(main): Use perror_msg_and_skip.
14362
14363	tests/pc.c: use libtests.
14364	* tests/pc.c (main): Use assert, get_page_size, perror_msg_and_fail,
14365	and perror_msg_and_skip.
14366
14367	tests/uio.c: use libtests.
14368	* tests/uio.c: Use SKIP_MAIN_UNDEFINED.
14369
14370	tests/bpf.c: use libtests.
14371	* tests/bpf.c: Use SKIP_MAIN_UNDEFINED.
14372	(main) Use perror_msg_and_skip.
14373
14374	tests/aio.c: use libtests.
14375	* tests/aio.c: Use SKIP_MAIN_UNDEFINED.
14376	(main) Use perror_msg_and_skip.
14377
14378	tests/sched_xetattr.c: use libtests.
14379	* tests/sched_xetattr.c: Use SKIP_MAIN_UNDEFINED.
14380	(main) Use perror_msg_and_skip.
14381
14382	tests/wait.c: use libtests.
14383	* tests/wait.c (main): Use perror_msg_and_fail.
14384
14385	tests/vfork-f.c: use libtests.
14386	* tests/vfork-f.c (main): Use assert and perror_msg_and_fail.
14387
14388	tests/fork-f.c: use libtests.
14389	* tests/fork-f.c (main): Use assert and perror_msg_and_fail.
14390
14391	tests/userfaultfd.c: use libtests.
14392	* tests/userfaultfd.c: Use SKIP_MAIN_UNDEFINED.
14393	(main): Use assert.
14394
14395	tests/mlock2.c: use libtests.
14396	* tests/mlock2.c: Use SKIP_MAIN_UNDEFINED.
14397	(main): Use assert.
14398
14399	tests/membarrier.c: use libtests.
14400	* tests/membarrier.c: Use SKIP_MAIN_UNDEFINED.
14401	(main): Use assert.
14402
14403	tests/nanosleep.c: use libtests.
14404	* tests/nanosleep.c (main): Use assert, perror_msg_and_fail,
14405	and perror_msg_and_skip.
14406
14407	tests/timerfd_xettime.c: use libtests.
14408	* tests/timerfd_xettime.c: Use SKIP_MAIN_UNDEFINED.
14409	(main): Use perror_msg_and_skip.
14410
14411	tests/timer_xettime.c: use libtests.
14412	* tests/timer_xettime.c: Use SKIP_MAIN_UNDEFINED.
14413	(main): Use perror_msg_and_skip.
14414
14415	tests/timer_create.c: use libtests.
14416	* tests/timer_create.c: Use SKIP_MAIN_UNDEFINED.
14417	(main): Use perror_msg_and_skip.
14418
14419	tests/clock_xettime.c: use libtests.
14420	* tests/clock_xettime.c: Use SKIP_MAIN_UNDEFINED.
14421	(main): Use perror_msg_and_skip.
14422
14423	tests/clock_nanosleep.c: use libtests.
14424	* tests/clock_nanosleep.c (main): Use assert and perror_msg_and_skip.
14425
14426	tests/truncate64.c: use libtests.
14427	* tests/truncate64.c: Use SKIP_MAIN_UNDEFINED.
14428	(main): Use assert and perror_msg_and_skip.
14429
14430	tests/truncate.c: use libtests.
14431	* tests/truncate.c: Use SKIP_MAIN_UNDEFINED.
14432	(main): Use assert and perror_msg_and_skip.
14433
14434	tests/ftruncate64.c: use libtests.
14435	* tests/ftruncate64.c: Use SKIP_MAIN_UNDEFINED.
14436	(main): Use assert and perror_msg_and_skip.
14437
14438	tests/ftruncate.c: use libtests.
14439	* tests/ftruncate.c: Use SKIP_MAIN_UNDEFINED.
14440	(main): Use assert and perror_msg_and_skip.
14441
144422016-01-05  Dmitry V. Levin  <ldv@altlinux.org>
14443
14444	tests/llseek.c: use libtests.
14445	* tests/llseek.c: Use SKIP_MAIN_UNDEFINED.
14446	(main): Use assert and perror_msg_and_skip.
14447
14448	tests/lseek.c: use libtests.
14449	* tests/lseek.c: Use SKIP_MAIN_UNDEFINED.
14450	(main): Use assert and perror_msg_and_skip.
14451
14452	tests/readlinkat.c: use libtests.
14453	* tests/readlinkat.c: Use SKIP_MAIN_UNDEFINED.
14454	(main): Use perror_msg_and_skip.
14455
14456	tests/readlink.c: use libtests.
14457	* tests/readlink.c: Use SKIP_MAIN_UNDEFINED.
14458	(main): Use perror_msg_and_skip.
14459
14460	tests/xattr.c: use libtests.
14461	* tests/xattr.c: Use SKIP_MAIN_UNDEFINED.
14462	(main): Use perror_msg_and_skip.
14463
14464	tests/seccomp.c: use libtests.
14465	* tests/seccomp.c: Use SKIP_MAIN_UNDEFINED.
14466	(main): Use perror_msg_and_fail and perror_msg_and_skip.
14467
14468	tests/restart_syscall.c: use libtests.
14469	* tests/restart_syscall.c (main): Use assert, perror_msg_and_fail,
14470	and perror_msg_and_skip.
14471
14472	tests/inet-cmsg.c: use libtests.
14473	* tests/inet-cmsg.c (main): Use perror_msg_and_skip.
14474
14475	tests/eventfd.c: use libtests.
14476	* tests/eventfd.c: Use SKIP_MAIN_UNDEFINED.
14477	(main): Use perror_msg_and_skip.
14478
14479	tests/epoll_create1.c: use libtests.
14480	* tests/epoll_create1.c: Use SKIP_MAIN_UNDEFINED.
14481	(main): Use assert and perror_msg_and_skip.
14482
14483	tests/mmap.c: use libtests.
14484	* tests/mmap.c (main): Use get_page_size and perror_msg_and_fail.
14485
14486	tests/fanotify_mark.c: use libtests.
14487	* tests/fanotify_mark.c: Use SKIP_MAIN_UNDEFINED.
14488
14489	tests/inet-accept-connect-send-recv.c: use libtests.
14490	* tests/inet-accept-connect-send-recv.c (main): Use perror_msg_and_skip
14491	and perror_msg_and_fail.
14492
14493	tests/net-accept-connect.c: use libtests.
14494	* tests/net-accept-connect.c (main): Use perror_msg_and_skip
14495	and perror_msg_and_fail.
14496
14497	tests/unix-pair-send-recv.c: use libtests.
14498	* tests/unix-pair-send-recv.c (main): Use perror_msg_and_skip
14499	and perror_msg_and_fail.
14500
145012016-01-06  Dmitry V. Levin  <ldv@altlinux.org>
14502
14503	tests/xselect.c: use libtests.
14504	* tests/xselect.c (main): Use assert, perror_msg_and_fail,
14505	and perror_msg_and_skip.
14506
14507	tests/pselect6.c: use libtests.
14508	* tests/pselect6.c: Use SKIP_MAIN_UNDEFINED.
14509	(main): Use assert, perror_msg_and_fail, and perror_msg_and_skip.
14510
145112016-01-05  Dmitry V. Levin  <ldv@altlinux.org>
14512
14513	tests/oldselect.c: use libtests.
14514	* tests/oldselect.c: Use SKIP_MAIN_UNDEFINED.
14515	(main): Use perror_msg_and_fail and perror_msg_and_skip.
14516
14517	tests/select.c: use libtests.
14518	* tests/select.c: Use SKIP_MAIN_UNDEFINED.
14519
14520	tests/_newselect.c: use libtests.
14521	* tests/_newselect.c: Use SKIP_MAIN_UNDEFINED.
14522
14523	tests/fstatat.c: use libtests.
14524	* tests/fstatat.c: Use SKIP_MAIN_UNDEFINED.
14525
14526	tests/newfstatat.c: use libtests.
14527	* tests/newfstatat.c: Use SKIP_MAIN_UNDEFINED.
14528
14529	tests/fstatat64.c: use libtests.
14530	* tests/fstatat64.c: Use SKIP_MAIN_UNDEFINED.
14531
14532	tests/xstatx.c: use libtests.
14533	* tests/xstatx.c: Use SKIP_MAIN_UNDEFINED.
14534
14535	tests/stat64.c: use libtests.
14536	* tests/stat64.c: Use SKIP_MAIN_UNDEFINED.
14537
14538	tests/stat.c: use libtests.
14539	* tests/stat.c: Use SKIP_MAIN_UNDEFINED.
14540
14541	tests/lstat64.c: use libtests.
14542	* tests/lstat64.c: Use SKIP_MAIN_UNDEFINED.
14543
14544	tests/lstat.c: use libtests.
14545	* tests/lstat.c: Use SKIP_MAIN_UNDEFINED.
14546
14547	tests/fstat64.c: use libtests.
14548	* tests/fstat64.c: Use SKIP_MAIN_UNDEFINED.
14549
14550	tests/fstat.c: use libtests.
14551	* tests/fstat.c: Use SKIP_MAIN_UNDEFINED.
14552
14553	tests/statfs.c: use libtests.
14554	* tests/statfs.c (main): Use perror_msg_and_fail.
14555
145562016-01-06  Dmitry V. Levin  <ldv@altlinux.org>
14557
14558	tests/xettimeofday.c: use libtests.
14559	* tests/xettimeofday.c (main): Use assert and perror_msg_and_skip.
14560
14561	tests/utime.c: use libtests.
14562	* tests/utime.c (main): Use assert and perror_msg_and_skip.
14563
14564	tests/filter-unavailable.c: use libtests.
14565	* tests/filter-unavailable.c (main): Use perror_msg_and_fail.
14566
14567	tests/scm_rights.c: use libtests.
14568	* tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip.
14569
14570	tests/caps.c: use libtests.
14571	* tests/caps.c (main): Use perror_msg_and_skip.
14572
14573	tests/rt_sigqueueinfo.c: use libtests.
14574	* tests/rt_sigqueueinfo.c (main): Use assert and perror_msg_and_skip.
14575
14576	tests/umount.c: use libtests.
14577	* tests/umount.c: Use SKIP_MAIN_UNDEFINED.
14578	(main): Use perror_msg_and_fail.
14579
14580	tests/umount2.c: use libtests.
14581	* tests/umount2.c (main): Use perror_msg_and_fail.
14582
145832016-01-05  Dmitry V. Levin  <ldv@altlinux.org>
14584
14585	tests/times.c: use libtests.
14586	* tests/times.c (main): Use perror_msg_and_fail and perror_msg_and_skip.
14587
145882016-01-04  Dmitry V. Levin  <ldv@altlinux.org>
14589
14590	tests/times-fail.c: use assert.
14591	* tests/times-fail.c (main): Use assert.
14592
14593	tests/memfd_create.c: use libtests.
14594	* tests/memfd_create.c: Use SKIP_MAIN_UNDEFINED.
14595
14596	tests/execveat.c: use libtests.
14597	* tests/execveat.c: Use SKIP_MAIN_UNDEFINED.
14598
14599	tests/xetitimer.c: use libtests.
14600	* tests/xetitimer.c (main): Use perror_msg_and_skip.
14601
146022016-01-05  Dmitry V. Levin  <ldv@altlinux.org>
14603
14604	tests/sysinfo.c: use libtests.
14605	* tests/sysinfo.c (main): Use perror_msg_and_skip.
14606
14607	tests/sigaltstack.c: use libtests.
14608	* tests/sigaltstack.c (main): Use perror_msg_and_skip.
14609
14610	tests/adjtimex.c: use libtests.
14611	* tests/adjtimex.c (main): Use perror_msg_and_skip.
14612
14613	tests/xet_robust_list.c: use libtests.
14614	* tests/xet_robust_list.c: Use SKIP_MAIN_UNDEFINED.
14615	(main): Use perror_msg_and_skip and tail_alloc.
14616
14617	tests/umovestr2.c: use libtests.
14618	* tests/umovestr2.c (main): Use get_page_size and tail_alloc.
14619
14620	tests/umovestr.c: use libtests.
14621	* tests/umovestr.c (main): Use perror_msg_and_skip and tail_alloc.
14622
14623	tests/time.c: use libtests.
14624	* tests/time.c: Use SKIP_MAIN_UNDEFINED.
14625	(main): Use perror_msg_and_skip and tail_alloc.
14626
14627	tests/sendfile64.c: use libtests.
14628	* tests/sendfile64.c: Use SKIP_MAIN_UNDEFINED.
14629	(main): Use assert, perror_msg_and_fail, perror_msg_and_skip,
14630	and tail_alloc.
14631
14632	tests/sendfile.c: use libtests.
14633	* tests/sendfile.c: Use SKIP_MAIN_UNDEFINED.
14634	(main): Use assert, perror_msg_and_fail, perror_msg_and_skip,
14635	and tail_alloc.
14636
146372016-01-05  Dmitry V. Levin  <ldv@altlinux.org>
14638
14639	tests: include tests.h instead of config.h.
14640	Automatically edit tests/*.c files using the following perl one-liner:
14641
14642	perl -0777 -pi -e \
14643	's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \
14644	tests/*.c
14645
146462016-01-05  Dmitry V. Levin  <ldv@altlinux.org>
14647
14648	tests: introduce libtests.
14649	Introduce tests/libtests.a with common functions for use in tests.
14650
14651	* tests/tests.h: New file.
14652	* tests/error_msg.c: Likewise.
14653	* tests/tail_alloc.c: Likewise.
14654	* tests/get_page_size.c: Likewise.
14655	* tests/Makefile.am (libtests_a_SOURCES, libtests_a_CPPFLAGS,
14656	check_LIBRARIES, LDADD): New variables.
14657	(clock_xettime_LDADD, filter_unavailable_LDADD, mq_LDADD,
14658	pc_LDADD, times_LDADD): Add $(LDADD).
14659	* tests/.gitignore: Add libtests.a.
14660
146612016-01-01  Dmitry V. Levin  <ldv@altlinux.org>
14662
14663	tests: enable strace-k.test only for --with-libunwind configurations.
14664	Also, since -k option does not support multiple personalities,
14665	add strace-k.test to XFAIL_TESTS when running mpers tests.
14666
14667	* tests/Makefile.am (MPERS_NAME, LIBUNWIND_TESTS, XFAIL_TESTS_,
14668	XFAIL_TESTS_m32, XFAIL_TESTS_mx32, XFAIL_TESTS): New variables.
14669	[USE_LIBUNWIND] (LIBUNWIND_TESTS): Add strace-k.test.
14670	(TESTS): Replace strace-k.test with $(LIBUNWIND_TESTS).
14671	* bootstrap: Substitute MPERS_NAME variable in tests-*/Makefile.am.
14672	* tests/strace-k.test: Do not check for -k option availability.
14673
146742016-01-02  Dmitry V. Levin  <ldv@altlinux.org>
14675
14676	Move gcc compat macros to gcc_compat.h.
14677	* defs.h: Include "gcc_compat.h".
14678	(GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
14679	ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
14680	ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): Move ...
14681	* gcc_compat.h: ... here.
14682	* Makefile.am (strace_SOURCES): Add gcc_compat.h.
14683
146842015-12-31  Dmitry V. Levin  <ldv@altlinux.org>
14685
14686	Move defs.h from noinst_HEADERS to strace_SOURCES.
14687	* Makefile.am (noinst_HEADERS): Move defs.h ...
14688	(strace_SOURCES): ... here.
14689
146902015-12-30  Dmitry V. Levin  <ldv@altlinux.org>
14691
14692	test: remove fork.c and vfork.c.
14693	These manual tests are obsoleted by fork-f.test and vfork-f.test.
14694
14695	* test/fork.c: Remove.
14696	* test/vfork.c: Remove.
14697	* test/Makefile (PROGS): Remove fork and vfork.
14698	* test/.gitignore: Remove fork and vfork.
14699
147002015-12-30  Dmitry V. Levin  <ldv@altlinux.org>
14701
14702	tests: add fork-f.test and vfork-f.test.
14703	Check how strace -f follows fork and vfork syscalls.
14704
14705	* tests/fork-f.c: New file.
14706	* tests/fork-f.test: New test.
14707	* tests/vfork-f.c: New file.
14708	* tests/vfork-f.test: New test.
14709	* tests/Makefile.am (check_PROGRAMS): Add fork-f and vfork-f.
14710	(TESTS): Add fork-f.test and vfork-f.test.
14711	* tests/.gitignore: Add fork-f and vfork-f.
14712
147132015-12-29  Dmitry V. Levin  <ldv@altlinux.org>
14714
14715	Set SYSCALL_NEVER_FAILS flag for getpid, getppid and gettid syscall.
14716	* linux/*/syscallent*.h (getpid, getppid, gettid): Set NF flag.
14717
147182015-12-29  Dmitry V. Levin  <ldv@altlinux.org>
14719
14720	Set SYSCALL_NEVER_FAILS flag for umask syscall.
14721	Linux kernel always ANDs umask argument with 0700 and therefore
14722	this syscall never fails.
14723
14724	* linux/*/syscallent*.h (umask): Set NF flag.
14725
147262015-12-27  Dmitry V. Levin  <ldv@altlinux.org>
14727
14728	alpha, ia64, mips, nios2, powerpc, sparc: always check for syscall error
14729	On architectures that use dedicated registers to report syscall errors,
14730	check for syscall error condition regardless of SYSCALL_NEVER_FAILS flag
14731	in the syscall entry.  On architectures that use negated errno
14732	semantics, there is no way to distinguish a syscall error from a valid
14733	return code that looks like a syscall error, and the check for
14734	SYSCALL_NEVER_FAILS flag remains the only way to tell one case
14735	from another.
14736
14737	* linux/alpha/get_error.c (get_error): Ignore check_errno.
14738	* linux/ia64/get_error.c: Likewise.
14739	* linux/mips/get_error.c: Likewise.
14740	* linux/nios2/get_error.c: Likewise.
14741	* linux/powerpc/get_error.c: Likewise.
14742	* linux/sparc/get_error.c: Likewise.
14743	* linux/sparc64/get_error.c: Likewise.
14744
147452015-12-27  Dmitry V. Levin  <ldv@altlinux.org>
14746
14747	Handle unlikely errors from personality syscall.
14748	Despite being marked as SYSCALL_NEVER_FAILS, personality syscall still
14749	might report a failure on some architectures due to obscure kernel
14750	bugs.  Check for this unlikely case and let users know that their
14751	kernel has gone bananas.
14752
14753	* personality.c (SYS_FUNC(personality)): Do not parse syscall return
14754	value in case of syserror.
14755
147562015-12-27  Dmitry V. Levin  <ldv@altlinux.org>
14757
14758	Do not truncate return value of get{,e}[ug]id and setfs[ug]id syscalls.
14759	This should not be a user visible change unless the kernel does
14760	something completely unexpected.  In the latter case, let user see
14761	what is going on.
14762
14763	* uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Do not truncate
14764	tcp->u_rval to uid_t on exiting syscall, return RVAL_DECODED.
14765
147662015-12-26  Dmitry V. Levin  <ldv@altlinux.org>
14767
14768	Enhance personality syscall decoding.
14769	* xlat/personality_options.in: Split into ...
14770	* xlat/personality_types.in: ... personality types and ...
14771	* xlat/personality_flags.in: ... personality flags.
14772	* personality.c: Include "xlat/personality_types.h"
14773	and "xlat/personality_flags.h" instead of "xlat/personality_options.h".
14774	(SYS_FUNC(personality)): Print PER_MASK part of personality as
14775	a symbolic value, and the rest of personality as a set of flags.
14776	* tests/personality.c (main): Add more test cases.
14777	* tests/personality.test: Update.
14778
147792015-12-25  Dmitry V. Levin  <ldv@altlinux.org>
14780
14781	sh, sh64: fix syscall flags in several syscall entries.
14782	* linux/sh/syscallent.h (geteuid32, getegid32, setfsuid32, setfsgid32):
14783	Set SYSCALL_NEVER_FAILS flag.
14784	(fchown32): Set TRACE_DESC flag.
14785	* linux/sh64/syscallent.h: Likewise.
14786
147872015-12-25  Dmitry V. Levin  <ldv@altlinux.org>
14788
14789	Print personality value 0xffffffff properly.
14790	Value 0xffffffff of personality syscall first argument has a special
14791	meaning, it is not a set of personality flags.
14792
14793	* personality.c (SYS_FUNC(personality)): If personality equals
14794	to 0xffffffff, print it verbatim.
14795	* tests/personality.c (main): Test it.
14796
147972015-12-25  Dmitry V. Levin  <ldv@altlinux.org>
14798
14799	tests: add personality.test.
14800	* tests/personality.c: New file.
14801	* tests/personality.test: New test.
14802	* tests/Makefile.am (check_PROGRAMS): Add personality.
14803	(TESTS): Add personality.test.
14804	* tests/.gitignore: Add personality.
14805
14806	Enhance personality syscall decoding.
14807	* personality.c (SYS_FUNC(personality)): On entering syscall,
14808	print first argument not as a hex value but as a set of flags.
14809	On exiting syscall, print return code as a set of flags.
14810	* NEWS: Mention this enhancement.
14811
148122015-12-25  Dmitry V. Levin  <ldv@altlinux.org>
14813
14814	Set SYSCALL_NEVER_FAILS flag for personality syscall.
14815	Starting with commit
14816	v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940, personality
14817	syscall never fails to set the personality, but before commit
14818	v2.6.35-rc1-372-g485d527 it still could return an error.
14819	Starting with that commit, personality syscall never returns an error.
14820
14821	* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag in personality
14822	syscall entries.
14823
148242015-12-24  Dmitry V. Levin  <ldv@altlinux.org>
14825
14826	Add personality emulation flags.
14827	* xlat/personality_options.in: Add UNAME26, ADDR_NO_RANDOMIZE,
14828	FDPIC_FUNCPTRS, MMAP_PAGE_ZERO, ADDR_COMPAT_LAYOUT, READ_IMPLIES_EXEC,
14829	ADDR_LIMIT_32BIT, SHORT_INODE, WHOLE_SECONDS, STICKY_TIMEOUTS,
14830	and ADDR_LIMIT_3GB.
14831
148322015-12-24  Dmitry V. Levin  <ldv@altlinux.org>
14833
14834	arc, metag, nios2, or1k, tile: fix build.
14835	Fix build regression introduced by commit
14836	34683e3926d8c2daa368afb805da422ee7043396.
14837
14838	* linux/32/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap.
14839	* linux/arc/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap_pgoff.
14840	* linux/nios2/syscallent.h: Likewise.
14841	* linux/or1k/syscallent.h: Likewise.
14842	* linux/tile/syscallent1.h: Add sys_ prefix to ARCH_mmap and sys_mmap_4koff.
14843	* pathtrace.c (pathtrace_match): Handle SEN_ARCH_mmap.
14844	* NEWS: Mention this build fix.
14845
14846	Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
14847
148482015-12-24  Dmitry V. Levin  <ldv@altlinux.org>
14849
14850	packages: remove acl development library from build dependencies.
14851	Starting with commit v4.9-46-g681452b that removed all references
14852	to acl.h, we no longer use acl development library.
14853
14854	* .travis.yml (addons.apt.packages): Remove libacl1-dev.
14855	* strace.spec (BuildRequires): Remove libacl-devel.
14856
148572015-12-23  Dmitry V. Levin  <ldv@altlinux.org>
14858
14859	packages/x86_64: enable experimental -k option.
14860	* debian/control (Build-Depends) [amd64]: Add libunwind-dev.
14861	* strace.spec (BuildRequires) [x86_64]: Add libunwind-devel.
14862
14863	maint: post-release administrivia.
14864	* NEWS: Add header line for the next release.
14865
148662015-12-21  Dmitry V. Levin  <ldv@altlinux.org>
14867
14868	Prepare for 4.11 release.
14869	* NEWS: Update for 4.11 release.
14870	* debian/changelog: 4.11-1.
14871	* strace.spec: 4.11-1.
14872
148732015-12-20  Dmitry V. Levin  <ldv@altlinux.org>
14874
14875	Sync strace.spec and debian/ with packages.
14876	* debian/changelog: Sync with 4.10-3.
14877	* debian/control: Likewise.
14878	* debian/rules: Likewise.
14879	* strace.spec: Sync with 4.10-3.
14880
14881	.mailmap: add addresses of Kirill A. Shutemov.
14882	* .mailmap: Add both addresses of Kirill A. Shutemov here
14883	to avoid duplications in CREDITS file.
14884
148852015-12-19  Dmitry V. Levin  <ldv@altlinux.org>
14886
14887	NEWS: Prepare for 4.11 release.
14888
148892015-12-18  Dmitry V. Levin  <ldv@altlinux.org>
14890
14891	ia64: wire up mlock2 syscall.
14892	* linux/ia64/syscallent.h [1346]: Add mlock2 entry.
14893
148942015-12-17  Dmitry V. Levin  <ldv@altlinux.org>
14895
14896	Add copyright headers to some files which lack them.
14897	Before this change, all files that exist since 20th century had
14898	copyright headers, while most files that appeared later didn't.  This
14899	change fixes the inconsistency by adding missing copyright headers.
14900
14901	It doesn't mean that copyright headers became maintained.  In my view,
14902	git history provides much better information on this subject and is much
14903	more accurate than copyright headers.
14904
149052015-12-16  Dmitry V. Levin  <ldv@altlinux.org>
14906
14907	tests/aio.c: include <time.h>
14908	* tests/aio.c: Include <time.h> for struct timespec.
14909
14910	Reported-by: Szabolcs Nagy <nsz@port70.net>
14911
149122015-12-16  Dmitry V. Levin  <ldv@altlinux.org>
14913
14914	mpers.sh: switch to DWARF version 2 format for better portability.
14915	* mpers.sh (CFLAGS): Replace -gdwarf-4 with -gdwarf-2.
14916
14917	mpers.awk: add support for DWARF version 2 format.
14918	* mpers.awk: Handle DW_AT_data_member_location in DWARF v2 format.
14919
149202015-12-16  Dmitry V. Levin  <ldv@altlinux.org>
14921
14922	Replace %Ld/%Lu printf format specifiers with %lld/%llu.
14923	As %Ld and %Lu printf format specifiers are not quite portable,
14924	replace them with %lld and %llu, respectively.
14925
14926	* desc.c (SYS_FUNC(pselect6)): Replace %Lu with %llu.
14927	* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Likewise.
14928	* times.c (SYS_FUNC(times)): Likewise.
14929	* fcntl.c (print_struct_flock64): Replace %Ld with %lld.
14930	* tests/ftruncate.c (main): Replace %Lu with %llu.
14931	* tests/ftruncate64.c (main): Likewise.
14932	* tests/getdents.c (print_dirent): Likewise.
14933	* tests/llseek.c (main): Likewise.
14934	* tests/lseek.c (main): Likewise.
14935	* tests/truncate.c (main): Likewise.
14936	* tests/truncate64.c (main): Likewise.
14937	* tests/xstatx.c (main): Likewise.
14938	* tests/pselect6.c (main): Replace %Ld with %lld.
14939	* tests/xselect.c(main): Likewise.
14940
14941	Reported-by: Szabolcs Nagy <nsz@port70.net>
14942
149432015-12-16  Szabolcs Nagy  <nsz@port70.net>
14944
14945	Fix SYS_FUNC and SEN macros for musl.
14946	The syscall_name argument was subject to macro expansion because
14947	it was passed down to other macros before it was prefixed.
14948
14949	musl libc defines lfs64 names as macros (e.g. fstat64 as fstat)
14950	so SYS_FUNC(fstat64) was expanded to sys_fstat.
14951
14952	This change adds the prefix before the name is passed to other macros,
14953	i.e. the argument of SYS_FUNC_NAME is already prefixed with sys_.
14954
14955	* defs.h (SYS_FUNC): Add sys_ prefix to SYS_FUNC_NAME's argument.
14956	(SYS_FUNC_NAME): Do not add sys_ prefix to MPERS_FUNC_NAME's argument.
14957	* linux/ia64/syscallent.h (SYS_FUNC_NAME): Do not add sys_ prefix
14958	to MPERS_FUNC_NAME's argument.
14959	* syscall.c (SEN_NAME): Remove.
14960	(SEN): Replace SEN_NAME call with its definition.  Add sys_ prefix
14961	to SYS_FUNC_NAME's argument.
14962
149632015-12-15  Dmitry V. Levin  <ldv@altlinux.org>
14964
14965	tests/times.test: workaround libc bug on x32.
14966	As glibc times wrapper on x32 is known to wrongly truncate and then sign
14967	extend the syscall return value, invoke the syscall directly on x32.
14968
14969	* tests/times.c (main) [__NR_times && __x86_64__ && __ILP32__]:
14970	Invoke times syscall using inline asm.
14971
149722015-12-15  Dmitry V. Levin  <ldv@altlinux.org>
14973
14974	mpers.awk: make fillers added to the output structure more predictable.
14975	* mpers.awk (array_seq): New function.
14976	(what_is): Use it for printing filler names.  Tweak return types.
14977	* mpers_test.sh: Use a more complicated sample type to test mpers
14978	machinery.
14979
149802015-12-15  Dmitry V. Levin  <ldv@altlinux.org>
14981
14982	Robustify mpers.awk against input containing index loops.
14983	Make mpers.awk check for potential index loops.  Such loops should not
14984	normally happen, but mpers.awk will not go into infinite recursion if
14985	they do.
14986
14987	* mpers.awk (enter, leave): New functions.
14988	(what_is): Use them.
14989
149902015-12-15  Dmitry V. Levin  <ldv@altlinux.org>
14991
14992	Robustify mpers.awk against invalid input.
14993	Make mpers.awk check that accessed elements of the main array that
14994	are expected to have non-empty values really meet this requirement.
14995
14996	* mpers.awk (array_get): New function.
14997	(what_is, END): Use it.
14998	* mpers_test.sh: Use a more complicated type to test mpers machinery.
14999
15000	Reported-by: Mike Frysinger <vapier@gentoo.org>
15001
150022015-12-14  Dmitry V. Levin  <ldv@altlinux.org>
15003
15004	Replace HAVE_LITTLE_ENDIAN_LONG_LONG with WORDS_BIGENDIAN.
15005	* defs.h: Use WORDS_BIGENDIAN instead of HAVE_LITTLE_ENDIAN_LONG_LONG.
15006	* configure.ac (AC_LITTLE_ENDIAN_LONG_LONG): Remove.
15007	* m4/long_long.m4: Remove.
15008
150092015-12-14  Dmitry V. Levin  <ldv@altlinux.org>
15010
15011	Remove unused parser of xmknod syscall.
15012	The last reference to this parser was removed by commit
15013	v4.10-45-gdf4dd8b.
15014
15015	* mknod.c [SPARC || SPARC64] (SYS_FUNC(xmknod)): Remove.
15016
150172015-12-13  Dmitry V. Levin  <ldv@altlinux.org>
15018
15019	tests/restart_syscall: add a workaround for old arm kernels.
15020	As arm kernels used to overwrite ARM_r0 with -EINTR after
15021	ERESTART_RESTARTBLOCK, update regexp to workaround this.
15022
15023	* tests/restart_syscall.c (main) [__arm__]: Add 0xfffffffc as a valid
15024	alternative value for the first argument of restarted nanosleep syscall.
15025
150262015-12-12  Dmitry V. Levin  <ldv@altlinux.org>
15027
15028	tests/.gitignore: add ksysent.h.
15029	tests/ksysent.h is a generated file listed in CLEANFILES.
15030	This change complements commit v4.10-566-gbab4ef4.
15031
15032	* tests/.gitignore: Add ksysent.h.
15033
150342015-12-11  Dmitry V. Levin  <ldv@altlinux.org>
15035
15036	aarch64: make arm registers unsigned.
15037	Follow the x86_64 example and define registers in arm_pt_regs
15038	as unsigned, to avoid potential sign extension bugs.
15039
15040	This also fixes --enable-gcc-Werror build.
15041
15042	* linux/aarch64/arch_regs.c (arm_pt_regs): Change uregs's type
15043	from int to uint32_t.
15044
15045	Reported-by: Sergey Bolshakov <sbolshakov@altlinux.org>
15046
150472015-12-10  Dmitry V. Levin  <ldv@altlinux.org>
15048
15049	tests: add ksysent.test.
15050	Check that syscall names and numbers defined in syscallent files
15051	match kernel __NR_* constants defined by <asm/unistd.h>.
15052
15053	Tested on various platforms, including the following combinations
15054	of architectures and kernel headers:
15055
15056	x86_64: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.12, 3.11,
15057	3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
15058	i386: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.11,
15059	3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
15060	aarch64: 4.4-rc
15061	alpha: 4.3
15062	arm eabi: 4.4-rc, 4.2, 4.1
15063	hppa: 3.18
15064	ia64: 3.18
15065	mips o32: 4.1
15066	ppc: 3.18
15067	ppc64: 3.10-rhel, 2.6.32-rhel
15068	s390: 3.18
15069	s390x: 3.18
15070	sparc: 4.1
15071	sparc: 3.18
15072	x32: 3.19
15073
15074	The only platform which is known at this moment to fail the test
15075	is CentOS-5 provided by OBS.  On x86_64 instance it fails with
15076	error: "prlimit64" syscall #300 is "fanotify_init" in syscallent.h
15077	and on i586 it similarly fails with
15078	error: "prlimit64" syscall #338 is "fanotify_init" in syscallent.h
15079	So this is a real platform bug that is not likely to be worked around
15080	on the strace side.
15081
15082	* tests/ksysent.c: New file.
15083	* tests/ksysent.sed: Likewise.
15084	* tests/ksysent.test: New test.
15085	* tests/Makefile.am (AM_CPPFLAGS): Add -I$(builddir).
15086	(check_PROGRAMS): Add ksysent.
15087	(TESTS): Add ksysent.test.
15088	(EXTRA_DIST): Add ksysent.sed.
15089	(ksysent.h): New rule.
15090	(BUILT_SOURCES, CLEANFILES): Add ksysent.h.
15091	* tests/.gitignore: Add ksysent.
15092
150932015-12-09  Dmitry V. Levin  <ldv@altlinux.org>
15094
15095	Document that syscall names match kernel __NR_* constants.
15096	* strace.1: Note syscall naming difference between architectures
15097	and the rule of choosing the right syscall name in each case.
15098
150992015-12-09  Dmitry V. Levin  <ldv@altlinux.org>
15100
15101	ia64: print all ia32 syscalls using printargs.
15102	Printing of ia32 syscalls on ia64 must have been broken for a long time.
15103	Do not pretend that it works, print ia32 syscalls using printargs
15104	instead.
15105
15106	* linux/ia64/syscallent.h: Remove all redefinitions of sys_* macros.
15107	Stop including"../dummy.h".  Include "../i386/syscallent.h" with
15108	SYS_FUNC_NAME macro temporarily redirected to printargs.
15109
151102015-12-09  Dmitry V. Levin  <ldv@altlinux.org>
15111
15112	Fix build on architectures for which arch_sigreturn is not implemented.
15113	This complements commit 527b42ff8da3f52fa7c48eb766b2b57fb0f0b977.
15114
15115	* linux/arch_sigreturn.c (arch_sigreturn): Define.
15116
151172015-12-09  Dmitry V. Levin  <ldv@altlinux.org>
15118
15119	aarch64: swap 64-bit and 32-bit personalities.
15120	Let native 64-bit personality be personality 0, and 32-bit personality
15121	be personality 1, to follow the traditional layout used for other
15122	architectures.
15123
15124	* defs.h [AARCH64]: Swap PERSONALITY0_WORDSIZE and
15125	PERSONALITY1_WORDSIZE, remove DEFAULT_PERSONALITY.
15126	[AARCH64 && HAVE_M32_MPERS]: Rename PERSONALITY1_* to PERSONALITY0_*.
15127	* file.c [AARCH64 || defined X86_64 || defined X32]: Define
15128	STAT32_PERSONALITY for AARCH64 as well.
15129	* syscall.c (update_personality) [AARCH64]: Adjust PERSONALITY_NAMES.
15130	* linux/aarch64/errnoent1.h: Adjust comment.
15131	* linux/aarch64/get_error.c (get_error): Adjust tcp->currpers check.
15132	* linux/aarch64/get_syscall_args.c (get_syscall_args): Likewise.
15133	* linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Likewise.
15134	* linux/aarch64/get_scno.c (arch_get_scno): Adjust update_personality
15135	invocations.
15136	* linux/aarch64/ioctls_arch0.h: Swap with ...
15137	* linux/aarch64/ioctls_arch1.h: ... this file.
15138	* linux/aarch64/ioctls_inc0.h: Swap with ...
15139	* linux/aarch64/ioctls_inc1.h: ... this file.
15140	* linux/aarch64/syscallent.h: Swap with ...
15141	* linux/aarch64/syscallent1.h: ... this file.
15142
151432015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15144
15145	mips: fix fadvise64 syscall entries.
15146	* linux/mips/syscallent-n32.h [6216]: Change syscall handler
15147	from fadvise64 to fadvise64_64.
15148	* linux/mips/syscallent-n64.h [5215]: Rename from "fadvise64_64"
15149	to "fadvise64"
15150	* linux/mips/syscallent-o32.h [4254]: Likewise.
15151
15152	xtensa: wire up syncfs syscall.
15153	* linux/xtensa/syscallent.h [179]: Add syncfs entry.
15154
15155	sh, sh64: fix syscall entries.
15156	* linux/sh/syscallent.h [322]: Fix timerfd_create entry.
15157	* linux/sh64/syscallent.h [350]: Likewise.
15158	[0]: Fix restart_syscall entry.
15159
15160	powerpc, powerpc64: wire up mlock2 syscall.
15161	* linux/powerpc/syscallent.h [378]: Add mlock2 entry.
15162	* linux/powerpc64/syscallent.h: Likewise.
15163
15164	hppa: fix syscall entries.
15165	* linux/hppa/syscallent.h: Swap [343] and [344] entries.
15166
15167	avr32: update syscall entries.
15168	* linux/avr32/syscallent.h [0]: Rename from setup to restart_syscall.
15169	[284 ... 320]: New entries.
15170
15171	m68k: fix syscall names.
15172	* linux/m68k/syscallent.h [335]: Rename "atomic_comxchg_32"
15173	to "atomic_cmpxchg_32".
15174
15175	sparc: update syscall names.
15176	* linux/sparc/syscallent.h [160]: Rename "sched_setaffinity"
15177	to "sched_set_affinity".
15178	[161]: Rename "sched_getaffinity" to "sched_get_affinity".
15179
15180	powerpc, powerpc64: update syscall names.
15181	* linux/powerpc/syscallent.h [201]: Rename "MOL" to "multiplexer".
15182	[225]: Rename "tux" to "tuxcall".
15183	[256]: Rename "debug_setcontext" to "sys_debug_setcontext".
15184	* linux/powerpc64/syscallent.h: Likewise.
15185
15186	alpha: update syscall entries.
15187	* linux/alpha/syscallent.h [224 ... 228]: Add stub entries.
15188	[100]: Rename "osf_getpriority" to "getpriority".
15189	[255]: Rename "osf_subsysinfo" to "osf_subsys_info".
15190	[303]: Rename "adjtimex32" to "old_adjtimex".
15191	[319]: Rename "sysctl" to "_sysctl".
15192	[320]: Remove.
15193
151942015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15195
15196	Fix mmap syscall entries.
15197	Change syscall names to match kernel __NR_* constants.
15198
15199	* linux/avr32/syscallent.h [90]: Rename "mmap" to "mmap2".
15200	* linux/bfin/syscallent.h [90]: Rename "old_mmap" to "mmap".
15201	* linux/i386/syscallent.h: Likewise.
15202	* linux/m68k/syscallent.h: Likewise.
15203	* linux/microblaze/syscallent.h: Likewise.
15204	* linux/sh/syscallent.h: Likewise.
15205	* linux/sh64/syscallent.h: Likewise.
15206	* tests/mmap.c (main): Remove old_mmap from expected output.
15207	* tests/mmap.test: Remove old_mmap from the list of mmap syscalls.
15208
152092015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15210
15211	Fix select and _newselect syscall entries.
15212	Change syscall names to match kernel __NR_* constants.
15213	This reverts commit ddcf54969d253582ab2cfdcab8ede9cdae3fb171.
15214
15215	* linux/arm/syscallent.h [82]: Rename "oldselect" to "select".
15216	[142]: Rename "select" to "_newselect".
15217	* linux/bfin/syscallent.h: Likewise.
15218	* linux/i386/syscallent.h: Likewise.
15219	* linux/m68k/syscallent.h: Likewise.
15220	* linux/microblaze/syscallent.h: Likewise.
15221	* linux/powerpc/syscallent.h [82]: Likewise.
15222	* linux/powerpc64/syscallent.h: Likewise.
15223	* linux/sh/syscallent.h: Likewise.
15224	* linux/sh64/syscallent.h: Likewise.
15225	* linux/hppa/syscallent.h [142]: Rename "select" to "_newselect".
15226	* linux/mips/syscallent-n32.h [6022]: Rename "select" to "_newselect".
15227	* linux/mips/syscallent-n64.h [5022]: Likewise.
15228	* linux/mips/syscallent-o32.h [4142]: Likewise.
15229	* linux/s390/syscallent.h [142]: Rename "select" to "_newselect".
15230	* linux/sparc/syscallent.h [230]: Rename "select" to "_newselect".
15231	* tests/oldselect.test: Rename oldselect to select.  Convert
15232	from match_grep to match_diff.
15233	* tests/oldselect.expected: Likewise.
15234	* xselect.c: New file, based on select.c.
15235	* tests/_newselect.c: New file.
15236	* tests/select.c: Replace with a wrapper around xselect.c.
15237	* tests/select.test: Parametrize.
15238	* tests/_newselect.test: New test.
15239	* tests/Makefile.am (check_PROGRAMS): Add _newselect.
15240	(TESTS): Add _newselect.test.
15241	(EXTRA_DIST): Add xselect.c.
15242	* tests/.gitignore: Add _newselect.
15243
152442015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15245
15246	Fix exit syscall entries.
15247	Change syscall names to match kernel __NR_* constants.
15248
15249	* linux/avr32/syscallent.h [1]: Rename "_exit" to "exit".
15250	* linux/bfin/syscallent.h: Likewise.
15251	* linux/i386/syscallent.h: Likewise.
15252	* linux/m68k/syscallent.h: Likewise.
15253	* linux/microblaze/syscallent.h: Likewise.
15254	* linux/sh/syscallent.h: Likewise.
15255	* linux/sh64/syscallent.h: Likewise.
15256	* linux/x32/syscallent.h [60]: Rename "_exit" to "exit".
15257	* linux/x86_64/syscallent.h: Likewise.
15258
152592015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15260
15261	Fix pread64 and pwrite64 syscall entries.
15262	Change syscall names to match kernel __NR_* constants.
15263
15264	* linux/alpha/syscallent.h [349]: Rename "pread" to "pread64".
15265	[350]: Rename "pwrite" to "pwrite64".
15266	* linux/ia64/syscallent.h [1148]: Rename "pread" to "pread64".
15267	[1149]: Rename "pwrite" to "pwrite64".
15268	* linux/sh/syscallent.h [180]: Rename "pread" to "pread64".
15269	[181]: Rename "pwrite" to "pwrite64".
15270	* linux/sh64/syscallent.h: Likewise.
15271	* linux/x32/syscallent.h [17]: Rename "pread" to "pread64".
15272	[18]: Rename "pwrite" to "pwrite64".
15273	* linux/x86_64/syscallent.h: Likewise.
15274
152752015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15276
15277	tests: sort the list of tests.
15278	* tests/Makefile.am (TESTS): Sort the list of regular tests.
15279	* tests/.gitignore: Sort.
15280
15281	ia64: fix remap_file_pages syscall entry.
15282	* linux/ia64/syscallent.h (1125): Set to remap_file_pages.
15283
15284	bfin, i386: remove sysentry for nonexistent security syscall.
15285	* linux/bfin/syscallent.h (223): Remove.
15286	* linux/i386/syscallent.h: Likewise.
15287
15288	build: add -D_FILE_OFFSET_BITS=64 to _CPPFLAGS instead of _CFLAGS.
15289	* tests/Makefile.am (fstat64_CFLAGS): Rename to fstat64_CPPFLAGS,
15290	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15291	(fstatat64_CFLAGS): Rename to fstatat64_CPPFLAGS,
15292	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15293	(ftruncate64_CFLAGS): Rename to ftruncate64_CPPFLAGS,
15294	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15295	(lstat64_CFLAGS): Rename to lstat64_CPPFLAGS,
15296	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15297	(mmap64_CFLAGS): Rename to mmap64_CPPFLAGS,
15298	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15299	(newfstatat_CFLAGS): Rename to newfstatat_CPPFLAGS,
15300	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15301	(stat64_CFLAGS): Rename to stat64_CPPFLAGS,
15302	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15303	(statfs_CFLAGS): Rename to statfs_CPPFLAGS,
15304	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15305	(truncate64_CFLAGS): Rename to truncate64_CPPFLAGS,
15306	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15307	(uio_CFLAGS): Rename to uio_CPPFLAGS,
15308	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
15309
153102015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15311
15312	Move x32 <asm/stat.h> replacement to x32 specific directory.
15313	As tests-m*32/Makefile.am files now refer to proper arch specific
15314	directories, it's possible to relocate x32 <asm/stat.h> replacement
15315	to its arch specific directory.
15316
15317	* linux/x86_64/asm_stat.h: Move ...
15318	* linux/x32/asm_stat.h: ... here, remove x32 guard.
15319	* Makefile.am (strace_SOURCES): Remove linux/x86_64/asm_stat.h.
15320
153212015-12-08  Dmitry V. Levin  <ldv@altlinux.org>
15322
15323	build: set arch specific -m switches in tests-m*32/Makefile.am files properly
15324	* tests/Makefile.am (ARCH_MFLAGS, AM_LDFLAGS): New variables.
15325	(AM_CPPFLAGS): Use ARCH_MFLAGS.
15326	* bootstrap: In tests-m32/Makefile.am and tests-mx32/Makefile.am,
15327	add -m32 and -mx32, respectively, to ARCH_MFLAGS instead of AM_CFLAGS.
15328
15329	build: initialize ARCH variable in tests-m*32/Makefile.am files properly
15330	* configure.ac (arch_m32): Set to sparc on sparc64, powerpc on
15331	powerpc64, arm on aarch64, i386 on x86_64 and x32, $arch in other cases.
15332	(arch_mx32): Set to x32 on x86_64, $arch in other cases.
15333	(AC_SUBST): Add arch_m32 and arch_mx32.
15334	* bootstrap: Substitute @arch@ with @arch_m32@ in tests-m32/Makefile.am.
15335	Substitute @arch@ with @arch_mx32@ in tests-mx32/Makefile.am.
15336
153372015-12-07  Dmitry V. Levin  <ldv@altlinux.org>
15338
15339	tests: add umount.test and umount2.test.
15340	* tests/umount.c: New file.
15341	* tests/umount2.c: Likewise.
15342	* tests/umount.test: New test.
15343	* tests/umount2.test: Likewise.
15344	* tests/Makefile.am (check_PROGRAMS): Add umount and umount2.
15345	(TESTS): Add umount.test and umount2.test.
15346	* tests/.gitignore: Add umount and umount2.
15347
15348	avr32: fix umount2 syscall entry.
15349	* linux/avr32/syscallent.h: Rename umount to umount2.
15350
15351	Update umount2 flags.
15352	* umount.c (MNT_FORCE, MNT_DETACH, MNT_EXPIRE): Move definitions ...
15353	* xlat/umount_flags.in: ... here.  Add UMOUNT_NOFOLLOW.
15354
153552015-12-07  Dmitry V. Levin  <ldv@altlinux.org>
15356
15357	Print the first argument of umount2 syscall as a path.
15358	* umount.c (SYS_FUNC(umount2)): Use printpath instead of printstr.
15359
15360	This fixes Debian bug #785050.
15361
153622015-12-06  Dmitry V. Levin  <ldv@altlinux.org>
15363
15364	prctl: add PR_CAP_AMBIENT parser.
15365	* xlat/pr_cap_ambient.in: New file.
15366	* prctl.c: Include "xlat/pr_cap_ambient.h".
15367	(SYS_FUNC(prctl)): Handle PR_CAP_AMBIENT.
15368
15369	prctl: finish decoding of several commands on entering syscall.
15370	* prctl.c (SYS_FUNC(prctl)): Return RVAL_DECODED after decoding of
15371	PR_GET_DUMPABLE, PR_GET_KEEPCAPS, PR_GET_SECCOMP, PR_GET_TIMERSLACK,
15372	PR_GET_TIMING, and PR_CAPBSET_READ commands.
15373
15374	Fix build on systems that lack EM_FRV definition.
15375	* xlat/audit_arch.in: Guard AUDIT_ARCH_FRV with EM_FRV check.
15376
15377	times.test: workaround buggy libc.
15378	* tests/times.c: Include <sys/syscall.h>.
15379	(main): On systems where user's and kernel's long types are the same,
15380	prefer direct times syscall over libc's times function because
15381	the latter is more prone to return value truncation.
15382
15383	times.test: reduce cpu time consumption, increase struct tms diversity.
15384	* tests/times.c (main): Reduce cpu time consumption fourfold,
15385	make the parent process consume less cpu time than the child process
15386	so that members of the structure returned by times syscall would be
15387	more likely to contain different values.
15388
153892015-12-06  Dmitry V. Levin  <ldv@altlinux.org>
15390
15391	mips n32, x32: fix printing of times syscall return value.
15392	As times syscall returns kernel's long value, it has to be printed as
15393	RVAL_LUDECIMAL on systems where long type is less than kernel's long.
15394
15395	* times.c (SYS_FUNC(times)) [RVAL_LUDECIMAL && !IN_MPERS]:
15396	Return RVAL_LUDECIMAL instead of RVAL_UDECIMAL.
15397
153982015-12-06  Dmitry V. Levin  <ldv@altlinux.org>
15399
15400	unix-yy.test: fix portability issue.
15401	* tests/unix-yy-connect.awk (r_close_listen): Quote square brackets
15402	that are not part of a bracket expression.
15403
15404	inet-cmsg.test: skip the test when the network is not functional.
15405	* tests/inet-cmsg.c (main): Return 77 if inet datagram socket
15406	cannot be bound to INADDR_LOOPBACK.
15407
154082015-12-05  Dmitry V. Levin  <ldv@altlinux.org>
15409
15410	fcntl: skip F_GETLK64, F_SETLK64, and F_SETLKW64 in fcntl syscall parser
15411	As the kernel recognizes F_GETLK64, F_SETLK64, and F_SETLKW64 commands
15412	in fcntl64 syscall only, do not parse their structures in fcntl parser.
15413
15414	* xlat/fcntlcmds.in: Move F_GETLK64, F_SETLK64, and F_SETLKW64 ...
15415	* xlat/fcntl64cmds.in: ... here.
15416	* fcntl.c: Include "xlat/fcntl64cmds.h".
15417	(print_fcntl): Move printing of first two syscall arguments
15418	and handling of F_GETLK64, F_SETLK64, and F_SETLKW64 commands ...
15419	(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): ... here.
15420	* tests/fcntl.c: New file, based on struct_flock.c.
15421	* tests/fcntl64.c: Likewise.
15422	* tests/struct_flock.c (test_flock_einval, create_sample): New functions.
15423	(test_flock): Use test_flock_einval.
15424	(test_flock64, main): Remove.
15425	* tests/fcntl.test: New test.
15426	* tests/fcntl64.test: Likewise.
15427	* tests/struct_flock.test: Remove.
15428	* tests/Makefile.am (check_PROGRAMS): Add fcntl and fcntl64,
15429	remove struct_flock.
15430	(TESTS): Add fcntl.test and fcntl64.test, remove struct_flock.test.
15431	(EXTRA_DIST) Add struct_flock.c.
15432	* tests/.gitignore: Add fcntl and fcntl64, remove struct_flock.
15433
154342015-12-05  Dmitry V. Levin  <ldv@altlinux.org>
15435
15436	print_fcntl: finish with unrecognized commands on entering syscall.
15437	* fcntl.c (print_fcntl): Merge two switch statements.
15438
154392015-12-04  Elvira Khabirova  <lineprinter0@gmail.com>
15440
15441	fcntl: create a separate parser for fcntl64 syscall.
15442	* fcntl.c(print_fcntl): New function, made from SYS_FUNC(fcntl).
15443	(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use it.
15444	* linux/32/syscallent.h: Change parser of fcntl64 to SEN(fcntl64).
15445	* linux/arm/syscallent.h: Likewise.
15446	* linux/avr32/syscallent.h: Likewise.
15447	* linux/bfin/syscallent.h: Likewise.
15448	* linux/hppa/syscallent.h: Likewise.
15449	* linux/i386/syscallent.h: Likewise.
15450	* linux/m68k/syscallent.h: Likewise.
15451	* linux/microblaze/syscallent.h: Likewise.
15452	* linux/mips/syscallent-n32.h: Likewise.
15453	* linux/mips/syscallent-o32.h: Likewise.
15454	* linux/powerpc/syscallent.h: Likewise.
15455	* linux/s390/syscallent.h: Likewise.
15456	* linux/sh/syscallent.h: Likewise.
15457	* linux/sh64/syscallent.h: Likewise.
15458	* linux/sparc/syscallent.h: Likewise.
15459	* linux/xtensa/syscallent.h: Likewise.
15460
154612015-12-05  Dmitry V. Levin  <ldv@altlinux.org>
15462
15463	travis-ci: add build matrix.
15464
15465	tests: replace old stat tests with stat.test and stat64.test.
15466	* tests/stat.c: Replace with a wrapper around lstatx.c
15467	* tests/stat.test: Replace with a wrapper around statx.sh.
15468	* tests/stat32-v.test: Remove.
15469	* tests/stat32.c: Remove.
15470	* tests/stat64-v.test: Remove.
15471	* tests/stat64.c: New file.
15472	* tests/stat64.test: New test.
15473	* tests/Makefile.am (check_PROGRAMS): Replace stat32 with stat64.
15474	(stat_CFLAGS): Rename to stat64_CFLAGS.
15475	(TESTS): Replace stat32-v.test and stat64-v.test with stat64.test.
15476	* tests/.gitignore: Replace stat32 with stat64.
15477
15478	tests: add lstat.test and lstat64.test.
15479	* tests/lstat.c: New file.
15480	* tests/lstat64.c: Likewise.
15481	* tests/lstatx.c: Likewise.
15482	* tests/lstat.test: New test.
15483	* tests/lstat64.test: Likewise.
15484	* tests/Makefile.am (check_PROGRAMS): Add lstat and lstat64.
15485	(lstat64_CFLAGS): Define.
15486	(TESTS): Add lstat.test and lstat64.test.
15487	(EXTRA_DIST): Add lstatx.c.
15488	* tests/.gitignore: Add lstat and lstat64.
15489
15490	tests: add fstat.test and fstat64.test.
15491	* tests/fstat.c: New file.
15492	* tests/fstat64.c: Likewise.
15493	* tests/fstatx.c: Likewise.
15494	* tests/fstat.test: New test.
15495	* tests/fstat64.test: Likewise.
15496	* tests/Makefile.am (check_PROGRAMS): Add fstat and fstat64.
15497	(fstat64_CFLAGS): Define.
15498	(TESTS): Add fstat.test and fstat64.test.
15499	(EXTRA_DIST): Add fstatx.c.
15500	* tests/.gitignore: Add fstat and fstat64.
15501
155022015-12-05  Dmitry V. Levin  <ldv@altlinux.org>
15503
15504	tests: prepare for detailed testing of stat family syscalls.
15505	Parametrize code from fstatat.c to support <asm/stat.h>
15506	as an alternative to <sys/stat.h> and move it to a separate file.
15507
15508	* tests/statx.sh: New file, based on fstatat64.test.
15509	* tests/fstatat64.test: Use it.
15510	* tests/newfstatat.test: Likewise.
15511	* tests/xstatx.c: New file, based on fstatat.c.
15512	* tests/fstatat.c: Use it.
15513	* tests/Makefile.am (EXTRA_DIST): Add statx.sh and xstatx.c.
15514	* tests/fstatat64.c (FSTATAT_NAME): Change to TEST_SYSCALL_NAME.
15515	* tests/newfstatat.c: Likewise.
15516
155172015-12-04  Gabriel Laskar  <gabriel@lse.epita.fr>
15518
15519	ioctl: allow to stop decoding number.
15520	For some ioctls, like from drm, the identification of the correct ioctl
15521	is done by custom code.  Specifying IOCTL_NUMBER_STOP_LOOKUP on
15522	return of ioctl_decode_command_number() disables further calls to
15523	ioctl_lookup().
15524
15525	* defs.h (IOCTL_NUMBER_UNKNOWN, IOCTL_NUMBER_HANDLED,
15526	IOCTL_NUMBER_STOP_LOOKUP): Add macros representing ioctl number state
15527	decoding.
15528	* ioctl.c (SYS_FUNC(ioctl)): Skip ioctl_lookup() when
15529	ioctl_decode_command_number() returns a value with
15530	IOCTL_NUMBER_STOP_LOOKUP flag is set.
15531
15532	Suggested-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
15533
155342015-12-04  Dmitry V. Levin  <ldv@altlinux.org>
15535
15536	tests: skip restart_syscall.test on x32.
15537	The syscall number of restart_syscall returned by the kernel in case
15538	of ERESTART_RESTARTBLOCK is broken on x32 from the beginning, see
15539	https://lkml.org/lkml/2015/11/30/790
15540
15541	Until that improves, skip the test on x32.
15542
15543	* tests/restart_syscall.c (main) [__x86_64__ && __ILP32__]: Return 77.
15544
155452015-12-04  Dmitry V. Levin  <ldv@altlinux.org>
15546
15547	x32: fix decoding of i386 personality lseek syscall.
15548	On x32, tcp->ext_arg is not initialized for i386 personality,
15549	so tcp->u_arg has to be used instead.
15550
15551	* lseek.c (SYS_FUNC(lseek)) [X32]: Handle "current_personality == 1" case.
15552
155532015-12-04  Dmitry V. Levin  <ldv@altlinux.org>
15554
15555	x86_64, x32: add a replacement for <asm/stat.h>
15556	Some old kernel headers, Ubuntu 14.04 in particular, provide
15557	<asm/stat.h> editions that are completely wrong for x32.
15558	Workaround this issue by providing a replacement.
15559
15560	* linux/x86_64/asm_stat.h: New file.
15561	* linux/x32/asm_stat.h: Likewise.
15562	* Makefile.am (strace_SOURCES): Add them.
15563
155642015-12-04  Dmitry V. Levin  <ldv@altlinux.org>
15565
15566	Add a wrapper around <asm/stat.h>
15567	* linux/asm_stat.h: New file.
15568	* Makefile.am (strace_SOURCES): Add it.
15569	* file.c: Use it.
15570
15571	kernel_types.h: protect from double inclusion.
15572	* kernel_types.h: Add #include guard.
15573
155742015-12-03  Dmitry V. Levin  <ldv@altlinux.org>
15575
15576	fstatat64.test: lift /proc requirement.
15577	While -P option needs /proc to match descriptors, it does not use
15578	/proc to match pathnames.  As this test does not need descriptor
15579	match, the /proc requirement can be safely lifted.
15580
15581	* tests/fstatat64.test: Lift /proc/self/fd/ requirement.
15582
155832015-12-02  Dmitry V. Levin  <ldv@altlinux.org>
15584
15585	tests: add fstatat64.test and newfstatat.test.
15586	* configure.ac (AC_CHECK_FUNCS): Add fstatat, ftruncate, and futimens.
15587	* tests/fstatat.c: New file.
15588	* tests/fstatat64.c: Likewise.
15589	* tests/newfstatat.c: Likewise.
15590	* tests/fstatat64.test: New test.
15591	* tests/newfstatat.test: Likewise.
15592	* tests/Makefile.am (check_PROGRAMS): Add fstatat64 and newfstatat.
15593	(fstatat64_CFLAGS, newstatat_CFLAGS): Define.
15594	(TESTS): Add fstatat64.test and newfstatat.test.
15595	(EXTRA_DIST): Add fstatat.c.
15596	* tests/.gitignore: Add fstatat64 and newfstatat.
15597
155982015-12-01  Dmitry V. Levin  <ldv@altlinux.org>
15599
15600	alpha, ppc, sh, sh64: fix fstatat64 syscall entries.
15601	* linux/alpha/syscallent.h (newfstatat): Change sys_name to fstatat64.
15602	* linux/powerpc/syscallent.h: Likewise.
15603	* linux/sh/syscallent.h: Likewise.
15604	* linux/sh64/syscallent.h: Likewise.
15605
15606	ppc64: clone syscallent.h from ppc.
15607	* linux/powerpc64/syscallent.h: Clone from linux/powerpc/syscallent.h
15608	with entries for numbers 192..197, 204, 226, and 254 unassigned.
15609
15610	tests: add lseek.test and llseek.test.
15611	* tests/llseek.c: New file.
15612	* tests/lseek.c: Likewise.
15613	* tests/llseek.test: New test.
15614	* tests/lseek.test: Likewise.
15615	* tests/Makefile.am (check_PROGRAMS): Add llseek and lseek.
15616	(TESTS): Add llseek.test and lseek.test.
15617	* tests/.gitignore: Add llseek and lseek.
15618
15619	tests: add ftruncate64.test and truncate64.test.
15620	* tests/ftruncate64.c: New file.
15621	* tests/truncate64.c: Likewise.
15622	* tests/ftruncate64.test: New test.
15623	* tests/truncate64.test: Likewise.
15624	* tests/Makefile.am (check_PROGRAMS): Add ftruncate64 and truncate64.
15625	(ftruncate64_CFLAGS, truncate64_CFLAGS): Define.
15626	(TESTS): Add ftruncate64.test and truncate64.test.
15627	* tests/.gitignore: Add ftruncate64 and truncate64.
15628
15629	tests: add ftruncate.test and truncate.test.
15630	* tests/ftruncate.c: New file.
15631	* tests/truncate.c: Likewise.
15632	* tests/ftruncate.test: New test.
15633	* tests/truncate.test: Likewise.
15634	* tests/Makefile.am (check_PROGRAMS): Add ftruncate and truncate.
15635	(TESTS): Add ftruncate.test and truncate.test.
15636	* tests/.gitignore: Add ftruncate and truncate.
15637
156382015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15639
15640	build: robustify linux/fcntl.h check.
15641	* configure.ac (AC_CHECK_TYPES): Support older linux kernel headers
15642	by including <sys/types.h> before <linux/fcntl.h>.
15643
156442015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15645
15646	syscall.c: move inclusion of arch specific files to the end of file.
15647	Move inclusion of arch specific files that define static functions to
15648	the end of syscall.c.
15649
15650	* syscall.c (get_syscall_result_regs, get_error, getregs_old):
15651	New forward declarations.
15652	(arch_get_scno): Move forward.
15653	Move inclusion of "get_scno.c", "get_syscall_args.c",
15654	"get_syscall_result.c", "get_error.c", and "getregs_old.c"
15655	to the end of file.
15656
156572015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15658
15659	x86_64: change getregs_old to forward ptrace return code.
15660	* linux/x86_64/getregs_old.c (getregs_old): Change to return ptrace
15661	return code.
15662	* syscall.c (get_regs) [ARCH_REGS_FOR_GETREGSET && X86_64]: Use
15663	getregs_old return code.
15664
156652015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15666
15667	Cleanup print_pc.
15668	Apparently, there are only two types of instruction pointer printers
15669	depending on the architecture: those that print a register that was
15670	fetched earlier, and those that fetch a register themselves using upeek.
15671	With this change, architectures of the first type have ARCH_PC_REG
15672	defined in their arch_regs.c file, architectures of the first type
15673	have ARCH_PC_PEEK_ADDR defined there, and the common code in syscall.c
15674	uses these macros to print the instruction pointer.
15675
15676	* Makefile.am (EXTRA_DIST): Remove linux/*/print_pc.c.
15677	* linux/*/print_pc.c: Remove.
15678	* linux/aarch64/arch_regs.c(ARCH_PC_REG): Define macro.
15679	* linux/arc/arch_regs.c(ARCH_PC_REG): Likewise.
15680	* linux/arm/arch_regs.c(ARCH_PC_REG): Likewise.
15681	* linux/avr32/arch_regs.c(ARCH_PC_REG): Likewise.
15682	* linux/i386/arch_regs.c(ARCH_PC_REG): Likewise.
15683	* linux/ia64/arch_regs.c(ARCH_PC_REG): Likewise.
15684	* linux/metag/arch_regs.c(ARCH_PC_REG): Likewise.
15685	* linux/mips/arch_regs.c(ARCH_PC_REG): Likewise.
15686	* linux/nios2/arch_regs.c(ARCH_PC_REG): Likewise.
15687	* linux/or1k/arch_regs.c(ARCH_PC_REG): Likewise.
15688	* linux/powerpc64/arch_regs.c(ARCH_PC_REG): Likewise.
15689	* linux/powerpc/arch_regs.c(ARCH_PC_REG): Likewise.
15690	* linux/s390/arch_regs.c(ARCH_PC_REG): Likewise.
15691	* linux/s390x/arch_regs.c(ARCH_PC_REG): Likewise.
15692	* linux/sparc64/arch_regs.c(ARCH_PC_REG): Likewise.
15693	* linux/sparc/arch_regs.c(ARCH_PC_REG): Likewise.
15694	* linux/tile/arch_regs.c(ARCH_PC_REG): Likewise.
15695	* linux/x32/arch_regs.c(ARCH_PC_REG): Likewise.
15696	* linux/x86_64/arch_regs.c(ARCH_PC_REG): Likewise.
15697	* linux/alpha/arch_regs.c(ARCH_PC_PEEK_ADDR): Define macro.
15698	* linux/bfin/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15699	* linux/crisv10/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15700	* linux/crisv32/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15701	* linux/hppa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15702	* linux/m68k/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15703	* linux/microblaze/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15704	* linux/sh64/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15705	* linux/sh/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15706	* linux/xtensa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
15707	* syscall.c (print_pc): Stop including "print_pc.c".
15708	Use ARCH_PC_REG or ARCH_PC_PEEK_ADDR.
15709
157102015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15711
15712	cleanup: make get_scno.c files more readable.
15713	Make get_scno.c files more self-contained.  While they are still
15714	being included by syscall.c, the latter no longer provides
15715	a function framework for them.
15716
15717	* linux/aarch64/get_scno.c (arch_get_scno): Define.
15718	* linux/alpha/get_scno.c: Likewise.
15719	* linux/arc/get_scno.c: Likewise.
15720	* linux/arm/get_scno.c: Likewise.
15721	* linux/avr32/get_scno.c: Likewise.
15722	* linux/bfin/get_scno.c: Likewise.
15723	* linux/crisv10/get_scno.c: Likewise.
15724	* linux/hppa/get_scno.c: Likewise.
15725	* linux/i386/get_scno.c: Likewise.
15726	* linux/ia64/get_scno.c: Likewise.
15727	* linux/m68k/get_scno.c: Likewise.
15728	* linux/metag/get_scno.c: Likewise.
15729	* linux/microblaze/get_scno.c: Likewise.
15730	* linux/mips/get_scno.c: Likewise.
15731	* linux/nios2/get_scno.c: Likewise.
15732	* linux/or1k/get_scno.c: Likewise.
15733	* linux/powerpc/get_scno.c: Likewise.
15734	* linux/powerpc64/get_scno.c: Likewise.
15735	* linux/s390/get_scno.c: Likewise.
15736	* linux/sh/get_scno.c: Likewise.
15737	* linux/sh64/get_scno.c: Likewise.
15738	* linux/sparc/get_scno.c: Likewise.
15739	* linux/sparc64/get_scno.c: Likewise.
15740	* linux/tile/get_scno.c: Likewise.
15741	* linux/x86_64/get_scno.c: Likewise.
15742	* linux/xtensa/get_scno.c: Likewise.
15743	* syscall.c (arch_get_scno): New declaration.
15744	Include "get_scno.c" in file scope.
15745	(get_scno): Use arch_get_scno.
15746
15747	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
15748
157492015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15750
15751	cleanup: make get_syscall_args.c files more readable.
15752	Make get_syscall_args.c files more self-contained.  While they are
15753	still being included by syscall.c, the latter no longer defines
15754	get_syscall_args function.
15755
15756	* linux/aarch64/get_syscall_args.c: Include "arm/get_syscall_args.c"
15757	with get_syscall_args temporarily defined to arm_get_syscall_args.
15758	(get_syscall_args): Define.
15759	* linux/alpha/get_syscall_args.c (get_syscall_args): Define.
15760	* linux/arc/get_syscall_args.c: Likewise.
15761	* linux/arm/get_syscall_args.c: Likewise.
15762	* linux/avr32/get_syscall_args.c: Likewise.
15763	* linux/bfin/get_syscall_args.c: Likewise.
15764	* linux/crisv10/get_syscall_args.c: Likewise.
15765	* linux/hppa/get_syscall_args.c: Likewise.
15766	* linux/i386/get_syscall_args.c: Likewise.
15767	* linux/ia64/get_syscall_args.c: Likewise.
15768	* linux/m68k/get_syscall_args.c: Likewise.
15769	* linux/metag/get_syscall_args.c: Likewise.
15770	* linux/microblaze/get_syscall_args.c: Likewise.
15771	* linux/mips/get_syscall_args.c: Likewise.
15772	* linux/nios2/get_syscall_args.c: Likewise.
15773	* linux/or1k/get_syscall_args.c: Likewise.
15774	* linux/powerpc/get_syscall_args.c: Likewise.
15775	* linux/s390/get_syscall_args.c: Likewise.
15776	* linux/sh/get_syscall_args.c: Likewise.
15777	* linux/sh64/get_syscall_args.c: Likewise.
15778	* linux/sparc/get_syscall_args.c: Likewise.
15779	* linux/tile/get_syscall_args.c: Likewise.
15780	* linux/x86_64/get_syscall_args.c: Likewise.
15781	* linux/xtensa/get_syscall_args.c: Likewise.
15782	* syscall.c (get_syscall_args): Remove.
15783	Include "get_syscall_args.c" in file scope.
15784
15785	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
15786
157872015-11-30  Dmitry V. Levin  <ldv@altlinux.org>
15788
15789	cleanup: make get_syscall_result.c files more readable.
15790	Make get_syscall_result.c files more self-contained.  While they are
15791	still being included by syscall.c, the latter no longer provides
15792	a function framework for them.
15793
15794	* linux/alpha/get_syscall_result.c (get_syscall_result_regs): Define.
15795	* linux/bfin/get_syscall_result.c: Likewise.
15796	* linux/crisv10/get_syscall_result.c: Likewise.
15797	* linux/hppa/get_syscall_result.c: Likewise.
15798	* linux/m68k/get_syscall_result.c: Likewise.
15799	* linux/microblaze/get_syscall_result.c: Likewise.
15800	* linux/sh/get_syscall_result.c: Likewise.
15801	* linux/sh64/get_syscall_result.c: Likewise.
15802	* linux/xtensa/get_syscall_result.c: Likewise.
15803	* syscall.c [!ARCH_REGS_FOR_GETREGSET && !ARCH_REGS_FOR_GETREGS]:
15804	Define USE_GET_SYSCALL_RESULT_REGS macro.
15805	[USE_GET_SYSCALL_RESULT_REGS]: Include "get_syscall_result.c".
15806	(get_syscall_result) [USE_GET_SYSCALL_RESULT_REGS]: Stop including
15807	"get_syscall_result.c".  Call get_syscall_result_regs.
15808
15809	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
15810
158112015-11-29  Dmitry V. Levin  <ldv@altlinux.org>
15812
15813	cleanup: make get_error.c files more readable.
15814	Make get_error.c files more self-sustained.  While they are still being
15815	included by syscall.c, the latter no longer defines get_error function.
15816
15817	* linux/aarch64/get_error.c: Include "arm/get_error.c" with get_error
15818	temporarily defined to arm_get_error.
15819	(get_error): Define.
15820	* linux/alpha/get_error.c (get_error): Define.
15821	* linux/arc/get_error.c: Likewise.
15822	* linux/arm/get_error.c: Likewise.
15823	* linux/avr32/get_error.c: Likewise.
15824	* linux/bfin/get_error.c: Likewise.
15825	* linux/crisv10/get_error.c: Likewise.
15826	* linux/hppa/get_error.c: Likewise.
15827	* linux/i386/get_error.c: Likewise.
15828	* linux/ia64/get_error.c: Likewise.
15829	* linux/m68k/get_error.c: Likewise.
15830	* linux/metag/get_error.c: Likewise.
15831	* linux/microblaze/get_error.c: Likewise.
15832	* linux/mips/get_error.c: Likewise.
15833	* linux/nios2/get_error.c: Likewise.
15834	* linux/or1k/get_error.c: Likewise.
15835	* linux/powerpc/get_error.c: Likewise.
15836	* linux/s390/get_error.c: Likewise.
15837	* linux/sh/get_error.c: Likewise.
15838	* linux/sh64/get_error.c: Likewise.
15839	* linux/sparc/get_error.c: Likewise.
15840	* linux/sparc64/get_error.c: Likewise.
15841	* linux/tile/get_error.c: Likewise.
15842	* linux/x86_64/get_error.c: Likewise.
15843	* linux/xtensa/get_error.c: Likewise.
15844	* syscall.c: Include "get_error.c" in file scope.
15845	(get_error): Remove.  Move arch independent code ...
15846	(get_syscall_result): ... here.  Update get_error invocation.
15847
15848	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
15849
158502015-11-28  Dmitry V. Levin  <ldv@altlinux.org>
15851
15852	cleanup: make arch_sigreturn.c files more readable.
15853	Make arch_sigreturn.c files more self-sustained.  While they are
15854	still being included by sigreturn.c, the latter no longer defines
15855	arch_sigreturn function.
15856
15857	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Define.
15858	* linux/arm/arch_sigreturn.c: Likewise.
15859	* linux/crisv10/arch_sigreturn.c: Likewise.
15860	* linux/i386/arch_sigreturn.c: Likewise.
15861	* linux/ia64/arch_sigreturn.c: Likewise.
15862	* linux/m68k/arch_sigreturn.c: Likewise.
15863	* linux/microblaze/arch_sigreturn.c: Likewise.
15864	* linux/mips/arch_sigreturn.c: Likewise.
15865	* linux/powerpc/arch_sigreturn.c: Likewise.
15866	* linux/s390/arch_sigreturn.c: Likewise.
15867	* linux/sparc/arch_sigreturn.c: Likewise.
15868	* linux/tile/arch_sigreturn.c: Likewise.
15869	* linux/x32/arch_sigreturn.c: Remove code.
15870	Include "x86_64/arch_sigreturn.c".
15871	* linux/x86_64/arch_sigreturn.c: Stop including "x32/arch_sigreturn.c".
15872	Include "i386/arch_sigreturn.c" with arch_sigreturn temporarily defined
15873	to i386_arch_sigreturn.
15874	(arch_sigreturn): Define.  Add x32 personality support there.
15875	* sigreturn.c: Remove arch_sigreturn header and footer.
15876
15877	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>
15878
158792015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
15880
15881	Add initial Travis CI support.
15882	* .travis.yml: New file.
15883	* travis-ci.sh: Likewise.
15884
158852015-11-27  Dmitry V. Levin  <ldv@altlinux.org>
15886
15887	tests: remove temporary files left after two tests.
15888	* tests/net-yy.test: Remove "$LOG"-connect and "$LOG"-accept.
15889	* tests/unix-yy.test: Likewise.
15890
158912015-11-27  Dmitry V. Levin  <ldv@altlinux.org>
15892
15893	tests: skip stat32-v.test on x32.
15894	Explicitly skip 32-bit stat test on x32 even if libc pretends
15895	to support it.
15896
15897	* tests/stat.c (main) [__x86_64__ && __ILP32__]: Skip.
15898
158992015-11-27  Dmitry V. Levin  <ldv@altlinux.org>
15900
15901	tests: fix ipc_msgbuf.test on x32.
15902	* tests/ipc_msgbuf.c: Include "config.h" and "kernel_types.h".
15903	(main): Replace "long" with "kernel_long_t" in struct msgbuf.
15904
15905	x32: fix pselect6 decoding.
15906	* desc.c: Include "kernel_types.h".
15907	(umove_kulong_array_or_printaddr): New function.
15908	(SYS_FUNC(pselect6)): Use it.
15909
15910	x32: fix sigreturn decoding.
15911	* linux/x32/arch_sigreturn.c: Implement x32_rt_sigreturn decoding.
15912	* linux/x86_64/arch_sigreturn.c: Handle (current_personality == 0)
15913	case only.
15914	Include "x32/arch_sigreturn.c" instead of "i386/arch_sigreturn.c".
15915
15916	x32: fix struct dirent decoding.
15917	* kernel_types.h: New file.
15918	* Makefile.am (strace_SOURCES): Add it.
15919	* configure.ac (AC_CHECK_TYPES): Check for __kernel_long_t
15920	and __kernel_ulong_t in <asm/posix_types.h>.
15921	* dirent.c: Stop including <dirent.h>.
15922	(kernel_dirent): Remove.
15923	Include "kernel_types.h".
15924	(print_old_dirent, SYS_FUNC(getdents)): Print variables
15925	of kernel_ulong_t type using %Lu format.
15926	* syscall.c (kernel_long_t, kernel_ulong_t): Remove.
15927	Include "kernel_types.h".
15928	* tests/getdents.c (kernel_dirent): Remove.
15929	Include "kernel_types.h".
15930	(print_dirent): Print variables of kernel_ulong_t type using %Lu format.
15931
159322015-11-26  Elvira Khabirova  <lineprinter0@gmail.com>
15933
15934	Refer to -h on incorrect usage.
15935	* defs.h (error_msg_and_help): New prototype.
15936	* strace.c (error_msg_and_help): New function.
15937	(error_opt_arg, init): Use it.
15938	(usage): Remove unnecessary arguments.
15939	* count.c: Use the new function.
15940
15941	Rearrange flags descriptions in the usage text.
15942	* strace.c (usage): Rearrange descriptions.
15943	* tests/strace-k.test: Change the option detecting regexp accordingly.
15944
159452015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
15946
15947	tests: run in "set -x" mode if VERBOSE variable is non-null.
15948	* tests/init.sh: Enter "set -x" mode if $VERBOSE is non-null.
15949
159502015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
15951
15952	tests: fix match_diff usage.
15953	Fix argument order in match_diff invocations:
15954	the first argument has to be actual output,
15955	the second argument has to be expected output.
15956
15957	* tests/aio.test: Swap match_diff arguments.
15958	* tests/clock_nanosleep.test: Likewise.
15959	* tests/clock_xettime.test: Likewise.
15960	* tests/file_handle.test: Likewise.
15961	* tests/getdents.test: Likewise.
15962	* tests/getdents64.test: Likewise.
15963	* tests/getrandom.test: Likewise.
15964	* tests/inet-cmsg.test: Likewise.
15965	* tests/ioctl.test: Likewise.
15966	* tests/membarrier.test: Likewise.
15967	* tests/mlock2.test: Likewise.
15968	* tests/nanosleep.test: Likewise.
15969	* tests/pselect6.test: Likewise.
15970	* tests/readdir.test: Likewise.
15971	* tests/readlink.test: Likewise.
15972	* tests/readlinkat.test: Likewise.
15973	* tests/rt_sigqueueinfo.test: Likewise.
15974	* tests/seccomp.test: Likewise.
15975	* tests/select.test: Likewise.
15976	* tests/sendfile.test: Likewise.
15977	* tests/sendfile64.test: Likewise.
15978	* tests/struct_flock.test: Likewise.
15979	* tests/sysinfo.test: Likewise.
15980	* tests/time.test: Likewise.
15981	* tests/timer_create.test: Likewise.
15982	* tests/timer_xettime.test: Likewise.
15983	* tests/timerfd_xettime.test: Likewise.
15984	* tests/times-fail.test: Likewise.
15985	* tests/times.test: Likewise.
15986	* tests/umovestr2.test: Likewise.
15987	* tests/userfaultfd.test: Likewise.
15988	* tests/utime.test: Likewise.
15989	* tests/utimensat.test: Likewise.
15990	* tests/xet_robust_list.test: Likewise.
15991	* tests/xetitimer.test: Likewise.
15992	* tests/xettimeofday.test: Likewise.
15993
159942015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
15995
15996	x86_64: fix x32 personality support in print_llu_from_low_high_val.
15997	x86 is the only personality supported on x86_64
15998	that has 32-bit syscall arguments.
15999
16000	* io.c (print_llu_from_low_high_val) [X86_64]: Fix
16001	current_personality == 2 case.
16002
160032015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
16004
16005	x86_64: fix x32 personality support in getllval.
16006	x86 is the only personality supported on x86_64
16007	that has 32-bit syscall arguments.
16008
16009	* util.c (getllval) [X86_64]: Fix current_personality == 2 case.
16010
160112015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
16012
16013	tests/file_handle: fix expected output.
16014	* tests/file_handle.c (main): Parametrize handle_type
16015	in open_by_handle_at parser output.
16016
16017	startup_attach: fix compilation warning.
16018	* strace.c (startup_attach): Split single error_msg statement with
16019	variable number of arguments to silence a compilation warning.
16020
160212015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
16022
16023	.gitignore: add mpers_xlat.h.
16024	Ignore mpers_xlat.h generated since commit v4.10-454-g5cb45b2.
16025
16026	* .gitignore: Add /mpers_xlat.h.
16027
16028	Reported-by: Elvira Khabirova <lineprinter0@gmail.com>
16029
160302015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
16031
16032	tests: add struct_flock.test.
16033	* tests/struct_flock.c: New file.
16034	* tests/struct_flock.test: New test.
16035	* tests/Makefile.am (check_PROGRAMS): Add struct_flock.
16036	(TESTS): Add struct_flock.test.
16037	* tests/.gitignore: Add struct_flock.
16038
16039	Convert parsers of flock structures to new mpers infrastructure.
16040	* fetch_struct_flock.c: New file.
16041	* Makefile.am (strace_SOURCES): Add it.
16042	* fcntl.c (print_struct_flock64): New function.
16043	(printflock64): Use fetch_struct_flock64 and print_struct_flock64.
16044	(printflock): Use fetch_struct_flock and print_struct_flock64.
16045
16046	fcntl.c: implement decoding for all known operations.
16047	* xlat/f_owner_types.in: New file.
16048	* xlat/f_seals.in: Likewise.
16049	* fcntl.c: Include "xlat/f_owner_types.h" and "xlat/f_seals.h".
16050	(print_f_owner_ex): New function.
16051	(SYS_FUNC(fcntl)): Use it.
16052	Handle F_SETPIPE_SZ, F_GETPIPE_SZ, F_OFD_SETLKW,
16053	F_OFD_SETLK, F_SETOWN_EX, F_ADD_SEALS, F_SETSIG,
16054	F_OFD_GETLK, F_GETOWN_EX, F_GET_SEALS, F_GETSIG.
16055
16056	fcntl.c: mark F_DUPFD and F_DUPFD_CLOEXEC return code with RVAL_FD flag.
16057	* fcntl.c (SYS_FUNC(fcntl)): Set RVAL_FD flag in the return code
16058	for F_DUPFD and F_DUPFD_CLOEXEC operations.
16059
16060	fcntl.c: remove redundant ifdefs.
16061	* fcntl.c (USE_PRINTFLOCK64): Remove macro.
16062	(printflock64): Define unconditionally.
16063	(SYS_FUNC(fcntl)): Do not check for USE_PRINTFLOCK64,
16064	F_DUPFD_CLOEXEC, F_NOTIFY, F_SETLEASE, and F_GETLEASE macros.
16065
16066	Update F_* constants.
16067	* xlat/fcntlcmds.in: Add F_SETOWN_EX, F_GETOWN_EX, F_GETOWNER_UIDS,
16068	F_OFD_GETLK, F_OFD_SETLK, F_OFD_SETLKW, and F_CANCELLK.
16069	Remove F_ALLOCSP, F_BLKSIZE, F_BLOCKS, F_CHKFL, F_CNVT, F_DUP2FD,
16070	F_ISSTREAM, F_NPRIV, F_PRIV, F_QUOTACL, F_REVOKE, F_RGETLK, F_RSETLK,
16071	F_RSETLKW, F_SHARE, and F_UNSHARE.
16072	Add default values.
16073
16074	Update LOCK_* constants.
16075	* xlat/flockcmds.in: Add LOCK_MAND, LOCK_READ, LOCK_WRITE, and LOCK_RW.
16076	Add default values.
16077
160782015-11-26  Dmitry V. Levin  <ldv@altlinux.org>
16079
16080	fcntl.c: use <linux/fcntl.h> instead of <fcntl.h>
16081	Include <linux/fcntl.h> for proper definitions of F_* constants
16082	and flock structures.
16083
16084	* configure.ac (AC_CHECK_TYPES): Check for struct flock, struct flock64,
16085	struct __kernel_flock, and struct __kernel_flock64 in <linux/fcntl.h>.
16086	* flock.h: New file.
16087	* Makefile.am (strace_SOURCES): Add it.
16088	* fcntl.c: Include it instead of <fcntl.h>.
16089	(struct flock64): Remove.
16090	(printflock): Use struct_kernel_flock instead of struct flock.
16091	(printflock64): Use struct_kernel_flock64 instead of struct flock64.
16092
160932015-11-26  Elvira Khabirova  <lineprinter0@gmail.com>
16094
16095	mpers: fix compound types with arbitrary member alignments.
16096	* mpers.sh: Compound types are now represented as packed
16097	with character arrays as explicit fillers inbetween members
16098	and at the end.
16099
161002015-11-26  Mike Frysinger  <vapier@gentoo.org>
16101
16102	Support C libraries without System V shared memory/ipc.
16103	Some systems (like Bionic) omit support for SysV related code.  That
16104	means no C library headers for strace to include.  Add configure tests
16105	to probe the headers from the kernel and use them when they are
16106	available.
16107
16108	It might make more sense to never rely on the C library's headers as
16109	there is no guarantee or requirement that the structure layout between
16110	apps and the C library match that what is passed to the kernel.
16111
16112	* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
16113	linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
16114	sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
16115	* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
16116	on what is available.
16117	* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
16118	Fallback to <linux/msg.h> when available.
16119	* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
16120	based on what is available.  Note missing support for old ipc structs.
16121	* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
16122	on what is available.  Only decode sembuf when available.
16123	* ipc_shm.c: Fallback to <linux/shm.h> when available.
16124	* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
16125	based on what is available.  Note missing support for old ipc structs.
16126	* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.
16127
161282015-11-25  Dmitry V. Levin  <ldv@altlinux.org>
16129
16130	CREDITS.in: add Jian Zhen.
16131	Thanks to Jian Zhen for donation of https://github.com/strace/ and
16132	strace.io.
16133
16134	* CREDITS.in: Add Jian Zhen.
16135
161362015-11-24  Dmitry V. Levin  <ldv@altlinux.org>
16137
16138	Fix syscall entries of unimplemented getpmsg and putpmsg syscalls.
16139	* linux/ia64/syscallent.h (getpmsg): Change SEN(printargs)
16140	to SEN(getpmsg).
16141	(putpmsg): Change SEN(printargs) to SEN(putpmsg).
16142	* linux/mips/syscallent-n32.h: Likewise.
16143	* linux/mips/syscallent-n64.h: Likewise.
16144	* linux/mips/syscallent-o32.h: Likewise.
16145	* linux/arm/syscallent.h (getpmsg, putpmsg): Set sys_flags to TN.
16146	* linux/bfin/syscallent.h (getpmsg, putpmsg): Likewise.
16147	* linux/hppa/syscallent.h (getpmsg, putpmsg): Likewise.
16148	* linux/i386/syscallent.h (getpmsg, putpmsg): Likewise.
16149	* linux/m68k/syscallent.h (getpmsg, putpmsg): Likewise.
16150	* linux/microblaze/syscallent.h (getpmsg, putpmsg): Likewise.
16151	* linux/powerpc/syscallent.h (getpmsg, putpmsg): Likewise.
16152	* linux/s390/syscallent.h (getpmsg, putpmsg): Likewise.
16153	* linux/s390x/syscallent.h (getpmsg, putpmsg): Likewise.
16154	* linux/x32/syscallent.h (getpmsg, putpmsg): Likewise.
16155	* linux/x86_64/syscallent.h (getpmsg, putpmsg): Likewise.
16156
161572015-11-24  Dmitry V. Levin  <ldv@altlinux.org>
16158
16159	Remove parsers of getpmsg and putpmsg syscalls.
16160	These system calls are not implemented in the Linux kernel.
16161
16162	* linux/dummy.h(getpmsg, putpmsg): Move to the list of deprecated
16163	syscalls.
16164	* Makefile.am (strace_SOURCES): Remove stream.c.
16165	* stream.c: Remove.
16166	* xlat/pmsgflags.in: Remove.
16167
161682015-11-24  Dmitry V. Levin  <ldv@altlinux.org>
16169
16170	Remove parser of query_module syscall.
16171	Since query_module syscall is present only in kernels before Linux 2.6
16172	and strace does not support those kernels, there is no use to keep this
16173	parser any longer.
16174
16175	* bjm.c: Do not include <sys/*>, "xlat/qm_which.h",
16176	and "xlat/modflags.h".
16177	(MOD_*, QM_*, module_symbol, module_info, SYS_FUNC(query_module)):
16178	Remove.
16179	* linux/dummy.h (sys_query_module): Add stub alias.
16180	* xlat/modflags.in: Remove.
16181	* xlat/qm_which.in: Remove.
16182
161832015-11-24  Dmitry V. Levin  <ldv@altlinux.org>
16184
16185	Fix syscall entries of deprecated sysfs syscall.
16186	* linux/alpha/syscallent.h (sysfs): Change nargs from 5 to 3.
16187	* linux/hppa/syscallent.h (sysfs): Likewise.
16188	* linux/mips/syscallent-n32.h (sysfs): Likewise.
16189	* linux/mips/syscallent-n64.h (sysfs): Likewise.
16190
16191	Move sysfs syscall to deprecated category.
16192	* linux/dummy.h (sys_sysfs): Move to the list of deprecated syscalls.
16193
16194	Fix syscall entries of deprecated bdflush syscall.
16195	* linux/alpha/syscallent.h (bdflush): Change nargs from 0 to 2.
16196	* linux/arm/syscallent.h (bdflush): Likewise.
16197	* linux/avr32/syscallent.h (bdflush): Likewise.
16198	* linux/bfin/syscallent.h (bdflush): Likewise.
16199	* linux/hppa/syscallent.h (bdflush): Likewise.
16200	* linux/i386/syscallent.h (bdflush): Likewise.
16201	* linux/ia64/syscallent.h (bdflush): Likewise.
16202	* linux/m68k/syscallent.h (bdflush): Likewise.
16203	* linux/microblaze/syscallent.h (bdflush): Likewise.
16204	* linux/powerpc/syscallent.h (bdflush): Likewise.
16205	* linux/s390/syscallent.h (bdflush): Likewise.
16206	* linux/s390x/syscallent.h (bdflush): Likewise.
16207	* linux/sh/syscallent.h (bdflush): Likewise.
16208	* linux/sh64/syscallent.h (bdflush): Likewise.
16209	* linux/sparc/syscallent.h (bdflush): Likewise.
16210
162112015-11-22  Dmitry V. Levin  <ldv@altlinux.org>
16212
16213	Implement name_to_handle_at and open_by_handle_at syscalls decoding.
16214	* file_handle.c: New file.
16215	* Makefile.am (strace_SOURCES): Add it.
16216	* linux/dummy.h (sys_name_to_handle_at, sys_open_by_handle_at):
16217	Remove stub aliases.
16218	* pathtrace.c (pathtrace_match): Add SEN_name_to_handle_at.
16219	* tests/file_handle.c: New file.
16220	* tests/file_handle.test: New test.
16221	* tests/Makefile.am (check_PROGRAMS): Add file_handle.
16222	(TESTS): Add file_handle.test.
16223	* tests/.gitignore: Add file_handle.
16224
16225	Implement lookup_dcookie syscall decoding.
16226	* lookup_dcookie.c: New file.
16227	* Makefile.am (strace_SOURCES): Add it.
16228	* linux/dummy.h (sys_lookup_dcookie): Remove stub alias.
16229
16230	Implement kexec_file_load syscall decoding.
16231	* xlat/kexec_file_load_flags.in: New file.
16232	* kexec.c: Include "xlat/kexec_file_load_flags.h".
16233	(SYS_FUNC(kexec_file_load)): New function.
16234	* linux/dummy.h (sys_kexec_file_load): Remove stub alias.
16235	* pathtrace.c (pathtrace_match): Add SEN_kexec_file_load.
16236
16237	Implement kcmp syscall decoding.
16238	* kcmp.c: New file.
16239	* Makefile.am (strace_SOURCES): Add it.
16240	* linux/dummy.h (sys_kcmp): Remove stub alias.
16241	* xlat/kcmp_types.in: New file.
16242
16243	Implement iopl syscall decoding.
16244	* iopl.c: New file.
16245	* Makefile.am (strace_SOURCES): Add it.
16246	* linux/dummy.h (sys_iopl): Remove stub alias.
16247
16248	Implement ioperm syscall decoding.
16249	* ioperm.c: New file.
16250	* Makefile.am (strace_SOURCES): Add it.
16251	* linux/dummy.h (sys_ioperm): Remove stub alias.
16252
16253	net: fix printing of IP_RECVOPTS/IP_RETOPTS cmsg options.
16254	* net.c (print_cmsg_ip_opts): Print each byte as unsigned char.
16255
16256	userfaultfd: fix pathtrace support.
16257	* pathtrace.c (pathtrace_match): Add SEN_userfaultfd.
16258
162592015-11-22  Dmitry V. Levin  <ldv@altlinux.org>
16260
16261	Implement IPPROTO_IP control messages decoding.
16262	* net.c: Include "xlat/ip_cmsg_types.h".
16263	(print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
16264	print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_checksum,
16265	print_cmsg_ip_origdstaddr): New functions.
16266	(print_cmsg_type_data): Add generic SOL_IP level decoding.
16267	Use these functions for decoding of IP_PKTINFO, IP_TTL, IP_TOS,
16268	IP_RECVOPTS, IP_RETOPTS, IP_RECVERR, IP_ORIGDSTADDR, IP_CHECKSUM,
16269	and SCM_SECURITY type messages.
16270	* xlat/ip_cmsg_types.in: New file.
16271	* xlat/sockipoptions.in: Move IP_RETOPTS before IP_RECVRETOPTS.
16272	* tests/inet-cmsg.c: New file.
16273	* tests/inet-cmsg.test: New test.
16274	* tests/Makefile.am (check_PROGRAMS): Add inet-cmsg.
16275	(TESTS): Add inet-cmsg.test.
16276	* tests/.gitignore: Add inet-cmsg.
16277
16278	Suggested-by: Orion Poplawski <orion@cora.nwra.com>
16279
162802015-11-22  Dmitry V. Levin  <ldv@altlinux.org>
16281
16282	Simplify control messages printers.
16283	Do not pass sizeof(struct cmsghdr) to every cmsg printer.
16284
16285	* net.c (printcmsghdr): Pass pointer to cmsg_data and length
16286	of cmsg_data to print_cmsg_type_data.
16287	(print_cmsg_type_data): Update prototype.  Pass pointer to cmsg_data
16288	and length of cmsg_data to cmsg printers.
16289	(print_scm_rights, print_scm_creds, print_scm_security): Update.
16290
162912015-11-21  Dmitry V. Levin  <ldv@altlinux.org>
16292
16293	net: factor out address printing code to a separate function.
16294	* net.c (sockaddr_buf_t): New type.
16295	(print_sockaddr): New function.
16296	(printsock, print_group_req): Use it.
16297
162982015-11-20  Dmitry V. Levin  <ldv@altlinux.org>
16299
16300	mpers: skip xlat struct definitions in mpers mode.
16301	Avoid duplicate definitions of xlat structures in files
16302	compiled in mpers mode.
16303
16304	Each xlat file defines the corresponding xlat struct with
16305	either global or local visibility using the following rules:
16306
16307	- if xlat struct declaration is available in defs.h,
16308	  a global definition is provided in regular mode,
16309	  and nothing is provided in mpers mode;
16310	- otherwise, if xlat file is included by a mpers source file,
16311	  a global definition is provided in regular mode
16312	  (unless no mpers mode is supported on this architecture,
16313	  in that case, a local definition is provided instead),
16314	  and a declaration is provided in mpers mode;
16315	- otherwise, a local definition is provided in regular mode,
16316	  and an error message is printed in mpers mode.
16317
16318	Fallback definitions of constants provided by xlat files
16319	remain available in all modes.
16320
16321	* bootstrap: Invoke generate_mpers_am.sh before xlat/gen.sh.
16322	* defs.h (adjtimex_modes, adjtimex_status, sigev_value): Remove.
16323	* generate_mpers_am.sh: Generate mpers_xlat.h.
16324	* Makefile.am (EXTRA_DIST): Add mpers_xlat.h.
16325	* print_sigevent.c: Include "xlat/sigev_value.h" unconditionally.
16326	* print_timex.c: Include "xlat/adjtimex_modes.h" and
16327	"xlat/adjtimex_status.h" unconditionally.
16328	* xlat/gen.sh (cond_xlat): Move printing of fallback definitions ...
16329	(cond_def): ... here.
16330	(gen_header): Check also mpers_xlat.h for global declarations
16331	of xlat structures.
16332	Process input file twice, first time print directives
16333	only, second time print everything.
16334	Wrap struct xlat into #ifdef IN_MPERS ... #else ... #endif.
16335	* xlat/getrandom_flags.in: Cleanup.
16336
163372015-11-20  Dmitry V. Levin  <ldv@altlinux.org>
16338
16339	tests: rewrite getdents test in C for better coverage.
16340	* tests/getdents.awk: Remove.
16341	* tests/getdents.out: Remove.
16342	* tests/getdents.c: New file.
16343	* tests/getdents.test: Rewrite.
16344	* tests/getdents64.c: New file.
16345	* tests/getdents64.test: New test.
16346	* tests/Makefile.am (check_PROGRAMS): Add getdents and getdents64.
16347	(TESTS): Add getdents64.test.
16348	(EXTRA_DIST): Remove getdents.awk and getdents.out.
16349	* tests/.gitignore: Add getdents and getdents64.
16350
163512015-11-19  Dmitry V. Levin  <ldv@altlinux.org>
16352
16353	tests: add readdir.test.
16354	* tests/readdir.c: New file.
16355	* tests/readdir.test: New test.
16356	* tests/Makefile.am (check_PROGRAMS): Add readdir.
16357	(TESTS): Add readdir.test.
16358	* tests/.gitignore: Add readdir.
16359
16360	Mpersify parsers of readdir and getdents syscalls.
16361	* defs.h (dirent_types): New xlat prototype.
16362	* dirent.c: Stop including "xlat/direnttypes.h".
16363	(kernel_dirent): New typedef.  Mpersify it.
16364	(print_old_dirent): Use it instead of old_dirent_t.
16365	(SYS_FUNC(getdents)): Use it instead of struct kernel_dirent.
16366	Rename direnttypes to dirent_types.
16367	(SYS_FUNC(getdents64)): Move ...
16368	* dirent64.c: ... here.  Rename direnttypes to dirent_types.
16369	Include "xlat/dirent_types.h".
16370	* Makefile.am (strace_SOURCES): Add dirent64.c.
16371	* xlat/direnttypes.in: Rename to xlat/dirent_types.in.
16372
163732015-11-19  Gabriel Laskar  <gabriel@lse.epita.fr>
16374
16375	getdents: fix typos in array output.
16376	Array should be enclosed by square brakets, and elements should be
16377	separated by commas.
16378
16379	* dirent.c (SYS_FUNC(getdents), SYS_FUNC(getdents64)): Fix typos
16380	in array output.
16381	* tests/getdents.awk: Update regexps to match fixed output.
16382	* tests/getdents.out: Update output.
16383
163842015-11-19  Dmitry V. Levin  <ldv@altlinux.org>
16385
16386	printcmsghdr: move type and data decoders to a separate function.
16387	* net.c (print_scm_rights, print_scm_creds, print_scm_security): Change
16388	to return void.  Move printing of struct cmsghdr closing '}' ...
16389	(printcmsghdr): ... here.  Move type and data decoders to ...
16390	(print_cmsg_type_data): ... new function.
16391
163922015-11-18  Dmitry V. Levin  <ldv@altlinux.org>
16393
16394	Assume that libc provides sendmsg.
16395	Starting with commit v4.6-281-g7af9f35, we implicitly assume that
16396	HAVE_SENDMSG is always defined.  Therefore, the check for sendmsg
16397	availability is redundant and could be safely removed.
16398
16399	* configure.ac (AC_CHECK_FUNCS): Remove sendmsg.
16400	* linux/dummy.h [!HAVE_SENDMSG] (sys_recvmsg, sys_sendmsg): Remove
16401	stub aliases.
16402	* net.c [HAVE_SENDMSG]: Define unconditionally.
16403	* syscall.c (dumpio) [HAVE_SENDMSG]: Likewise.
16404
164052015-11-18  Dmitry V. Levin  <ldv@altlinux.org>
16406
16407	net.c: move fallback definition of SCM_SECURITY to xlat/
16408	* net.c: Move fallback definition of SCM_SECURITY ...
16409	* xlat/scmvals.in: ... here.
16410
164112015-11-17  Dmitry V. Levin  <ldv@altlinux.org>
16412
16413	Implement mlock2 syscall decoding.
16414	* mem.c: Include "xlat/mlock_flags.h".
16415	(SYS_FUNC(mlock2)): New function.
16416	* xlat/mlock_flags.in: New file.
16417	* xlat/mlockall_flags.in: Add MCL_ONFAULT, add default values.
16418	* linux/dummy.h (mlock2): Remove.
16419	* tests/mlock2.c: New file.
16420	* tests/mlock2.test: New test.
16421	* tests/Makefile.am (check_PROGRAMS): Add mlock2.
16422	(TESTS): Add mlock2.test.
16423	* tests/.gitignore Add mlock2.
16424
16425	Implement membarrier syscall decoding.
16426	* membarrier.c: New file.
16427	* Makefile.am (strace_SOURCES): Add it.
16428	* xlat/membarrier_cmds.in: New file.
16429	* linux/dummy.h (membarrier): Remove.
16430	* tests/membarrier.c: New file.
16431	* tests/membarrier.test: New test.
16432	* tests/Makefile.am (check_PROGRAMS): Add membarrier.
16433	(TESTS): Add membarrier.test.
16434	* tests/.gitignore: Add membarrier.
16435
16436	Implement userfaultfd syscall decoding.
16437	* userfaultfd.c: New file.
16438	* Makefile.am (strace_SOURCES): Add it.
16439	* xlat/uffd_flags.in: New file.
16440	* linux/dummy.h (userfaultfd): Remove.
16441	* tests/userfaultfd.c: New file.
16442	* tests/userfaultfd.test: New test.
16443	* tests/Makefile.am (check_PROGRAMS): Add userfaultfd.
16444	(TESTS): Add userfaultfd.test.
16445	* tests/.gitignore: Add userfaultfd.
16446
164472015-11-17  Dmitry V. Levin  <ldv@altlinux.org>
16448
16449	ia64: wire up kcmp syscall.
16450	ia64 has kcmp syscall starting with linux kernel commit
16451	v4.3-rc7-1-gd305c47.
16452
16453	* linux/ia64/syscallent.h (kcmp): New entry.
16454
164552015-11-17  Dmitry V. Levin  <ldv@altlinux.org>
16456
16457	powerpc: wire up direct sysv ipc syscalls.
16458	Starting with linux commit v4.3-rc3-33-ga342361, powerpc has
16459	direct sysv ipc syscalls in addition to traditional ipc syscall.
16460
16461	* linux/powerpc/syscallent.h (semop, semget, semctl, semtimedop, msgsnd,
16462	msgrcv, msgget, msgctl, shmat, shmdt, shmget, shmctl): New entries.
16463
164642015-11-17  Dmitry V. Levin  <ldv@altlinux.org>
16465
16466	Wire up userfaultfd, membarrier, and mlock2 syscalls.
16467	* linux/dummy.h (membarrier, mlock2, userfaultfd): New stub aliases.
16468	* linux/32/syscallent.h (userfaultfd, membarrier, mlock2): New entries.
16469	* linux/64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16470	* linux/arm/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16471	* linux/hppa/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16472	* linux/i386/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16473	* linux/ia64/syscallent.h (userfaultfd, membarrier): Likewise.
16474	* linux/m68k/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16475	* linux/microblaze/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16476	* linux/mips/syscallent-n32.h (userfaultfd, membarrier, mlock2): Likewise.
16477	* linux/mips/syscallent-n64.h (userfaultfd, membarrier, mlock2): Likewise.
16478	* linux/mips/syscallent-o32.h (userfaultfd, membarrier, mlock2): Likewise.
16479	* linux/powerpc/syscallent.h (userfaultfd, membarrier): Likewise.
16480	* linux/s390/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16481	* linux/s390x/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16482	* linux/sparc/syscallent.h (membarrier, userfaultfd, mlock2): Likewise.
16483	* linux/x32/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16484	* linux/x86_64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
16485
164862015-11-16  Dmitry V. Levin  <ldv@altlinux.org>
16487
16488	sprintflags: skip zero flags.
16489	Tweak sprintflags behaviour to match printflags.
16490
16491	* util.c (sprintflags): Skip zero flags unless the value passed
16492	to sprintflags is also zero.
16493
164942015-11-16  Mike Frysinger  <vapier@gentoo.org>
16495
16496	printflags: handle empty xlats.
16497	If the set of headers are unable to produce a valid list, printflags
16498	will try to pass NULL to tprints which crashes.  Add a sanity check
16499	for this edge case.
16500
16501	* util.c (printflags): Check xlat->str is not NULL.
16502
165032015-11-16  Dmitry V. Levin  <ldv@altlinux.org>
16504
16505	mpers: forward mpers_DEFS to mpers.sh.
16506	mpers_DEFS has to be forwarded to mpers.sh so that config.h would be
16507	properly included by defs.h at preprocessor stage.
16508
16509	* Makefile.am (mpers-m%.stamp): Add the whole $(mpers_sh_opts) set of
16510	options to mpers.sh's CPPFLAGS.
16511
165122015-11-16  Dmitry V. Levin  <ldv@altlinux.org>
16513
16514	tests/ioctl: workaround glibc ioctl wrapper on powerpc.
16515	* tests/ioctl.c (main) [POWERPC] Disable TCGETS test.
16516
165172015-11-15  Dmitry V. Levin  <ldv@altlinux.org>
16518
16519	powerpc: wire up switch_endian syscall.
16520	powerpc has switch_endian syscall starting with linux commit
16521	v4.0-rc4-67-g529d235.
16522
16523	* linux/powerpc/syscallent.h (switch_endian): New entry.
16524
165252015-11-15  Dmitry V. Levin  <ldv@altlinux.org>
16526
16527	sparc: reserve more space for new syscalls.
16528	Move socket subcalls further down the table to make room
16529	for new syscalls.
16530
16531	* linux/sparc/syscallent.h (SYS_socket_subcall): Raise from 353 to 400.
16532
165332015-11-15  Dmitry V. Levin  <ldv@altlinux.org>
16534
16535	m68k: wire up direct socket syscalls.
16536	Starting with linux commit v4.3-rc3-1-g5b3f33e, m68k has direct
16537	socket syscalls in addition to traditional socketcall syscall.
16538
16539	* linux/m68k/syscallent.h (socket, socketpair, bind, connect, listen,
16540	accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
16541	sendmsg, recvfrom, recvmsg, shutdown, recvmmsg, sendmmsg): New entries.
16542
165432015-11-15  Dmitry V. Levin  <ldv@altlinux.org>
16544
16545	i386: wire up direct socket syscalls.
16546	Starting with linux commit v4.2-rc1-64-g9dea5dc, x86 has direct
16547	socket syscalls in addition to traditional socketcall syscall.
16548
16549	* linux/i386/syscallent.h (socket, socketpair, bind, connect, listen,
16550	accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
16551	sendmsg, recvfrom, recvmsg, shutdown): New entries.
16552
165532015-11-11  Heiko Carstens  <heiko.carstens@de.ibm.com>
16554
16555	s390, s390x: update syscall tables.
16556	* linux/s390/syscallent.h: Add new syscalls available with kernel 4.3.0.
16557	* linux/s390x/syscallent.h: Likewise.
16558
165592015-11-07  Dmitry V. Levin  <ldv@altlinux.org>
16560
16561	Fix *_printer_defs.h rules ambiguousness.
16562	There is an ambiguousness in *_printer_defs.h rules definition:
16563
16564	$ grep '^[^ ]*_defs\.h: ' Makefile.am
16565	m%_defs.h: $(srcdir_mpers_source_files)
16566	%_printer_defs.h: $(srcdir_mpers_source_files)
16567
16568	While it appears to work with GNU make, it has to be fixed nevertheless.
16569
16570	* Makefile.am (m%_defs.h): Rename to m%_type_defs.h.
16571	(mpers_m32_targets): Rename m32_defs.h to m32_type_defs.h.
16572	(mpers_mx32_targets): Rename mx32_defs.h to mx32_type_defs.h.
16573	* mpers_type.h: Rename m32_defs.h to m32_type_defs.h,
16574	mx32_defs.h to mx32_type_defs.h.
16575	* .gitignore: Likewise.
16576
16577	Reported-by: Elliott Hughes <enh@google.com>
16578
165792015-10-09  Dmitry V. Levin  <ldv@altlinux.org>
16580
16581	fcntl.c: make use of RVAL_DECODED.
16582	* fcntl.c (SYS_FUNC(fcntl)): Return RVAL_DECODED for write-only operations.
16583
165842015-10-08  Dmitry V. Levin  <ldv@altlinux.org>
16585
16586	desc.c: move parser of fcntl syscall to a separate file.
16587	* fcntl.c: New file.
16588	* Makefile.am (strace_SOURCES): Add it.
16589	* desc.c (printflock64, printflock, SYS_FUNC(fcntl)): Move to fcntl.c.
16590
16591	desc.c: move parser of flock syscall to a separate file.
16592	* flock.c: New file.
16593	* Makefile.am (strace_SOURCES): Add it.
16594	* desc.c (SYS_FUNC(flock)): Move to flock.c.
16595
165962015-10-08  Dmitry V. Levin  <ldv@altlinux.org>
16597
16598	tests: fix false uio.test failures.
16599	* tests/uio.c (main): Use descriptor number 0 in pread/pwrite
16600	and preadv/pwritev syscalls.
16601	* tests/uio.expected: Update regexps.
16602
16603	Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
16604
166052015-10-01  Gabriel Laskar  <gabriel@lse.epita.fr>
16606
16607	Fix make -j builds.
16608	In files generated by mpers scripts, includes directives are taken from
16609	original files where the type definition was done.  This causes to
16610	include defs.h in multiple files.  defs.h includes printers.h header,
16611	which is a generated header.
16612
16613	This patch add an explicit dependency to printers.h for the mpers
16614	scripts.
16615
16616	* Makefile.am (mpers-m%.stamp): Add printers.h to order-only
16617	prerequisites.
16618
166192015-09-29  Mike Frysinger  <vapier@gentoo.org>
16620
16621	mpers: fix shell code to conform better to POSIX.
16622	The `echo -n` behavior is non-portable, so use printf instead.
16623
16624	* generate_mpers_am.sh: Change `echo -n` to `printf`.
16625
166262015-09-23  Gabriel Laskar  <gabriel@lse.epita.fr>
16627
16628	ioctl: fix ioctl command number decoding in case of conflicts.
16629	When a command number was decoded through ioctl_decode_command_number(),
16630	there was no check for conflicts with other potential ioctls numbers.
16631
16632	For example:
16633		ioctl(fd, MCE_GET_RECORD_LEN, &i);
16634	output:
16635		ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0
16636	instead of:
16637		ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0
16638
16639	* ioctl.c (SYS_FUNC(ioctl)): Fix ioctl command number decoding
16640	in case of conflicts.
16641	* tests/ioctl.c (main): Add a case for command number conflicts.
16642
166432015-09-23  Dmitry V. Levin  <ldv@altlinux.org>
16644
16645	tests: convert ioctl.test from match_grep to match_diff.
16646	* tests/ioctl.c (main): Print expected output.
16647	* tests/ioctl.test: Use match_diff instead of match_grep.
16648	* tests/ioctl.expected: Remove.
16649	* tests/Makefile.am (EXTRA_DIST): Remove ioctl.expected.
16650
166512015-09-20  Dmitry V. Levin  <ldv@altlinux.org>
16652
16653	Convert parser of seccomp filter program to new mpers infrastructure.
16654	* seccomp_fprog.h: New file.
16655	* fetch_seccomp_fprog.c: New file.
16656	* Makefile.am (strace_SOURCES): Add them.
16657	* seccomp.c: Include "seccomp_fprog.h".
16658	(print_seccomp_filter): Use fetch_seccomp_fprog.
16659
166602015-09-19  Dmitry V. Levin  <ldv@altlinux.org>
16661
16662	tests/init.sh: enhance match_grep error diagnostics.
16663	* tests/init.sh (match_grep): Check patterns one by one,
16664	output only those patterns that didn't match.
16665
16666	tests/init.sh: fix comment.
16667	* tests/init.sh (match_awk): Fix usage description.
16668
16669	tests: add one more case to select.test.
16670	* tests/select.c (main): Check how timeout is printed
16671	on exiting syscall.
16672
16673	tests: uncouple pselect6 from select.test.
16674	* tests/select.c Do not include <string.h>.
16675	Include <sys/syscall.h>.
16676	[!__NR_select]: Skip the test.
16677	(main): Remove pselect6 support, test just select syscall.
16678	* tests/select.test: Remove all pselect6 checks, test just
16679	select syscall.
16680
16681	tests: robustify select test.
16682	* tests/select.c: Do not include <assert.h>.
16683	(main): Skip the test instead of assertions.
16684	Add some padding to the timeval structure.
16685
16686	tests: add one more case to pselect6.test.
16687	* tests/pselect6.c (main): Check how timeout is printed
16688	on exiting syscall.
16689
16690	tests: robustify pselect6 test.
16691	* tests/pselect6.c: Do not include <assert.h> and <string.h>.
16692	Include <sys/syscall.h>.
16693	[!__NR_pselect6]: Skip the test.
16694	(main): Skip the test instead of assertions.
16695	Add some padding to the timespec structure.
16696
16697	Convert another parser of struct timeval to new mpers infrastructure.
16698	* print_time.c (sprint_timeval): New mpers printer.
16699	[ALPHA] (sprint_timeval32): New function.
16700	* defs.h [ALPHA] (sprint_timeval32): New prototype.
16701	(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
16702	* desc.c (decode_select): Replace bitness parameter with two printers.
16703	Use them instead of printtv_bitness and sprinttv.
16704	(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
16705	to decode_select.
16706	[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
16707	to decode_select.
16708	(pselect6): Pass print_timespec and sprint_timespec to decode_select.
16709	* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
16710	struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.
16711
16712	Convert another parser of struct timespec to new mpers infrastructure.
16713	* print_time.c (sprint_timespec): New mpers printer.
16714	* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
16715	(sprint_timespec): Remove.
16716	* time.c (sprint_timespec): Remove.
16717	* net.c (sys_recvmmsg): Update callers.
16718	* poll.c (decode_poll_exiting): Likewise.
16719
16720	tests: add another case to pselect6 test.
16721	* tests/pselect6.c: Include <sys/time.h>.
16722	(handler): New function.
16723	(main): Install an interval timer.
16724	Use it to check how ERESTARTNOHAND is printed.
16725
16726	Fix decoding of gettimeofday and settimeofday.
16727	* time.c (print_timezone): new function.
16728	(sys_gettimeofday, sys_settimeofday): Use it instead of print_timeval
16729	to print struct timezone.
16730	[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday): Use it
16731	instead of print_timeval32 to print struct timezone.
16732	* tests/xettimeofday.c: New file.
16733	* tests/xettimeofday.test: New test.
16734	* tests/Makefile.am (check_PROGRAMS): Add xettimeofday.
16735	(TESTS): Add xettimeofday.
16736	* tests/.gitignore: Add xettimeofday.
16737
16738	Convert parser of struct timeval to new mpers infrastructure.
16739	* defs.h (printtv, printtv_special): Remove.
16740	[ALPHA] (print_timeval32, print_timeval32_pair): New prototypes.
16741	* print_time.c (print_timeval): New mpers printer.
16742	[ALPHA] (print_timeval32, print_timeval32_pair): New functions.
16743	* time.c (sys_gettimeofday, sys_settimeofday): Use print_timeval
16744	instead of printtv.
16745	[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday):
16746	Use print_timeval32 instead of printtv_bitness.
16747	* utimes.c [ALPHA] (sys_osf_utimes): Use print_timeval32_pair
16748	instead of printtv_bitness.
16749
16750	Convert parser of struct timespec to new mpers infrastructure.
16751	* defs.h (print_timespec): Remove.
16752	* print_time.c (print_timespec): New mpers printer.
16753	* futex.c (sys_futex): Use print_timespec instead of printtv.
16754	* ipc_sem.c (sys_semtimedop): Likewise.
16755	* mq.c (sys_mq_timedsend, sys_mq_timedreceive): Likewise.
16756	* time.c (clock_settime, clock_gettime, clock_nanosleep): Likewise.
16757	(print_timespec): Remove.
16758
16759	Remove unused parser of adjtime syscall.
16760	* time.c (sys_adjtime): Remove.
16761
16762	Fix decoding of clock_nanosleep.
16763	* time.c (sys_clock_nanosleep): Use is_erestart,
16764	temporarily_clear_syserror, and restore_cleared_syserror.
16765	* tests/clock_nanosleep.c: New file.
16766	* tests/clock_nanosleep.test: New test.
16767	* tests/Makefile.am (check_PROGRAMS): Add clock_nanosleep.
16768	(TESTS): Add clock_nanosleep.test.
16769	* tests/.gitignore: Add clock_nanosleep.
16770
16771	Add is_erestart helper function.
16772	* defs.h (is_erestart): New prototype.
16773	* syscall.c (is_erestart): New function.
16774	* time.c (sys_nanosleep): Use is_erestart,
16775	temporarily_clear_syserror, and restore_cleared_syserror.
16776
16777	Add helper functions to clear/restore syserror.
16778	* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
16779	New prototypes.
16780	* syscall.c (saved_u_error): New variable.
16781	(temporarily_clear_syserror, restore_cleared_syserror): New functions.
16782	* aio.c (sys_io_getevents): Use temporarily_clear_syserror
16783	and restore_cleared_syserror.
16784	* mq.c (sys_mq_timedreceive): Likewise.
16785	* signal.c (sys_rt_sigtimedwait): Likewise.
16786
16787	tests: add nanosleep.test.
16788	* tests/nanosleep.c: New file.
16789	* tests/nanosleep.test: New test.
16790	* tests/Makefile.am (check_PROGRAMS): Add nanosleep.
16791	(TESTS): Add nanosleep.test.
16792	* tests/.gitignore: Add nanosleep.
16793
16794	tests: rewrite restart_syscall in C.
16795	* tests/restart_syscall.c: New file.
16796	* tests/restart_syscall.expected: Remove.
16797	* tests/restart_syscall_unknown.expected: Remove.
16798	* tests/restart_syscall.test: Update to use restart_syscall.
16799	* tests/Makefile.am (check_PROGRAMS): Add restart_syscall.
16800	(EXTRA_DIST): Remove restart_syscall.expected
16801	and restart_syscall_unknown.expected.
16802	* tests/.gitignore: Add restart_syscall.
16803
16804	Properly initialize siginfo_t object passed to print_stopped function.
16805	* strace.c (trace): Clear the whole siginfo_t variable before passing it
16806	to ptrace(PTRACE_GETSIGINFO) because the latter may initialize only a
16807	part of the structure.
16808
16809	tests: add clock_xettime.test.
16810	* tests/clock_xettime.c: New file.
16811	* tests/clock_xettime.test: New test.
16812	* tests/Makefile.am (check_PROGRAMS): Add clock_xettime.
16813	(TESTS): Add clock_xettime.test.
16814	* tests/.gitignore: Add clock_xettime.
16815
16816	Convert parser of struct itimerval to new mpers infrastructure.
16817	* defs.h [ALPHA] (print_itimerval32): New prototype.
16818	* print_time.c (print_itimerval): New mpers printer.
16819	[ALPHA] (timeval32_t): New typedef.
16820	[ALPHA] (print_timeval32_t, print_itimerval32): New functions.
16821	* time.c (sys_getitimer, sys_setitimer): Use print_itimerval instead
16822	of printitv.
16823	[ALPHA] (sys_osf_getitimer, sys_osf_setitimer): Use print_itimerval32
16824	instead of printitv_bitness.
16825	(tprint_timeval32, tprint_timeval, printitv_bitness, printitv): Remove.
16826
16827	tests: add xetitimer.test.
16828	* tests/xetitimer.c: New file.
16829	* tests/xetitimer.test: New test.
16830	* tests/Makefile.am (check_PROGRAMS): Add xetitimer.
16831	(TESTS): Add xetitimer.test.
16832	* tests/.gitignore: Add xetitimer.
16833
16834	Convert parser of struct itimerspec to new mpers infrastructure.
16835	* print_time.c (print_itimerspec): New mpers printer.
16836	* time.c (sys_timer_settime, sys_timer_gettime, sys_timerfd,
16837	sys_timerfd_settime, sys_timerfd_gettime): Use it instead of printitv.
16838
168392015-09-17  Dmitry V. Levin  <ldv@altlinux.org>
16840
16841	print_time.c: introduce print_timespec_t helper.
16842	* print_time.c (time_fmt): New constant string.
16843	(print_timeval_t): Use it.
16844	(print_timespec_t): New function.
16845	(print_timespec_t_utime): Use it.
16846
16847	tests: add timerfd_xettime.test.
16848	* tests/timerfd_xettime.c: New file.
16849	* tests/timerfd_xettime.test: New test.
16850	* tests/Makefile.am (check_PROGRAMS): Add timerfd_xettime.
16851	(TESTS): Add timerfd_xettime.test.
16852	* tests/.gitignore: Add timerfd_xettime.
16853
16854	tests: add timer_xettime.test.
16855	* tests/timer_xettime.c: New file.
16856	* tests/timer_xettime.test: New test.
16857	* tests/Makefile.am (check_PROGRAMS): Add timer_xettime.
16858	(TESTS): Add timer_xettime.test.
16859	* tests/.gitignore: Add timer_xettime.
16860
16861	time.c: move parser of time syscall to print_time.c.
16862	* time.c (current_time_t_is_int32): Remove.
16863	(sys_time): Move ...
16864	* print_time.c: ... here.  Mpersify time_t.
16865
16866	print_time.c: remove unused function parameters.
16867	* print_time.c (print_timespec_t_utime, print_timeval_t): Remove
16868	"struct tcb *" parameter.
16869	(print_timespec_utime_pair, print_timeval_pair): Update callers.
16870
16871	Add struct timex.tai support.
16872	* configure.ac (AC_CHECK_MEMBERS): Add struct timex.tai.
16873	* print_timex.c (print_timex) [HAVE_STRUCT_TIMEX_TAI]: Print tai field.
16874	* tests/adjtimex.c (main) [HAVE_STRUCT_TIMEX_TAI]: Likewise.
16875
16876	Convert parser of struct timex to new mpers infrastructure.
16877	* defs.h (adjtimex_modes, adjtimex_status): New xlat prototypes.
16878	* print_timex.c (struct_timex): New typedef.  Mpersify it.
16879	[IN_MPERS]: Do not include "xlat/adjtimex_modes.h"
16880	and "xlat/adjtimex_status.h".
16881	[SUPPORTED_PERSONALITIES > 1]: Remove.
16882	(tprint_timeval): Remove.
16883	(tprint_timex): Rename to print_timex.  Mpersify it.
16884	* time.c (do_adjtimex): Rename tprint_timex to print_timex.
16885	* tests/adjtimex.c: New file.
16886	* tests/adjtimex.test: New test.
16887	* tests/Makefile.am (check_PROGRAMS): Add adjtimex.
16888	(TESTS): Add adjtimex.test.
16889	* tests/.gitignore: Add adjtimex.
16890
16891	Move parser of struct timex to a separate file.
16892	* print_timex.c: New file.
16893	* Makefile.am (strace_SOURCES): Add it.
16894	* time.c (tprint_timex32, tprint_timex): Move to print_timex.c.
16895
16896	Enhance parser of struct sigevent.
16897	* print_sigevent.c (print_sigevent): Always print names
16898	of struct_sigevent fields along with their values.
16899	Print signal name of sigev_signo for those sigev_notify values
16900	that require valid signal numbers.
16901	* tests/timer_create.c: New file.
16902	* tests/timer_create.test: New test.
16903	* tests/Makefile.am (check_PROGRAMS): Add timer_create.
16904	(TESTS): Add timer_create.test.
16905	* tests/.gitignore: Add timer_create.
16906
169072015-09-16  Dmitry V. Levin  <ldv@altlinux.org>
16908
16909	Convert parser of struct sigevent to new mpers infrastructure.
16910	* defs.h (sigev_value): New prototype.
16911	(printsigevent): Remove.
16912	* print_sigevent.c (struct_sigevent): New typedef.  Mpersify it.
16913	[IN_MPERS]: Do not include "xlat/sigev_value.h".
16914	(printsigevent32): Remove.
16915	(printsigevent): Rename to print_sigevent.  Mpersify it.
16916	* mq.c (sys_mq_notify): Rename printsigevent to print_sigevent.
16917	* time.c (sys_timer_create): Likewise.
16918
16919	Move parser of struct sigevent to a separate file.
16920	* print_sigevent.c: New file.
16921	* Makefile.am (strace_SOURCES): Add it.
16922	* time.c (printsigevent32, printsigevent): Move to print_sigevent.c.
16923
16924	time.c: move fallback definitions of SIGEV_* values to xlat/
16925	* time.c: Move fallback definitions of SIGEV_* values ...
16926	* xlat/sigev_value.in: ... here.
16927
16928	Simplify use of mpers printers.
16929	* native_defs.h: New file.
16930	* syscall.c: Include it.
16931	* mpers_type.h [!IN_MPERS] (MPERS_DEFS): Change to "native_defs.h".
16932	* defs.h (MPERS_PRINTER_NAME): Remove.
16933	[SUPPORTED_PERSONALITIES > 1] (MPERS_PRINTER_NAME, printers): Move ...
16934	* Makefile.am (printers.h): ... here.
16935	Add macro definitions for mpers printers.
16936	(m%_defs.h): Add redefinition of MPERS_PRINTER_NAME and inclusion
16937	of "$(mpers_PREFIX)printer_decls.h".
16938	(strace_SOURCES): Add native_defs.h.
16939	* README-mpers: Update instructions for using mpers printers.
16940	* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Call tprint_msgbuf directly.
16941	* mq.c (sys_mq_open, mq_getsetattr): Call printmqattr directly.
16942	* process.c (sys_ptrace): Call printsiginfo_at directly.
16943	* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Likewise.
16944	* resource.c (sys_getrusage): Call printrusage directly.
16945	* utimes.c (sys_utimensat): Call print_timespec_utime_pair directly.
16946	(sys_utimes, sys_futimesat): Call print_timeval_pair directly.
16947	* wait.c (printwaitn): Call printrusage directly.
16948	(sys_waitid): Call printrusage and printsiginfo_at directly.
16949
169502015-09-15  Dmitry V. Levin  <ldv@altlinux.org>
16951
16952	Add a new helper function umove_ulong_array_or_printaddr.
16953	* defs.h (umove_ulong_array_or_printaddr): New prototype.
16954	* util.c (umove_ulong_array_or_printaddr): New function.
16955	* desc.c (sys_pselect6): Use it instead of open-coding
16956	a proxy struct parser for different personalities.
16957	* io.c (tprint_iov_upto): Use it instead of open-coding
16958	a struct iovec parser for different personalities.
16959	* kexec.c (print_kexec_segments): Use it instead of open-coding
16960	a struct kexec_segment parser for different personalities.
16961	(print_seg): Pass arguments using an array.
16962
16963	tests: add pselect6.test.
16964	* tests/pselect6.c: New file.
16965	* tests/pselect6.test: New test.
16966	* tests/Makefile.am (check_PROGRAMS): Add pselect6.
16967	(TESTS): Add pselect6.test.
16968	* tests/.gitignore: Add pselect6.
16969
169702015-09-14  Dmitry V. Levin  <ldv@altlinux.org>
16971
16972	Rename umove_long_or_printaddr to umove_ulong_or_printaddr.
16973	Rename the recently added function to reflect what kind of data type
16974	it actually deals with: unsigned long int, without sign extension.
16975
16976	* defs.h (umove_long_or_printaddr): Rename to umove_ulong_or_printaddr,
16977	chage 3rd argument to unsigned long *.
16978	* util.c (umove_long_or_printaddr): Likewise.
16979	* aio.c (sys_io_submit): Update callers.
16980
169812015-09-14  Dmitry V. Levin  <ldv@altlinux.org>
16982
16983	aarch64, ppc64, sparc64, tile: hook up mpers printers.
16984	* defs.h [AARCH64 && HAVE_M32_MPERS]: Define PERSONALITY0_INCLUDE_FUNCS,
16985	PERSONALITY0_INCLUDE_PRINTERS_DECLS,
16986	and PERSONALITY0_INCLUDE_PRINTERS_DEFS.
16987	[POWERPC64 && HAVE_M32_MPERS]: Define PERSONALITY1_INCLUDE_FUNCS,
16988	PERSONALITY1_INCLUDE_PRINTERS_DECLS,
16989	and PERSONALITY1_INCLUDE_PRINTERS_DEFS.
16990	[SPARC64 && HAVE_M32_MPERS]: Likewise.
16991	[TILE && HAVE_M32_MPERS]: Likewise.
16992
169932015-09-14  Anton Blanchard  <anton@samba.org>
16994
16995	Add PowerPC specific ptrace constants.
16996	* xlat/ptrace_cmds.in: Add PowerPC specific ptrace constants.
16997
169982015-09-14  Dmitry V. Levin  <ldv@altlinux.org>
16999
17000	Update SCTP_* constants.
17001	* xlat/socksctpoptions.in: Add SCTP_GET_ASSOC_ID_LIST, SCTP_AUTO_ASCONF,
17002	SCTP_PEER_ADDR_THLDS, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO,
17003	SCTP_DEFAULT_SNDINFO, SCTP_SOCKOPT_CONNECTX, SCTP_SOCKOPT_CONNECTX3,
17004	and SCTP_GET_ASSOC_STATS.
17005
17006	Update F_* constants.
17007	* xlat/fcntlcmds.in: Add F_SETPIPE_SZ, F_GETPIPE_SZ, F_ADD_SEALS,
17008	and F_GET_SEALS.
17009
17010	Update RENAME_* constants.
17011	* xlat/rename_flags.in: Add RENAME_WHITEOUT.
17012
17013	Update SO_* constants.
17014	* xlat/sockoptions.in: Add SO_ATTACH_BPF, SO_BPF_EXTENSIONS,
17015	SO_BUSY_POLL, SO_DETACH_BPF, SO_GET_FILTER, SO_INCOMING_CPU,
17016	SO_LOCK_FILTER, SO_MAX_PACING_RATE, SO_PEEK_OFF, SO_RXQ_OVFL,
17017	SO_SELECT_ERR_QUEUE, and SO_WIFI_STATUS.
17018
17019	Update INPUT_PROP_* constants.
17020	* xlat/evdev_prop.in: Add INPUT_PROP_ACCELEROMETER.
17021
17022	Update KEY_* constants.
17023	* xlat/evdev_keycode.in: Add KEY_ROTATE_DISPLAY, KEY_NUMERIC_A,
17024	KEY_NUMERIC_B, KEY_NUMERIC_C, and KEY_NUMERIC_D.
17025
17026	Update FALLOC_FL_* constants.
17027	* xlat/falloc_flags.in: Add FALLOC_FL_INSERT_RANGE.
17028
17029	Update AF_* and PF_* constants.
17030	* xlat/addrfams.in: Add AF_IB and AF_MPLS.
17031	* xlat/domains.in: Add PF_IB and PF_MPLS.
17032
17033	Update TCP_* constants.
17034	* xlat/socktcpoptions.in: Add TCP_NOTSENT_LOWAT, TCP_CC_INFO,
17035	TCP_SAVE_SYN, and TCP_SAVED_SYN.
17036
17037	Update PACKET_* constants.
17038	* xlat/sockpacketoptions.in: Add PACKET_VNET_HDR, PACKET_TX_TIMESTAMP,
17039	PACKET_TIMESTAMP, PACKET_FANOUT, PACKET_TX_HAS_OFF, PACKET_QDISC_BYPASS,
17040	PACKET_ROLLOVER_STATS, and PACKET_FANOUT_DATA.
17041
17042	Update BPF_MAP_TYPE_* constants.
17043	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERF_EVENT_ARRAY.
17044
17045	Update IPPROTO_* constants.
17046	* xlat/inet_protocols.in: Add IPPROTO_MPLS.
17047
17048	Update IP_* constants.
17049	* xlat/sockipoptions.in: Add IP_CHECKSUM and IP_BIND_ADDRESS_NO_PORT.
17050
17051	Update PTRACE_O_* constants.
17052	* ptrace.h: Define PTRACE_O_SUSPEND_SECCOMP.
17053	* xlat/ptrace_setoptions_flags.in: Add it.
17054
17055	Update PR_* constants.
17056	* xlat/prctl_options.in: Add PR_SET_FP_MODE, PR_GET_FP_MODE,
17057	and PR_CAP_AMBIENT.
17058
17059	Update SECBIT_* constants.
17060	* xlat/secbits.in: Add SECBIT_NO_CAP_AMBIENT_RAISE
17061	and SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED.
17062
170632015-08-28  Dmitry V. Levin  <ldv@altlinux.org>
17064
17065	mpers.m4: workaround missing gnu/stubs-*.h files.
17066	On some systems missing gnu/stubs-*.h files make -m32/-mx32 compilation
17067	checks fail.  As we want to support multiple personalities despite of
17068	this limitation, workaround the check by creating empty gnu stub files
17069	if necessary.
17070
17071	* m4/mpers.m4 (st_MPERS): Check for the gnu stub file.  Create an empty
17072	gnu stub file if the system one is missing.
17073	* Makefile.am (DISTCLEANFILES): Add gnu/stubs-32.h and gnu/stubs-x32.h.
17074
170752015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17076
17077	tests: add times-fail.test.
17078	* tests/times-fail.c: New file.
17079	* tests/times-fail.test: New test.
17080	* tests/Makefile.am (check_PROGRAMS): Add times-fail.
17081	(TESTS): Add times-fail.test.
17082	* tests/.gitignore: Add times-fail.
17083
170842015-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
17085
17086	tests: add times.test.
17087	* tests/times.c: New file.
17088	* tests/times.test: New test.
17089	* tests/Makefile.am (check_PROGRAMS): Add times.
17090	(TESTS): Add times.test.
17091	(times_LDADD): Define.
17092	* tests/.gitignore: Add times.
17093
170942015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17095
17096	Mpersify parser of times syscall.
17097	Fix multiple personalities support in parser of times syscall by
17098	mpersifying struct tms.
17099
17100	* times.c (tms_t): New typedef.  Mpersify it.
17101	(sys_times): Use it instead of struct tms.
17102
171032015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17104
17105	tests: add sysinfo.test.
17106	* tests/sysinfo.c: New file.
17107	* tests/sysinfo.test: New test.
17108	* tests/Makefile.am (check_PROGRAMS): Add sysinfo.
17109	(TESTS): Add sysinfo.test.
17110	* tests/.gitignore: Add sysinfo.
17111
171122015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17113
17114	Mpersify parser of sysinfo syscall.
17115	Fix multiple personalities support in parser of sysinfo syscall by
17116	mpersifying struct sysinfo.
17117
17118	* sysinfo.c (sysinfo_t): New typedef.  Mpersify it.
17119	(sys_sysinfo): Use it instead of struct sysinfo.
17120
171212015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17122
17123	Enhance msgctl syscall decoding.
17124	Make parser of msgctl syscall print struct msqid_ds.
17125
17126	* ipc_msgctl.c (msqid_ds_t): New typedef.  Mpersify it.
17127	(print_msqid_ds): New function.  Use msqid_ds_t.
17128	(sys_msgctl): Use print_msqid_ds.
17129	* tests/ipc_msg.c: Update for struct msqid_ds support.
17130
171312015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17132
17133	Enhance shmctl syscall decoding.
17134	Make parser of shmctl syscall print struct shmid_ds.
17135
17136	* ipc_shmctl.c (shmid_ds_t): New typedef.  Mpersify it.
17137	(print_shmid_ds): New function.  Use shmid_ds_t.
17138	(sys_shmctl): Use print_shmid_ds.
17139	* tests/ipc_shm.c: Update for struct shmid_ds support.
17140
171412015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17142
17143	tests: add ipc_msgbuf.test.
17144	* tests/ipc_msgbuf.c: New file.
17145	* tests/ipc_msgbuf.expected: Likewise.
17146	* tests/ipc_msgbuf.test: New test.
17147	* tests/Makefile.am (check_PROGRAMS): Add ipc_msgbuf.
17148	(TESTS): Add ipc_msgbuf.test.
17149	(EXTRA_DIST): Add ipc_msgbuf.expected.
17150	* tests/.gitignore: Add ipc_msgbuf.
17151
171522015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17153
17154	Mpersify tprint_msgsnd and tprint_msgrcv.
17155	Fix multiple personalities support in tprint_msgsnd and tprint_msgrcv
17156	by converting tprint_msgbuf into a mpersified printer.
17157
17158	* print_msgbuf.c (msgbuf_t): New typedef.  Mpersify it.
17159	(tprint_msgbuf): Use it instead of long.
17160	Wrap function name into MPERS_PRINTER_DECL.
17161	* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Use mpersified
17162	tprint_msgbuf.
17163
171642015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17165
17166	tests: add mq.test.
17167	* tests/mq.c: New file.
17168	* tests/mq.expected: Likewise.
17169	* tests/mq.test: New test.
17170	* tests/Makefile.am (check_PROGRAMS): Add mq.
17171	(TESTS): Add mq.test.
17172	(EXTRA_DIST): Add mq.expected.
17173	(mq_LDADD): Add -lrt.
17174	* tests/.gitignore: Add mq.
17175
171762015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17177
17178	Mpersify parsers of mq_open and mq_getsetattr syscalls.
17179	Fix multiple personalities support in parsers of mq_open and
17180	mq_getsetattr by converting printmqattr into a mpersified printer.
17181
17182	* print_mq_attr.c (mq_attr_t): New typedef.  Mpersify it.
17183	(printmqattr): Use it instead of struct mq_attr.  Wrap function name
17184	into MPERS_PRINTER_DECL.
17185	* mq.c (mq_open, mq_getsetattr): Use mpersified printmqattr.
17186
171872015-08-28  Dmitry V. Levin  <ldv@altlinux.org>
17188
17189	tests: add wait.test.
17190	* tests/wait.c: New file.
17191	* tests/wait.expected: Likewise.
17192	* tests/wait.test: New test.
17193	* tests/Makefile.am (check_PROGRAMS): Add wait.
17194	(TESTS): Add wait.test.
17195	(EXTRA_DIST): Add wait.expected.
17196	* tests/.gitignore: Add wait.
17197
171982015-08-28  Dmitry V. Levin  <ldv@altlinux.org>
17199
17200	Mpersify parsers of getrusage, waitpid, wait4, and waitid syscalls.
17201	Fix multiple personalities support in parsers of getrusage, waitpid,
17202	wait4, and waitid syscalls by converting printrusage into a mpersified
17203	printer.
17204
17205	* defs.h (printrusage): Remove.
17206	* printrusage.c (rusage_t): New typedef.  Mpersify it.
17207	(printrusage): Use it instead of struct rusage.
17208	Wrap function name into MPERS_PRINTER_DECL.
17209	* resource.c (sys_getrusage): Use mpersified printrusage.
17210	* wait.c (printwaitn, sys_waitid): Likewise.
17211
172122015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17213
17214	tests: add rt_sigqueueinfo.test.
17215	* tests/rt_sigqueueinfo.c: New file.
17216	* tests/rt_sigqueueinfo.test: New test.
17217	* tests/Makefile.am (check_PROGRAMS): Add rt_sigqueueinfo.
17218	(TESTS): Add rt_sigqueueinfo.test.
17219	* tests/.gitignore: Add rt_sigqueueinfo.
17220
172212015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17222
17223	Mpersify printsiginfo_at printer.
17224	Fix multiple personalities support in parsers of ptrace,
17225	rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
17226	by converting printsiginfo_at into a mpersified printer.
17227
17228	* printsiginfo.c (siginfo_t): Mpersify.
17229	(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
17230	* defs.h (printsiginfo_at): Remove.
17231	* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
17232	printsiginfo_at.
17233	* process.c (sys_ptrace): Likewise.
17234	* wait.c (sys_waitid): Likewise.
17235
172362015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17237
17238	Mpersify parser of sigaltstack syscall.
17239	Fix multiple personalities support in parser of sigaltstack syscall by
17240	mpersifying stack_t typedef.
17241
17242	* sigaltstack.c (stack_t): Mpersify.
17243	(print_stack_t): Use it.
17244
172452015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17246
17247	Mpersify parser of utime syscall.
17248	Fix multiple personalities support in parser of utime syscall by using
17249	mpersified utimbuf_t typedef.
17250
17251	* utime.c (utimbuf_t): New typedef.  Mpersify it.
17252	(sys_utime): Use it instead of a locally defined union.
17253
172542015-08-28  Dmitry V. Levin  <ldv@altlinux.org>
17255
17256	tests: add utimensat.test.
17257	* tests/utimensat.c: New file.
17258	* tests/utimensat.test: New test.
17259	* tests/Makefile.am (check_PROGRAMS): Add utimensat.
17260	(TESTS): Add utimensat.test.
17261	* configure.ac (AC_CHECK_FUNCS): Add utimensat.
17262	* tests/.gitignore: Add utimensat.
17263
172642015-08-28  Dmitry V. Levin  <ldv@altlinux.org>
17265
17266	Mpersify parsers of utimes, futimesat, and utimensat syscalls.
17267	Fix multiple personalities support in parsers of utimes, futimesat,
17268	and utimensat syscalls by introducing two mpersified printers:
17269	print_timeval_pair and print_timespec_utime_pair.
17270
17271	* print_time.c: New file.
17272	* Makefile.am (strace_SOURCES): Add it.
17273	* utimes.c (decode_utimes): Remove.
17274	(sys_utimes, sys_futimesat): Use print_timeval_pair instead
17275	of decode_utimes.
17276	(sys_utimensat): Use print_timespec_utime_pair instead of decode_utimes.
17277
172782015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>
17279
17280	Add mpers support.
17281	Add a subsystem for semi-automatical definition of how parsers should
17282	work with personality-dependent (mpers) types of tracee's data.  Create
17283	auxiliary libraries containing mpers syscall parsers and printer
17284	functions, one library for each possible nonnative target personality.
17285
17286	Currently some parsers do not handle differences in definitions of data
17287	types between personalities, namely LP64 and ILP32.  When
17288	this is the case, long integers, pointers, and all compound
17289	types containing long and pointer members may be printed incorrectly,
17290	because of differences in sizes, offsets and alignments.
17291
17292	Since in most cases these are the only differences in desired behaviour
17293	of parsers and printers for different personalities, a correct way
17294	would be to compile one source code into multiple parsers, differing
17295	only in definitions of mpers types.
17296
17297	To get a definition of a given type for nonnative personality
17298	a very basic .c file containing a declaration of a variable of this type
17299	is being compiled for this personality (using -m32 or -mx32 compiler
17300	flag).  Information about the type is then being extracted from
17301	this binary's DWARF debug info with an awk script and put
17302	into a corresponding header file.  Resulting headers are being used to
17303	compile mpers variations of syscall parsers and printer functions.
17304
17305	In addition to syscall parsers, there can occur a need to create mpers
17306	printing functions, which then can be called from many places
17307	in the code (for example, printsiginfo_at).  Such functions (printers)
17308	are marked in a special manner.
17309
17310	For each possible nonnative target personality a library is being
17311	created, containing mpers variations of syscall parsers and printers.
17312	Only syscall parsers from files marked in a special manner and specially
17313	marked functions from such files are being recompiled and included
17314	in these libraries.
17315
17316	generate_mpers_am.sh is called by bootstrap to find the files
17317	from strace_SOURCES which include MPERS_DEFS.  During compilation,
17318	these files are being inspected for inclusions of DEF_MPERS_TYPE,
17319	and nonnative variations of each included type are being generated
17320	by an awk script.
17321
17322	Mpers parser names are being modified during inclusions of syscallent
17323	headers for nonnative personalities.  Pointers to printers are
17324	being stored in structs struct_printers, and a master
17325	pointer printers is being updated on every set_personality.
17326
17327	* README-mpers: New README explaining how to use mpers support.
17328	* empty.h: New empty file.
17329	* generate_mpers_am.sh: New file.
17330	* mpers.awk: Likewise.
17331	* mpers.sh: Likewise.
17332	* mpers_test.sh: Likewise.
17333	* mpers_type.h: Likewise.
17334	* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
17335	(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
17336	of the file.
17337	(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
17338	(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
17339	(BUILT_SOURCES, CLEANFILES): Add new generated files:
17340	native_printer_decls.h, native_printer_defs.h, printers.h,
17341	[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
17342	$(mpers_mx32_targets).
17343	(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
17344	mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
17345	libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
17346	(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
17347	%_printer_decls.h, %_printer_defs.h, clean-local,
17348	native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
17349	New targets.
17350	* bootstrap: Add generate_mpers_am.sh.
17351	* configure.ac: Add AC_PROG_RANLIB.
17352	* m4/mpers.m4: Add HAVE_MPERS variable.  Add $st_cv_mpers checks.
17353	* defs.h: Include mpers_type.h.
17354	Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
17355	Redefine SYS_FUNC_NAME.  Define MPERS_PRINTER_DECL.
17356	[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
17357	PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
17358	for X86_64, X32.
17359	[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
17360	PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
17361	for X86_64.
17362	Add fallback definitions of
17363	PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
17364	PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
17365	PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
17366	PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
17367	* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
17368	PERSONALITY2_INCLUDE_FUNCS,
17369	PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
17370	PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
17371	PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
17372	(printers): New struct.  Update it when needed.
17373	* .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h,
17374	m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32,
17375	mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h,
17376	mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h,
17377	native_printer_decls.h, native_printer_defs.h, and printers.h.
17378
173792015-08-28  Dmitry V. Levin  <ldv@altlinux.org>
17380
17381	tests: convert readlink.test and readlinkat.test from match_awk to match_diff
17382	* tests/readlink.c (main): Print expected output.
17383	* tests/readlinkat.c (main): Likewise.
17384	* tests/readlink.test: Use match_diff instead of match_awk.
17385	* tests/readlinkat.test: Likewise.
17386	* tests/readlink.awk: Remove.
17387	* tests/readlinkat.awk: Likewise.
17388	* tests/Makefile.am (EXTRA_DIST): Remove readlink.awk and readlinkat.awk.
17389
17390	tests: convert getrandom.test from match_awk to match_diff.
17391	* tests/getrandom.c (main): Print expected output.
17392	* tests/getrandom.test: Use match_diff instead of match_awk.
17393	* tests/getrandom.awk: Remove.
17394	* tests/Makefile.am (EXTRA_DIST): Remove getrandom.awk.
17395
173962015-08-27  Dmitry V. Levin  <ldv@altlinux.org>
17397
17398	tests: convert select.test from match_awk to match_diff.
17399	* tests/select.c (main): Print expected output.
17400	* tests/select.test: Use match_diff instead of match_awk.
17401	* tests/select.awk: Remove.
17402	* tests/Makefile.am (EXTRA_DIST): Remove select.awk.
17403
17404	tests: convert several tests from match_grep to match_diff.
17405	* tests/sendfile.test: Use match_diff instead of match_grep.
17406	* tests/sendfile64.test: Likewise.
17407	* tests/time.test: Likewise.
17408	* tests/utime.test: Likewise.
17409	* tests/xet_robust_list.test: Likewise.
17410	* tests/sendfile.c (main): Update match patterns for match_diff.
17411	* tests/sendfile64.c (main): Likewise.
17412	* tests/time.c (main): Likewise.
17413	* tests/utime.c (main): Likewise.
17414	* tests/xet_robust_list.c (main): Likewise.
17415
174162015-08-27  Dmitry V. Levin  <ldv@altlinux.org>
17417
17418	tests: fix match_diff usage.
17419	The first argument of match_diff should be the file with expected
17420	output, the second argument - the file with actual output.
17421
17422	* tests/aio.test: Swap match_diff arguments.
17423	* tests/restart_syscall.test: Likewise.
17424	* tests/seccomp.test: Likewise.
17425	* tests/umovestr2.test: Likewise.
17426
174272015-08-27  Dmitry V. Levin  <ldv@altlinux.org>
17428
17429	build: fix -I options.
17430	* configure.ac (AM_INIT_AUTOMAKE): Add nostdinc.
17431	* Makefile.am (AM_CPPFLAGS): Append -I$(builddir) and -I$(srcdir).
17432	* tests/Makefile.am (AM_CPPFLAGS): Likewise.
17433
174342015-08-26  Dmitry V. Levin  <ldv@altlinux.org>
17435
17436	aio: rewrite from libaio.h to linux/aio_abi.h.
17437	* configure.ac (AC_CHECK_HEADERS): Remove libaio.h.
17438	* aio.c: Assume that <linux/aio_abi.h> is available,
17439	include it instead of <libaio.h>.
17440	[!IOCB_RESFD]: Remove.
17441	(enum iocb_sub): Remove SUB_POLL.
17442	(tprint_lio_opcode): Update.
17443	(print_common_flags): Use IOCB_FLAG_RESFD instead of IOCB_RESFD,
17444	rename fields of struct iocb.
17445	(iocb_is_valid, print_iocb_header, print_iocb): New functions.
17446	(sys_io_submit): Use print_iocb.
17447	(print_io_event): Fix struct io_event decoding.
17448	(sys_io_cancel): Use print_iocb_header.
17449	* strace.spec (BuildRequires): Remove libaio-devel.
17450	* tests/aio.c (main): Test IOCB_CMD_PREADV, io_cancel,
17451	and struct io_event decoding.
17452	* tests/aio.test (syscalls): Add io_cancel.
17453
174542015-08-26  Dmitry V. Levin  <ldv@altlinux.org>
17455
17456	Fix multiple personalities support in parser of io_submit syscall.
17457	Introduce a new helper function to fetch tracee's long integers
17458	and use it to fix multiple personalities support in io_submit parser.
17459
17460	* defs.h (umove_long_or_printaddr): New prototype.
17461	* util.c (umove_long_or_printaddr): New function.
17462	* aio.c (sys_io_submit): Use it to fetch tracee's pointers.
17463	* tests/aio.c: New file.
17464	* tests/aio.test: New test.
17465	* tests/Makefile.am (check_PROGRAMS): Add aio.
17466	(TESTS): Add aio.test.
17467	* tests/.gitignore: Add aio.
17468
174692015-08-26  Dmitry V. Levin  <ldv@altlinux.org>
17470
17471	tests: fix build on systems that lack O_CLOEXEC definition.
17472	* tests/epoll_create1.c (main): Check that O_CLOEXEC is defined.
17473	* tests/eventfd.c (main): Likewise.
17474	* tests/signalfd.c (main): Likewise.
17475
17476	tests: fix build on systems that lack AT_FDCWD definition.
17477	* tests/readlinkat.c: Stop including <fcntl.h>.
17478	(main): Replace AT_FDCWD with -100.
17479
17480	Fix printing of io_getevents first argument.
17481	* aio.c (sys_io_getevents): Print first argument using "%lu" format.
17482
174832015-08-26  Mike Frysinger  <vapier@gentoo.org>
17484
17485	decode extend getsockopt/setsockopt options.
17486	Currently the code assumes the set of valid options between getsockopt
17487	and setsockopt are exactly the same and thus maintains one list.  The
17488	kernel unfortunately does not do this -- it allows for different opts
17489	between the get and set functions.  See the {g,s}et_opt{min,max} fields
17490	in the various netfilter subcores.
17491
17492	To support this, extend the printxval function to take multiple sets of
17493	xlats as varargs.  Then we add the new get/set lists, and pass them down
17494	in the net code when decoding things.
17495
17496	A simple example is iptables; before:
17497		getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
17498		getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
17499	after:
17500		getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
17501		getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0
17502
17503	If these were setsockopt calls, then 0x40 & 0x41 would be
17504	IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.
17505
17506	* configure.ac: Check for netfilter headers.
17507	* defs.h (printxvals): New prototype.
17508	(printxval): Change to a define.
17509	* net.c: Include netfilter headers and new sockopts headers.
17510	(print_sockopt_fd_level_name): Add a is_getsockopt argument.  Change SOL_IP
17511	and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
17512	xlats down.
17513	(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
17514	(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
17515	* util.c (printxval): Rename to ...
17516	(printxvals): ... this.  Rewrite to be varargs based.
17517	* xlat/getsockipoptions.in: New xlat list.
17518	* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
17519	xlat/setsockipv6options.in: Likewise.
17520
175212015-08-26  Dmitry V. Levin  <ldv@altlinux.org>
17522
17523	Fix build on systems that lack VIDIOC_CREATE_BUFS definition.
17524	* v4l2.c (v4l2_ioctl): Check that v4l2_ioctl is defined.
17525
17526	Fix build on systems that lack EM_ARM/EM_OPENRISC definitions.
17527	* xlat/audit_arch.in: Guard AUDIT_ARCH_ARM and AUDIT_ARCH_ARMEB
17528	with EM_ARM check.  Guard AUDIT_ARCH_OPENRISC with EM_OPENRISC check.
17529
175302015-08-25  Dmitry V. Levin  <ldv@altlinux.org>
17531
17532	Fix build on systems that lack UBI_IOCVOLCRBLK/UBI_IOCVOLRMBLK definitions
17533	* mtd.c (ubi_ioctl): Check that UBI_IOCVOLCRBLK and UBI_IOCVOLRMBLK
17534	are defined.
17535
17536	Fix build on systems that lack O_CLOEXEC definition.
17537	* xlat/efd_flags.in: Check that O_CLOEXEC is defined.
17538	* xlat/epollflags.in: Likewise.
17539	* xlat/sfd_flags.in: Likewise.
17540	* xlat/timerfdflags.in: Fix O_CLOEXEC check.
17541
175422015-08-21  Elvira Khabirova  <lineprinter0@gmail.com>
17543
17544	printsiginfo.c: fix integer conversions.
17545	* printsiginfo.c (printsigsource): Print si_pid and si_uid as unsigned
17546	integers.
17547	(printsigval): Print si_int as signed int.
17548
175492015-08-20  Dmitry V. Levin  <ldv@altlinux.org>
17550
17551	Fix decoding of times syscall return value.
17552	Always print return value of successful times syscall
17553	as unsigned long integer.
17554
17555	* times.c (sys_times): Return RVAL_UDECIMAL unless syserror.
17556
175572015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>
17558
17559	mq.c: remove repeated code.
17560	* mq.c (sys_mq_open): Use printmqattr instead of implementing it again.
17561	[HAVE_MQUEUE_H]: Remove.
17562
175632015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>
17564
17565	ipc_msg.c: fix multiple personalities support in msgrcv ipc subcall.
17566	When msgrcv syscall is an ipc subcall, msgp (pointer to struct msgbuf)
17567	and msgtyp (message type) syscall arguments are passed via proxy
17568	structure which definition significantly depends on tracee's
17569	wordsize.
17570
17571	* ipc_msg.c (fetch_msgrcv_args): New function.
17572	(sys_msgrcv): Use it.
17573
175742015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>
17575
17576	ipc.c: split into separate files.
17577	In preparation for upcoming mpers-related changes,
17578	split ipc.c into independent groups of parsers.
17579
17580	* ipc_defs.h: New file.
17581	* ipc_msg.c: Likewise.
17582	* ipc_msgctl.c: Likewise.
17583	* ipc_sem.c: Likewise.
17584	* ipc_shm.c: Likewise.
17585	* ipc_shmctl.c: Likewise.
17586	* mq.c: Likewise.
17587	* print_mq_attr.c: Likewise.
17588	* print_msgbuf.c: Likewise.
17589	* ipc.c: Remove.
17590	(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
17591	sys_mq_getsetattr): Move to mq.c.
17592	(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
17593	to ipc_msg.c.
17594	(sys_msgctl): Move to ipc_msgctl.c.
17595	(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
17596	sys_semget, syssemctl): Move to ipc_sem.c.
17597	(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
17598	(sys_shmctl): Move to ipc_shmctl.c.
17599	(printmqattr): Move to print_mq_attr.c.
17600	(tprint_msgbuf): Move to print_msgbuf.c.
17601	(IPC_64, PRINTCTL): Move to ipc_defs.h.
17602	* defs.h (struct xlat resource_flags): New prototype.
17603	* Makefile.am (strace_SOURCES): Remove ipc.c.  Add ipc_defs.h, mq.c,
17604	ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
17605	print_mq_attr.c, and print_msgbuf.c.
17606
176072015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>
17608
17609	.gitignore: add sen.h and sys_func.h.
17610
176112015-08-19  Dmitry V. Levin  <ldv@altlinux.org>
17612
17613	tests: add sendfile.test and sendfile64.test.
17614	* tests/sendfile.c: New file.
17615	* tests/sendfile64.c: New file.
17616	* tests/sendfile.test: New test.
17617	* tests/sendfile64.test: New test.
17618	* tests/Makefile.am (check_PROGRAMS): Add sendfile and sendfile64.
17619	(TESTS): Add sendfile.test and sendfile64.test.
17620	* tests/.gitignore: Add sendfile and sendfile64.
17621
176222015-08-19  Dmitry V. Levin  <ldv@altlinux.org>
17623
17624	sendfile: decode file offset both on entering and exiting syscall.
17625	When sendfile is called with a valid pointer to a file offset variable,
17626	kernel updates this variable on successfull exit from syscall.
17627
17628	* sendfile.c (sys_sendfile, sys_sendfile64): Print tcp->u_arg[2]
17629	on exiting syscall as well as on entering.
17630
176312015-08-19  Dmitry V. Levin  <ldv@altlinux.org>
17632
17633	io.c: move sendfile parsers to a separate file.
17634	* sendfile.c: New file.
17635	* Makefile.am (strace_SOURCES): Add it.
17636	* io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c
17637
176382015-08-19  Dmitry V. Levin  <ldv@altlinux.org>
17639
17640	Make printnum_* functions return boolean status.
17641	With this change, printnum_* functions return true iff they
17642	successfully fetched necessary data from tracee's memory.
17643
17644	* defs.h (printnum_short, printnum_int, printnum_int64,
17645	printnum_long_int, printpair_int, printpair_int64): Return bool.
17646	* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.
17647
176482015-08-19  Dmitry V. Levin  <ldv@altlinux.org>
17649
17650	mips: print _MIPS_SIM in configure.ac for debug purposes.
17651	* configure.ac [MIPS]: Print _MIPS_SIM.
17652
17653	xtensa: fix several syscall entries.
17654	* linux/xtensa/syscallent.h: Fix nargs in splice, tee, vmsplice,
17655	pselect6, ppoll, epoll_pwait, and set_robust_list syscall entries.
17656
17657	ia64: fix syscall numbers for set_robust_list, get_robust_list, and splice syscalls
17658	* linux/ia64/syscallent.h: Place syscall entries for set_robust_list,
17659	get_robust_list, and splice in correct order.
17660
176612015-08-18  Dmitry V. Levin  <ldv@altlinux.org>
17662
17663	tests: add a test for get_robust_list and set_robust_list decoding.
17664	* tests/xet_robust_list.c: New file.
17665	* tests/xet_robust_list.test: New test.
17666	* tests/Makefile.am (check_PROGRAMS): Add xet_robust_list.
17667	(TESTS): Add xet_robust_list.test.
17668	* tests/.gitignore: Add xet_robust_list.
17669
17670	Simplify printing of get_robust_list first argument.
17671	* get_robust_list.c (sys_get_robust_list): Print first argument
17672	using "%d" format.
17673
176742015-08-18  Elvira Khabirova  <lineprinter0@gmail.com>
17675
17676	Fix io_setup first argument printing.
17677	* aio.c (sys_io_setup): Print first argument using "%u" format.
17678
176792015-08-18  Dmitry V. Levin  <ldv@altlinux.org>
17680
17681	Fix printing tracee's long integers.
17682	Replace ambiguous printnum_long that used to fetch native long integers
17683	from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
17684	that fetch tracee's pointer, signed long, and unsigned long integers.
17685
17686	* defs.h (printnum_long, printpair_long): Remove prototypes.
17687	(printnum_int64, printpair_int64): Remove macros, declare functions
17688	unconditionally.
17689	[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
17690	New prototype.
17691	(printnum_ptr, printnum_slong, printnum_ulong): New macros.
17692	* aio.c (sys_io_setup): Use printnum_ulong.
17693	* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
17694	* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
17695	and printnum_ulong.
17696	* io.c (print_off_t): Remove.
17697	(sys_sendfile): Use printnum_ulong.
17698	* ipc.c (sys_semctl): Use printnum_ptr.
17699	* prctl.c (sys_prctl): Likewise.
17700	* process.c (sys_ptrace): Likewise.
17701	* rtc.c (rtc_ioctl): Use printnum_ulong.
17702	* util.c (printnum_long, printpair_long): Remove.
17703	(printnum_int64, printpair_int64): Define unconditionally.
17704	[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
17705	New function.
17706
177072015-08-18  Dmitry V. Levin  <ldv@altlinux.org>
17708
17709	Fix time syscall decoding for some personalities.
17710	* time.c (current_time_t_is_int32): Define.
17711	(sys_time): Use it, printnum_int, and printnum_int64 instead
17712	of printnum_long.
17713	* tests/time.c: New file.
17714	* tests/time.test: New test.
17715	* tests/Makefile.am (check_PROGRAMS): Add time.
17716	(TESTS): Add time.test.
17717	* tests/.gitignore: Add time.
17718
177192015-08-18  Mike Frysinger  <vapier@gentoo.org>
17720
17721	signal: SIGSYS: decode si_syscall & si_arch fields.
17722	When receiving SIGSYS, the si_syscall & si_arch fields are set to known
17723	values, so make sure we decode their values into the symbol settings.
17724	This makes stracing seccomp failures much easier.
17725
17726	* defs.h (syscall_name): New prototype.
17727	* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
17728	(print_si_info): Decode si_syscall & si_arch for SIGSYS.
17729	* syscall.c (undefined_scno_name): Delete.
17730	(syscall_name): New function.
17731	(trace_syscall_entering): Change undefined_scno_name to syscall_name.
17732	(trace_syscall_exiting): Likewise.
17733	* xlat/audit_arch.in: New file.
17734
177352015-08-18  Elvira Khabirova  <lineprinter0@gmail.com>
17736
17737	ipc.c: remove unnecesarry #ifdef IPC_64.
17738	* ipc.c (PRINTCTL): Remove #ifdef IPC_64 check as IPC_64 is always
17739	defined at this point.
17740
177412015-08-16  Elvira Khabirova  <lineprinter0@gmail.com>
17742
17743	resource.c: move times parser to a separate file.
17744	* times.c: New file.
17745	* Makefile.am (strace_SOURCES): Add it.
17746	* resource.c (sys_times): Move to times.c.
17747
177482015-08-16  Elvira Khabirova  <lineprinter0@gmail.com>
17749
17750	sysctl.c: remove KERN_JAVA_* defines handling.
17751	This has been obsoleted by binfmt_misc since Linux 2.1.43.
17752
17753	* sysctl.c (sys_sysctl): Remove KERN_JAVA_INTERPRETER
17754	and KERN_JAVA_APPLETVIEWER.
17755
177562015-08-16  Elvira Khabirova  <lineprinter0@gmail.com>
17757
17758	sysinfo.c: remove obsolete code.
17759	struct sysinfo members totalhigh, freehigh and mem_unit are present
17760	since Linux 2.3.48.
17761
17762	* configure.ac (AC_CHECK_MEMBERS): Remove struct sysinfo checks.
17763	* sysinfo.c (sys_sysinfo): Remove HAVE_STRUCT_SYSINFO_* checks.
17764
177652015-08-15  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>
17766
17767	tests: add readlink.test and readlinkat.test.
17768	* tests/readlink.c: New file.
17769	* tests/readlink.awk: Likewise.
17770	* tests/readlinkat.c: Likewise.
17771	* tests/readlinkat.awk: Likewise.
17772	* tests/readlink.test: New test.
17773	* tests/readlinkat.test: Likewise.
17774	* tests/Makefile.am (check_PROGRAMS): Add readlink and readlinkat.
17775	(TESTS): Add readlink.test and readlinkat.test.
17776	(EXTRA_DIST): Add readlink.awk and readlinkat.awk.
17777	* tests/.gitignore: Add readlink and readlinkat.
17778
177792015-08-09  Dmitry V. Levin  <ldv@altlinux.org>
17780
17781	Print nanoseconds along with seconds in stat family syscalls.
17782	* configure.ac (AC_CHECK_MEMBERS): Add stat.st_atim.tv_nsec,
17783	stat.st_ctim.tv_nsec, stat.st_mtim.tv_nsec, stat.st_atime_nsec,
17784	stat.st_atime_csec, and stat.st_mtime_nsec.
17785	* file.c: Explicitly define HAVE_STRUCT_STAT_ST_ATIME_NSEC,
17786	HAVE_STRUCT_STAT_ST_CTIME_NSEC and HAVE_STRUCT_STAT_ST_MTIME_NSEC
17787	for locally defined types.
17788	* printstat.h (DO_PRINTSTAT): Print st_atime_nsec, st_ctime_nsec,
17789	and st_mtime_nsec members.
17790	* tests/stat.c [_FILE_OFFSET_BITS == 64]: Use st_atime_nsec,
17791	st_ctime_nsec, and st_mtime_nsec via st_atim.tv_nsec, st_ctim.tv_nsec,
17792	and st_mtim.tv_nsec.
17793	(main): Print st_atime_nsec, st_ctime_nsec, and st_mtime_nsec members.
17794
17795	This fixes Fedora bug #1251176.
17796
177972015-08-03  Dmitry V. Levin  <ldv@altlinux.org>
17798
17799	signalfd4: fix flags decoding.
17800	* configure.ac (AC_CHECK_FUNCS): Add eventfd.
17801	(AC_CHECK_HEADERS): Add sys/signalfd.h.
17802	* signalfd.c: Include <fcntl.h>.
17803	[HAVE_SYS_SIGNALFD_H] Include <sys/signalfd.h>.
17804	Include "xlat/sfd_flags.h".
17805	(do_signalfd): Use sfd_flags for flags decoding.
17806	* xlat/sfd_flags.in: New file.
17807	* tests/signalfd.c: Likewise.
17808	* tests/signalfd.expected: Likewise.
17809	* tests/signalfd.test: New test.
17810	* tests/Makefile.am (check_PROGRAMS): Add signalfd.
17811	(TESTS): Add signalfd.test.
17812	(EXTRA_DIST): Add signalfd.expected.
17813	* tests/.gitignore: Add signalfd.
17814
17815	signalfd, signalfd4: mark return code with RVAL_FD flag.
17816	* signalfd.c (do_signalfd): Set RVAL_FD flag in the return code.
17817
17818	signal.c: move signalfd parsers to a separate file.
17819	* signalfd.c: New file.
17820	* Makefile.am (strace_SOURCES): Add it.
17821	* signal.c (do_signalfd, sys_signalfd, sys_signalfd4): Move to signalfd.c
17822
17823	perf_event_open: mark return code with RVAL_FD flag.
17824	* perf.c (sys_perf_event_open): Set RVAL_FD flag in the return code.
17825
17826	pipe, pipe2, socketpair: print returned descriptors using printfd.
17827	* net.c (printpair_fd, decode_pair_fd): New functions.
17828	(do_pipe, sys_socketpair): Use them.
17829
17830	socket: mark return code with RVAL_FD flag.
17831	* net.c (sys_socket): Set RVAL_FD flag in the return code.
17832	* tests/net-yy-accept.awk: Update socket and bind regexps.
17833	* tests/unix-yy-accept.awk: Likewise.
17834	* tests/net-yy-connect.awk: Update socket and connect regexps.
17835	* tests/unix-yy-connect.awk: Likewise.
17836
17837	timerfd, timerfd_create: mark return code with RVAL_FD flag.
17838	* time.c (sys_timerfd, sys_timerfd_create): Set RVAL_FD flag
17839	in the return code.
17840
178412015-08-02  Dmitry V. Levin  <ldv@altlinux.org>
17842
17843	inotify_init1: mark return code with RVAL_FD flag.
17844	* inotify.c (sys_inotify_init1): Set RVAL_FD flag in the return code.
17845
17846	fanotify_init: mark return code with RVAL_FD flag.
17847	* fanotify.c (sys_fanotify_init): Set RVAL_FD flag in the return code.
17848
17849	Fix epoll_create syscall decoding.
17850	* epoll.c (sys_epoll_create): New function.
17851	* linux/dummy.h (sys_epoll_create): Remove.
17852
17853	epoll_create1: mark return code with RVAL_FD flag.
17854	* epoll.c (sys_epoll_create1): Set RVAL_FD flag in the return code.
17855
17856	epoll_create1: fix pathtrace support.
17857	* pathtrace.c (pathtrace_match): Add SEN_epoll_create1.
17858
17859	epoll_create1: fix flags decoding.
17860	* xlat/epollflags.in: Remove EPOLL_NONBLOCK, provide fallback definition
17861	for EPOLL_CLOEXEC.
17862	* tests/epoll_create1.c: New file.
17863	* tests/epoll_create1.expected: Likewise.
17864	* tests/epoll_create1.test: New test.
17865	* tests/Makefile.am (check_PROGRAMS): Add epoll_create1.
17866	(TESTS): Add epoll_create1.test.
17867	(EXTRA_DIST): Add epoll_create1.expected.
17868	* tests/.gitignore: Add epoll_create1.
17869
178702015-08-01  Dmitry V. Levin  <ldv@altlinux.org>
17871
17872	desc.c: move epoll parsers to a separate file.
17873	* epoll.c: New file.
17874	* Makefile.am (strace_SOURCES): Add it.
17875	* desc.c (sys_epoll_create1, print_epoll_event, sys_epoll_ctl,
17876	print_epoll_event_array, epoll_wait_common, epoll_wait, epoll_pwait):
17877	Move to epoll.c.
17878
17879	eventfd2: fix flags decoding.
17880	* configure.ac (AC_CHECK_HEADERS): Add sys/eventfd.h.
17881	* eventfd.c: Include <fcntl.h>.
17882	[HAVE_SYS_EVENTFD_H] Include <sys/eventfd.h>.
17883	Include "xlat/efd_flags.h".
17884	(do_eventfd): Use efd_flags for flags decoding.
17885	* xlat/efd_flags.in: New file.
17886	* tests/eventfd.c: New file.
17887	* tests/eventfd.expected: Likewise.
17888	* tests/eventfd.test: New test.
17889	* tests/Makefile.am (check_PROGRAMS): Add eventfd.
17890	(TESTS): Add eventfd.test.
17891	(EXTRA_DIST): Add eventfd.expected.
17892	* tests/.gitignore: Add eventfd.
17893
17894	eventfd: print first argument as unsigned int.
17895	* eventfd.c (do_eventfd): Explicitly cast initial value to unsigned int.
17896
17897	Mark eventfd return code with RVAL_FD flag.
17898	* eventfd.c (do_eventfd): Set RVAL_FD flag in the return code.
17899
17900	desc.c: move eventfd parsers to a separate file.
17901	* eventfd.c: New file.
17902	* Makefile.am (strace_SOURCES): Add it.
17903	* desc.c (do_eventfd, sys_eventfd, sys_eventfd2): Move to eventfd.c.
17904
17905	Update PERF_FLAG_* constants.
17906	* xlat/perf_event_open_flags.in: Add PERF_FLAG_FD_CLOEXEC,
17907	provide fallback definitions.
17908
17909	desc.c: move perf_event_open parser to a separate file.
17910	* perf.c: New file.
17911	* Makefile.am (strace_SOURCES): Add it.
17912	* desc.c (sys_perf_event_open): Move to perf.c.
17913
179142015-08-01  Elvira Khabirova  <lineprinter0@gmail.com>
17915
17916	time.c: remove obsolete code from adjtimex parser.
17917	Linux versions 1.3.28 and below are not supported.
17918
17919	* time.c (tprint_timex) [LINUX_VERSION_CODE < 66332]: Remove.
17920
179212015-08-01  Elvira Khabirova  <lineprinter0@gmail.com>
17922
17923	ipc.c: move fallback definitions of msg, sem, and shm constants to xlat/
17924	* ipc.c: Move MSG_STAT and MSG_INFO definitions to xlat/msgctl_flags.in.
17925	Move SHM_STAT and SHM_INFO definitions to xlat/shmctl_flags.in.
17926	Move SEM_STAT and SEM_INFO definitions to xlat/semctl_flags.in.
17927
179282015-08-01  Dmitry V. Levin  <ldv@altlinux.org>
17929
17930	tests/ppoll: replace SIGABRT with SIGHUP.
17931	Use SIGHUP instead of SIGABRT, the number of the former
17932	is more portable across architectures.
17933
17934	* tests/ppoll.c (test2): Replace SIGABRT with SIGHUP.
17935	* tests/ppoll.expected: Update regexp.
17936	* tests/ppoll-v.expected: Likewise.
17937
179382015-08-01  Dmitry V. Levin  <ldv@altlinux.org>
17939
17940	decode_poll_exiting: reserve more space in output buffer.
17941	* poll.c (decode_poll_exiting): Reserve more space in output buffer.
17942
179432015-07-30  Dmitry V. Levin  <ldv@altlinux.org>
17944
17945	Cleanup poll/ppoll decoders.
17946	* poll.c (decode_poll): Split into print_pollfd, decode_poll_entering,
17947	and decode_poll_exiting.
17948	(sys_poll, sys_ppoll): Update callers.
17949	* tests/ppoll.c: New file.
17950	* tests/ppoll.expected: Likewise.
17951	* tests/ppoll-v.expected: Likewise.
17952	* tests/ppoll.test: New test.
17953	* tests/Makefile.am (check_PROGRAMS): Add ppoll.
17954	(TESTS): Add ppoll.test.
17955	(EXTRA_DIST): Add ppoll.expected and ppoll-v.expected.
17956	* tests/.gitignore: Add ppoll.
17957
17958	poll: print timeout argument as int.
17959	* poll.c (sys_poll): Explicitly cast timeout argument to int.
17960
17961	stream.c: move poll and ppoll parsers to a separate file.
17962	* poll.c: New file.
17963	* Makefile.am (strace_SOURCES): Add it.
17964	* stream.c (decode_poll, sys_poll, sys_ppoll): Move to poll.c.
17965
17966	Assume that <poll.h> is available.
17967	* configure.ac (AC_CHECK_HEADERS): Remove poll.h and sys/poll.h.
17968	* pathtrace.c: Include <poll.h> unconditionally.
17969	* stream.c: Likewise.
17970	[HAVE_SYS_POLL_H]: Compile unconditionally.
17971	[!HAVE_SYS_POLL_H]: Remove.
17972
17973	tests: add oldselect.test.
17974	* tests/oldselect.c: New file.
17975	* tests/oldselect.expected: Likewise.
17976	* tests/oldselect.test: New test.
17977	* tests/Makefile.am (check_PROGRAMS): Add oldselect.
17978	(TESTS): Add oldselect.test.
17979	(EXTRA_DIST): Add oldselect.expected.
17980	* tests/.gitignore: Add oldselect.
17981
179822015-07-30  Elvira Khabirova  <lineprinter0@gmail.com>
17983
17984	Fix oldselect decoding on 64-bit architectures.
17985	As struct sel_arg_struct is an array of 32-bit values,
17986	fetch it using an intermediate array on 64-bit architectures.
17987
17988	* desc.c (sys_oldselect): Rename args to long_args.
17989	[SIZEOF_LONG == 4] Alias oldselect_args to long_args.
17990	[SIZEOF_LONG != 4] Introduce oldselect_args to fetch oldselect args.
17991	* linux/sh64/syscallent.h (oldselect): Remove.
17992
179932015-07-30  Dmitry V. Levin  <ldv@altlinux.org>
17994
17995	net.c: use printaddr.
17996	* net.c (printsock, sys_recvfrom): Use printaddr.
17997
179982015-07-30  Denys Vlasenko  <dvlasenk@redhat.com>
17999
18000	net.c: recvfrom fixes.
18001	This change fixes these three problems (before/after is shown):
18002
18003	On interrupted syscall, flags are not decoded:
18004
18005	    -recvfrom(3, 0x7fff0a41e306, 10, 2, 0, 0) = ? ERESTARTSYS
18006	    +recvfrom(3, 0x7fff0a41e306, 10, MSG_PEEK, 0, 0) = ? ERESTARTSYS
18007
18008	If peer address is unavalable (example: anon sockets from socketpair()),
18009	kernel returns socklen of 0, but we ignore that and show bogus sockaddr data:
18010
18011	    -recvfrom(3, "123456789\0", 10, MSG_PEEK, {sa_family=0x7777 /* AF_??? */, sa_data="wwwwwwwwwwwwww"}, [0]) = 10
18012	    +recvfrom(3, "123456789\0", 10, MSG_PEEK, 0x7ffde6edf760, [0]) = 10
18013
18014	SYS_FUNC(recvfrom) passes address of fromlen, not fromlen, to printsock():
18015
18016	    -               printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
18017	    +               printsock(tcp, tcp->u_arg[4], fromlen);
18018
180192015-07-29  Elliott Hughes  <enh@google.com>
18020
18021	prctl: decode Android-specific PR_SET_VMA.
18022	Android kernels have a prctl to name VMAs.
18023
18024	* prctl.c (sys_prctl) [__ANDROID__]: Decode PR_SET_VMA.
18025
180262015-07-29  Dmitry V. Levin  <ldv@altlinux.org>
18027
18028	mips: fix stub files.
18029	This complements commit 140ecf876686d49085c6eb3a2306e2ea6ea641bc.
18030
18031	* linux/mips/genstub.sh: Output SEN(printargs) instead of printargs.
18032
18033	Reported-by: Elliott Hughes <enh@google.com>
18034
180352015-07-29  Dmitry V. Levin  <ldv@altlinux.org>
18036
18037	tests/bpf: fix build with incompatibly old linux/bpf.h and/or gcc.
18038	* configure.ac: Check how union bpf_attr.log_buf initialization works.
18039	* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_LOG_BUF.
18040
18041	Implement sched_getattr and sched_setattr syscalls decoding.
18042	* xlat/sched_flags.in: New file.
18043	* sched.c: Include "xlat/sched_flags.h".
18044	(print_sched_attr, sys_sched_setattr, sys_sched_getattr): New functions.
18045	* linux/dummy.h (sys_sched_getattr, sys_sched_setattr): Remove.
18046	* tests/sched_xetattr.c: New file.
18047	* tests/sched_xetattr.test: New test.
18048	* tests/Makefile.am (check_PROGRAMS): Add sched_xetattr.
18049	(TESTS): Add sched_xetattr.test.
18050	* tests/.gitignore: Add sched_xetattr.
18051
18052	Implement memfd_create syscall decoding.
18053	* memfd_create.c: New file.
18054	* Makefile.am (strace_SOURCES): Add it.
18055	* linux/dummy.h (sys_memfd_create): Remove.
18056	* pathtrace.c (pathtrace_match): Add SEN_memfd_create.
18057	* xlat/memfd_create_flags.in: New file.
18058	* tests/memfd_create.c: New file.
18059	* tests/memfd_create.expected: Likewise.
18060	* tests/memfd_create.test: New test.
18061	* tests/Makefile.am: (check_PROGRAMS): Add memfd_create.
18062	(TESTS): Add memfd_create.test.
18063	(EXTRA_DIST): Add memfd_create.expected.
18064	* tests/.gitignore: Add memfd_create.
18065
180662015-07-28  Elliott Hughes  <enh@google.com>
18067
18068	Fix builds where HAVE_MQUEUE_H isn't defined.
18069	Android doesn't have <mqueue.h>.
18070
18071	* ipc.c (sys_mq_open) [!HAVE_MQUEUE_H]: Fix printaddr invocation.
18072
180732015-07-27  Dmitry V. Levin  <ldv@altlinux.org>
18074
18075	tests/restart_syscall: skip if nanosleep looks uninterrupted.
18076	* tests/restart_syscall.test: Skip if restart_syscall is not detected
18077	and nanosleep syscall looks uninterrupted.
18078
18079	Implement execveat syscall decoding.
18080	* execve.c (decode_execve): New function.
18081	(sys_execve): Use it.
18082	(sys_execveat): New function.
18083	* linux/dummy.h (sys_execveat): Remove.
18084	* tests/execveat.c: New file.
18085	* tests/execveat.expected: Likewise.
18086	* tests/execveat-v.expected: Likewise.
18087	* tests/execveat.test: New test.
18088	* tests/Makefile.am (check_PROGRAMS): Add execveat.
18089	(TESTS): Add execveat.test.
18090	(EXTRA_DIST): Add execveat.expected and execveat-v.expected.
18091	* tests/.gitignore: Add execveat.
18092
18093	execve: fix support of personalities with different word size.
18094	* execve.c (printargc): Do not assume that host and target pointers have
18095	the same size.
18096	* tests/execve.c: New file.
18097	* tests/execve.expected: Likewise.
18098	* tests/execve-v.expected: Likewise.
18099	* tests/execve.test: New test.
18100	* tests/Makefile.am (check_PROGRAMS): Add execve.
18101	(TESTS): Add execve.test.
18102	(EXTRA_DIST): Add execve.expected and execve-v.expected.
18103	* tests/.gitignore: Add execve.
18104
18105	Implement bpf syscall decoding.
18106	* bpf.c: New file.
18107	* Makefile.am (strace_SOURCES): Add it.
18108	* configure.ac (AC_CHECK_HEADERS): Add linux/bpf.h.
18109	* linux/dummy.h (sys_bpf): Remove.
18110	* pathtrace.c (pathtrace_match): Add SEN_bpf.
18111	* xlat/bpf_commands.in: New file.
18112	* xlat/bpf_map_types.in: New file.
18113	* xlat/bpf_map_update_elem_flags.in: New file.
18114	* xlat/bpf_prog_types.in: New file.
18115	* tests/bpf.c: New file.
18116	* tests/bpf.test: New test.
18117	* tests/Makefile.am (check_PROGRAMS): Add bpf.
18118	(TESTS): Add bpf.test.
18119	* tests/.gitignore: Add bpf.
18120
181212015-07-25  Dmitry V. Levin  <ldv@altlinux.org>
18122
18123	prctl: fix decoding of unrecognized commands.
18124	The use of printargs introduced by commit v4.10-179-g210a6b6 is wrong:
18125	when the first argument is already printed, printargs cannot be called.
18126
18127	* prctl.c (print_prctl_args): New function.
18128	(sys_prctl): Use it.
18129
181302015-07-23  Dmitry V. Levin  <ldv@altlinux.org>
18131
18132	Macroize -m32/-mx32 configure checks.
18133	Prepare for additional configure checks that would be needed
18134	for new multiple personalities support.
18135
18136	* m4/mpers.m4: New file.
18137	* configure.ac: Use it.
18138
181392015-07-22  Dmitry V. Levin  <ldv@altlinux.org>
18140
18141	tests/uid: import uid overflow check from tests/uid16.
18142	* tests/uid.c (main): Skip if the uid returned by getuid matches
18143	/proc/sys/kernel/overflowuid.
18144
181452015-07-21  Dmitry V. Levin  <ldv@altlinux.org>
18146
18147	sh64: fix inotify_{add,rm}_watch syscall entries.
18148	* linux/sh64/syscallent.h (inotify_add_watch, inotify_rm_watch):
18149	Set sys_func.
18150
18151	microblaze: fix several syscall entries.
18152	* linux/microblaze/syscallent.h (signalfd4, eventfd2, epoll_create1,
18153	dup3, pipe2, inotify_init1, recvmmsg): Set sys_func.
18154
18155	hppa: fix several syscall entries.
18156	* linux/hppa/syscallent.h (remap_file_pages, mq_open, mq_unlink,
18157	mq_timedsend, mq_timedreceive, mq_notify, mq_getsetattr,
18158	clock_nanosleep, signalfd, timerfd): Set sys_func.
18159
18160	ia64: fix getpagesize syscall entry.
18161	* linux/ia64/syscallent.h (getpagesize): Fux nargs.
18162
18163	avr32: fix fstatat64 syscall entry.
18164	* linux/avr32/syscallent.h (fstatat64): Set sys_func.
18165
18166	alpha: fix 2 dummy osf syscall entries.
18167	* linux/alpha/syscallent.h (osf_set_program_attributes): Fix nargs.
18168	(osf_sigstack): Fix nargs and sys_name.
18169
18170	alpha, arm, ia64, mips, sh64: fix semop syscall entries.
18171	* linux/alpha/syscallent.h (semop): Fix nargs, set sys_func.
18172	* linux/ia64/syscallent.h (semop): Set sys_func.
18173	* linux/mips/syscallent-n32.h (semop): Likewise.
18174	* linux/mips/syscallent-n64.h (semop): Likewise.
18175	* linux/arm/syscallent.h (semop): Fix nargs.
18176	* linux/sh64/syscallent.h (semop): Likewise.
18177
18178	m68k: fix getpagesize decoding.
18179	* linux/m68k/syscallent.h (getpagesize): Set sys_func.
18180	* mem.c [M68K] (sys_getpagesize): Define.
18181
18182	tests/ip_mreq: skip if basic setsockopt operations fail.
18183	* tests/ip_mreq.c (main): Return 77 if basic
18184	IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP options cannot be set.
18185
181862015-07-21  Dmitry V. Levin  <ldv@altlinux.org>
18187
18188	tests: use -lpthread instead of -pthread.
18189	On some obscure systems, -lpthread is more likely to work than -pthread.
18190
18191	* tests/Makefile.am (filter_unavailable_LDFLAGS): Rename to
18192	filter_unavailable_LDADD and change to -lpthread.
18193
181942015-07-21  Dmitry V. Levin  <ldv@altlinux.org>
18195
18196	mips o32: fix utimensat syscall entry.
18197	* linux/mips/syscallent-o32.h (utimensat): set sys_flags and sys_func.
18198
181992015-07-21  Dmitry V. Levin  <ldv@altlinux.org>
18200
18201	linux/mips/syscallent-compat.h: use designated initializers.
18202	Change linux/mips/syscallent-compat.h to use designated initializers
18203	like normal syscallent.h files.
18204
18205	* linux/mips/syscallent-compat.h: Use designated initializers.
18206
182072015-07-21  Dmitry V. Levin  <ldv@altlinux.org>
18208
18209	linux/mips/syscallent-compat.h: fix initalization of empty entries.
18210	This complements commit 140ecf876686d49085c6eb3a2306e2ea6ea641bc.
18211
18212	* linux/mips/syscallent-compat.h: Fix initalization of empty entries.
18213
182142015-07-20  Dmitry V. Levin  <ldv@altlinux.org>
18215
18216	Remove unused parsers of getmsg and putmsg.
18217	* stream.c [SPARC || SPARC64] (sys_putmsg, sys_getmsg): Remove.
18218	Stop including "xlat/msgflags.h".
18219	* xlat/msgflags.in: Remove.
18220
18221	sigreturn: make use of RVAL_DECODED.
18222	* sigreturn.c (arch_sigreturn): New function.
18223	(sys_sigreturn): Use it.  Return RVAL_DECODED.
18224	* linux/alpha/arch_sigreturn.c: Update.
18225	* linux/crisv10/arch_sigreturn.c: Likewise.
18226	* linux/m68k/arch_sigreturn.c: Likewise.
18227	* linux/microblaze/arch_sigreturn.c: Likewise.
18228	* linux/x86_64/arch_sigreturn.c: Likewise.
18229
18230	or1k_atomic.c: make use of RVAL_DECODED.
18231	* or1k_atomic.c (sys_or1k_atomic): Update for RVAL_DECODED.
18232
18233	Update openat parser for the RVAL_DECODED change.
18234	* open.c (sys_openat): Update for RVAL_DECODED.
18235
18236	bjm.c: make use of RVAL_DECODED.
18237	* bjm.c (sys_create_module, sys_delete_module, sys_init_module,
18238	sys_finit_module): Update for RVAL_DECODED.
18239
18240	access.c: make use of RVAL_DECODED.
18241	* access.c (decode_access, sys_faccessat): Update for RVAL_DECODED.
18242
18243	affinity.c: make use of RVAL_DECODED.
18244	* affinity.c (sys_sched_setaffinity): Update for RVAL_DECODED.
18245
18246	affinity.c: use printaddr and umove_or_printaddr.
18247	* affinity.c (print_affinitylist): Use printaddr and umove_or_printaddr.
18248	(sys_sched_getaffinity): Remove redundant u_rval check.
18249
18250	aio.c: enhance io_* syscalls decoding.
18251	* aio.c (sys_io_setup): Use printnum_int64 and printnum_long.
18252	(sys_io_destroy, sys_io_submit): Update for RVAL_DECODED.
18253	(sys_io_submit): Use umove_or_printaddr and printaddr.
18254	Enclose iocb array in square brackets.
18255	Change to traditional structure output format.
18256	(print_io_event): New function.
18257	(sys_io_cancel, sys_io_getevents): Use it.
18258	(sys_io_cancel): Use umove_or_printaddr and printaddr.
18259	(sys_io_getevents): Use printaddr.
18260
18261	cacheflush.c: make use of RVAL_DECODED.
18262	* cacheflush.c (sys_cacheflush): Update for RVAL_DECODED.
18263
18264	cacheflush.c: use printaddr.
18265	* cacheflush.c (sys_cacheflush): Use printaddr.
18266
18267	capability.c: make use of RVAL_DECODED.
18268	* capability.c (sys_capset): Update for RVAL_DECODED.
18269
18270	capability.c: use printaddr and umove_or_printaddr.
18271	* capability.c (get_cap_header): Use printaddr.
18272	(print_cap_data): Use printaddr and umove_or_printaddr.
18273
18274	chdir.c: make use of RVAL_DECODED.
18275	* chdir.c (sys_chdir): Update for RVAL_DECODED.
18276
18277	chmod.c: make use of RVAL_DECODED.
18278	* chmod.c (decode_chmod): Change to return void.
18279	(sys_chmod, sys_fchmodat): Update callers.  Update for RVAL_DECODED.
18280	(sys_fchmod): Update for RVAL_DECODED.
18281
18282	clone.c: make use of RVAL_DECODED.
18283	* clone.c (sys_setns, sys_unshare, sys_fork): Update for RVAL_DECODED.
18284
18285	Alias sys_epoll_create to printargs_ld.
18286	* desc.c (sys_epoll_create): Remove.
18287	* linux/dummy.h (sys_epoll_create): Alias to printargs_ld.
18288
18289	desc.c: make use of RVAL_DECODED.
18290	* desc.c (sys_flock, sys_close, sys_dup, do_dup2, sys_epoll_create1,
18291	sys_epoll_ctl, do_eventfd, sys_perf_event_open): Update
18292	for RVAL_DECODED.
18293
18294	desc.c: do not use xmalloc, use umove_or_printaddr and printaddr.
18295	* desc.c (printflock64, printflock): Use umove_or_printaddr.
18296	(decode_select): Do not use xmalloc.  Use umoven_or_printaddr
18297	and printaddr.
18298	(sys_oldselect): Use printaddr.
18299	(sys_epoll_ctl): Use umoven_or_printaddr and printaddr.
18300	(print_epoll_event_array): New function.
18301	(sys_epoll_wait_common): Use it.
18302	(sys_pselect6): Use umove_or_printaddr.
18303	(sys_eventfd2): Use printaddr.
18304
18305	xlat/epollctls.in: add default values.
18306	* xlat/epollctls.in (EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD): Add
18307	default values.
18308
18309	dirent.c: do not use xmalloc.
18310	* dirent.c (print_old_dirent): Use umove_or_printaddr.
18311	(sys_readdir): Use printaddr.
18312	(sys_getdents, sys_getdents64): Do not use xmalloc for dirents,
18313	treat malloc failure the same way as umoven failure.  Use printaddr.
18314
18315	execve.c: make use of RVAL_DECODED.
18316	* execve.c (sys_execve, sys_execv): Update for RVAL_DECODED.
18317
18318	execve.c: use printaddr and umove_or_printaddr.
18319	* execve.c (printargv): Use umoven_or_printaddr.
18320	(sys_execve, sys_execv): Use printaddr.
18321
18322	fadvise.c: make use of RVAL_DECODED.
18323	* fadvise.c (sys_fadvise64, sys_fadvise64_64): Update for RVAL_DECODED.
18324
18325	fallocate.c: make use of RVAL_DECODED.
18326	* fallocate.c (sys_fallocate): Update for RVAL_DECODED.
18327
18328	fanotify.c: make use of RVAL_DECODED.
18329	* fanotify.c (sys_fanotify_init, sys_fanotify_mark): Update
18330	for RVAL_DECODED.
18331
18332	fchownat.c: make use of RVAL_DECODED.
18333	* fchownat.c (sys_fchownat): Update for RVAL_DECODED.
18334
18335	file.c: use umove_or_printaddr.
18336	* file.c (printstat32, printstatsol): Remove.
18337	(printstat, printstat64, printoldstat): Use umove_or_printaddr.
18338
18339	futex.c: enhance futex syscall decoding.
18340	* futex.c (sys_futex): Use switch statement.  Use printaddr.
18341	Print uint32_t syscall arguments using %u format.
18342	Update for RVAL_DECODED.
18343
18344	get_robust_list.c: use printnum_long.
18345	* get_robust_list.c (sys_get_robust_list): Use printnum_long.
18346
18347	getcpu.c: use printnum_int and printaddr.
18348	* getcpu.c (sys_getcpu): Use printnum_int and printaddr.
18349
18350	getcwd.c: use printaddr.
18351	* getcwd.c (sys_getcwd): Use printaddr.
18352
18353	getrandom.c: use printaddr.
18354	* getrandom.c (sys_getrandom): Use printaddr.
18355
18356	hostname.c: make use of RVAL_DECODED.
18357	* hostname.c (sys_sethostname): Update for RVAL_DECODED.
18358
18359	hostname.c: use printaddr.
18360	* hostname.c (sys_gethostname): Use printaddr.
18361
18362	inotify.c: make use of RVAL_DECODED.
18363	* inotify.c (sys_inotify_add_watch, sys_inotify_rm_watch,
18364	sys_inotify_init1): Update for RVAL_DECODED.
18365
18366	io.c: make use of RVAL_DECODED.
18367	* io.c (sys_write, sys_writev, sys_pwrite, sys_pwritev, sys_sendfile,
18368	sys_sendfile64, sys_tee, sys_splice, sys_vmsplice): Update
18369	for RVAL_DECODED.
18370
18371	Use printnum_int64 instead of print_loff_t.
18372	* defs.h (print_loff_t): Remove.
18373	* io.c (print_loff_t): Remove.
18374	(sys_sendfile64, sys_splice): Use printnum_int64 instead of print_loff_t.
18375	* mtd.c (mtd_ioctl): Likewise.
18376
18377	io.c: use printaddr and umove_or_printaddr.
18378	* io.c (sys_read, sys_pread): Use printaddr.
18379	(tprint_iov_upto): Do not fetch data in case of syserror.
18380	Use printaddr.
18381	(sys_readv, sys_preadv): Remove redundant check for syserror.
18382	(print_off_t): Use printnum_int and printnum_long.
18383	(print_loff_t): Use umove_or_printaddr.
18384
18385	ioprio.c: make use of RVAL_DECODED.
18386	* ioprio.c (sys_ioprio_set): Update for RVAL_DECODED.
18387
18388	ipc.c: use printaddr and umove_or_printaddr.
18389	* ipc.c (sys_msgctl): Use printaddr.
18390	(tprint_msgbuf): New function.
18391	(tprint_msgsnd, tprint_msgrcv): Use it.
18392	(sys_msgrcv): Use umove_or_printaddr.
18393	(tprint_sembuf): Rename to tprint_sembuf_array.
18394	(tprint_sembuf): New function.
18395	(tprint_sembuf_array): Use it.
18396	(sys_semop, sys_semtimedop): Update callers.
18397	(sys_shmctl, sys_shmat, sys_shmdt): Use printaddr.
18398	(sys_mq_open, printmqattr): Use printaddr and umove_or_printaddr.
18399	* tests/ipc_msg.c (main): Update msgctl IPC_RMID regexp.
18400	* tests/ipc_shm.c (main): Update shmctl IPC_RMID regexp.
18401
18402	kexec.c: use printaddr and umove_or_printaddr.
18403	* kexec.c (print_seg): New function.
18404	(print_kexec_segments): Use it.  Use printaddr and umove_or_printaddr.
18405	(kexec_load): Use printaddr.  Update for RVAL_DECODED.
18406
18407	keyctl.c: make use of RVAL_DECODED.
18408	* keyctl.c (sys_add_key, sys_request_key): Update for RVAL_DECODED.
18409	(keyctl_join_session_keyring, keyctl_handle_key,
18410	keyctl_set_reqkey_keyring): Remove.
18411	(keyctl_get_keyring_id, keyctl_update_key, keyctl_handle_key_key,
18412	keyctl_read_key, keyctl_keyring_search, keyctl_chown_key,
18413	keyctl_instantiate_key, keyctl_instantiate_key_iov, keyctl_negate_key,
18414	keyctl_reject_key, keyctl_set_timeout, keyctl_get_persistent,
18415	keyctl_setperm_key): Change to return void.
18416	Update for RVAL_DECODED.
18417	(sys_keyctl): Update callers.  Update for RVAL_DECODED.
18418
18419	keyctl.c: use printaddr.
18420	* keyctl.c (keyctl_read_key): Use printaddr.
18421
18422	ldt.c: make use of RVAL_DECODED.
18423	* ldt.c (sys_modify_ldt, sys_set_thread_area, sys_get_thread_area):
18424	Update for RVAL_DECODED.
18425
18426	ldt.c: use printaddr and umove_or_printaddr.
18427	* ldt.c [I386 || X86_64 || X32] (print_user_desc):
18428	Use umove_or_printaddr.
18429	[I386 || X86_64 || X32] (sys_modify_ldt): Use printaddr.
18430	[(M68K || MIPS] (set_thread_area): Likewise.
18431	[I386 || X86_64 || X32] (set_thread_area): Do not fetch data
18432	if !verbose.
18433	[I386 || X86_64 || X32] (get_thread_area): Remove redundant check
18434	for syserror.
18435
18436	link.c: make use of RVAL_DECODED.
18437	* link.c (sys_link, sys_linkat, sys_unlinkat, sys_symlinkat): Update
18438	for RVAL_DECODED.
18439
18440	lseek.c: make use of RVAL_DECODED.
18441	* lseek.c (sys_lseek): Update for RVAL_DECODED.
18442
18443	lseek.c: use printnum_int64.
18444	* lseek.c (sys_llseek): Use printnum_int64.
18445
18446	mem.c: make use of RVAL_DECODED.
18447	* mem.c (print_mmap): Change to return void.
18448	Update for RVAL_DECODED.
18449	(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
18450	sys_mmap_4koff): Update callers.  Update for RVAL_DECODED.
18451	(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
18452	sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
18453	sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
18454	Update for RVAL_DECODED.
18455
18456	mem.c: use printaddr and umove_or_printaddr.
18457	* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
18458	sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
18459	sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
18460	(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
18461
18462	mknod.c: make use of RVAL_DECODED.
18463	* mknod.c (decode_mknod): Change to return void.
18464	Update for RVAL_DECODED.
18465	(sys_mknod, sys_mknodat): Update callers.  Update for RVAL_DECODED.
18466	[SPARC || SPARC64] (xmknod): Update for RVAL_DECODED.
18467
18468	mount.c: make use of RVAL_DECODED.
18469	* mount.c (sys_mount): Update for RVAL_DECODED.
18470
18471	mount.c: use printaddr.
18472	* mount.c (sys_mount): Use printaddr.
18473
18474	Alias sys_connect to sys_bind.
18475	* linux/dummy.h (sys_connect): Alias to sys_bind.
18476	* net.c (sys_connect): Remove.
18477
18478	net.c: make use of RVAL_DECODED.
18479	* net.c (sys_socket, sys_bind, sys_listen, sys_send, sys_sendto,
18480	sys_sendmsg, sys_shutdown, sys_setsockopt): Update for RVAL_DECODED.
18481
18482	net.c: use printaddr and umove_or_printaddr.
18483	* net.c (printsock): Use printaddr and umove_or_printaddr.
18484	(printcmsghdr, printmsghdr, printmmsghdr, decode_mmsg, do_sockname,
18485	sys_recv, sys_recvfrom, sys_recvmsg, do_pipe, print_linger, print_ucred,
18486	print_tpacket_stats, print_icmp_filter, print_getsockopt,
18487	print_group_req, print_tpacket_req, print_packet_mreq,
18488	print_setsockopt): Use printaddr.
18489	(print_mreq, print_mreq6): Use umove_or_printaddr.
18490
184912015-07-18  Elvira Khabirova  <lineprinter0@gmail.com>
18492
18493	tests: add sigaltstack.test.
18494	* tests/sigaltstack.c: New file.
18495	* tests/sigaltstack.expected: Likewise.
18496	* tests/sigaltstack.test: New test.
18497	* tests/Makefile.am (check_PROGRAMS): Add sigaltstack.
18498	(TESTS): Add sigaltstack.test.
18499	(EXTRA_DIST): sigaltstack.expected.
18500	* tests/.gitignore: Add sigaltstack.
18501
18502	bootstrap: delete personality test directories beforehand.
18503	* bootstrap: Delete tests-m32 and tests-mx32 directories
18504	before creating them.
18505
185062015-07-18  Dmitry V. Levin  <ldv@altlinux.org>
18507
18508	defs.h: do not include <signal.h>
18509	* printsiginfo.h: New file.
18510	* Makefile.am (strace_SOURCES): Add it.
18511	* defs.h: Do not include <signal.h>.
18512	(printsiginfo): Remove.
18513	* printsiginfo.c: Include <signal.h> and "printsiginfo.h".
18514	* strace.c: Likewise.
18515	* sigaltstack.c: Include <signal.h>.
18516	* signal.c: Likewise.
18517	* sigreturn.c: Likewise.
18518	* time.c: Likewise.
18519
18520	resource.c: move printrusage and printrusage32 to a separate file.
18521	* printrusage.c: New file.
18522	* Makefile.am (strace_SOURCES): Add it.
18523	* resource.c (printrusage, [ALPHA] printrusage32): Move
18524	to printrusage.c.
18525
18526	open.c: make use of RVAL_DECODED.
18527	* open.c (decode_open, sys_creat): Update for RVAL_DECODED.
18528
18529	personality.c: make use of RVAL_DECODED.
18530	* personality.c (sys_personality): Update for RVAL_DECODED.
18531
18532	printsiginfo.c: use umove_or_printaddr.
18533	* printsiginfo.c (printsiginfo_at): Use umove_or_printaddr.
18534
18535	prctl.c: make use of RVAL_DECODED.
18536	* prctl.c (prctl_enter, prctl_exit): Merge into sys_prctl.
18537	(sys_prctl, sys_arch_prctl): Update for RVAL_DECODED.
18538
18539	prctl.c: use printaddr and umove_or_printaddr.
18540	* prctl.c (prctl_exit): Use printaddr and umove_or_printaddr.
18541
18542	process.c: use printaddr.
18543	* process.c (sys_ptrace): Use printaddr.
18544
18545	process_vm.c: make use of RVAL_DECODED.
18546	* process_vm.c (sys_process_vm_writev): Update for RVAL_DECODED.
18547
18548	process_vm.c: use printaddr.
18549	* process_vm.c (sys_process_vm_readv): Use printaddr.
18550
18551	reboot.c: make use of RVAL_DECODED.
18552	* reboot.c (sys_reboot): Update for RVAL_DECODED.
18553
18554	Enhance quotactl decoding.
18555	* quota.c (decode_cmd_data): Use umove_or_printaddr.
18556	(sys_quotactl): Do not disable the parser in verbose mode.
18557	Decode all "set" commands on entering syscall.
18558
18559	readahead.c: make use of RVAL_DECODED.
18560	* readahead.c (sys_readahead.c): Update for RVAL_DECODED.
18561
18562	readlink.c: use printaddr.
18563	* readlink.c (decode_readlink): Use printaddr.
18564
18565	renameat.c: make use of RVAL_DECODED.
18566	* renameat.c (sys_renameat, sys_renameat2): Update for RVAL_DECODED.
18567
18568	resource.c: make use of RVAL_DECODED.
18569	* resource.c (sys_setrlimit, sys_getpriority, sys_setpriority):
18570	Update for RVAL_DECODED.
18571
18572	resource.c: use umove_or_printaddr.
18573	* resource.c (print_rlimit64, print_rlimit32, printrusage32,
18574	printrusage, sys_times): Use umove_or_printaddr.
18575	(decode_rlimit64): Remove.
18576	(decode_rlimit): Remove redundant checks.
18577	[defined(current_wordsize) && current_wordsize != 4] (decode_rlimit):
18578	Define to print_rlimit64.
18579	(sys_prlimit64): Replace decode_rlimit64 with print_rlimit64.
18580
18581	sched.c: make use of RVAL_DECODED.
18582	* sched.c (sys_sched_setscheduler, sys_sched_setparam,
18583	sys_sched_get_priority_min): Update for RVAL_DECODED.
18584
18585	sched.c: use printnum_int and printaddr.
18586	* sched.c (sys_sched_setscheduler, sys_sched_getparam,
18587	sys_sched_setparam): Use printnum_int for sched_param decoding.
18588	(sched_rr_get_interval): Use printaddr.
18589
18590	scsi.c: use printaddr.
18591	* scsi.c (print_sg_io_buffer): Use printaddr.
18592
185932015-07-17  Dmitry V. Levin  <ldv@altlinux.org>
18594
18595	seccomp.c: make use of RVAL_DECODED.
18596	* seccomp.c (sys_seccomp): Update for RVAL_DECODED.
18597
18598	seccomp.c: use printaddr and umove_or_printaddr.
18599	* seccomp.c (decode_fprog, decode_seccomp_set_mode_strict):
18600	Use printaddr.
18601	(print_seccomp_filter): Use umove_or_printaddr.
18602
18603	sigaltstack.c: use printaddr and umove_or_printaddr.
18604	* sigaltstack.c (print_stack_t): Use umove_or_printaddr and printaddr.
18605
18606	signal.c: make use of RVAL_DECODED.
18607	* signal.c (sys_sigsuspend, sys_kill, sys_tgkill, sys_rt_sigsuspend,
18608	sys_rt_sigqueueinfo, sys_rt_tgsigqueueinfo, sys_restart_syscall,
18609	do_signalfd): Update for RVAL_DECODED.
18610
18611	signal.c: use printaddr and umove_or_printaddr.
18612	* signal.c (print_sigset_addr_len, decode_old_sigaction):
18613	Use printaddr and umove_or_printaddr.
18614	(sys_signal): Use printaddr.
18615	(sys_sigprocmask, sys_sigpending, sys_rt_sigprocmask,
18616	sys_rt_sigpending): Remove redundant checks for syserror.
18617	(decode_new_sigaction): Use umove_or_printaddr.
18618
186192015-07-16  Dmitry V. Levin  <ldv@altlinux.org>
18620
18621	sram_alloc.c: make use of RVAL_DECODED.
18622	* sram_alloc.c [BFIN] (sys_sram_alloc): Update for RVAL_DECODED.
18623
18624	statfs.c: use umove_or_printaddr.
18625	* statfs.c (printstatfs, printstatfs64, printcompat_statfs64):
18626	Use umove_or_printaddr.
18627
18628	swapon.c: make use of RVAL_DECODED.
18629	* swapon.c (sys_swapon): Update for RVAL_DECODED.
18630
18631	swapon.c: move fallback definitions of swap options to xlat/
18632	* swapon.c: Move definitions of SWAP_FLAG_* flags ...
18633	* xlat/swap_flags.in: ... here.
18634
18635	sync_file_range2: fix typo in flags decoding.
18636	* sync_file_range.c (sys_sync_file_range2): Fix typo in flags decoding.
18637
18638	sync_file_range.c: make use of RVAL_DECODED.
18639	* sync_file_range.c (sys_sync_file_range, sys_sync_file_range2): Update
18640	for RVAL_DECODED.
18641
18642	syslog.c: use umove_or_printaddr and RVAL_DECODED.
18643	* sysctl.c (sys_sysctl): Use umove_or_printaddr and RVAL_DECODED.
18644
18645	sysinfo.c: use umove_or_printaddr.
18646	* sysinfo.c (sys_sysinfo): Use umove_or_printaddr.
18647
18648	syslog.c: make use of RVAL_DECODED.
18649	* syslog.c (sys_syslog): Update for RVAL_DECODED.
18650
18651	syslog.c: use printaddr.
18652	* syslog.c (sys_syslog): Use printaddr.
18653
18654	sysmips.c: cleanup.
18655	* sysmips.c [MIPS] (sys_sysmips): Use switch statement.  Use printaddr.
18656	Fix misprinted ", " delimiter.
18657
18658	sysmips.c: make use of RVAL_DECODED.
18659	* sysmips.c [MIPS] (sys_sysmips): Update for RVAL_DECODED.
18660
18661	time.c: make use of RVAL_DECODED.
18662	* time.c (sys_settimeofday, sys_osf_settimeofday, sys_clock_settime,
18663	sys_timerfd, sys_timerfd_create, sys_timerfd_settime): Update
18664	for RVAL_DECODED.
18665	(timerfd_gettime): Decode struct itimerspec argument on exiting syscall.
18666
18667	time.c: use printaddr, printnum_int, and umoven_or_printaddr.
18668	* time.c (sys_nanosleep): Use printaddr.
18669	(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
18670	printsigevent): Use umoven_or_printaddr.
18671	(sys_timer_create): Use printnum_int.
18672	(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
18673	do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
18674	redundant checks for syserror.
18675
18676	sprinttv: do not fetch data in case of syserror.
18677	* time.c (sprinttv): Do not fetch data in case syserror.
18678	Print address instead of {...} in case of umove failure.
18679	(sys_gettimeofday, sys_osf_gettimeofday, sys_adjtime, sys_clock_gettime,
18680	clock_nanosleep): Remove now redundant checks for syserror.
18681
18682	truncate.c: make use of RVAL_DECODED.
18683	* truncate.c (sys_truncate, sys_truncate64, sys_ftruncate,
18684	sys_ftruncate64): Update for RVAL_DECODED.
18685
18686	umask.c: make use of RVAL_DECODED.
18687	* umask.c (sys_umask): Update for RVAL_DECODED.
18688
18689	umount.c: make use of RVAL_DECODED.
18690	* umount.c (sys_umount2): Update for RVAL_DECODED.
18691
18692	utimes.c: make use of RVAL_DECODED.
18693	* utimes.c (decode_utimes): Change to return void.
18694	Update for RVAL_DECODED.
18695	(sys_utimes, sys_futimesat, sys_utimensat, sys_osf_utimes):
18696	Update callers.  Update for RVAL_DECODED.
18697
186982015-07-16  Dmitry V. Levin  <ldv@altlinux.org>
18699
18700	tests/uid.test: adopt for alpha.
18701	Make the test work on alpha that has getxuid syscall instead of getuid.
18702
18703	* tests/uid.awk (BEGIN): Update getuid regexp to match both getuid
18704	and getxuid syscalls.
18705	* tests/uid.c (main): Allow __NR_getxuid as an alternative
18706	to __NR_getuid.
18707	* tests/uid.test: If getuid syscall is not available, probe for
18708	getxuid syscall.
18709
187102015-07-16  Dmitry V. Levin  <ldv@altlinux.org>
18711
18712	uid.c: make use of RVAL_DECODED.
18713	* uid.c (sys_setuid, sys_setreuid, sys_setresuid, sys_chown, sys_fchown,
18714	sys_setgroups): Update for RVAL_DECODED.
18715
18716	uid.c: use printaddr and umoven_or_printaddr.
18717	* uid.c (get_print_uid): Use umoven_or_printaddr.
18718	(sys_getresuid): Do not check for syserror, get_print_uid now does
18719	the right thing.
18720	(sys_setgroups, sys_getgroups): Add const qualifier to local variables
18721	that are assigned once.  Use printaddr.
18722
18723	ia64: wire up utimensat syscall.
18724	* linux/ia64/syscallent.h (utimensat): New entry.
18725
18726	decode_utimes: enclose timespec array in square brackets.
18727	* utimes.c (decode_utimes): enclose timespec array in square brackets
18728	instead of curly brackets.
18729
18730	uname.c: use umove_or_printaddr.
18731	* uname.c (sys_uname): Use umove_or_printaddr.
18732
18733	tests: add utime.test.
18734	* tests/utime.c: New file.
18735	* tests/utime.test: New test.
18736	* tests/Makefile.am (check_PROGRAMS): Add utime.
18737	(TESTS): Add utime.test.
18738	* tests/.gitignore: Add utime.
18739
18740	utime.c: make use of RVAL_DECODED.
18741	* utime.c (sys_utime): Update for RVAL_DECODED.
18742
18743	utime.c: use umoven_or_printaddr.
18744	* utime.c (sys_utime): Use umoven_or_printaddr.
18745
187462015-07-15  Dmitry V. Levin  <ldv@altlinux.org>
18747
18748	wait.c: use printaddr and umove_or_printaddr.
18749	* wait.c (waitid): Do not check for NULL the address passed
18750	to printrusage.
18751	(printwaitn): Likewise.
18752	Use printaddr and umove_or_printaddr for fetching wait status.
18753
18754	wait: move fallback definitions of wait options to xlat/
18755	* wait.c: Move definitions of __W* flags ...
18756	* xlat/wait4_options.in: ... here.
18757
18758	tests: add xattr.test.
18759	* tests/xattr.c: New file.
18760	* tests/xattr.expected: Likewise.
18761	* tests/xattr.test: New test.
18762	* tests/Makefile.am (check_PROGRAMS): Add xattr.
18763	(TESTS): Add xattr.test.
18764	(EXTRA_DIST): Add xattr.expected.
18765	* tests/.gitignore: Add xattr.
18766
187672015-07-14  Dmitry V. Levin  <ldv@altlinux.org>
18768
18769	xattr.c: make use of RVAL_DECODED.
18770	* xattr.c (sys_setxattr, sys_fsetxattr, sys_removexattr,
18771	sys_fremovexattr): Update for RVAL_DECODED.
18772
18773	print_xattr_val: do not fetch data in case of !verbose || syserror.
18774	* xattr.c (print_xattr_val): Do not fetch data in case
18775	of !verbose || syserror.   Use printaddr.
18776
18777	print_xattr_list: use printaddr.
18778	* xattr.c (print_xattr_list): Use printaddr.
18779
18780	print_xattr_val: remove unused argument.
18781	* xattr.c (print_xattr_val): Remove unused "failed" argument.
18782	(sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr): Update
18783	all callers.
18784
18785	print_xattr_list: remove redundant address check.
18786	* xattr.c (print_xattr_list): Do not check for NULL the address passed
18787	to printstr.
18788
18789	ipc.c: make use of RVAL_DECODED.
18790	* ipc.c (sys_mq_notify, sys_mq_open, sys_mq_timedreceive,
18791	sys_mq_timedsend, sys_msgctl, sys_msgget, sys_msgsnd, sys_semctl,
18792	sys_semget, sys_semop, sys_semtimedop, sys_shmctl, sys_shmdt,
18793	sys_shmget): Update for RVAL_DECODED.
18794	(sys_shmat): Decode all arguments on entering syscall.
18795
187962015-07-14  Dmitry V. Levin  <ldv@altlinux.org>
18797
18798	umoven_or_printaddr: do not fetch data if not in verbose mode.
18799	After this change, umoven_or_printaddr and its callers, including
18800	printnum_* and printpair_*, will not fetch data in !verbose mode.
18801
18802	* util.c (umoven_or_printaddr): Do not call umoven if !verbose.
18803
188042015-07-14  Dmitry V. Levin  <ldv@altlinux.org>
18805
18806	Change printnum_* printers to honor syserror.
18807	With this change, printnum_* printers will not attempt to fetch data
18808	in case of exiting(tcp) && syserror(tcp).
18809	All "at exiting" decoders that call these printers have been made
18810	ready for this change in previous commits.
18811
18812	* util.c (DEF_PRINTNUM, DEF_PRINTPAIR): Use umove_or_printaddr.
18813	* prctl.c (prctl_exit): Use printnum_int and printnum_long.
18814	(sys_arch_prctl): Do not check for syserror.
18815
188162015-07-13  Dmitry V. Levin  <ldv@altlinux.org>
18817
18818	term.c: enhance tty ioctl parser.
18819	Decode as much data on entering syscall as possible.
18820
18821	* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
18822	decode_modem_flags): New functions.
18823	(term_ioctl): Use them.  Update for RVAL_DECODED.
18824
188252015-07-12  Elvira Khabirova  <lineprinter0@gmail.com>
18826
18827	Change comparisons with function pointers to comparisons with SENs.
18828	* pathtrace.c (pathtrace_match): Change all comparisons with function
18829	pointers to a single SEN based switch.
18830	* syscall.c (dumpio, trace_syscall_entering): Change all comparisons
18831	with function pointers to comparisons with SENs.
18832	* ipc.c (sys_ipc): Remove.
18833	* sock.c (sys_socketcall): Likewise.
18834	* linux/dummy.h (sys_ipc, sys_socketcall): New aliases.
18835
18836	Add unique syscall entry numbers (SENs)
18837	* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sen.h.
18838	(syscallent_names, syscallent_patterns, syscallent_files): New variables.
18839	(sen.h): New rule.
18840	* defs.h (struct sysent): Add sen field.
18841	* generate_sen.sh: New file.
18842	* linux/syscall.h: Include "sen.h".
18843	* syscall.c (SEN_NAME): New temporary macro.
18844	(SEN): Use it to prepend syscall entry number.
18845
18846	Introduce SEN macro.
18847	* syscall.c (SEN): New temporary macro.
18848	* linux/dummy.h (sys_printargs): New macro.
18849	* linux/subcall.h: Wrap all sys_func entries using SEN.
18850	* linux/*/syscallent*.h: Likewise.
18851
188522015-07-10  Dmitry V. Levin  <ldv@altlinux.org>
18853
18854	scsi.c: enhance SG_IO ioctl parser.
18855	Fix SG_IO ioctl output in case of failed umove
18856
18857	* scsi.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
18858	Update for RVAL_DECODED.
18859	(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
18860	print_sg_io_v4_res): Do not print address in case of failed umove.
18861	(scsi_ioctl): Use printaddr.
18862
188632015-07-10  Dmitry V. Levin  <ldv@altlinux.org>
18864
18865	ptp.c: enhance ptp ioctl parser.
18866	* ptp.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
18867	Update for RVAL_DECODED.
18868	(ptp_ioctl): Use umove_or_printaddr.
18869
188702015-07-10  Dmitry V. Levin  <ldv@altlinux.org>
18871
18872	mtd.c: enhance mtd and ubi ioctl parsers.
18873	Decode as much data on entering syscall as possible.
18874
18875	* xlat/mtd_file_mode_options.in: New file.
18876	* mtd.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
18877	Include "xlat/mtd_file_mode_options.h".
18878	Update for RVAL_DECODED.
18879	(mtd_ioctl, ubi_ioctl): Use printnum_int and umove_or_printaddr.
18880
188812015-07-10  Dmitry V. Levin  <ldv@altlinux.org>
18882
18883	sock.c: enhance socket ioctl parser.
18884	Decode as much data on entering syscall as possible.
18885
18886	* sock.c: Update for RVAL_DECODED.
18887	(print_addr): Remove.
18888	(print_ifreq_addr, print_ifreq, print_ifc_len, decode_ifconf): New
18889	functions.
18890	(sock_ioctl) Use them.  Use umove_or_printaddr.
18891
188922015-07-10  Dmitry V. Levin  <ldv@altlinux.org>
18893
18894	block.c: enhance block ioctl parser.
18895	* block.c: Update for RVAL_DECODED.
18896	Define BLKROTATIONAL and BLKZEROOUT.
18897	(block_ioctl): Decode them.  Use printnum_short, printnum_int,
18898	printnum_long, printpair_int64, and umove_or_printaddr.
18899	(print_blkpg_req, block_ioctl): Use umove_or_printaddr.
18900
189012015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18902
18903	blkpg_ops: add BLKPG_RESIZE_PARTITION constant.
18904	* xlat/blkpg_ops.in: Add BLKPG_RESIZE_PARTITION.
18905
18906	Reported-by: Christian Neukirchen <chneukirchen@gmail.com>
18907
189082015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18909
18910	loop.c: enhance loop ioctl parser.
18911	Decode as much data on entering syscall as possible.
18912
18913	* loop.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
18914	Update for RVAL_DECODED.
18915	(decode_loop_info, decode_loop_info64): New functions.
18916	(loop_ioctl): Use them.  Decode LOOP_SET_STATUS, LOOP_SET_STATUS64,
18917	LOOP_SET_FD, LOOP_CHANGE_FD, LOOP_CTL_ADD and LOOP_CTL_REMOVE on
18918	entering syscall.
18919	Print LOOP_SET_FD and LOOP_CHANGE_FD arguments using printfd.
18920
189212015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18922
18923	rtc.c: enhance rtc ioctl parser.
18924	* rtc.c: Update for RVAL_DECODED.
18925	(print_rtc): Rename to print_rtc_time.
18926	(decode_rtc_time, decode_rtc_wkalrm): New functions.
18927	(rtc_ioctl): Use them.
18928	[RTC_VL_READ]: Decode RTC_VL_READ.
18929	Use printnum_long for RTC_IRQP_READ and RTC_EPOCH_READ decoding.
18930
18931	Use printpair_int.
18932	* evdev.c (repeat_ioctl): Use printpair_int.
18933	* net.c (do_pipe, sys_socketpair): Likewise.
18934
189352015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18936
18937	Add several generic integer pairs printing functions.
18938	Add functions to fetch and print pairs of integer types.
18939	Note that these printers do not attempt to fetch data
18940	in case of exiting(tcp) && syserror(tcp).
18941
18942	printnum_* printers will follow as soon as all callers are made ready
18943	for this change.
18944
18945	* defs.h (printpair_int, printpair_long, printpair_int64): New
18946	prototypes.
18947	* util.c (DEF_PRINTPAIR): New macro.
18948	(printpair_int, printpair_long, printpair_int64): New functions.
18949
189502015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18951
18952	Add two generic integer printing functions.
18953	Add printnum_short and printnum_int64 in addition to already existing
18954	printnum_int and printnum_long.
18955
18956	* defs.h (printnum_short, printnum_int64): New prototypes.
18957	* util.c (DEF_PRINTNUM): New macro.
18958	(printnum_int, printnum_long): Use DEF_PRINTNUM.
18959	(printnum_short, printnum_int64): New functions.
18960
189612015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18962
18963	Add address printing functions.
18964	printaddr is a simple function implementing "print NULL or address"
18965	idiom.
18966	umoven_or_printaddr is a wrapper around umoven that has the same return
18967	value semantics as umoven but also prints the address when the data
18968	is not going to be fetched (in case of exiting(tcp) && syserror(tcp))
18969	or cannot be fetched (umoven fails).
18970	umove_or_printaddr is a macro wrapper around umoven_or_printaddr that
18971	mirrors umove wrapper around umoven.
18972
18973	* defs.h (printaddr, umoven_or_printaddr): New prototypes.
18974	(umove_or_printaddr): New macro.
18975	* util.c (printaddr, umoven_or_printaddr): New functions.
18976
189772015-07-09  Dmitry V. Levin  <ldv@altlinux.org>
18978
18979	Implement RVAL_DECODED flag.
18980	Implement a method for "on entering" parsers to return
18981	"done with decoding" information to their callers.
18982
18983	If a syscall parser called from trace_syscall_entering returns a value
18984	with RVAL_DECODED bit set, record this value in tcp->sys_func_rval
18985	and use it in trace_syscall_exiting instead of calling the parser on
18986	exiting syscall.
18987
18988	If an ioctl parser returned RVAL_DECODED, this would tell
18989	SYS_FUNC(ioctl) that the decoding is finished but fallback printing of
18990	the ioctl command argument is needed, while e.g. RVAL_DONE+1 would mean
18991	that the decoding is finished and no fallback decoding is needed.
18992
18993	* defs.h (struct tcb): Add sys_func_rval.
18994	(RVAL_DECODED): New macro.
18995	* syscall.c (trace_syscall_entering): Initialize tcp->sys_func_rval
18996	along with setting TCB_INSYSCALL flag.
18997	(trace_syscall_exiting): Use tcp->sys_func_rval instead of calling
18998	tcp->s_ent->sys_func when the former has RVAL_DECODED flag set.
18999	Reset tcp->sys_func_rval along with clearing TCB_INSYSCALL flag.
19000	* ioctl.c (sys_ioctl): Set RVAL_DECODED flag on exiting.
19001	Print ioctl argument iff RVAL_DECODED is set and fallback decoding
19002	is requested.
19003
190042015-07-05  Dmitry V. Levin  <ldv@altlinux.org>
19005
19006	time.c: move rtc ioctl parser to a separate file.
19007	* rtc.c: new file
19008	* Makefile.am (strace_SOURCES): Add it.
19009	* time.c (print_rtc, rtc_ioctl): Move to rtc.c.
19010
19011	term.c: fix typo.
19012	* term.c: Rename TCLFLSH to TCFLSH.
19013
19014	Do not include sys/filio.h.
19015	* configure.ac (AC_CHECK_HEADERS): Remove sys/filio.h.
19016	* term.c: Do not include <sys/filio.h>.
19017
190182015-07-02  Dmitry V. Levin  <ldv@altlinux.org>
19019
19020	ioctl: prepare ioctl_decode_command_number for future changes.
19021	* ioctl.c (ioctl_decode_command_number): Change 1st arg to struct tcb*.
19022	(sys_ioctl): Update callers.
19023
19024	ioctl: simplify ioctl_decode signature.
19025	* ioctl.c (ioctl_decode): Remove 2nd and 3rd parameters.
19026	(sys_ioctl): Update callers.
19027
19028	ioctl: consistently use name "code" for ioctl request code.
19029	* ioctl.c (evdev_decode_number, hiddev_decode_number,
19030	ioctl_decode_command_number): Rename "arg" to "code".
19031
19032	Move ioctl syscall parser to ioctl.c.
19033	* io.c (sys_ioctl): Move ...
19034	* ioctl.c: ... here.
19035	(ioctl_lookup, ioctl_next_match, ioctl_print_code, ioctl_decode,
19036	ioctl_decode_command_number): Declare as static.
19037	* defs.h (ioctl_lookup, ioctl_next_match, ioctl_print_code,
19038	ioctl_decode, ioctl_decode_command_number): Remove.
19039
19040	ioctl: remove obsolete registry of ioctl characters.
19041	* ioctl.c: Remove registry of ioctl characters.
19042
190432015-06-30  Dmitry V. Levin  <ldv@altlinux.org>
19044
19045	Fix filtering of <unavailable> syscalls.
19046	* syscall.c (trace_syscall_exiting): Skip filtered syscalls also in case
19047	of get_regs or get_syscall_result failure.
19048	* tests/filter-unavailable.c: New file.
19049	* tests/filter-unavailable.expected: Likewise.
19050	* tests/filter-unavailable.test: New test.
19051	* tests/Makefile.am (check_PROGRAMS): Add filter-unavailable.
19052	(filter_unavailable_LDFLAGS): Add -pthread.
19053	(TESTS): Add filter-unavailable.test.
19054	(EXTRA_DIST): Add filter-unavailable.expected.
19055	* tests/.gitignore: Add filter-unavailable.
19056
19057	Reported-by: Bryan Matsuo <bryan.matsuo@gmail.com>
19058
190592015-06-30  Dmitry V. Levin  <ldv@altlinux.org>
19060
19061	Fix -qq option in conjunction with -o option.
19062	This change makes -qq option work in conjunction with -o option,
19063	thus complementing commit v4.7-222-g01997cf.
19064
19065	* strace.c (init): Do not reset qflag.
19066
190672015-06-30  Dmitry V. Levin  <ldv@altlinux.org>
19068
19069	xtensa: wire up new syscalls.
19070	* linux/xtensa/syscallent.h (bpf, execveat): New entries.
19071
19072	bfin: wire up new syscalls.
19073	* linux/bfin/syscallent.h (kcmp, finit_module, sched_setattr,
19074	sched_getattr, renameat2, seccomp, getrandom, memfd_create,
19075	bpf, execveat): New entries.
19076
19077	alpha: wire up new syscalls.
19078	* linux/alpha/syscallent.h (getrandom, memfd_create, execveat):
19079	New entries.
19080
190812015-06-17  Dmitry V. Levin  <ldv@altlinux.org>
19082
19083	tests: skip stat32 test if struct stat is defined incorrectly.
19084	If stat.st_mode returned by syscall is 0, it means that the definition
19085	of struct stat in <asm/stat.h> is incorrect.  This is the case e.g. on
19086	mips n32 where the only available stat syscall is 64-bit but at the same
19087	time struct stat defined by <asm/stat.h> is 32-bit.
19088
19089	* tests/stat.c (main) [NR_stat]: Return 77 if st_mode is 0.
19090
190912015-06-17  Dmitry V. Levin  <ldv@altlinux.org>
19092
19093	Consistenly use #ifdef to check for AC_DEFINE'd macros.
19094	* aio.c (print_common_flags): Use #ifdef in the check for
19095	HAVE_STRUCT_IOCB_U_C_FLAGS.
19096	* defs.h: Use #ifdef in the check for HAVE_LITTLE_ENDIAN_LONG_LONG.
19097	* net.c: Use #ifdef in the check for HAVE_SENDMSG.
19098	* syscall.c (dumpio): Likewise.
19099	* printstat.h (DO_PRINTSTAT): Use #ifdef in checks for
19100	HAVE_STRUCT_STAT_ST_* macros.
19101	* util.c: Use #ifdef in checks for HAVE_SYS_XATTR_H.
19102
19103	xattr: move fallback definitions of xattr flags to xlat/
19104	* xattr.c: Include <sys/xattr.h> insread of <linux/xattr.h>.
19105	Move definitions of XATTR_* flags ...
19106	* xlat/xattrflags.in: ... here.
19107
19108	link: move fallback definitions of AT_* constants to xlat/
19109	* link.c: Move definitions of AT_* constants ...
19110	* xlat/at_flags.in: ... here.
19111
19112	net: move fallback definitions of SOL_* constants to xlat/
19113	* net.c: Move definitions of SOL_* constants ...
19114	* xlat/socketlayers.in: ... here.
19115
19116	futex: move fallback definitions of futex constants to xlat/
19117	* futex.c: Move definitions of FUTEX_OP_CMP_* constants ...
19118	* xlat/futexwakecmps.in: ... here.
19119	* futex.c: Move definitions of other FUTEX_OP_* constants ...
19120	* xlat/futexwakeops.in: ... here.
19121	* futex.c: Move definitions of remaining FUTEX_* constants except
19122	FUTEX_PRIVATE_FLAG and FUTEX_CLOCK_REALTIME flags ...
19123	* xlat/futexops.in: ... here.
19124
19125	clone: move definitions of cloning flags to xlat/
19126	* clone.c: Include <sched.h>.  Move definitions of CLONE_* flags ...
19127	* xlat/clone_flags.in: ... here.
19128
191292015-06-16  Dmitry V. Levin  <ldv@altlinux.org>
19130
19131	Update mount flags constants.
19132	* mount.c: Remove definitions of mount flags constants.
19133	* xlat/mount_flags.in: Update from linux v4.0, add default values.
19134
19135	mount: update parser to match kernel behaviour.
19136	* mount.c (sys_mount): Do not decode type and data strings for
19137	MS_SHARED, MS_PRIVATE, MS_SLAVE, and MS_UNBINDABLE mount flags
19138	that do not imply valid strings.
19139
19140	mount: robustify MS_MGC_VAL decoding.
19141	* mount.c (sys_mount): When printing mount flags, do not assume that
19142	(flags & MS_MGC_MSK) == MS_MGC_VAL.
19143
191442015-06-08  Dmitry V. Levin  <ldv@altlinux.org>
19145
19146	net: decode setsockopt() multicast arguments.
19147	* configure.ac (AC_CHECK_FUNCS): Add inet_pton.
19148	* net.c (print_mreq, print_mreq6): New functions.
19149	(print_setsockopt): Use them to decode IP_ADD_MEMBERSHIP,
19150	IP_DROP_MEMBERSHIP, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP,
19151	IPV6_JOIN_ANYCAST, and IPV6_LEAVE_ANYCAST.
19152	* tests/ip_mreq.c: New file.
19153	* tests/ip_mreq.expected: Likewise.
19154	* tests/ip_mreq.test: New test.
19155	* tests/Makefile.am (check_PROGRAMS): Add ip_mreq.
19156	(TESTS): Add ip_mreq.test.
19157	(EXTRA_DIST): ip_mreq.expected.
19158	* tests/.gitignore: Add ip_mreq.
19159
19160	Based on patch by Ben Noordhuis <info@bnoordhuis.nl>.
19161
191622015-06-08  Dmitry V. Levin  <ldv@altlinux.org>
19163
19164	Update IPV6 socket options constants.
19165	* xlat/sockipv6options.in: Update from linux v4.0.
19166
191672015-06-05  Dmitry V. Levin  <ldv@altlinux.org>
19168
19169	net: factor out interface index printing code.
19170	* net.c (print_ifindex): New function.
19171	(printsock) [HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID]: Use it.
19172
191732015-05-25  Dmitry V. Levin  <ldv@altlinux.org>
19174
19175	Consistently use error_msg instead of fprintf(stderr)
19176	* linux/alpha/get_scno.c: Use error_msg.
19177	* linux/arm/get_scno.c: Likewise.
19178	* linux/mips/get_scno.c: Likewise.
19179	* linux/sh/get_scno.c: Likewise.
19180	* linux/x86_64/get_scno.c: Likewise.
19181	* exit.c (sys_exit): Likewise.
19182	* pathtrace.c (pathtrace_select, pathtrace_match): Likewise.
19183	* strace.c (alloctcb, droptcb, detach, startup_attach,
19184	test_ptrace_seize, init, cleanup, print_debug_info,
19185	maybe_allocate_tcb, startup_tcb, trace): Likewise.
19186	* syscall.c (update_personality, trace_syscall_exiting,
19187	get_scno): Likewise.
19188	* unwind.c (DPRINTF): Likewise.
19189	* tests/bexecve.test: Update patterns.
19190	* tests/detach-stopped.test: Likewise.
19191
19192	Consistently print OOM diagnostic messages.
19193	* bjm.c (sys_query_module): Use error_msg to print OOM diagnostics.
19194	* util.c (dumpiov, dumpstr): Likewise.
19195
191962015-05-25  Dmitry V. Levin  <ldv@altlinux.org>
19197
19198	Introduce memory allocation wrappers.
19199	Introduce wrappers to the following functions that do memory allocation:
19200	malloc, calloc, realloc, strdup.
19201
19202	This commit is a follow-up to the related discussions in strace-devel ML:
19203	http://sourceforge.net/p/strace/mailman/message/33618180/
19204	http://sourceforge.net/p/strace/mailman/message/33733470/
19205
19206	* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
19207	* xmalloc.c: New file.
19208	* Makefile.am (strace_SOURCES): Add it.
19209	* count.c (count_syscall, call_summary_pers): Use xcalloc.
19210	* desc.c (decode_select): Use xmalloc.
19211	* dirent.c (sys_getdents, sys_getdents64): Likewise.
19212	* net.c (sys_recvmmsg): Use xstrdup.
19213	* pathtrace.c (storepath): Use xreallocarray.
19214	(pathtrace_match): Use xmalloc.
19215	* strace.c (die_out_of_memory): Move to xmalloc.c.
19216	(expand_tcbtab): Use xcalloc and xreallocarray.
19217	(startup_child): Use xstrdup.
19218	(init): Use xmalloc, xcalloc, and xstrdup.
19219	* syscall.c (reallocate_qual): Use xreallocarray.
19220	(qualify): Use xstrdup.
19221	* unwind.c (unwind_tcb_init): Use xmalloc.
19222	(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
19223	(get_symbol_name): Use xreallocarray.
19224	(stacktrace_walk, queue_put): Use xmalloc.
19225	* util.c (printstr): Use xmalloc.
19226	* vsprintf.c (strace_vfprintf): Likewise.
19227
192282015-05-21  Dmitry V. Levin  <ldv@altlinux.org>
19229
19230	Fix ioctl entries on 32-bit architectures with 64-bit aligned structures
19231	Some ioctl constants are defined to different values on those 32-bit
19232	architectures where structures containing a 64-bit field are aligned on
19233	a 8-byte boundary and have a size multiple of 8 bytes, and on other
19234	32-bit architectures.
19235
19236	* configure.ac: Check the size of a structure containing a 64-bit field.
19237	* linux/32/ioctls_inc.h: Rename to ...
19238	* linux/32/ioctls_inc_align32.h: ... this.
19239	* linux/32/ioctls_inc_align64.h: New file.
19240	* linux/32/ioctls_inc.h: Include either 32/ioctls_inc_align32.h
19241	or ioctls_inc_align64.h depending on SIZEOF_STRUCT_I64_I32.
19242	* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align32.h and
19243	* linux/32/ioctls_inc_align64.h.
19244	* tests/ioctl.c (main): Test for VIDIOC_ENUMINPUT.
19245	* tests/ioctl.expected: Check VIDIOC_ENUMINPUT decoding.
19246
19247	Reported-by: Philippe De Muyter <phdm@macqel.be>
19248
192492015-05-21  Dmitry V. Levin  <ldv@altlinux.org>
19250
19251	maint: make linux/kvm.h parseable on arm.
19252	* maint/ioctls_sym.sh [AARCH64 || ARM]: Add missing definitions for
19253	structures referenced from linux/kvm.h.
19254
192552015-05-21  Philippe De Muyter  <phdm@macqel.be>
19256
19257	v4l2: add decoding for VIDIOC_S_CROP's arg.
19258	* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_S_CROP's arg.
19259
192602015-05-19  Ezequiel Garcia  <ezequiel@vanguardiasur.com.ar>
19261
19262	Add support for Altera's Nios-II softcore architecture.
19263	This commit adds strace support for Altera's Nios-II.  The architecture
19264	is supported by Linux since v3.19, and it implements the generic syscall
19265	ABI.
19266
19267	* configure.ac: Add nios2 support.
19268	* cacheflush.c [NIOS2] (sys_cacheflush): New function.
19269	* linux/nios2/*: New Nios-II specific files.
19270	* Makefile.am (EXTRA_DIST): Add them.
19271
192722015-05-19  Philippe De Muyter  <phdm@macqel.be>
19273
19274	v4l2: VIDIOC_CROPCAP: add missing braces around arg printout.
19275	* v4l2.c (v4l2_ioctl): case VIDIOC_CROPCAP: add missing braces around arg
19276	printout.
19277
192782015-05-19  Dmitry V. Levin  <ldv@altlinux.org>
19279
19280	maint: avoid effects of locale when sorting files.
19281	* maint/ioctls_gen.sh: Invoke sort with LC_COLLATE=C.
19282	* maint/ioctls_hex.sh: Likewise.
19283	* maint/ioctls_sym.sh: Likewise.
19284
19285	Reported-by: Philippe De Muyter <phdm@macqel.be>
19286
192872015-04-18  Philippe De Muyter  <phdm@macqel.be>
19288
19289	v4l2: add decoding for VIDIOC_CREATE_BUFS's arg.
19290	* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_CREATE_BUFS's arg.
19291
192922015-04-17  Dmitry V. Levin  <ldv@altlinux.org>
19293
19294	mips o32: decode indirect syscall.
19295	Implement decoding of MIPS O32 specific indirect syscall.
19296
19297	* syscall.c [LINUX_MIPSO32] (decode_mips_subcall, sys_syscall):
19298	New functions.
19299	(trace_syscall_entering) [LINUX_MIPSO32]: Use decode_mips_subcall.
19300	* linux/mips/syscallent-o32.h (4000): Change sys_func to sys_syscall.
19301
19302	Reported-and-tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
19303
193042015-04-14  Dmitry V. Levin  <ldv@altlinux.org>
19305
19306	debian: add gawk to Build-Depends.
19307	* debian/control (Build-Depends): Add gawk.
19308	Patch by Reiner Herrmann <reiner@reiner-h.de>.
19309
19310	This fixes Debian bug #780992.
19311
193122015-04-14  Dmitry V. Levin  <ldv@altlinux.org>
19313
19314	tests: fix bexecve.test for the case of mixed personalities.
19315	Fix bexecve.test when the executable being run does not match the
19316	native architecture.
19317
19318	* tests/bexecve.test: Use "set_ptracer_any" instead of "sh".
19319	Allow for a personality switch notification in the strace output.
19320
193212015-04-07  Dmitry V. Levin  <ldv@altlinux.org>
19322
19323	tests: add a test for "resuming interrupted nanosleep"
19324	* tests/restart_syscall.test: New test.
19325	* tests/restart_syscall.expected: New file.
19326	* tests/restart_syscall_unknown.expected: Likewise.
19327	* tests/Makefile.am (TESTS): Add restart_syscall.test.
19328	(EXTRA_DIST): Add restart_syscall.expected
19329	(TEST_LOG_COMPILER): Change to "env".
19330	(OS, ARCH, AM_TEST_LOG_FLAGS): Define.
19331	and restart_syscall_unknown.expected.
19332
19333	tests: strip executable bit from *.expected files.
19334
193352015-04-07  Dmitry V. Levin  <ldv@altlinux.org>
19336
19337	Declare syscall parsers using SYS_FUNC macro.
19338	Introduce SYS_FUNC macro to declare and define all syscall parsers.
19339
19340	* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
19341	(sys_func.h): New rule.
19342	* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
19343	* linux/syscall.h: Include "sys_func.h".
19344	[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
19345	Remove other declarations.
19346	* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
19347	and osf_fstatfs syscall parsers.
19348	* *.c: Use SYS_FUNC to define syscall parsers.
19349
193502015-04-07  Denys Vlasenko  <dvlasenk@redhat.com>
19351
19352	Fix confusing "resuming interrupted unknown" message.
19353	Dmitry reported seeing the following:
19354
19355	    $ sleep 2 & sleep 1; ./strace -erestart_syscall -p $!
19356	    [1] 12345
19357	    Process 12345 attached
19358	    restart_syscall(<... resuming interrupted unknown ...>) = 0
19359
19360	Fixing it by replacing "unknown" with "system call".
19361
193622015-04-07  Dmitry V. Levin  <ldv@altlinux.org>
19363
19364	tests: workaround old gawk versions that do not provide @include support
19365	Some of our tests use GNU awk @include extension, but not all currently
19366	used versions of GNU awk support it.  Skip these tests if gawk does not
19367	provide @include support.
19368
19369	* tests/init.sh (check_gawk): New function.
19370	(match_awk): Use it.
19371
193722015-04-06  Dmitry V. Levin  <ldv@altlinux.org>
19373
19374	tests: rewrite umovestr2.test without using grep.
19375	The regular expression generated by umovestr2.c on systems with large
19376	page size is too big for GNU grep.  Rewrite the test to use diff
19377	instead of grep.
19378
19379	* tests/umovestr2.test: Use match_diff instead of match_grep.
19380	* tests/umovestr2.c (main): Convert output from regexp to plain text.
19381
193822015-03-31  Dmitry V. Levin  <ldv@altlinux.org>
19383
19384	Cleanup process_vm_writev syscall decoding.
19385	* process_vm.c (sys_process_vm_writev): Do not check for syserror,
19386	it is not applicable on entering syscall.
19387
19388	umovestr: read chunks of memory up to pagesize at a time.
19389	* defs.h (get_pagesize): New prototype.
19390	* mem.c (get_pagesize) Make global.
19391	* util.c (PAGMASK): Remove.
19392	(vm_read_mem): New process_vm_readv proxy function.
19393	(umoven, umovestr): Use it.
19394	(umovestr): Read chunks up to pagesize at a time.
19395
193962015-03-31  Dmitry V. Levin  <ldv@altlinux.org>
19397
19398	umovestr: fix short read bug.
19399	* util.c (umovestr): Check the right address.
19400	* tests/umovestr.c: New file.
19401	* tests/umovestr2.c: Likewise.
19402	* tests/umovestr.expected: Likewise.
19403	* tests/umovestr.test: New test.
19404	* tests/umovestr2.test: Likewise.
19405	* tests/Makefile.am (check_PROGRAMS): Add umovestr and umovestr2.
19406	(TESTS): Add umovestr.test and umovestr2.test.
19407	(EXTRA_DIST): Add umovestr.expected.
19408	* tests/.gitignore: Add umovestr and umovestr2.
19409
19410	Reported-by: Josef T. Burger <bolo@cs.wisc.edu>
19411
194122015-03-31  Dmitry V. Levin  <ldv@altlinux.org>
19413
19414	When process_vm_readv fails with EPERM, try PTRACE_PEEKDATA.
19415	process_vm_readv() and ptrace(PTRACE_PEEKDATA) have inconsistent access
19416	control rules wrt traced processes: process_vm_readv() is more likely to
19417	fail with EPERM than ptrace(PTRACE_PEEKDATA) when tracing a process that
19418	has execve'd a privileged executable.
19419
19420	* util.c (umoven, umovestr): If process_vm_readv returned EPERM,
19421	fall back to ptrace(PTRACE_PEEKDATA).
19422
19423	Reported-by: Andrew Guertin <lists@dolphinling.net>
19424
194252015-03-30  Dmitry V. Levin  <ldv@altlinux.org>
19426
19427	Use macros for gcc attributes.
19428	* defs.h (error_msg, perror_msg, error_msg_and_die, perror_msg_and_die,
19429	die_out_of_memory, printllval, printnum_int, printnum_long, tprintf):
19430	Use ATTRIBUTE_* macros for gcc attributes.
19431	* file.c (struct stat64): Likewise.
19432	* statfs.c (struct compat_statfs64): Likewise.
19433	* strace.c (die, exec_or_die, init): Likewise.
19434	* linux/sparc/arch_sigreturn.c: Likewise.
19435	* linux/ubi-user.h: Likewise.
19436
194372015-03-30  Dmitry V. Levin  <ldv@altlinux.org>
19438
19439	Introduce macros for gcc attributes.
19440	Define macros for gcc attributes that are already in use
19441	or going to be used soon.
19442
19443	* defs.h (GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
19444	ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
19445	ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): New macros.
19446
194472015-03-28  Felix Janda  <felix.janda@posteo.de>
19448
19449	Include <linux/ioctl.h> for _IOC_* macros.
19450	Fix a compilation failure with musl libc.
19451
19452	* evdev.c: Include <linux/ioctl.h>.
19453	* ioctl.c: Include <linux/ioctl.h> instead of <asm/ioctl.h>.
19454	* ioctlsort.c: Likewise.
19455
19456	Reported-by: Dima Krasner <dima@dimakrasner.com>
19457	Acked-by: Mike Frysinger <vapier@gentoo.org>
19458
194592015-03-28  Felix Janda  <felix.janda@posteo.de>
19460
19461	Include <sys/stat.h> for S_I* macros.
19462	Fix a compilation failure with musl libc.
19463
19464	* mknod.c: Include <sys/stat.h>.
19465	* printmode.c: Likewise.
19466
19467	Reported-by: Dima Krasner <dima@dimakrasner.com>
19468	Acked-by: Mike Frysinger <vapier@gentoo.org>
19469
194702015-03-27  Dmitry V. Levin  <ldv@altlinux.org>
19471
19472	signal.c: move siginfo_t parsers to a separate file.
19473	* printsiginfo.c: New file.
19474	* Makefile.am (strace_SOURCES): Add it.
19475	* defs.h (printsiginfo): Change second argument's type from int to bool.
19476	* signal.c: Stop defining siginfo_t related constants.
19477	Move inclusion of xlat/sig*_codes.h files to printsiginfo.c
19478	(printsigsource, printsigval, printsiginfo_at): Move to printsiginfo.c.
19479	(printsiginfo): Change second argument's type from int to bool,
19480	split, and move to printsiginfo.c.
19481
19482	Update siginfo_t constants.
19483	* xlat/sigbus_codes.in: Add BUS_MCEERR_AR and BUS_MCEERR_AO,
19484	add default values.
19485	* xlat/sigtrap_codes.in: Add TRAP_BRANCH and TRAP_HWBKPT,
19486	add default values.
19487	* xlat/sigsegv_codes.in: Add SEGV_BNDERR, add default values.
19488	* xlat/sigchld_codes.in: Add default values.
19489	* xlat/sigemt_codes.in: Likewise.
19490	* xlat/sigfpe_codes.in: Likewise.
19491	* xlat/sigill_codes.in: Likewise.
19492	* xlat/siginfo_codes.in: Likewise.
19493	* xlat/sigpoll_codes.in: Likewise.
19494	* xlat/sigsys_codes.in: Likewise.
19495
194962015-03-26  Dmitry V. Levin  <ldv@altlinux.org>
19497
19498	signal.c: move sigaltstack parser to a separate file.
19499	* sigaltstack.c: New file.
19500	* Makefile.am (strace_SOURCES): Add it.
19501	* signal.c (print_stack_t, sys_sigaltstack): Move to sigaltstack.c.
19502	* xlat/sigaltstack_flags.in: Add default values.
19503
195042015-03-25  Denys Vlasenko  <dvlasenk@redhat.com>
19505
19506	Move sparc64 get_scno() code where it belongs.
19507
19508	sparc: rename personality 2 files to personality 1.
19509	Run-tested in qemu 32-bit sparc.
19510
195112015-03-25  Denys Vlasenko  <dvlasenk@redhat.com>
19512
19513	sparc: delete personality 1.
19514	Personality 1 for sparc and sparc64 appears to be an old attempt
19515	to support stracing Solaris binaries.
19516
19517	It stalled after the only syscall, solaris_open, was covered:
19518	all other solaris_foo's are printargs.
19519
19520	This change deletes personality 1. Now sparc is an one-personality
19521	arch, and sparc64 is a two-personality one.
19522
19523	For clarity, pure renaming of personality 2 files to personality 1 for sparc64
19524	is performed in the next commit - this prevents a state where syscallent1.h
19525	seems to indergo a lot of changes, where in fact in is deleted, and then
19526	replaced by syscallent2.h
19527
19528	Therefore, tree at this commit will not build.
19529
195302015-03-24  Denys Vlasenko  <dvlasenk@redhat.com>
19531
19532	qemu_multiarch_testing/*: make it easier to do debug in sandboxes.
19533
195342015-03-24  Denys Vlasenko  <dvlasenk@redhat.com>
19535
19536	sparc: fix v4.10-25-g8497b62 fallout.
19537	Before:
19538
19539	$ sleep 3 & ./strace -p $!
19540	Process 8703 attached
19541	syscall: unknown syscall trap 1a800003 00025d58
19542	syscall_516(0, 0x40080000, 0, 0xfc000f00, 0x28, 0xefc03b18) = 0
19543	exit_group(0)                           = ?
19544	+++ exited with 0 +++
19545
19546	After:
19547
19548	$ sleep 3 & ./strace -p $!
19549	Process 8725 attached
19550	restart_syscall(<... resuming interrupted nanosleep ...>) = 0
19551	exit_group(0)                           = ?
19552	+++ exited with 0 +++
19553
195542015-03-24  Dmitry V. Levin  <ldv@altlinux.org>
19555
19556	get_scno: add diagnostics for invalid syscall numbers.
19557	* syscall.c (get_scno): Print a debug level message
19558	for !SCNO_IS_VALID syscall numbers.
19559
195602015-03-24  Dmitry V. Levin  <ldv@altlinux.org>
19561
19562	arm: fix v4.10-25-g8497b62 fallout.
19563	Starting with commit v4.10-25-g8497b62,
19564
19565	arm$ ./strace true
19566	pid 1234 stray syscall exit
19567	Segmentation fault
19568
19569	Fix this by updating ARM syscall sanity check.
19570	In particular, get_scno() should not set TCB_INSYSCALL flag because
19571	other code assumes that s_ent is properly initialized when this flag
19572	is set.
19573
19574	* linux/arm/get_scno.c: Check syscall number after fetching.
19575	Do not apply the check to SCNO_IN_RANGE syscalls.
19576	Do not set TCB_INSYSCALL flag.
19577	Extend diagnostics and move it to debug level.
19578
195792015-03-24  Dmitry V. Levin  <ldv@altlinux.org>
19580
19581	mips: fix pipe syscall decoding.
19582	* linux/mips/arch_getrval2.c: New file.
19583	* Makefile.am (EXTRA_DIST): Add it.
19584	* defs.h [MIPS] (HAVE_GETRVAL2): Define.
19585
195862015-03-23  Dmitry V. Levin  <ldv@altlinux.org>
19587
19588	sigreturn.c: split arch specific code into separate arch files.
19589	Split code that use arch-specific registers to separate arch files.
19590
19591	* sigreturn.c (sys_sigreturn): Move arch-specific code
19592	to linux/*/arch_sigreturn.c, include "arch_sigreturn.c".
19593	* linux/arch_sigreturn.c: New file.
19594	* Makefile.am (EXTRA_DIST): Add linux/arch_sigreturn.c
19595	and linux/*/arch_sigreturn.c files.
19596
195972015-03-23  Dmitry V. Levin  <ldv@altlinux.org>
19598
19599	syscall.c: split arch specific code into separate arch files.
19600	Split code that use arch-specific registers to separate arch files.
19601
19602	* syscall.c: Move definitions of variables containing fetched registers
19603	to linux/*/arch_regs.c files.
19604	[HAVE_GETRVAL2] (getrval2): Move arch-specific code
19605	to linux/*/arch_getrval2.c, include "arch_getrval2.c".
19606	(print_pc): Move arch-specific code to linux/*/print_pc.c files,
19607	include "print_pc.c".
19608	[X86_64] (x86_64_getregs_old): Rename to getregs_old, move to
19609	linux/x86_64/getregs_old.c, include "getregs_old.c".
19610	[POWERPC] (powerpc_getregs_old): Rename to getregs_old, move to
19611	linux/powerpc/getregs_old.c, include "getregs_old.c".
19612	(get_regs) [X86_64, POWERPC]: Update callers.
19613	(get_scno): Move arch-specific code to linux/*/get_scno.c,
19614	include "get_scno.c".
19615	(get_syscall_args): Move arch-specific code
19616	to linux/*/get_syscall_args.c, include "get_syscall_args.c".
19617	(get_error): Move arch-specific code to linux/*/get_error.c,
19618	include "get_error.c".
19619	(get_syscall_result): Move arch-specific code
19620	to linux/*/get_syscall_result.c, include "get_syscall_result.c".
19621	* Makefile.am (EXTRA_DIST): Add new linux/*/*.c files.
19622
196232015-03-23  Dmitry V. Levin  <ldv@altlinux.org>
19624
19625	syscall.c: prepare for the split.
19626	Move functions that use arch-specific registers to the end of file.
19627
196282015-03-23  Dmitry V. Levin  <ldv@altlinux.org>
19629
19630	Move get_regs error check from trace_syscall_entering to get_scno.
19631	Starting with commit v4.10-25-g8497b62, get_scno() can be called outside
19632	trace_syscall_entering(), so move the get_regs_error check from
19633	trace_syscall_entering() to get_scno().
19634
19635	* syscall.c (trace_syscall_entering): Move get_regs_error check ...
19636	(get_scno): ... here.
19637
196382015-03-23  Dmitry V. Levin  <ldv@altlinux.org>
19639
19640	alpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding.
19641	Fix pipe syscall decoding on alpha.
19642	Fix pipe2 syscall decoding on ia64, sh, sparc, and sparc64.
19643
19644	* configure.ac (AC_CHECK_FUNCS): Add pipe2.
19645	* defs.h [ALPHA || IA64 || SH || SPARC || SPARC64] (HAVE_GETRVAL2):
19646	Define.
19647	* net.c (do_pipe): Check HAVE_GETRVAL2 instead of architecture macros.
19648	Do not use getrval2 for pipe2 decoding.
19649	Print address if umove call fails.
19650	* syscall.c (getrval2): Check HAVE_GETRVAL2 instead of architecture
19651	macros.  Implement for [ALPHA].
19652	* tests/pipe.c: New file.
19653	* tests/pipe.expected: New file.
19654	* tests/pipe.test: New test.
19655	* tests/Makefile.am (check_PROGRAMS): Add pipe.
19656	(TESTS): Add pipe.test.
19657	(EXTRA_DIST): Add pipe.expected.
19658	* tests/.gitignore: Add pipe.
19659
196602015-03-22  Dmitry V. Levin  <ldv@altlinux.org>
19661
19662	decode_socket_subcall: fetch all arguments with a single umoven call.
19663	* syscall.c (decode_socket_subcall): Replace umoven fetch loop
19664	with a single umoven call.
19665
196662015-03-21  Denys Vlasenko  <dvlasenk@redhat.com>
19667
19668	New test: test/many_looping_threads.c.
19669
19670	test/.gitignore: add missing test targets.
19671
19672	Trivial optimization in sys_sigreturn()
19673
19674	Change last parameter of umoven() from char* to void*
19675	Saves tons of casts.
19676
19677	Remove unused struct tcb::inst field.
19678	It is unused since we dropped support for kernels without PTRACE_SETOPTIONS.
19679
19680	test/Makefile: add missing test targets.
19681
19682	Move the comment about termination logic where it belongs.
19683
19684	startup_tcb() never fails, remove code which checks for failures.
19685
196862015-03-21  Denys Vlasenko  <dvlasenk@redhat.com>
19687
19688	Show the syscall name in "resuming interrupted call" message.
19689	When signal is received, or if we have attached to a process,
19690	current syscall (if process is in one) gets restarted.
19691
19692	Some syscalls are restarted via "restart_syscall()" mechanism.
19693	On such sycalls, we don't show _which_ syscall gets restarted.
19694
19695	IOW: users want to see "resuming interrupted nanosleep"
19696	instead of "resuming interrupted call" when they attach to "sleep 999".
19697
19698	Kernel does expose this information. The only thing we need is
19699	to fetch syscall# on attach, and save it.
19700
19701	This patch does this. It adds tcp->s_prev_ent, which is
19702	a pointer to struct_sysent of the previous syscall of this tracee.
19703	It can be NULL.
19704
19705	sys_restart_syscall() is made to use it when the message is generated.
19706
19707	To similarly handle restart_syscall() *after signals*, not just
19708	on attach, on each syscall exit patch saves exited syscall's data
19709	in the same member (tcp->s_prev_ent).
19710
19711	Example:
19712
19713	    $ sleep 3 & strace -p $!
19714	    Process 8728 attached
19715	    restart_syscall(<... resuming interrupted nanosleep ...>) = 0
19716	    _exit(0)                                = ?
19717	    +++ exited with 0 +++
19718
197192015-03-20  Dmitry V. Levin  <ldv@altlinux.org>
19720
19721	tests: add a test for mmap/mprotect/munmap decoding.
19722	* tests/mmap.c: New file.
19723	* tests/mmap64.c: New file.
19724	* tests/mmap.test: New test.
19725	* tests/mmap64.test: New test.
19726	* tests/Makefile.am (check_PROGRAMS): Add mmap and mmap64.
19727	(mmap64_CFLAGS): Define.
19728	(TESTS): Add mmap.test and mmap64.test.
19729	* tests/.gitignore: Add mmap and mmap64.
19730
19731	sparc, sparc64: fix decoding of mmap2.
19732	* linux/sparc/syscallent.h (mmap2): Decode with sys_mmap_4koff,
19733	not sys_mmap.
19734	* linux/sparc64/syscallent2.h (mmap2): Decode with sys_mmap_pgoff,
19735	not sys_mmap.
19736
197372015-03-19  Dmitry V. Levin  <ldv@altlinux.org>
19738
19739	tests: add a test for SECCOMP_MODE_FILTER decoding.
19740	* tests/seccomp.c: New file.
19741	* tests/seccomp.test: New test.
19742	* tests/Makefile.am (check_PROGRAMS): Add seccomp.
19743	(TESTS): Add seccomp.test.
19744	* tests/.gitignore: Add seccomp.
19745
197462015-03-18  Dmitry V. Levin  <ldv@altlinux.org>
19747
19748	tests: factor out common awk code.
19749	Factor out awk code used in several tests to match.awk.
19750
19751	* tests/match.awk: New file.
19752	* tests/Makefile.am (EXTRA_DIST): Add it.
19753	* tests/caps.awk: Use it.
19754	* tests/getdents.awk: Likewise.
19755	* tests/getrandom.awk: Likewise.
19756	* tests/select.awk: Likewise.
19757	* tests/sigaction.awk: Likewise.
19758	* tests/init.sh (match_awk): Use gawk not awk.  Define AWKPATH.
19759	* tests/getdents.test: Likewise.
19760
197612015-03-18  Dmitry V. Levin  <ldv@altlinux.org>
19762
19763	tests: skip netlink based tests when resources are not available.
19764	* tests/netlink_inet_diag.c (main): Return 77 if socket, bind,
19765	or listen syscall fail.
19766	* tests/netlink_unix_diag.c (main): Likewise.
19767
197682015-03-18  Dmitry V. Levin  <ldv@altlinux.org>
19769
19770	aarch64, arm: decode extra padded compat struct statfs64.
19771	According to arch/arm/kernel/sys_oabi-compat.c,
19772	struct statfs64 has extra padding with EABI.
19773
19774	* statfs.c [AARCH64 || defined ARM] (COMPAT_STATFS64_PADDED_SIZE):
19775	Define.
19776	(do_statfs64_fstatfs64): New function, factored out from sys_statfs64.
19777	[COMPAT_STATFS64_PADDED_SIZE]: Check it in addition to
19778	sizeof(struct compat_statfs64).
19779	(sys_statfs64, sys_fstatfs64): Use do_statfs64_fstatfs64.
19780
19781	Reported-and-tested-by: Elliott Hughes <enh@google.com>
19782
197832015-03-18  Dmitry V. Levin  <ldv@altlinux.org>
19784
19785	tests: factor out common shell code to functions.
19786	Factor out shell code used in several tests to common functions.
19787
19788	* tests/fanotify_mark.expected: New file.
19789	* tests/ioctl.expected: New file.
19790	* tests/net-fd.expected: New file.
19791	* tests/net.expected: New file.
19792	* tests/statfs.expected: New file.
19793	* tests/sun_path.expected: New file.
19794	* tests/uio.expected: New file.
19795	* tests/ipc.sh: New file.
19796	* tests/Makefile.am (EXTRA_DIST): Add them.
19797	* tests/init.sh (dump_log_and_fail_with, run_prog,
19798	run_prog_skip_if_failed, run_strace, run_strace_merge,
19799	match_awk, match_diff, match_grep): New functions.
19800	* tests/*.test: Use them.
19801
198022015-03-18  Elliott Hughes  <enh@google.com>
19803
19804	Show f_flags field in printstatfs.
19805	printstatfs64 was right, but printstatfs was missing f_flags.
19806	Noticed on aarch64.
19807
19808	* statfs.c (printstatfs) [_STATFS_F_FLAGS]: Print statfs.f_flags.
19809
198102015-03-16  Dmitry V. Levin  <ldv@altlinux.org>
19811
19812	tests/uid*: use fchown* instead of chown*
19813	Newer architectures have no chown syscall, so use fchown* syscalls
19814	for testing printuid.
19815
19816	* tests/uid.test: Use fchown instead of chown.
19817	* tests/uid.c: Test __NR_fchown instead of __NR_chown.
19818	(main): Use __NR_fchown instead of __NR_chown.
19819	* tests/uid32.c: Test __NR_fchown32 instead of __NR_chown32.
19820	(main): Use __NR_fchown32 instead of __NR_chown32.
19821	* tests/uid16.c: Test __NR_fchown and __NR_fchown32 instead
19822	of __NR_chown and __NR_chown32.
19823	(main): Use __NR_fchown instead of __NR_chown.
19824	* tests/uid.awk: Update regexp.
19825
198262015-03-16  Dmitry V. Levin  <ldv@altlinux.org>
19827
19828	stat64-v.test: add newfstatat syscall support.
19829	Newer architectures have no stat syscall, so stat() is implemented there
19830	using newfstatat syscall.
19831
19832	* tests/stat.c (STAT_FNAME): Rename to STAT_PREFIX.  Update callers.
19833	[_FILE_OFFSET_BITS == 64] (STAT_PREFIX): Add newfstatat support.
19834	(main) [!NR_stat]: Add newfstatat support.
19835
19836	Reported-by: Andreas Schwab <schwab@suse.de>
19837
198382015-03-16  Andreas Schwab  <schwab@suse.de>
19839
19840	aarch64: properly decode generic syscalls.
19841	* linux/aarch64/syscallent1.h: Don't override entries 277 to 1023.
19842
19843	tests: verify that all patterns match.
19844	* tests/ipc_msg.test: Count matches to verify that all patterns match.
19845	* tests/ipc_sem.test: Likewise.
19846	* tests/ipc_shm.test: Likewise.
19847	* tests/stat32-v.test: Likewise.
19848	* tests/stat64-v.test: Likewise.
19849
198502015-03-16  Dmitry V. Levin  <ldv@altlinux.org>
19851
19852	Fix stat64 st_[acm]time decoding for personalities with 32-bit time_t.
19853	STRUCT_STAT.st_[acm]time are declared as unsigned int for some
19854	personalities, while time_t is signed.
19855
19856	* printstat.h (DO_PRINTSTAT): If st_[acm]time have the same size as int,
19857	explicitly cast them to int.
19858	* tests/stat64-v.test: Test that negative time_t is decoded properly.
19859
19860	Reported-by: Andreas Schwab <schwab@suse.de>
19861
198622015-03-16  Dmitry V. Levin  <ldv@altlinux.org>
19863
19864	semctl: fix indirect syscall decoding.
19865	On architectures where the semctl call is implemented by the ipc syscall
19866	the 4th argument is passed by reference.
19867
19868	* ipc.c (sys_semctl): Handle the indirect ipc subcall case.
19869	* tests/ipc_sem.c (main): Optionally match indirection
19870	in the 4th argument of semctl calls.
19871
19872	Reported-by: Andreas Schwab <schwab@suse.de>
19873
198742015-03-16  Andreas Schwab  <schwab@suse.de>
19875
19876	tests/ipc_*: match IPC_64 flag.
19877	* tests/ipc_msg.c (main): Optionally match "IPC_64|" in the third
19878	argument of the ipc call.
19879	* tests/ipc_sem.c (main): Likewise.
19880	* tests/ipc_shm.c (main): Likewise.
19881
198822015-03-16  Andreas Schwab  <schwab@suse.de>
19883
19884	Fix crash in ipc_sem test.
19885	Properly use union semun as argument of semctl.
19886
19887	* tests/ipc_sem.c (main): Properly use union semun as argument of
19888	semctl.  Don't handle EFAULT specially.
19889	* tests/ipc_sem.test: Revert last change.
19890
198912015-03-16  Andreas Schwab  <schwab@suse.de>
19892
19893	m68k: fix sigreturn decoding.
19894	* sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
19895	signal mask from the proper place.
19896
19897	aarch64: fix ioctl decoding.
19898	* linux/aarch64/ioctls_inc0.h: Rename from ioctls_inc1.h.
19899	* linux/aarch64/ioctls_inc1.h: Rename from ioctls_inc0.h.
19900	* linux/aarch64/ioctls_arch0.h: Rename from ioctls_arch1.h.
19901	* linux/aarch64/ioctls_arch1.h: Rename from ioctls_arch0.h.
19902
199032015-03-12  Andreas Schwab  <schwab@suse.de>
19904
19905	tests/select.test: handle architectures using pselect6 syscall.
19906	* tests/select.awk (BEGIN): Update regexps to match both select
19907	and pselect6 syscalls.
19908	* tests/select.test: Probe for both select and pselect6 syscall.
19909
19910	Distribute linux/aarch64/arch_regs.h.
19911	* Makefile.am (EXTRA_DIST): Add linux/aarch64/arch_regs.h.
19912
19913	Fix decoding of mmap2 for arm.
19914	* syscallent.h (mmap2): Decode with sys_mmap_4koff, not
19915	sys_mmap_pgoff.
19916
199172015-03-12  Andreas Schwab  <schwab@suse.de>
19918
19919	m68k: define HAVE_SA_RESTORER.
19920	On m68k the kernel sigaction structure has the sa_restorer member for
19921	historical reasons.
19922
19923	* signal.c (HAVE_SA_RESTORER): Define for M68K.
19924
199252015-03-11  Dmitry V. Levin  <ldv@altlinux.org>
19926
19927	aarch64: fix rt_sigreturn decoding.
19928	* sigreturn.c (sys_sigreturn) [AARCH64]: Fix personality check.
19929
199302015-03-09  Dmitry V. Levin  <ldv@altlinux.org>
19931
19932	maint: post-release administrivia.
19933	* NEWS: Add header line for next release.
19934
199352015-03-06  Dmitry V. Levin  <ldv@altlinux.org>
19936
19937	Prepare for 4.10 release.
19938	* NEWS: Update for 4.10 release.
19939	* debian/changelog: 4.10-1.
19940	* strace.spec: 4.10-1.
19941
19942	Move sigreturn/rt_sigreturn parser to a separate file.
19943	* sigreturn.c: New file.
19944	* Makefile.am (strace_SOURCES): Add it.
19945	* defs.h (sprintsigmask_n): New prototype.
19946	(tprintsigmask_addr): New macro.
19947	* signal.c (sprintsigmask_n): Make global.
19948	(tprintsigmask_addr): Remove.
19949	(sys_sigreturn): Move to sigreturn.c.
19950
199512015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
19952
19953	ia64: use PTRACE_GETREGS to fetch registers.
19954	* linux/ia64/arch_regs.h: Stop including <asm/rse.h>.
19955	(ia64_frame_ptr): New declaration.
19956	* signal.c (sys_sigreturn) [IA64]: Use ia64_frame_ptr.
19957	* syscall.c [IA64]: Include <asm/rse.h>.
19958	[IA64] (ia64_regs, ia64_frame_ptr): New variable.
19959	[IA64] (ARCH_REGS_FOR_GETREGS): New macro.
19960	[IA64] (ia64_ia32mode): Convert to macro.
19961	[IA64] (ia64_r8, ia64_r10): Remove.
19962	(getrval2, print_pc, get_scno, get_syscall_args, get_error) [IA64]:
19963	Use ia64_regs.
19964	(get_syscall_result) [IA64]: Remove.
19965
19966	s390, s390x: use PTRACE_GETREGSET to fetch registers.
19967	* linux/s390/arch_regs.h: New file.
19968	* linux/s390x/arch_regs.h: New file.
19969	* Makefile.am (EXTRA_DIST): Add them.
19970	* signal.c (sys_sigreturn) [S390 || S390X]: Use s390_frame_ptr.
19971	* syscall.c [S390 || S390X] (s390_regset, s390_frame_ptr): New variable.
19972	[S390 || S390X] (ARCH_REGS_FOR_GETREGSET): New macro.
19973	(print_pc) [S390 || S390X]: Use s390_regset.
19974	(get_scno) [S390 || S390X]: Likewise.
19975	(get_syscall_args) [S390 || S390X]: Likewise.
19976	(get_error) [S390 || S390X]: Likewise.
19977	(get_syscall_result) [S390 || S390X]: Remove.
19978
19979	qemu_multiarch_testing: update.
19980	* qemu_multiarch_testing/README: Update statistics.
19981
199822015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
19983
19984	tests: robustify unix-yy.test.
19985	Implement additional synchronization between parent and child processes
19986	to guarantee that the child starts closing connected socket only after
19987	exiting of the parent's accept() syscall.
19988	This guarantee seems to be necessary to reliably receive UNIX_DIAG_PEER
19989	messages from NETLINK_SOCK_DIAG interface.
19990
19991	* tests/net-accept-connect.c: Implement additional synchronization
19992	between parent and child processes.
19993	* tests/unix-yy-connect.awk: Update.
19994
199952015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
19996
19997	Use SIGRTMIN from kernel headers.
19998	* configure.ac (ASM_SIGRTMIN): Define to SIGRTMIN from <asm/signal.h>.
19999	* signal.c: Use ASM_SIGRTMIN instead of constants provided by libc.
20000	* tests/sigreturn.c: Use ASM_SIGRTMIN instead of hardcoded value.
20001	Use lower RT_* numbers to support pre-3.18 hppa kernels.
20002	* tests/sigreturn.test: Update regexp.
20003
200042015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
20005
20006	ppc64: fix compilation warning.
20007	Fix compilation warning introduced by commit
20008	577be2593d4895ef941e1c4e5e1608f7dd13610d
20009
20010	* signal.c (sys_sigreturn) [POWERPC64]: Fix initialization of signal
20011	mask on 32bit personality.
20012
200132015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
20014
20015	aarch64: fix compilation warnings.
20016	Fix compilation warnings introduced by commit
20017	5b9b7e1d347eb4556084cdccad75e8247c535ed5:
20018
20019	signal.c:702:45: warning: signed and unsigned type in conditional expression [-Wsign-compare]
20020	syscall.c:746:34: warning: initialization from incompatible pointer type [enabled by default]
20021
20022	* syscall.c [AARCH64] (aarch64_sp_ptr): Add explicit cast.
20023	[AARCH64] (arm_sp_ptr): Change pointer type to unsigned.
20024	* linux/aarch64/arch_regs.h (arm_sp_ptr): Update.
20025
20026	Reported-by: Mike Frysinger <vapier@gentoo.org>
20027
200282015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
20029
20030	i386: simplify sigreturn decoding.
20031	* signal.c (sys_sigreturn) [X86_64 || X32 || I386]: Do not define
20032	i386_sigcontext_struct and i386_fpstate structures.
20033
200342015-03-05  Dmitry V. Levin  <ldv@altlinux.org>
20035
20036	tests: add a test for sigreturn/rt_sigreturn decoding.
20037	Convert test/sigreturn.c into a regular test.
20038
20039	* test/Makefile (PROGS): Remove sigreturn.
20040	* test/.gitignore: Likewise.
20041	* test/sigreturn.c: Rewrite to ...
20042	* tests/sigreturn.c: ... new file.
20043	* tests/sigreturn.test: New test.
20044	* tests/Makefile.am (check_PROGRAMS): Add sigreturn.
20045	(TESTS): Add sigreturn.test.
20046	* tests/.gitignore: Add sigreturn.
20047
200482015-03-04  Dmitry V. Levin  <ldv@altlinux.org>
20049
20050	sigreturn: print signal mask as a syscall argument.
20051	Although sigreturn takes signal mask via frame pointer,
20052	it's more convenient to display signal mask as a syscall argument
20053	rather than an outstanding object of unknown nature:
20054
20055	Before this change:
20056	    sigreturn() (mask [USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]) = 0
20057
20058	After this change:
20059	    sigreturn({mask=[USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]}) = 0
20060
20061	* signal.c (sys_sigreturn): Display signal mask as a syscall argument.
20062
200632015-03-04  Dmitry V. Levin  <ldv@altlinux.org>
20064
20065	aarch64: implement rt_sigreturn decoding.
20066	* linux/64/syscallent.h (139): Use sys_sigreturn for rt_sigreturn
20067	decoding.
20068	* syscall.c [ARM] (arm_regs): Make static.
20069	[ARM] (arm_sp_ptr): New variable.
20070	[AARCH64] (aarch64_sp_ptr, arm_sp_ptr): New variables.
20071	* linux/aarch64/arch_regs.h: New file.
20072	* linux/arm/arch_regs.h (arm_regs): Remove.
20073	(arm_sp_ptr): New declaration.
20074	* signal.c (sys_sigreturn) [ARM]: Use arm_sp_ptr.
20075	[AARCH64]: Print signal mask.
20076
20077	arm: simplify sigreturn decoding.
20078	* signal.c (sys_sigreturn) [ARM]: Do not define sigcontext and ucontext
20079	structures, fetch signal mask only, use print_sigset_addr_len.
20080
20081	s390: fix sigreturn decoding.
20082	* signal.c (sys_sigreturn) [S390]: Fix signal mask decoding.
20083
20084	mips o32: fix sigreturn decoding.
20085	* signal.c (sys_sigreturn) [LINUX_MIPSO32]: Fix the address of signal mask.
20086	[MIPS] Use print_sigset_addr_len to print signal mask.
20087
20088	x86_64, x32: implement rt_sigreturn decoding.
20089	* syscall.c [X86_64 || X32] (x86_64_rsp_ptr): New variable.
20090	* linux/x86_64/arch_regs.h (x86_64_rsp_ptr): New declaration.
20091	* linux/x86_64/syscallent.h (15): Use sys_sigreturn for rt_sigreturn
20092	decoding.
20093	* linux/x32/syscallent.h (513): Likewise.
20094	* signal.c (sys_sigreturn) [X86_64 || X32]: Print signal mask
20095	for non-i386 personalities.
20096
20097	sparc, sparc64: fix sigreturn decoding.
20098	* linux/sparc/arch_regs.h (U_REG_FP): New macro.
20099	* signal.c (sys_sigreturn) [SPARC || SPARC64]: Fix decoding
20100	of upper 32 bits of the sigmask.
20101
20102	ppc, ppc64: fix sigreturn decoding.
20103	* signal.c (sys_sigreturn) [POWERPC]: Fix decoding of upper 32 bits
20104	of the sigmask.
20105
20106	sigreturn: issue a less innocuous warning.
20107	* signal.c (sys_sigreturn): Issue a less innocuous warning on
20108	architectures for which signal mask decoding is not implemented yet.
20109
201102015-03-04  Dmitry V. Levin  <ldv@altlinux.org>
20111
20112	bootstrap: do not link Makefile* files.
20113	* bootstrap: Do not symlink any Makefile* files, not just Makefile.am
20114	and Makefile.in.
20115
20116	Reported-by: Christopher Covington <cov@codeaurora.org>
20117
201182015-03-04  Dmitry V. Levin  <ldv@altlinux.org>
20119
20120	ia64: fix sigreturn decoding.
20121	* signal.c (sys_sigreturn) [IA64]: Fix the address of signal mask.
20122	Use print_sigset_addr_len to print signal mask.
20123
201242015-03-04  Dmitry V. Levin  <ldv@altlinux.org>
20125
20126	ia64: use generic signalent.
20127	This complements commit v4.9-321-gfcf7f8d.
20128
20129	* linux/ia64/signalent.h: Remove.
20130	* Makefile.am (EXTRA_DIST): Remove it.
20131
201322015-03-04  Giedrius Statkevičius  <giedrius.statkevicius@gmail.com>
20133
20134	Document that -k is available only with libunwind.
20135	Without this users might get confused why `man strace` describes
20136	an option that doesn't work.
20137
20138	* strace.1: Note that -k is available only if strace is built
20139	with libunwind.
20140
201412015-03-03  Dmitry V. Levin  <ldv@altlinux.org>
20142
20143	debian: update control file.
20144	* debian/control (strace, strace-udeb): Add mips64 and mips64el
20145	to architecture list.
20146	Patch by James Cowgill <james410@cowgill.org.uk>
20147
20148	This fixes Debian bug #773375.
20149
201502015-03-03  Dmitry V. Levin  <ldv@altlinux.org>
20151
20152	debian: sync with 4.9-2 package.
20153	* debian/changelog: Sync with 4.9-2.
20154	* debian/control: Likewise.
20155
201562015-03-03  Dmitry V. Levin  <ldv@altlinux.org>
20157
20158	Add arch-specific PTRACE_* constants.
20159	* xlat/ptrace_cmds.in: Add arch-specific ptrace commands.
20160	* xlat/ptrace_events.in: Add PTRACE_EVENT_MIGRATE for tile.
20161	* xlat/ptrace_setoptions_flags.in: Add PTRACE_O_TRACEMIGRATE for tile.
20162
20163	This fixes Debian bug #734554.
20164
201652015-03-03  Mike Frysinger  <vapier@gentoo.org>
20166
20167	Clarify bootstrap-vs-autoreconf usage.
20168	* README-hacking: Tell people to run ./bootstrap.
20169
201702015-03-03  Dmitry V. Levin  <ldv@altlinux.org>
20171
20172	mips n32: fix preadv/pwritev offset decoding.
20173	In mips n32 abi, like in most of 32-bit architectures, offset
20174	is passed to preadv/pwritev syscalls using two syscall arguments.
20175
20176	* io.c (print_llu_from_low_high_val) [LINUX_MIPSN32]: Remove.
20177
201782015-03-03  Mike Frysinger  <vapier@gentoo.org>
20179
20180	tests: skip ipc_sem.test on broken kernels.
20181	Rather than trigger an ERROR which fails `make check`, go with SKIP
20182	instead.  We don't want the testsuite failing due to kernel bugs.
20183
20184	* tests/ipc_sem.c (main): Change 99 to 77.
20185
201862015-03-03  Mike Frysinger  <vapier@gentoo.org>
20187
20188	tests: skip pc.test on s390.
20189	The s390 hardware can't support an exact si_addr, and the current kernels
20190	don't handle text addresses correctly at all.  Until that improves, skip
20191	the test on s390.
20192
20193	* tests/pc.c (main): Return 77 on s390 systems.
20194
201952015-03-03  Mike Frysinger  <vapier@gentoo.org>
20196
20197	tests: note the kernel configs for -yy options.
20198	* tests/net-yy.test: Note CONFIG_INET_TCP_DIAG.
20199	* tests/unix-yy.test: Note CONFIG_UNIX_DIAG.
20200
202012015-03-02  Dmitry V. Levin  <ldv@altlinux.org>
20202
20203	alpha: fix -yy decoding.
20204	* socketutils.c (receive_responses): Align buffer on a sizeof(long) boundary.
20205
20206	Reported-and-tested-by: Mike Frysinger <vapier@gentoo.org>
20207
202082015-03-02  Dmitry V. Levin  <ldv@altlinux.org>
20209
20210	aarch64, x32: fix decoding of compat personality statfs64/fstatfs64.
20211	* statfs.c (struct compat_statfs64) [AARCH64 || X32]: Apply the same
20212	attributes as on X86_64.
20213
20214	mips: fix compilation warning.
20215	* syscall.c (get_scno) [MIPS]: Fix harmless compilation warning
20216	about comparison between signed and unsigned integer expressions.
20217
20218	x32: fix compilation warnings.
20219	* sysinfo.c (sys_sysinfo): Use ll length format modifier
20220	instead of l and cast kernel ulong types to unsigned long long.
20221
20222	aarch64: add -i option support.
20223	* syscall.c (print_pc): Add aarch64 support.
20224
202252015-03-02  Dmitry V. Levin  <ldv@altlinux.org>
20226
20227	ioctl: use x32 specific ioctl entries on x32 personality.
20228	As ioctls_inc.h generated natively on x32 differs both from 32/ioctls_inc.h
20229	(by 45 entries) and from linux/64/ioctls_inc.h (by 322 entries), use x32
20230	specific ioctl entries on x32 personality.
20231
20232	* linux/x32/ioctls_inc0.h: Generate from linux v3.19 using ioctls_gen.sh.
20233	* linux/x86_64/ioctlent2.h: Remove.
20234	* linux/x86_64/ioctls_arch2.h: New file.
20235	* linux/x86_64/ioctls_inc2.h: New file.
20236	* Makefile.am (EXTRA_DIST): Remove linux/x86_64/ioctlent2.h, add
20237	linux/x86_64/ioctls_arch2.h and linux/x86_64/ioctls_inc2.h.
20238
202392015-03-02  Dmitry V. Levin  <ldv@altlinux.org>
20240
20241	tests/uid16: skip if real uid is larger than 16bit.
20242	* tests/uid16.c (main): Skip if the uid returned by getuid matches
20243	/proc/sys/kernel/overflowuid.
20244
202452015-03-02  Dmitry V. Levin  <ldv@altlinux.org>
20246
20247	tests: fix uid tests on big endian architectures.
20248	* tests/uid.c (main): Ignore uids returned by getresuid to avoid
20249	16bit vs 32bit issues on big endian architectures.
20250	Change real UID instead of effective UID in setresuid test.
20251	* tests/uid16.c (main): Likewise.
20252	* tests/uid32.c (main): Change real UID instead of effective UID
20253	in setresuid test to match uid.c
20254	* tests/uid.awk: Update setresuid regexp.
20255
20256	Reported-by: Mike Frysinger <vapier@gentoo.org>
20257
202582015-03-01  Mike Frysinger  <vapier@gentoo.org>
20259
20260	tests/getdents: handle older getdents calls.
20261	If the tools we use call older getdents syscalls where d_type isn't
20262	passed back, or the arch is old (like Alpha) and can't pass back in
20263	either version, make sure we don't fail.
20264
20265	* tests/getdents.awk (d_type_dir, d_type_reg): Accept DT_UNKNOWN.
20266
202672015-02-28  Dmitry V. Levin  <ldv@altlinux.org>
20268
20269	Fix multiple personalities support in decoding syscall return values.
20270	* syscall.c (trace_syscall_exiting): When current personality is 32bit,
20271	print 32bit return code.
20272
20273	Update generic 64-bit ioctlent from linux v3.19.
20274	* linux/64/ioctls_inc.h: Update from linux v3.19 using ioctls_gen.sh.
20275
202762015-02-28  Dmitry V. Levin  <ldv@altlinux.org>
20277
20278	sparc, sparc64: fix rt_sigaction decoding.
20279	Fix regression introduced by commit v4.9-9-gc3a5c01.
20280
20281	* signal.c (HAVE_SA_RESTORER): New macro.
20282	[HPPA || IA64]: Do not undefine SA_RESTORER.
20283	(old_sigaction, old_sigaction32, new_sigaction): Use HAVE_SA_RESTORER
20284	instead of SA_RESTORER to check whether to define sa_restorer.
20285	(decode_old_sigaction, decode_new_sigaction): Use HAVE_SA_RESTORER in
20286	addition to SA_RESTORER to check whether to use sa_restorer.
20287
202882015-02-28  Dmitry V. Levin  <ldv@altlinux.org>
20289
20290	Fix stack buffer overflow when specified command is too long.
20291	* strace.c (startup_child): Check that the length of the command strace
20292	is going to execute does not exceed PATH_MAX limit.
20293
20294	Reported-by: Cheolung Lee <chpie@grayhash.com>
20295
202962015-02-28  Dmitry V. Levin  <ldv@altlinux.org>
20297
20298	build: include ptrace.h after regs.h.
20299	Restore the order of including <sys/reg.h> and <linux/ptrace.h>
20300	headers that was inadvertently changed by commit v4.9-280-g5503dd2.
20301
20302	This should fix build on platforms like m68k where some constants
20303	are defined simultaneously as enums by <sys/reg.h> and as macros
20304	by <asm/ptrace.h>.
20305
20306	* process.c: Include "ptrace.h" after "regs.h".
20307	* signal.c: Likewise.
20308	* syscall.c: Likewise.
20309	* util.c: Likewise.
20310
203112015-02-28  Dmitry V. Levin  <ldv@altlinux.org>
20312
20313	x32: fix decoding of timeval, timespec, and timex structures.
20314	As time_t is a 64-bit type in x32 personality, it is not correct to
20315	treat it as a long int type.
20316
20317	* time.c (current_time_t_is_compat): New macro.
20318	(sprinttv, sprint_timespec, printitv_bitness, tprint_timex): Use it.
20319	(tprint_timeval, do_sprinttv, sprint_timespec): Use j and uintmax_t
20320	when printing tv_sec/tv_usec.
20321	(tprint_timex): Use j and intmax_t/uintmax_t when printing struct timex
20322	members of type kernel_long_t.
20323
203242015-02-28  Mike Frysinger  <vapier@gentoo.org>
20325
20326	tests/ipc_sem: detect broken kernels.
20327	When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
20328	logic wrongly returns errors.  Detect that and throw an error.
20329
20330	* tests/ipc_sem.c: Return 99 when errno is EFAULT.
20331	* tests/ipc_sem.test: Save output to $OUT and show it when failing.
20332	Handle exit status 99 to throw an ERROR.
20333
203342015-02-27  Dmitry V. Levin  <ldv@altlinux.org>
20335
20336	build: do not link strace with -ldl.
20337	* configure.ac: Fix dladdr check.
20338
203392015-02-27  Mike Frysinger  <vapier@gentoo.org>
20340
20341	Handle broken PTRACE_EVENT_STOP values.
20342	For a few linux releases (3.1 through 3.3), this define in the exported
20343	headers were broken.  Redefine if that's the case.
20344
20345	* ptrace.h [PTRACE_EVENT_STOP]: Redefine if PTRACE_EVENT_STOP is 7.
20346
203472015-02-27  Mike Frysinger  <vapier@gentoo.org>
20348
20349	bootstrap: always set up test dirs.
20350	When files get updated, the bootstrap script should make sure the
20351	parallel dirs are kept in sync.
20352
20353	* bootstrap: Always generate the test$m.  Clean up symlinks first.
20354	Don't link in Makefile.in files.
20355
203562015-02-27  Mike Frysinger  <vapier@gentoo.org>
20357
20358	Fix cross-compiling of ioctlsort.
20359	Use the AX_PROG_CC_FOR_BUILD helper to set up build settings when cross
20360	compiling.  This way ioctlsort uses the build tools all the time.
20361
20362	* configure.ac: Call AX_PROG_CC_FOR_BUILD.
20363	* Makefile.am (ioctlsort_CC): Set to CC_FOR_BUILD.
20364	(ioctlsort_CPPFLAGS): Change CPPFLAGS to CPPFLAGS_FOR_BUILD.
20365	(ioctlsort_CFLAGS): Change CFLAGS to CFLAGS_FOR_BUILD.
20366	(ioctlsort_LDFLAGS): Change LDFLAGS to LDFLAGS_FOR_BUILD.
20367	(ioctlsort_LD): Delete.
20368	(ioctlsort%): Change to ioctlsort%$(BUILD_EXEEXT).  Use ioctlsort_CFLAGS.
20369	* m4/ax_prog_cc_for_build.m4: Import from the autoconf-archive package.
20370
203712015-02-27  Dmitry V. Levin  <ldv@altlinux.org>
20372
20373	tests: robustify pc.test.
20374	* configure.ac: Check for dladdr in -ldl.
20375	* tests/Makefile.am (pc_LDADD): Adde $(dl_LIBS).
20376	* tests/pc.c: Include "config.h" and <dlfcn.h>.
20377	(main): Use dladdr to find the address to unmap.
20378
203792015-02-27  Dmitry V. Levin  <ldv@altlinux.org>
20380
20381	tests: drop support for alternative names of select syscall.
20382	This mostly reverts commit 4a00fc4867bde7a4c333f238851e5cb03f02c824.
20383
20384	* tests/select.awk: Drop _newselect support.
20385	* tests/select.test: Skip if select syscall is not supported.
20386
203872015-02-27  Dmitry V. Levin  <ldv@altlinux.org>
20388
20389	Rename _newselect to select.
20390	As an exception to the general rules that syscall names should match
20391	__NR_* constants defined in kernel headers, show select as "select"
20392	and old select as "oldselect".
20393
20394	* linux/arm/syscallent.h (82): Change name to oldselect.
20395	* linux/hppa/syscallent.h (142): Change name to select.
20396	* linux/mips/syscallent-n32.h (6022): Likewise.
20397	* linux/mips/syscallent-n64.h (5022): Likewise.
20398	* linux/mips/syscallent-o32.h (4142): Likewise.
20399	* linux/sparc/syscallent.h (230): Likewise.
20400
204012015-02-27  Dmitry V. Levin  <ldv@altlinux.org>
20402
20403	sparc: sync syscall entries with kernel headers.
20404	* linux/sparc/syscallent.h: Fix syscall entries for vmsplice,
20405	inotify_init, inotify_add_watch, inotify_rm_watch, inotify_rm_watch,
20406	ioprio_set, ioprio_get, splice, sync_file_range, sched_getaffinity, and
20407	sched_setaffinity.
20408	(67, 68, 202, 230): Change syscall names to match __NR_* constants
20409	defined in arch/sparc/include/uapi/asm/unistd.h.
20410
204112015-02-26  Dmitry V. Levin  <ldv@altlinux.org>
20412
20413	s390, s390x: sync syscall entry names with kernel headers.
20414	* linux/s390/syscallent.h (1, 180, 181): Change syscall names to match
20415	__NR_* constants defined in arch/s390/include/uapi/asm/unistd.h.
20416	* linux/s390x/syscallent.h: Likewise.
20417
204182015-02-26  Mike Frysinger  <vapier@gentoo.org>
20419
20420	xlat: avoid fork bombing the build system.
20421	When there were fewer xlat headers, this didn't matter as much.
20422	But now with >200, trying to run them all in parallel can easily
20423	fork bomb smaller systems.
20424
20425	* xlat/gen.sh (main): Do not more jobs than # of cpus.
20426
204272015-02-26  Dmitry V. Levin  <ldv@altlinux.org>
20428
20429	arm: sync syscall entry names with kernel.
20430	* linux/arm/syscallent.h (82, 90, 180, 181, 327):
20431	Change syscall names to match __NR_* constants defined
20432	in arch/arm/include/uapi/asm/unistd.h.
20433
20434	arm: fix get_mempolicy, set_mempolicy, and timerfd_create syscall entries
20435	* linux/arm/syscallent.h (320, 321, 350): Fix names and handlers.
20436
20437	hppa: sync syscall entry names with kernel.
20438	* linux/hppa/syscallent.h (18, 28, 59, 84, 108, 109, 280):
20439	Change syscall names to match __NR_* constants defined in
20440	arch/parisc/include/uapi/asm/unistd.h.
20441
20442	subcall.h: add sendmmsg entry.
20443	* linux/subcall.h: Add sys_sendmmsg entry.
20444	(SYS_socket_nsubcalls): Update.
20445
20446	arm: simplify ARM_FIRST_SHUFFLED_SYSCALL definition.
20447	* linux/arm/syscallent.h (ARM_FIRST_SHUFFLED_SYSCALL): Use SYS_ipc_subcall.
20448
20449	ia64: parametrize i386 syscallent size check.
20450	* linux/ia64/syscallent.h: Use (SYS_ipc_subcall + SYS_ipc_nsubcalls)
20451	instead of numeric constant.
20452
20453	Cleanup linux/subcall.h.
20454	* linux/subcall.h: Use SYS_ipc_subcall.
20455
20456	alpha: fix statfs decoding.
20457	* statfs.c (printstatfs) [ALPHA]: Remove faulty code.
20458
20459	x32: fix build regression.
20460	* linux/x32/arch_regs.h: New file.
20461	* Makefile.am (EXTRA_DIST): Add it.
20462
204632015-02-26  Mike Frysinger  <vapier@gentoo.org>
20464
20465	hppa: fix fanotify_mark decoding.
20466	The parisc kernel has some legacy baggage here and decodes the 64bit
20467	field in the reverse order.  Handle it in strace too.
20468
20469	* fanotify.c [HPPA] (sys_fanotify_mark): Reverse the mask bits.
20470
204712015-02-26  Mike Frysinger  <vapier@gentoo.org>
20472
20473	ia64: fix decoding of getresuid/getresgid/setresgid.
20474	Looks like the similarity of these names caused confusion when generating
20475	the syscall table.  getresgid was wired to the wrong output while the other
20476	two were wired up to printargs instead of the real printer.
20477
20478	* linux/ia64/syscallent.h: Connect getresuid to sys_getresuid, getresgid to
20479	sys_getresgid, and setresgid to sys_setresgid.
20480
204812015-02-26  Mike Frysinger  <vapier@gentoo.org>
20482
20483	ia64: fix up builds after 16bit uid support.
20484	The ia64 port pulls in the i386 syscall table so it can decode
20485	32bit apps, so we need to enable the 16bit uid parsers for it.
20486
20487	* defs.h (NEED_UID16_PARSERS): Define to 1 for IA64.
20488	* linux/ia64/syscallent.h: Undefine sys_stime to avoid redefine warnings.
20489
204902015-02-26  Mike Frysinger  <vapier@gentoo.org>
20491
20492	v4l2: use uintmax_t for times.
20493	There is no guarantee that the backing value for the various time fields
20494	are ints or longs which makes printfs annoying.  Lets cast them to the
20495	uintmax_t type so we can use the j flag and not worry about truncation.
20496
20497	* v4l2.c (v4l2_ioctl): Use j and uintmax_t when printing tv_sec/tv_usec.
20498
204992015-02-26  Mike Frysinger  <vapier@gentoo.org>
20500
20501	ignore core/compile files.
20502	Newer autotools includes a compile helper script.
20503
20504	* .gitignore: Add /compile and core.
20505
205062015-02-24  Dmitry V. Levin  <ldv@altlinux.org>
20507
20508	NEWS: Prepare for 4.10 release.
20509
205102015-02-24  Dmitry V. Levin  <ldv@altlinux.org>
20511
20512	Remove support for systems without PTRACE_SETOPTIONS.
20513	Assume that the kernel is v2.5.46 or newer, i.e. PTRACE_SETOPTIONS
20514	and PTRACE_O_TRACESYSGOOD|PTRACE_O_TRACEEXEC|PTRACE_O_TRACECLONE
20515	are universally available.
20516
20517	This change removes all code that implemented post-execve SIGTRAP
20518	handling and fork/vfork/clone->CLONE_PTRACE substitution.
20519
20520	* defs.h (TCB_BPTSET, TCB_WAITEXECVE): Remove macros.
20521	(need_fork_exec_workarounds, setbpt, clearbpt): Remove declarations.
20522	* strace.c (need_fork_exec_workarounds,
20523	test_ptrace_setoptions_followfork, test_ptrace_setoptions_for_all):
20524	Remove.
20525	(syscall_trap_sig): Set to (SIGTRAP | 0x80).
20526	(ptrace_setoptions): Set to (PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC).
20527	(detach): Do not test for TCB_BPTSET.
20528	(init): Do not call test_ptrace_setoptions_followfork and
20529	test_ptrace_setoptions_for_all.  Do not test for TCB_BPTSET.
20530	* syscall.c (syscall_fixup_on_sysenter, internal_fork, internal_exec,
20531	syscall_fixup_for_fork_exec, syscall_fixup_on_sysexit): Remove.
20532	(trace_syscall_entering): Do not test for TCB_WAITEXECVE.  Do not call
20533	syscall_fixup_on_sysenter and syscall_fixup_for_fork_exec.
20534	(trace_syscall_exiting): Do not call syscall_fixup_on_sysexit and
20535	syscall_fixup_for_fork_exec.
20536	[IA64] (ia64_ia32mode): Make static.
20537	* linux/ia64/arch_regs.h (ia64_ia32mode): Remove declaration.
20538	* util.c: Do not include "syscall.h".
20539	(arg_setup, get_arg0, get_arg1, set_arg0, set_arg1, restore_arg0,
20540	restore_arg1, arg_finish_change, change_syscall, setbpt, clearbpt):
20541	Remove.
20542	* tests/ptrace_setoptions.test: Remove.
20543	* tests/Makefile.am (TESTS): Remove it.
20544
205452015-02-24  Dmitry V. Levin  <ldv@altlinux.org>
20546
20547	tests: robustify pc.test.
20548	* tests/pc.c (main): Unmap larger memory region.
20549	Dump process map for debug purposes.
20550	* tests/pc.test: Update regexps to take CLD_DUMPED child process
20551	into account.
20552
205532015-02-23  Dmitry V. Levin  <ldv@altlinux.org>
20554
20555	tests: fix "make dist" regression.
20556	* tests/Makefile.am (EXTRA_DIST): Add getrandom.awk.
20557
20558	tests: workaround broken awk.
20559	* tests/getdents.out: New file.
20560	* tests/Makefile.am (EXTRA_DIST): Add it.
20561	* tests/getdents.test: Check whether awk is capable of matching long
20562	regular expressions.
20563
205642015-02-23  Dmitry V. Levin  <ldv@altlinux.org>
20565
20566	Fix compilation warnings about incompatible print formats.
20567	On some platforms printing of __s64 types with "%lld" format,
20568	or __u64 types with "%llu" or "%llx" formats causes a warning
20569	that __s64/__u64 type is not compatible with long long format.
20570	From my PoV, this is nonsense, but the workaround costs nothing.
20571
20572	* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Cast __u64 types
20573	to (unsigned long long).
20574	* v4l2.c (v4l2_ioctl): Likewise.  Cast __s64 type to (long long).
20575
205762015-02-23  Dmitry V. Levin  <ldv@altlinux.org>
20577
20578	powerpc64: fix build regression.
20579	* linux/powerpc64/arch_regs.h: New file.
20580	* Makefile.am (EXTRA_DIST): Add it.
20581
20582	signalent: update from linux v3.19.
20583	* linux/alpha/signalent.h: Update from linux v3.19 signalent.sh.
20584	* linux/hppa/signalent.h: Likewise.
20585	* linux/mips/signalent.h: Likewise.
20586	* linux/sparc/signalent.h: Likewise.
20587
20588	Cleanup auxiliary signalent files.
20589	* linux/aarch64/signalent1.h: Include "signalent.h".
20590	* linux/powerpc64/signalent1.h: Likewise.
20591	* linux/sparc64/signalent2.h: Likewise.
20592	* linux/tile/signalent1.h: Likewise.
20593	* linux/x32/signalent1.h: Likewise.
20594	* linux/x86_64/signalent1.h: Likewise.
20595	* linux/x86_64/signalent2.h: Likewise.
20596	* linux/sparc64/signalent.h: Include "sparc/signalent.h".
20597	* linux/sparc64/signalent1.h: Include "sparc/signalent1.h".
20598	* linux/x32/signalent.h: Remove.
20599	* Makefile.am (EXTRA_DIST): Remove linux/x32/signalent.h.
20600
206012015-02-23  Dmitry V. Levin  <ldv@altlinux.org>
20602
20603	x86_64, x32: fix sys_sigreturn.
20604	On x86_64/x32, sys_sigreturn is defined only for i386 personality.
20605
20606	* signal.c (sys_sigreturn): Define for X32.
20607	(sys_sigreturn) [X86_64 || X32]: Implement for i386 personality only.
20608
206092015-02-23  Dmitry V. Levin  <ldv@altlinux.org>
20610
20611	sparc, x32: fix build regression.
20612	* syscall.c (print_pc): Use current_wordsize iff it is defined.
20613
20614	Change errnoent.h files to use designated initializers.
20615	* signal.c (printsiginfo): Allow elements of errnoent array to be zero.
20616	* syscall.c (trace_syscall_exiting): Likewise.
20617	* errnoent.sh: Output designated initializers.
20618	* linux/errnoent.h: Regenerated.
20619	* linux/alpha/errnoent.h: Regenerated.
20620	* linux/hppa/errnoent.h: Regenerated.
20621	* linux/mips/errnoent.h: Regenerated.
20622	* linux/sparc/errnoent.h: Regenerated.
20623	* linux/sparc/errnoent1.h: Regenerated.
20624	* linux/powerpc/errnoent.h: New file.
20625	* linux/powerpc64/errnoent.h: Include "powerpc/errnoent.h".
20626	* Makefile.am (EXTRA_DIST): Add linux/powerpc/errnoent.h
20627	and linux/powerpc64/errnoent.h.
20628
20629	errnoent: update from linux v3.19.
20630	* linux/errnoent.h: Update from linux v3.19 using errnoent.sh.
20631	* linux/alpha/errnoent.h: Likewise.
20632	* linux/hppa/errnoent.h: Likewise.
20633	* linux/mips/errnoent.h: Likewise.
20634	* linux/sparc/errnoent.h: Likewise.
20635
20636	Cleanup auxiliary errnoent files.
20637	* linux/aarch64/errnoent1.h: Include "errnoent.h".
20638	* linux/powerpc64/errnoent1.h: Likewise.
20639	* linux/sparc64/errnoent2.h: Likewise.
20640	* linux/tile/errnoent1.h: Likewise.
20641	* linux/x32/errnoent1.h: Likewise.
20642	* linux/x86_64/errnoent1.h: Likewise.
20643	* linux/x86_64/errnoent2.h: Likewise.
20644	* linux/sparc64/errnoent.h: Include "sparc/errnoent.h".
20645	* linux/sparc64/errnoent1.h: Include "sparc/errnoent1.h".
20646	* linux/x32/errnoent.h: Remove.
20647	* Makefile.am (EXTRA_DIST): Remove linux/x32/errnoent.h.
20648
206492015-02-22  Dmitry V. Levin  <ldv@altlinux.org>
20650
20651	evdev: update constants from linux v3.19.
20652	* xlat/evdev_keycode.in: Update from linux v3.19.
20653	* xlat/evdev_prop.in: Likewise.
20654
20655	evdev: decode keycode value in EVIOC[GS]KEYCODE_V2 commands.
20656	* evdev.c (keycode_V2_ioctl): Use evdev_keycode to print
20657	input_keymap_entry.keycode.
20658
20659	evdev: fix build with old kernel headers.
20660	* configure.ac: Check whether struct input_absinfo.resolution is defined
20661	in <linux/input.h>.
20662	* evdev.c (SYN_MAX): Add fallback definition.
20663	(abs_ioctl): Wrap use of struct input_absinfo.resolution in #ifdef check.
20664	(keycode_V2_ioctl, mtslots_ioctl, repeat_ioctl): Wrap in #ifdef checks.
20665	(evdev_read_ioctl): Wrap in #ifdef checks the code that uses EV_SW,
20666	EVIOCGREP, EVIOCGKEYCODE_V2, EVIOCGMTSLOTS, EVIOCGPROP, and EVIOCGSW.
20667	(evdev_write_ioctl): Wrap in #ifdef checks the code that uses EVIOCSREP,
20668	EVIOCSKEYCODE_V2, EVIOCSCLOCKID, and EVIOCREVOKE.
20669
206702015-02-22  Etienne Gemsa  <etienne.gemsa@lse.epita.fr>
20671
20672	Add decoding for evdev ioctls.
20673	This patch introduces decoding for evdev ioctls.  For EVIOCSFF the five
20674	first members are decoded, the union is not.  The code was compiled and
20675	tested on x86_64 with Linux 3.13.
20676
20677	* evdev.c: New file.
20678	* Makefile.am (strace_SOURCES): Add it.
20679	* defs.h (evdev_ioctl): New prototype.
20680	* ioctl.c (ioctl_decode): Call evdev_ioctl for 'E' ioctl commands.
20681	* xlat/evdev_autorepeat.in: New file.
20682	* xlat/evdev_ff_status.in: New file.
20683	* xlat/evdev_ff_types.in: New file.
20684	* xlat/evdev_keycode.in: New file.
20685	* xlat/evdev_leds.in: New file.
20686	* xlat/evdev_misc.in: New file.
20687	* xlat/evdev_mtslots.in: New file.
20688	* xlat/evdev_prop.in: New file.
20689	* xlat/evdev_relative_axes.in: New file.
20690	* xlat/evdev_snd.in: New file.
20691	* xlat/evdev_switch.in: New file.
20692	* xlat/evdev_sync.in: New file.
20693
206942015-02-22  Dmitry V. Levin  <ldv@altlinux.org>
20695
20696	Fix build with old kernel headers.
20697	* strace.c (print_debug_info, maybe_allocate_tcb, print_signalled,
20698	print_exited): Remove "const" qualifier from status variable to
20699	workaround some old implementations of WIFSIGNALED/WIFSTOPPED/WIFEXITED
20700	macros.
20701	* v4l2.c: Include <linux/types.h>.
20702	(v4l2_ioctl): Check that V4L2_CTRL_FLAG_NEXT_CTRL and VIDIOC_S_EXT_CTRLS
20703	macros are defined.
20704	* tests/Makefile.am (AM_CPPFLAGS): Define.
20705
20706	Fix "make dist" regression.
20707	* Makefile.am (EXTRA_DIST): Remove README-linux.
20708
207092015-02-20  Elliott Hughes  <enh@google.com>
20710
20711	test/sfd.c: add missing includes.
20712
207132015-02-19  Dmitry V. Levin  <ldv@altlinux.org>
20714
20715	Remove linux/fanotify.h.
20716	* linux/fanotify.h: Remove.
20717	* Makefile.am (EXTRA_DIST): Remove it.
20718	* fanotify.c: Do not include <linux/fanotify.h>.
20719	* xlat/fan_classes.in: Add default values.
20720	* xlat/fan_event_flags.in: Likewise.
20721	* xlat/fan_init_flags.in: Likewise.
20722	* xlat/fan_mark_flags.in: Likewise.
20723
20724	Remove linux/keyctl.h.
20725	* linux/keyctl.h: Remove.
20726	* Makefile.am (EXTRA_DIST): Remove it.
20727	* keyctl.c: Do not include <linux/keyctl.h>.
20728	* xlat/key_perms.in: Add default values.
20729	* xlat/key_reqkeys.in: Likewise.
20730	* xlat/key_spec.in: Likewise.
20731	* xlat/keyctl_commands.in: Likewise.
20732
20733	Remove linux/kexec.h.
20734	* linux/kexec.h: Remove.
20735	* Makefile.am (EXTRA_DIST): Remove it.
20736	* kexec.c: Do not include <linux/kexec.h>.
20737	* xlat/kexec_arch_values.in: Add default values.
20738	* xlat/kexec_flags.in: Rename to kexec_load_flags.in, add default
20739	values.
20740
20741	Remove linux/inotify.h.
20742	* linux/inotify.h: Remove.
20743	* Makefile.am (EXTRA_DIST): Remove it.
20744	* inotify.c: Do not include <linux/inotify.h>.
20745	* xlat/inotify_flags.in: Add default values.
20746
20747	Remove linux/reboot.h.
20748	* linux/reboot.h: Remove.
20749	* Makefile.am (EXTRA_DIST): Remove it.
20750	* reboot.c: Do not include <linux/reboot.h>.
20751	* xlat/bootflags1.in: Add default values.
20752	* xlat/bootflags2.in: Likewise.
20753	* xlat/bootflags3.in: Likewise.
20754
20755	seccomp: fix fallback definitions of some SECCOMP_* constants.
20756	* seccomp.c (SECCOMP_SET_MODE_STRICT, SECCOMP_SET_MODE_FILTER,
20757	SECCOMP_FILTER_FLAG_TSYNC): Remove fallback definitions.
20758	* xlat/seccomp_filter_flags.in: Add default value.
20759	* xlat/seccomp_ops.in: Add default values.
20760
207612015-02-19  Dmitry V. Levin  <ldv@altlinux.org>
20762
20763	is_negated_errno: sync MAX_ERRNO with the kernel.
20764	Linux kernel used to guarantee that the largest errno value will not
20765	exceed 4095, but SECCOMP_RET_ERRNO support introduced by kernel commit
20766	v3.4-rc2-13-gacf3b2c71ed20c53dc69826683417703c2a88059 inadvertently
20767	broke it.  The guarantee is back with kernel commit
20768	v3.19-8275-g580c57f1076872ebc2427f898b927944ce170f2d.
20769
20770	* syscall.c (is_negated_errno): Set maximum errno value to 4095.
20771
207722015-02-19  Mike Frysinger  <vapier@gentoo.org>
20773
20774	README-linux: punt.
20775	Considering we're requiring linux-2.6 era kernels, the discussion of
20776	header troubles that plagued 2.2 and 2.4 are no longer relevant.
20777
20778	* README-linux: Delete.
20779
207802015-02-19  Dmitry V. Levin  <ldv@altlinux.org>
20781
20782	Improve prctl decoding.
20783	* configure.ac (AC_CHECK_HEADERS): Add linux/securebits.h.
20784	* prctl.c (sys_prctl): Implement full decoding of all PR_* constants
20785	as defined in linux v3.19.
20786	(sys_arch_prctl): Fix decoding of unknown commands.
20787	* xlat/cap.in: New file.
20788	* xlat/pr_mce_kill.in: New file.
20789	* xlat/pr_mce_kill_policy.in: New file.
20790	* xlat/pr_set_mm.in: New file.
20791	* xlat/pr_tsc.in: New file.
20792	* xlat/pr_unalign_flags.in: New file.
20793	* xlat/secbits.in: New file.
20794	* xlat/prctl_options.in: Remove non-linux constants, add fallback
20795	definitions.
20796	* xlat/seccomp_mode.in: Add fallback definitions.
20797
20798	xlat: extend syntax.
20799	* xlat/gen.sh (gen_header): If the name of constant is specified with a
20800	value, generate a default definition for the constant using this value.
20801	* xlat/timerfdflags.in: Use extended syntax.
20802
20803	Move CAP_* definitions out to header files.
20804	* Makefile.am (strace_SOURCES): Add caps0.h and caps1.h.
20805	* caps0.h: New file.
20806	* caps1.h: New file.
20807	* capability.c: Remove CAP_* definitions, include "caps0.h"
20808	and "caps1.h" instead.
20809	Include "xlat/cap_mask0.h" instead of "xlat/capabilities.h".
20810	Include "xlat/cap_mask1.h" instead of "xlat/capabilities1.h".
20811	(print_cap_bits): Update callers.
20812	* xlat/capabilities.in: Rename to xlat/cap_mask0.in.
20813	* xlat/capabilities1.in: Rename to xlat/cap_mask1.in.
20814
208152015-02-18  Dmitry V. Levin  <ldv@altlinux.org>
20816
20817	Declare all format printers with printf format attribute.
20818	* defs.h (printllval, printnum_int, printnum_long): Mark with
20819	format(printf) attribute.
20820	* sock.c (sock_ioctl): Fix format string.
20821
208222015-02-17  Dmitry V. Levin  <ldv@altlinux.org>
20823
20824	Rename printnum to printnum_long to avoid confusion.
20825	* defs.h (printnum): Rename to printnum_long.
20826	* util.c (printnum): Likewise.
20827	* process.c (sys_ptrace): Likewise.
20828	* time.c (sys_time): Likewise.
20829
20830	Use printnum_int consistently.
20831	* sock.c (sock_ioctl): Use printnum_int instead of printnum to print
20832	integer type.
20833	* stream.c (sys_getpmsg): Likewise.
20834
208352015-02-16  Dmitry V. Levin  <ldv@altlinux.org>
20836
20837	print_pc: fix multiple personalities support.
20838	* syscall.c (print_pc): Choose instruction pointer format depending
20839	on current_wordsize, not the size of long integer type.
20840	* tests/pc.c: New file.
20841	* tests/pc.test: New test.
20842	* tests/Makefile.am (check_PROGRAMS): Add pc.
20843	(TESTS): Add pc.test.
20844	* tests/.gitignore: Add pc.
20845
20846	mips: use PTRACE_GETREGS to fetch all registers.
20847	* linux/mips/arch_regs.h (struct mips_regs): New structure.
20848	(mips_REG_*): New macros.
20849	* signal.c (sys_sigreturn) [MIPS]: Use mips_REG_SP.
20850	* syscall.c [MIPS] (struct mips_regs): New variable.
20851	[MIPS] (ARCH_REGS_FOR_GETREGS): New macro.
20852	(mips_a3, mips_r2): Remove.
20853	(print_pc) [MIPS]: Use mips_REG_EPC.
20854	(get_scno) [MIPS]: Use mips_REG_V0 and mips_REG_A3.
20855	(get_syscall_args) [MIPS]: Use mips_REG_A[0-5].
20856	(get_syscall_result) [MIPS]: Remove.
20857	(get_error) [MIPS]: Use mips_REG_A3 and mips_REG_V0.
20858
20859	mips: move ABI check to configure.ac.
20860	* configure.ac [MIPS]: Check for MIPS ABI.
20861	* defs.h [MIPS]: Remove MIPS ABI check.
20862	* ioctlsort.c: Likewise.
20863
20864	tests: support alternative names of select syscall.
20865	* tests/select.awk: Recognize "_newselect" as another name of "select".
20866	* tests/select.test: Try alternative names of select syscall.
20867
208682015-02-15  Dmitry V. Levin  <ldv@altlinux.org>
20869
20870	i386: fix compilation warning.
20871	Some gcc versions complain about assigning long* to uint32_t* on i386.
20872
20873	* syscall.c [I386] (i386_esp_ptr): Change type from uint32_t* to long*.
20874	* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
20875	* linux/x86_64/arch_regs.h: Do not include "i386/arch_regs.h".
20876	(i386_esp_ptr): New prototype.
20877
208782015-02-14  Dmitry V. Levin  <ldv@altlinux.org>
20879
20880	Do not reset get_regs_error unnecessarily.
20881	As get_regs() is now guaranteed to set get_regs_error,
20882	there is no need to reset get_regs_error before get_regs() call.
20883
20884	* strace.c (trace): Call clear_regs() iff !WIFSTOPPED.
20885
208862015-02-14  Dmitry V. Levin  <ldv@altlinux.org>
20887
20888	get_syscall_result: remove redundant ifdefs.
20889	As get_regs() is now guaranteed to fetch registers when either
20890	ARCH_REGS_FOR_GETREGSET or ARCH_REGS_FOR_GETREGS is defined, we can
20891	safely replace all checks for architectures where these macros are defined
20892	with a single check for these macros.
20893
20894	* syscall.c (get_syscall_result): Check for [ARCH_REGS_FOR_GETREGSET ||
20895	ARCH_REGS_FOR_GETREGS].  Remove all checks for architectures where
20896	nothing has to be done after get_regs().
20897
208982015-02-14  Dmitry V. Levin  <ldv@altlinux.org>
20899
20900	get_regs: define for all architectures.
20901	* defs.h (get_regs_error): Remove.
20902	(clear_regs): Update prototype, declare unconditionally.
20903	(get_regs): Declare unconditionally.
20904	* syscall.c (clear_regs): New function.
20905	(get_regs): Define unconditionally.
20906	(get_regs_error): Define unconditionally, change scope to static.
20907
20908	get_regs: unify code for architectures that use PTRACE_GETREGS.
20909	* syscall.c [I386, POWERPC, ARM, AVR32, SPARC, SPARC64, TILE]
20910	(ARCH_REGS_FOR_GETREGS): New macro.
20911	(get_regs): Unify code for ARCH_REGS_FOR_GETREGS architectures.
20912
20913	get_regset: define iff PTRACE_GETREGSET is used.
20914	* syscall.c [AARCH64, X86_64, X32] (ARCH_REGS_FOR_GETREGSET,
20915	ARCH_IOVEC_FOR_GETREGSET): New macros.
20916	(get_regset): Define iff ARCH_REGS_FOR_GETREGSET is defined; change
20917	return type to long, return ptrace() return code instead of assigning it
20918	to get_regs_error; do not list individual architectures, implement
20919	constant and variable iovec cases depending on ARCH_IOVEC_FOR_GETREGSET.
20920	(get_regs): Assign get_regset() return code to get_regs_error.
20921
209222015-02-14  Dmitry V. Levin  <ldv@altlinux.org>
20923
20924	arm, i386: switch back to use PTRACE_GETREGS.
20925	PTRACE_GETREGSET and PTRACE_GETREGS methods are equally good on arm and
20926	i386 architectures, but PTRACE_GETREGSET with fallback to PTRACE_GETREGS
20927	is a bit more costly, so choose the method that costs less.
20928	This partially reverts commit v4.7-149-gfaa177e.
20929
20930	* syscall.c [ARM, I386] (ARCH_REGS_FOR_GETREGSET): Remove.
20931	(get_regset) [ARM || I386]: Remove.
20932	(get_regs) [ARM || I386]: Use PTRACE_GETREGS unconditionally.
20933
209342015-02-14  Dmitry V. Levin  <ldv@altlinux.org>
20935
20936	syscall.c: remove obsolete ifdefs.
20937	* syscall.c (get_regset, get_regs): Do not check for availability
20938	of PTRACE_GETREGSET and NT_PRSTATUS macros.
20939
20940	syscall.c: ensure that NT_PRSTATUS is defined.
20941	* syscall.c: Do not include <elf.h>.
20942	(NT_PRSTATUS): New macro.
20943
209442015-02-13  Dmitry V. Levin  <ldv@altlinux.org>
20945
20946	Move regs-related macros and declarations from defs.h to regs.h.
20947	* regs.h: New file.
20948	* Makefile.am (strace_SOURCES): Add it.
20949	* linux/arch_regs.h: New file.
20950	* linux/alpha/arch_regs.h: Likewise.
20951	* linux/arm/arch_regs.h: Likewise.
20952	* linux/hppa/arch_regs.h: Likewise.
20953	* linux/i386/arch_regs.h: Likewise.
20954	* linux/ia64/arch_regs.h: Likewise.
20955	* linux/mips/arch_regs.h: Likewise.
20956	* linux/powerpc/arch_regs.h: Likewise.
20957	* linux/sh64/arch_regs.h: Likewise.
20958	* linux/sparc/arch_regs.h: Likewise.
20959	* linux/sparc64/arch_regs.h: Likewise.
20960	* linux/tile/arch_regs.h: Likewise.
20961	* linux/x86_64/arch_regs.h: Likewise.
20962	* Makefile.am (EXTRA_DIST): Add them.
20963	* defs.h: Remove definitions of PTRACE_*, REG_*, PT_*, U_REG_*,
20964	and ARM_* macros.
20965	Remove declarations of struct pt_regs variables.
20966	[SPARC]: Do not include <asm/psr.h>.
20967	[SPARC64]: Do not include <asm/psrcompat.h>.
20968	* bjm.c: Do not include <sys/user.h>.
20969	* process.c: Include "regs.h".
20970	Do not include <sys/user.h> and <sys/reg.h>.
20971	[IA64]: Do not include <asm/ptrace_offsets.h> and <asm/rse.h>.
20972	* util.c: Likewise.
20973	* syscall.c: Likewise.
20974	[AARCH64]: Define struct arm_pt_regs and ARM_* macros.
20975	[SPARC]: Include <asm/psr.h>.
20976	[SPARC64]: Include <asm/psrcompat.h>.
20977	* signal.c: Include "regs.h".
20978	Do not include <sys/user.h> and <sys/reg.h>.
20979	[IA64]: Do not include <asm/ptrace_offsets.h>.
20980	* strace.c [IA64]: Do not include <asm/ptrace_offsets.h>.
20981
20982	Move all ptrace-related macros and declarations from defs.h to ptrace.h.
20983	* ptrace.h: New file.
20984	* Makefile.am (strace_SOURCES): Add it.
20985	* configure.ac (AC_CHECK_HEADERS): Remove linux/ptrace.h and sys/ptrace.h.
20986	* defs.h: Do not include <sys/ptrace.h> and <asm/ptrace.h>.
20987	Remove definitions of PTRACE_* macros.
20988	* process.c: Remove <linux/ptrace.h> workarounds, include "ptrace.h".
20989	* signal.c: Likewise.
20990	* syscall.c: Likewise.
20991	* util.c: Likewise.
20992	* strace.c: Include "ptrace.h".
20993	* wait.c: Likewise.
20994
209952015-02-12  Dmitry V. Levin  <ldv@altlinux.org>
20996
20997	Enhance wait status decoding.
20998	* xlat/ptrace_events.in: New file.
20999	* wait.c: Include "xlat/ptrace_events.h".
21000	(printstatus): In case of WIFSTOPPED, print 0x80 flag separately from
21001	the stop signal name.
21002	[WIFCONTINUED]: Add WIFCONTINUED support.
21003	Decode PTRACE_EVENT_* events.
21004
210052015-02-08  Bart Van Assche  <bart.vanassche@sandisk.com>
21006
21007	scsi: add bsg support.
21008	The Linux kernel supports two different versions of the SG_IO API,
21009	namely v3 and v4. This patch adds support for version 4 of this API.
21010	At least the sg3_utils package supports version 4 of this API.  Version
21011	4 of this API is used if /dev/bsg/H:C:I:L is used as device name.
21012
21013	This patch has been tested by inspecting the output of the following
21014	commands:
21015
21016	modprobe scsi_debug dev_size_mb=16 delay=0
21017	dev=$(lsscsi | sed -n '/ scsi_debug /s,^[^/]*,,p')
21018	./strace -eioctl -s256 sg_inq $dev
21019	echo 'Test XDWRITEREAD(10)'
21020	bsg=/dev/bsg/$(lsscsi | sed -n '/ scsi_debug /s,^\[\([^]]\+\)\].*,\1,p')
21021	dd if=/dev/zero bs=512 count=1 |
21022	  ./strace -eioctl -s256 sg_raw -s 512 -r 1024 $bsg 53 00 00 00 00 01 00 00 01 00
21023
21024	* configure.ac (AC_CHECK_HEADERS): Add linux/bsg.h.
21025	* xlat/bsg_protocol.in: New file.
21026	* xlat/bsg_subprotocol.in: Likewise.
21027	* scsi.c: Include them and <linux/bsg.h>.
21028	(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
21029	print_sg_io_v4_res): New functions.
21030	(print_sg_io_req, print_sg_io_res): Use them.
21031	(scsi_ioctl): Update callers.
21032
210332015-02-08  Bart Van Assche  <bart.vanassche@sandisk.com>
21034
21035	scsi: Add iovec support.
21036	* scsi.c (print_sg_io_req, print_sg_io_res): Add support for decoding
21037	iovecs passed via the SG I/O v3 interface.  Decode the "data in" and
21038	"data out" buffers in hex instead of in ASCII.
21039
21040	scsi: on exit, print only initialized part of the buffer.
21041	* scsi.c (print_sg_io_res): Only print that part of the data in buffer
21042	that has been initialized by the SCSI LLD driver.
21043
21044	scsi: make print_sg_io_buffer() print square brackets instead of its callers
21045	* scsi.c (print_sg_io_buffer): Print square brackets in this function.
21046	(print_sg_io_req, print_sg_io_res): Update callers.
21047
210482015-02-08  Bart Van Assche  <bart.vanassche@sandisk.com>
21049
21050	scsi: improve consistency with other decoding functions.
21051	Pass pointers to tracee's memory as integers instead of pointers.
21052
21053	* scsi.c (print_sg_io_buffer): Change second argument's type to
21054	unsigned long.
21055	(print_sg_io_req, print_sg_io_res): Update callers.
21056
210572015-02-08  Dmitry V. Levin  <ldv@altlinux.org>
21058
21059	tests: extend getdents to support all filesystems regardless of file order
21060	* tests/getdents.awk: Include all 6 possible permutations of 3
21061	direntries to regexps.
21062
210632015-02-08  Dmitry V. Levin  <ldv@altlinux.org>
21064
21065	print_setsockopt: fix fall-through bug in SOL_IP switch case.
21066	This fixes the bug introduced by commit v4.9-250-ga0a4909.
21067
21068	* net.c (print_setsockopt): Separate SOL_IP case from SOL_PACKET.
21069
21070	Reported-by: Ben Noordhuis <info@bnoordhuis.nl>
21071
210722015-02-07  Dmitry V. Levin  <ldv@altlinux.org>
21073
21074	Do not watch for post-execve SIGTRAP if PTRACE_O_TRACEEXEC is enabled.
21075	If PTRACE_O_TRACEEXEC option is enabled, then post-execve SIGTRAPs are
21076	suppressed and we can safely skip -ENOSYS heuristics.  This partially
21077	reverts commits v4.9-258-g8e398b6 and v4.9-261-gd70c41d.
21078
21079	* syscall.c (syscall_fixup_on_sysenter): Skip if PTRACE_O_TRACEEXEC
21080	flag is set in ptrace_setoptions.  Remove all SECCOMP_RET_ERRNO
21081	workarounds as they are not needed when PTRACE_O_TRACEEXEC is not
21082	supported by the kernel.
21083
210842015-02-07  Dmitry V. Levin  <ldv@altlinux.org>
21085
21086	When the process stared by strace exits/terminates, forget its pid.
21087	The process stared by strace can exit/terminate only once.  When this
21088	happens, forget its pid, so that any other event or action related to a
21089	process with the same pid as the pid of that first process would not be
21090	confused with that first process.
21091
21092	* strace.c (print_signalled, print_exited): Clear strace_child when it
21093	equals to the given pid.
21094
210952015-02-07  Dmitry V. Levin  <ldv@altlinux.org>
21096
21097	-b execve: avoid misleading warning about unknown pid.
21098	* strace.c (maybe_allocate_tcb): If detach_on_execve is set, do not warn
21099	about !WIFSTOPPED process with pid == strace_child.
21100	* tests/bexecve.test: New test.
21101	* tests/Makefile.am (TESTS): Add it.
21102
21103	-b execve: do not use struct tcb after detach.
21104	* strace.c (trace): Do not proceed after detach.
21105
211062015-02-07  Dmitry V. Levin  <ldv@altlinux.org>
21107
21108	trace: split into several functions.
21109	This change moves the main loop back to main() and splits trace()
21110	into several functions.  There are no algorithmic changes.
21111
21112	* strace.c (print_debug_info, maybe_allocate_tcb, maybe_switch_tcbs,
21113	print_signalled, print_exited, print_stopped, startup_tcb): New
21114	functions.
21115	(trace) Use them.  Move the main loop ...
21116	(main): ... here.
21117
211182015-02-07  Dmitry V. Levin  <ldv@altlinux.org>
21119
21120	printsiginfo: constify the first argument.
21121	* signal.c (printsiginfo): Make the first argument a pointer to a const type.
21122	* defs.h (printsiginfo): Likewise.
21123	(printsiginfo, printsiginfo_at): Always define these prototypes.
21124	* configure.ac (AC_CHECK_TYPES): Remove siginfo_t, as HAVE_SIGINFO_T
21125	is no longer used.
21126
211272015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21128
21129	test: add a manual test for seccomp decoding.
21130	* test/.gitignore: Add seccomp.
21131	* test/Makefile (PROGS): Likewise.
21132	* test/seccomp.c: New file.
21133	* test/README: Mention ../tests/.
21134
21135	Implement seccomp decoding.
21136	* configure.ac (AC_CHECK_HEADERS): Add linux/filter.h
21137	and linux/seccomp.h.
21138	* defs.h (print_seccomp_filter): New prototype.
21139	* linux/dummy.h (sys_seccomp): Remove.
21140	* linux/syscall.h (sys_seccomp): New prototype.
21141	* prctl.c: Include <linux/seccomp.h>.
21142	(sys_prctl): Decode PR_SET_SECCOMP.
21143	* seccomp.c: New file.
21144	* Makefile.am (strace_SOURCES): Add it.
21145	* xlat/bpf_class.in: New file.
21146	* xlat/bpf_miscop.in: Likewise.
21147	* xlat/bpf_mode.in: Likewise.
21148	* xlat/bpf_op_alu.in: Likewise.
21149	* xlat/bpf_op_jmp.in: Likewise.
21150	* xlat/bpf_rval.in: Likewise.
21151	* xlat/bpf_size.in: Likewise.
21152	* xlat/bpf_src.in: Likewise.
21153	* xlat/seccomp_filter_flags.in: Likewise.
21154	* xlat/seccomp_mode.in: Likewise.
21155	* xlat/seccomp_ops.in: Likewise.
21156	* xlat/seccomp_ret_action.in: Likewise.
21157
211582015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21159
21160	is_negated_errno: support large errno values.
21161	Thanks to SECCOMP_RET_DATA == 0xffff, abnormally large errno
21162	values could be easily seen when a seccomp filter is used, e.g.
21163	BPF_STMT(BPF_RET, SECCOMP_RET_ERRNO | SECCOMP_RET_DATA)
21164
21165	* syscall.c (is_negated_errno): Allow errno values as large as 0xffff.
21166
211672015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21168
21169	x86, x32, x86_64: print SECCOMP_RET_ERRNO filtered syscalls.
21170	This is required to process SECCOMP_RET_ERRNO filtered syscalls on
21171	systems where linux kernel does not change the syscall number to -1.
21172
21173	* syscall.c (is_negated_errno): Move before syscall_fixup_on_sysenter.
21174	(syscall_fixup_on_sysenter) [I386 || X32 || X86_64] : Use it to check
21175	AX register.
21176
211772015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21178
21179	is_negated_errno: merge x86_64 and x32 definitions.
21180	* syscall.c (kernel_long_t, kernel_ulong_t): New types.
21181	(is_negated_errno): Merge [X32] and [!X32] definitions.
21182	(get_error): Merge [X86_64] and [X32] code.
21183
211842015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21185
21186	x32: rename is_negated_errno_x32 to is_negated_errno.
21187	Use the same function name on all architectures.
21188
21189	* syscall.c [X32] (is_negated_errno_x32): Rename to is_negated_errno.
21190	(get_error) [X32]: Update callers.
21191
211922015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21193
21194	x86, x32, x86_64: do not skip syscall number -1.
21195	Syscall number -1 might be a side effect of SECCOMP_RET_ERRNO filtering.
21196
21197	* syscall.c (syscall_fixup_on_sysenter) [I386 || X32 || X86_64]:
21198	Do not skip syscalls that have number -1.
21199
212002015-02-06  Dmitry V. Levin  <ldv@altlinux.org>
21201
21202	x86_64: do not interpet syscall number -1 as a x32 personality syscall.
21203	Syscall number -1 might be a side effect of SECCOMP_RET_ERRNO filtering.
21204
21205	* syscall.c (get_scno) [X86_64]: Handle the case of scno == -1.
21206
212072015-02-05  Dmitry V. Levin  <ldv@altlinux.org>
21208
21209	Implement getrandom syscall decoding.
21210	* getrandom.c: New file.
21211	* Makefile.am (strace_SOURCES): Add it.
21212	* linux/dummy.h (sys_getrandom): Remove.
21213	* linux/syscall.h (sys_getrandom): New prototype.
21214	* xlat/getrandom_flags.in: New file.
21215	* tests/getrandom.c: New file.
21216	* tests/getrandom.awk: New file.
21217	* tests/getrandom.test: New test.
21218	* tests/Makefile.am (check_PROGRAMS): Add getrandom.
21219	(TESTS): Add getrandom.test.
21220	(EXTRA_DIST): Add getrandom.awk.
21221	* tests/.gitignore: Add getrandom.
21222
212232015-02-04  Dmitry V. Levin  <ldv@altlinux.org>
21224
21225	tests: add a test for select syscall decoding.
21226	Convert test/select.c into a regular test.
21227
21228	* test/Makefile (PROGS): Remove select.
21229	* test/.gitignore: Likewise.
21230	* test/select.c: Rewrite to ...
21231	* tests/select.c: ... new file.
21232	* tests/select.awk: New file.
21233	* tests/select.test: New test.
21234	* tests/Makefile.am (check_PROGRAMS): Add select.
21235	(TESTS): Add select.test.
21236	(EXTRA_DIST): Add select.awk.
21237	* tests/.gitignore: Add select.
21238
212392015-02-01  Dmitry V. Levin  <ldv@altlinux.org>
21240
21241	tests: add a test for the latest dumpio fix.
21242	* tests/dumpio.expected: New file.
21243	* tests/unix-pair-send-recv.c: New file.
21244	* tests/dumpio.test: New test.
21245	* tests/Makefile.am (check_PROGRAMS): Add unix-pair-send-recv.
21246	(TESTS): Add dumpio.test.
21247	(EXTRA_DIST): Add dumpio.expected.
21248	* tests/.gitignore: Add unix-pair-send-recv.
21249
212502015-02-01  Aurelien Jacobs  <aurel@gnuage.org>
21251
21252	Fix simultaneous -e read and -e write usage.
21253	This allows using both -e read=FD and -e write=FD at the same time
21254	with the same FD.
21255	Without this patch, the -e write=FD is ignored if -e read=FD is used
21256	at the same time.
21257
212582015-01-31  Dmitry V. Levin  <ldv@altlinux.org>
21259
21260	net.c: remove unused HAVE_SIN6_SCOPE_ID_LINUX-based code.
21261	The AC_SIN6_SCOPE_ID autoconf macro that was able to define
21262	HAVE_SIN6_SCOPE_ID_LINUX was removed by commit v4.4-98-g64f793a.
21263
21264	* net.c [HAVE_SIN6_SCOPE_ID_LINUX]: Remove.
21265
212662015-01-30  Dmitry V. Levin  <ldv@altlinux.org>
21267
21268	printsock: do not fetch sockaddr.sa_data twice.
21269	* net.c (printsock): Print addrbuf.sa.sa_data using print_quoted_string.
21270
21271	setsockopt: add decoding of MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP.
21272	* net.c (print_group_req): New function.
21273	(print_setsockopt): Use it.
21274
212752015-01-29  Dmitry V. Levin  <ldv@altlinux.org>
21276
21277	tests: add a test for sockaddr_un.sun_path decoding.
21278	* tests/net-accept-connect.c: Allow long socket addresses.
21279	* tests/sun_path.test: New test.
21280	* tests/Makefile.am (TESTS): Add it.
21281
21282	printsock: print the whole sockaddr_un.sun_path.
21283	* net.c (printsock): If sockaddr_un.sun_path is not NUL-terminated,
21284	do not omit the last byte of sockaddr_un.sun_path array.
21285
21286	printsock: do not fetch sockaddr_un.sun_path twice.
21287	* net.c (printsock): Print addrbuf.sau.sun_path using
21288	print_quoted_string.
21289
212902015-01-29  Dmitry V. Levin  <ldv@altlinux.org>
21291
21292	net: define all SOL_* constants.
21293	Ensure that all known SOL_* constants are defined.
21294	Sync the list of known SOL_* constants with linux/socket.h.
21295
21296	* net.c: Provide definitions for all SOL_* constants.
21297	Remove all SOL_* preprocessor conditionals.
21298	(socketlayers): Disconnect from inet_protocols.
21299	* xlat/socketlayers.in: Remove SOL_ICMP, add SOL_ALG and SOL_NFC.
21300
213012015-01-29  Dmitry V. Levin  <ldv@altlinux.org>
21302
21303	setsockopt: decode PACKET_ADD_MEMBERSHIP.
21304	* xlat/packet_mreq_type.in: New file.
21305	* net.c: Include "xlat/packet_mreq_type.h".
21306	(print_packet_mreq): New function.
21307	(print_setsockopt): Use it.
21308
213092015-01-29  Dmitry V. Levin  <ldv@altlinux.org>
21310
21311	getsockopt, setsockopt: do not decode structures in non-verbose mode.
21312	Move the code that is common between getsockopt and setsockopt parsers
21313	to a separate function.
21314	Move printers specific to getsockopt and setsockopt to separate
21315	functions, choose appropriate parsers depending on verbose mode.
21316	Move parsers of specific socket options to separate functions.
21317
21318	* net.c (printicmpfilter): Rename to print_icmp_filter.
21319	(printsockopt): Remove.
21320	(print_sockopt_fd_level_name, print_linger, print_ucred,
21321	print_tpacket_stats, print_getsockopt, print_tpacket_req,
21322	print_packet_mreq, print_setsockopt): New functions.
21323	(sys_getsockopt, sys_setsockopt): Use them.
21324
213252015-01-28  Dmitry V. Levin  <ldv@altlinux.org>
21326
21327	sendmsg: do not decode msghdr in non-verbose mode.
21328	* net.c (printmsghdr): Do not decode struct msghdr in non-verbose mode.
21329
21330	decode_select: do not allocate unused memory.
21331	* desc.c (decode_select): On entering syscall, do not allocate memory
21332	in non-verbose mode.
21333
213342015-01-26  Dmitry V. Levin  <ldv@altlinux.org>
21335
21336	xattr: quote using print_quoted_string.
21337	* xattr.c (print_xattr_val): Drop local quoting code, use
21338	print_quoted_string.
21339
21340	v4l2: quote pixelformat.
21341	* v4l2.c (print_pixelformat): Output in quoted v4l2_fourcc() format.
21342
21343	v4l2: quote strings.
21344	* v4l2.c (v4l2_ioctl): Print strings using print_quoted_string.
21345
21346	mips: quote sysmips nodename.
21347	* sysmips.c (sys_sysmips): Print nodename using print_quoted_string.
21348
21349	block_ioctl: quote strings.
21350	* block.c (print_blkpg_req): Print blkpg_partition.devname and
21351	blkpg_partition.volname using print_quoted_string.
21352	(block_ioctl): Print blk_user_trace_setup.name using print_quoted_string.
21353
21354	sys_uname: quote struct utsname members.
21355	* uname.c (PRINT_UTS_MEMBER): New macro.
21356	(sys_uname): Use them.
21357
21358	sock_ioctl: quote network interface names.
21359	* sock.c (print_ifname): New function.
21360	(sock_ioctl): Use it to quote ifr_name, ifru_newname, and ifru_slave.
21361
21362	printsock: quote network interface names.
21363	* net.c (printsock): Print network interface names returned by
21364	if_indextoname() using print_quoted_string.
21365
21366	getdents, getdents64: quote filenames.
21367	* dirent.c (print_old_dirent): Fix quoting.
21368	(sys_getdents): Print d_name using print_quoted_string.
21369	(sys_getdents64): Likewise.
21370	* tests/getdents.test: Test it.
21371	* tests/getdents.awk: Update.
21372
213732015-01-26  Dmitry V. Levin  <ldv@altlinux.org>
21374
21375	printfd: quote pathnames.
21376	Change printfd() behaviour in show_fd_path mode to quote pathnames
21377	the same way printpathn() does.
21378
21379	* util.c (printfd): Print non-socket paths using print_quoted_string.
21380	* tests/scm_rights-fd.test: Test it.
21381	* tests/scm_rights.c: Update.
21382
213832015-01-26  Dmitry V. Levin  <ldv@altlinux.org>
21384
21385	Rework string_quote API.
21386	string_quote() has proven to be too hard to use, replace it with
21387	print_quoted_string() that does memory allocation and prints the result.
21388
21389	* defs.h (string_quote): Remove.
21390	(QUOTE_0_TERMINATED, QUOTE_OMIT_LEADING_TRAILING_QUOTES): New macros.
21391	(print_quoted_string): New prototype.
21392	* util.c (string_quote): Make static; take "style" flags instead
21393	of "len", treat QUOTE_0_TERMINATED style flag as former (len == -1);
21394	add QUOTE_OMIT_LEADING_TRAILING_QUOTES style flag support.
21395	(ALLOCA_CUTOFF, use_alloca): New macros.
21396	(print_quoted_string): New function.
21397	(printpathn, printstr): Update to new API.
21398	* loop.c (loop_ioctl): Likewise.
21399	* mtd.c (ubi_ioctl): Likewise.
21400	* net.c (print_scm_security): Likewise.
21401	* socketutils.c (unix_parse_response): Likewise.
21402
214032015-01-24  Dmitry V. Levin  <ldv@altlinux.org>
21404
21405	avr32: fix typo in sys_timerfd syscall entry.
21406	* linux/avr32/syscallent.h (timerfd): Change sys_name to "timerfd".
21407
21408	hppa: fix typos in getresuid and getresgid syscall entries.
21409	* linux/hppa/syscallent.h (getresuid): Change sys_func to sys_getresuid.
21410	(getresgid): Change sys_func to sys_getresgid.
21411
214122015-01-24  Helge Deller  <deller@gmx.de>
21413
21414	hppa: fix typo in getpeername syscall entry.
21415	This fixes an obvious typo which prints "lock" instead of "getpeername"
21416	for the getpeername syscall.
21417
21418	* linux/hppa/syscallent.h (getpeername): Change sys_name to "getpeername".
21419
214202015-01-24  Dmitry V. Levin  <ldv@altlinux.org>
21421
21422	Impove struct cmsghdr decoding.
21423	Print all cmsghdr structures in msg_control array,
21424	not just the first one.
21425	Change output format to be consistent with other parts of strace
21426	where structures and arrays are printed.
21427	Implement decoder for SCM_SECURITY message type.
21428
21429	* net.c (print_scm_rights, print_scm_creds, print_scm_security):
21430	New functions.
21431	(printcmsghdr): Use them.  Iterate over all members of the array.
21432	* xlat/scmvals.in: Add SCM_SECURITY.
21433	* tests/scm_rights.c (main): Pass one more descriptor to the receiver.
21434	Set SO_PASSCRED on the receiver part.  Reserve enough space to receive
21435	SCM_CREDENTIALS and SCM_RIGHTS.
21436	* tests/scm_rights-fd.test: Update.
21437
214382015-01-24  Dmitry V. Levin  <ldv@altlinux.org>
21439
21440	Update SO_* constants.
21441	* xlat/sockoptions.in: Add SO_DOMAIN, SO_MARK, SO_NOFCS, SO_PASSSEC,
21442	SO_PROTOCOL, SO_RCVBUFFORCE, SO_SNDBUFFORCE, SO_TIMESTAMPING,
21443	and SO_TIMESTAMPNS.
21444
214452015-01-24  Dmitry V. Levin  <ldv@altlinux.org>
21446
21447	tests: run tests for each supported personality.
21448	When strace supports more than one personality, run test suite
21449	for each personality supported by the host system.
21450
21451	* bootstrap: Create tests-m32 and tests-mx32 subtrees from tests.
21452	* configure.ac: Check for -m32 and -mx32 runtime support.
21453	(AC_CONFIG_FILES): Add tests-m32/Makefile and tests-mx32/Makefile.
21454	* Makefile.am [HAVE_M32_RUNTIME] (TESTS_M32): Define.
21455	[HAVE_MX32_RUNTIME] (TESTS_MX32): Define.
21456	(SUBDIRS): Add $(TESTS_M32) $(TESTS_MX32).
21457	* .gitignore: Add /tests-m32 and /tests-mx32.
21458
214592015-01-24  Dmitry V. Levin  <ldv@altlinux.org>
21460
21461	Fix ILP32 personality struct cmsghdr decoding on LP64 architectures.
21462	* net.c (union_cmsghdr): New union.
21463	[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (cmsghdr32): New structure.
21464	(printcmsghdr): Properly handle the case of current_wordsize < sizeof(long).
21465
21466	Fix ILP32 personality preadv/pwritev offset decoding on LP64 architectures
21467	* io.c (print_llu_from_low_high_val) [SIZEOF_LONG == SIZEOF_LONG_LONG
21468	&& SUPPORTED_PERSONALITIES > 1]: Properly handle the case of
21469	current_wordsize < sizeof(long).
21470
214712015-01-22  Dmitry V. Levin  <ldv@altlinux.org>
21472
21473	ioctl: take all 32 bits of ioctl commands into account.
21474	Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl
21475	commands were used for decoding, which was the source for numerous
21476	annoying collisions like this:
21477
21478		ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
21479		ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device)
21480
21481	The solution is to use all 32 bits for decoding, not just "number" and
21482	"type", but also "size" and "direction".
21483
21484	As some architectures override defaults that come from asm-generic/ and
21485	provide alternative definitions for some ioctl commands, we support
21486	per-architecture ioctl definitions and merge them with common
21487	definitions at build time.  During the merge, we used to keep both
21488	generic and architecture-specific definitions, now architecture-specific
21489	definitions have precedence over generic ones -- ioctlsort omits
21490	definitions from asm-generic/ for those ioctl names that have different
21491	definitions in asm/.
21492
21493	Additional bits of "direction" are architecture specific -- the number
21494	of bits and their values differ between architectures.  To reduce
21495	architecture differences in the source code, we keep "direction" in
21496	symbolic form and compile it in ioctlsort.
21497
21498	Additional bits of "size" are also architecture specific -- not only the
21499	number of bits differ between architectures, but sizes of many types
21500	depend on sizeof(long).  To reduce architecture differences in the
21501	source code, we keep 32-bit and 64-bit versions of common ioctl
21502	definitions, and use the appropriate version for each architecture and
21503	personality.
21504
21505	To implement this, the tools for generating ioctl definitions from
21506	kernel headers have been rewritten, and the source format of ioctl
21507	definitions has been extended.   The final ioctlent*.h files that are
21508	included by syscall.c are now generated from source ioctls_inc*.h and
21509	ioctls_arch*.h files at build time with ioctlsort.
21510
21511	* ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code.
21512	* ioctlsort.c: Rewritten.
21513	* linux/32/ioctls_inc.h: New file.
21514	* linux/64/ioctls_inc.h: New file.
21515	* linux/aarch64/ioctls_arch0.h: New file.
21516	* linux/aarch64/ioctls_arch1.h: New file.
21517	* linux/aarch64/ioctls_inc0.h: New file.
21518	* linux/aarch64/ioctls_inc1.h: New file.
21519	* linux/alpha/ioctls_arch0.h: New file.
21520	* linux/alpha/ioctls_inc0.h: New file.
21521	* linux/arc/ioctls_arch0.h: New file.
21522	* linux/arc/ioctls_inc0.h: New file.
21523	* linux/arm/ioctls_arch0.h: New file.
21524	* linux/arm/ioctls_inc0.h: New file.
21525	* linux/avr32/ioctls_arch0.h: New file.
21526	* linux/avr32/ioctls_inc0.h: New file.
21527	* linux/bfin/ioctls_arch0.h: New file.
21528	* linux/bfin/ioctls_inc0.h: New file.
21529	* linux/hppa/ioctls_arch0.h: New file.
21530	* linux/hppa/ioctls_inc0.h: New file.
21531	* linux/i386/ioctls_arch0.h: New file.
21532	* linux/i386/ioctls_inc0.h: New file.
21533	* linux/ia64/ioctls_arch0.h: New file.
21534	* linux/ia64/ioctls_inc0.h: New file.
21535	* linux/m68k/ioctls_arch0.h: New file.
21536	* linux/m68k/ioctls_inc0.h: New file.
21537	* linux/metag/ioctls_arch0.h: New file.
21538	* linux/metag/ioctls_inc0.h: New file.
21539	* linux/microblaze/ioctls_arch0.h: New file.
21540	* linux/microblaze/ioctls_inc0.h: New file.
21541	* linux/mips/ioctls_arch0.h: New file.
21542	* linux/mips/ioctls_inc0.h: New file.
21543	* linux/or1k/ioctls_arch0.h: New file.
21544	* linux/or1k/ioctls_inc0.h: New file.
21545	* linux/powerpc/ioctls_arch0.h: New file.
21546	* linux/powerpc/ioctls_inc0.h: New file.
21547	* linux/powerpc64/ioctls_arch0.h: New file.
21548	* linux/powerpc64/ioctls_arch1.h: New file.
21549	* linux/powerpc64/ioctls_inc0.h: New file.
21550	* linux/powerpc64/ioctls_inc1.h: New file.
21551	* linux/s390/ioctls_arch0.h: New file.
21552	* linux/s390/ioctls_inc0.h: New file.
21553	* linux/s390x/ioctls_arch0.h: New file.
21554	* linux/s390x/ioctls_inc0.h: New file.
21555	* linux/sh/ioctls_arch0.h: New file.
21556	* linux/sh/ioctls_inc0.h: New file.
21557	* linux/sh64/ioctls_arch0.h: New file.
21558	* linux/sh64/ioctls_inc0.h: New file.
21559	* linux/sparc/ioctls_arch0.h: New file.
21560	* linux/sparc/ioctls_inc0.h: New file.
21561	* linux/sparc64/ioctls_arch0.h: New file.
21562	* linux/sparc64/ioctls_arch2.h: New file.
21563	* linux/sparc64/ioctls_inc0.h: New file.
21564	* linux/sparc64/ioctls_inc2.h: New file.
21565	* linux/tile/ioctls_arch0.h: New file.
21566	* linux/tile/ioctls_arch1.h: New file.
21567	* linux/tile/ioctls_inc0.h: New file.
21568	* linux/tile/ioctls_inc1.h: New file.
21569	* linux/x32/ioctls_arch0.h: New file.
21570	* linux/x32/ioctls_arch1.h: New file.
21571	* linux/x32/ioctls_inc0.h: New file.
21572	* linux/x32/ioctls_inc1.h: New file.
21573	* linux/x86_64/ioctls_arch0.h: New file.
21574	* linux/x86_64/ioctls_arch1.h: New file.
21575	* linux/x86_64/ioctls_inc0.h: New file.
21576	* linux/x86_64/ioctls_inc1.h: New file.
21577	* linux/xtensa/ioctls_arch0.h: New file.
21578	* linux/xtensa/ioctls_inc0.h: New file.
21579	* linux/aarch64/ioctlent.h.in: Remove.
21580	* linux/aarch64/ioctlent1.h: Remove.
21581	* linux/alpha/ioctlent.h.in: Remove.
21582	* linux/arc/ioctlent.h.in: Remove.
21583	* linux/arm/ioctlent.h.in: Remove.
21584	* linux/avr32/ioctlent.h.in: Remove.
21585	* linux/bfin/ioctlent.h.in: Remove.
21586	* linux/hppa/ioctlent.h.in: Remove.
21587	* linux/i386/ioctlent.h.in: Remove.
21588	* linux/ia64/ioctlent.h.in: Remove.
21589	* linux/ioctlent.h.in: Remove.
21590	* linux/ioctlent.sh: Remove.
21591	* linux/m68k/ioctlent.h.in: Remove.
21592	* linux/metag/ioctlent.h.in: Remove.
21593	* linux/microblaze/ioctlent.h.in: Remove.
21594	* linux/mips/ioctlent.h.in: Remove.
21595	* linux/mips/ioctlent.sh: Remove.
21596	* linux/or1k/ioctlent.h.in: Remove.
21597	* linux/powerpc/ioctlent.h.in: Remove.
21598	* linux/powerpc64/ioctlent.h: Remove.
21599	* linux/powerpc64/ioctlent1.h: Remove.
21600	* linux/s390/ioctlent.h.in: Remove.
21601	* linux/s390x/ioctlent.h.in: Remove.
21602	* linux/sh/ioctlent.h.in: Remove.
21603	* linux/sh64/ioctlent.h.in: Remove.
21604	* linux/sparc/ioctlent.h.in: Remove.
21605	* linux/sparc64/ioctlent.h.in: Remove.
21606	* linux/sparc64/ioctlent2.h: Remove.
21607	* linux/tile/ioctlent.h.in: Remove.
21608	* linux/tile/ioctlent1.h: Remove.
21609	* linux/x32/ioctlent.h.in: Remove.
21610	* linux/x32/ioctlent1.h: Remove.
21611	* linux/x86_64/ioctlent.h.in: Remove.
21612	* linux/x86_64/ioctlent1.h: Remove.
21613	* linux/xtensa/ioctlent.h.in: Remove.
21614	* linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h.
21615	* syscall.c (struct_ioctlent ioctlent0): Likewise.
21616	* Makefile.am: Remove all ioctlent-related definitions.
21617	Define the list of ioctlent*.h files that have to be generated by
21618	presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files.
21619	Add rules for ioctlent*.h files generation.
21620	(EXTRA_DIST): Update.
21621	* maint/ioctls_gen.sh: New file.
21622	* maint/ioctls_hex.sh: New file.
21623	* maint/ioctls_sym.sh: New file.
21624	* maint/print_ioctlent.c: New file.
21625	* HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration.
21626	* .gitignore: Add ioctlent[012].h and ioctls_all[012].h.
21627	* configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h
21628	and linux/mmtimer.h for tests.
21629	* tests/ioctl.c: New file.
21630	* tests/ioctl.test: New test.
21631	* tests/Makefile.am (check_PROGRAMS): Add ioctl.
21632	(TESTS): Add ioctl.test.
21633	* tests/.gitignore: Add ioctl.
21634
216352015-01-21  Gabriel Laskar  <gabriel@lse.epita.fr>
21636
21637	ioctl: add decoding for parametrized command names.
21638	Some ioctl commands from evdev, hiddev, mixer, uinput, spi, and joystick
21639	are parametrized by a size or a number that are variable.  This change
21640	implements printing of these parametrized ioctl command names.
21641
21642	* configure.ac (AC_CHECK_HEADERS): Add linux/input.h.
21643	* defs.h (ioctl_decode_number): New prototype.
21644	* io.c (sys_ioctl): Use ioctl_decode_number.
21645	* ioctl.c (ioctl_decode_number): New function.
21646	* xlat/evdev_abs.in: New file.
21647	* xlat/evdev_ev.in: New file.
21648
216492015-01-21  Dmitry V. Levin  <ldv@altlinux.org>
21650
21651	Update auxiliary maintainer mode build tools.
21652	* git-set-file-times: Update from rsync.
21653	* git-version-gen: Update from gnulib.
21654	* gitlog-to-changelog: Likewise.
21655
21656	Update warnings.m4.
21657	* m4/warnings.m4: Update from gnulib.
21658
216592015-01-21  Dmitry V. Levin  <ldv@altlinux.org>
21660
21661	powerpc64: maintain own linux/powerpc64 subdirectory.
21662	Most architectures supported by strace have their own subdirectory in
21663	linux directory, but powerpc64 didn't, causing inconveniences.
21664
21665	* configure.ac (arch): Define to "powerpc64" on powerpc64.
21666	* linux/powerpc/errnoent1.h: Move to linux/powerpc64/.
21667	* linux/powerpc/ioctlent1.h: Likewise.
21668	* linux/powerpc/signalent1.h: Likewise.
21669	* linux/powerpc/syscallent1.h: Likewise.
21670	* linux/powerpc64/ioctlent.h: New file.
21671	* linux/powerpc64/syscallent.h: Likewise.
21672	* linux/powerpc64/userent.h: Likewise.
21673	* Makefile.am (EXTRA_DIST): Remove linux/powerpc/ioctlent1.h,
21674	linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h, and
21675	linux/powerpc/signalent1.h; added linux/powerpc64/errnoent1.h,
21676	linux/powerpc64/ioctlent.h, linux/powerpc64/ioctlent1.h,
21677	linux/powerpc64/signalent1.h, linux/powerpc64/syscallent.h,
21678	linux/powerpc64/syscallent1.h, and linux/powerpc64/userent.h.
21679
216802015-01-21  Dmitry V. Levin  <ldv@altlinux.org>
21681
21682	configure.ac: remove unused AC_INCLUDEDIR.
21683	* configure.ac (AC_INCLUDEDIR): Remove.
21684	* m4/includedir.m4: Remove.
21685
21686	ioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format.
21687	* defs.h (ioctl_print_code): New prototype.
21688	* ioctl.c: Include xlat/ioctl_dirs.h.
21689	(ioctl_print_code): New function.
21690	* io.c (sys_ioctl): Use it.
21691	* xlat/ioctl_dirs.in: New file.
21692
216932015-01-20  Dmitry V. Levin  <ldv@altlinux.org>
21694
21695	ioctl: assume that all ioctl commands have unsigned int type.
21696	In linux, ioctl command number has a 32-bit unsigned integer type:
21697		fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
21698	If the kernel completely ignores other bits on 64-bit architectures,
21699	why should strace care?
21700	Let's follow the kernel and treat it as unsigned int.
21701
21702	* defs.h (struct_ioctlent): Change "code" type to "unsigned int".
21703	(ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl,
21704	ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl,
21705	v4l2_ioctl): Likewise.
21706	* ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match):
21707	Likewise.
21708	* block.c (block_ioctl): Likewise.
21709	* loop.c (loop_ioctl): Likewise.
21710	* mtd.c (mtd_ioctl, ubi_ioctl): Likewise.
21711	* ptp.c (ptp_ioctl): Likewise.
21712	* scsi.c (scsi_ioctl): Likewise.
21713	* sock.c (sock_ioctl): Likewise.
21714	* term.c (term_ioctl): Likewise.
21715	* time.c (rtc_ioctl): Likewise.
21716	* v4l2.c (v4l2_ioctl): Likewise.
21717	* ioctlsort.c (struct ioctlent, compare, main): Likewise.
21718
217192015-01-16  Dmitry V. Levin  <ldv@altlinux.org>
21720
21721	ioctlent.sh: cleanup regexps that are used to fetch bases.
21722
21723	ioctlent.sh: sync lookup regexps that are used in grep and sed.
21724	ioctlent.sh looks for ioctl command names using grep, and fetches them
21725	with their definitions using sed.  Historically, lookup regexps used in
21726	grep and sed are slightly different, which makes the script more
21727	complicated than necessary.
21728
21729	qemu_multiarch_testing: update.
21730	* qemu_multiarch_testing/.gitignore: New file.
21731	* qemu_multiarch_testing/README: Update statistics.
21732	* qemu_multiarch_testing/hdc.dir/init2: Run "make check".
21733	* qemu_multiarch_testing/make-hdc-img.sh: Robustify,
21734	automatically calculate hdc image size.
21735	* qemu_multiarch_testing/parallel-build-hdc-img.sh: Reduce
21736	hdb image size.  Report completion of each parallelized task.
21737
217382015-01-14  Dmitry V. Levin  <ldv@altlinux.org>
21739
21740	tests: add IPC_STAT to ipc tests, workaround limitiations of old kernels
21741	* tests/ipc_msg.c: Include <errno.h>.
21742	(main): Add a test call with IPC_STAT, handle old kernels MSG_STAT behaviour.
21743	* tests/ipc_sem.c: Include <errno.h>.
21744	(main): Add a test call with IPC_STAT, handle old kernels SEM_STAT behaviour.
21745	* tests/ipc_shm.c: Include <errno.h>.
21746	(main): Add a test call with IPC_STAT, handle old kernels SHM_STAT behaviour.
21747
21748	Change length type of umoven and umovestr to unsigned.
21749	* defs.h (umoven, umovestr): Change type of 3rd argument from "int"
21750	to "unsigned int".
21751	* util.c (umoven, umovestr): Likewise.  Adjust the code appropriately.
21752
21753	tests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel
21754	* tests/mmsg.c: #include <errno.h>
21755	(main): Return 77 if sendmmsg failed with ENOSYS.
21756
21757	tests: skip ip network tests when the network is not functional.
21758	* tests/inet-accept-connect-send-recv.c (main): Return 77 if inet stream
21759	socket cannot be created or it cannot be bound to INADDR_LOOPBACK.
21760	* tests/net-yy.test: Skip the test if inet-accept-connect-send-recv
21761	returns 77.
21762
21763	tests: handle the case when all 64 process capability bits are set.
21764	* tests/caps.awk: Handle the case when all bits of 64-bit capability
21765	word are set.
21766
21767	tests: explicitly request gawk when using gawk features.
21768	* tests/uid.test: Check for gawk availability and invoke gawk instead of
21769	plain awk because the test uses gawk's match() feature.
21770
21771	tests: skip detach tests if kill does not work.
21772	* tests/detach-running.test: Skip if "kill -0" does not work.
21773	* tests/detach-sleeping.test: Likewise.
21774	* tests/detach-stopped.test: Likewise.
21775
21776	ARM OABI: fix potential compilation warning.
21777	* syscall.c (get_scno) [!__ARM_EABI__ || ENABLE_ARM_OABI]: Fix
21778	"comparison between signed and unsigned" warning reported by some
21779	gcc versions.
21780
21781	powerpc: fix potential compilation warning.
21782	* mem.c [POWERPC] (sys_subpage_prot): Fix "comparison between signed
21783	and unsigned" warning reported by some gcc versions.
21784
217852015-01-13  Dmitry V. Levin  <ldv@altlinux.org>
21786
21787	sparc, sparc64: remove ioctl header file names from solaris ioctl entries
21788	Starting with commit v4.9-27-g3e252ca, header file names should not be
21789	part of ioctlent files included by syscall.c
21790
21791	* linux/sparc/ioctlent1.h: Remove ioctl header file names.
21792	* linux/sparc64/ioctlent2.h: Remove all entries, include "ioctlent.h".
21793
217942015-01-13  Dmitry V. Levin  <ldv@altlinux.org>
21795
21796	mips: enable indirect ipc subcall support.
21797	* linux/mips/syscallent-n32.h [LINUX_MIPSN32]: Define SYS_socket_subcall,
21798	include "subcall.h".
21799	* linux/mips/syscallent-n64.h [LINUX_MIPSN64]: Likewise.
21800	* linux/mips/syscallent-o32.h [LINUX_MIPSO32]: Likewise.
21801
21802	mips: remove stub entries from syscallent files, generate stubs at build time
21803	* linux/mips/genstub.sh: New file.
21804	* Makefile.am (EXTRA_DIST): Add it.
21805	* configure.ac [MIPS]: Use it to generate syscallent stubs.
21806	* linux/mips/.gitignore: Add syscallent stubs.
21807	* linux/mips/syscallent-n32.h: Remove stub entries, include
21808	the stub file instead.
21809	* linux/mips/syscallent-n64.h: Likewise.
21810	* linux/mips/syscallent-o32.h: Likewise.
21811
21812	build: add $(builddir)/$(OS)/$(ARCH) to the headers search list.
21813	* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS)/$(ARCH) before
21814	-I$(srcdir)/$(OS)/$(ARCH).
21815
21816	build: fix build if siginfo_t lacks si_timerid/si_overrun.
21817	* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_timerid and
21818	siginfo_t.si_overrun.
21819	* signal.c (printsiginfo) [SI_TIMER]: Check HAVE_SIGINFO_T_SI_TIMERID
21820	and HAVE_SIGINFO_T_SI_OVERRUN.
21821
21822	configure.ac: remove unused AM_CONDITIONAL expressions.
21823	* configure.ac (AM_CONDITIONAL): Remove I386, X86_64, X32.
21824
21825	tests: portability fixes.
21826	* tests/stat.test: dd obs= is not portable, use bs= instead.
21827	* tests/stat32-v.test: Likewise.
21828	* tests/stat64-v.test: Likewise.
21829	* tests/net.test: Use $* instead of $@ in the quoted string.
21830	* tests/net-fd.test: Likewise.
21831	* tests/statfs.test: Quote { and } in regexps.
21832	* tests/caps.awk: Likewise.
21833	* tests/getdents.awk: Likewise.
21834	* tests/net-yy-accept.awk: Likewise.
21835	* tests/net-yy-connect.awk: Likewise.
21836	* tests/sigaction.awk: Likewise.
21837	* tests/unix-yy-accept.awk: Likewise.
21838	* tests/unix-yy-connect.awk: Likewise.
21839
218402015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
21841
21842	Wire up new syscalls.
21843	* linux/dummy.h (sys_bpf, sys_execveat, sys_getrandom,
21844	sys_kexec_file_load, sys_memfd_create, sys_seccomp): New stub aliases.
21845	* linux/32/syscallent.h (seccomp, getrandom, memfd_create, bpf,
21846	execveat): New entries.
21847	* linux/64/syscallent.h: Likewise.
21848	* linux/arm/syscallent.h: Likewise.
21849	* linux/hppa/syscallent.h: Likewise.
21850	* linux/i386/syscallent.h: Likewise.
21851	* linux/microblaze/syscallent.h: Likewise.
21852	* linux/mips/syscallent-n32.h: Likewise.
21853	* linux/mips/syscallent-n64.h: Likewise.
21854	* linux/mips/syscallent-o32.h: Likewise.
21855	* linux/powerpc/syscallent.h: Likewise.
21856	* linux/sparc/syscallent.h: Likewise.
21857	* linux/ia64/syscallent.h (getrandom, memfd_create, bpf, execveat):
21858	New entries.
21859	* linux/m68k/syscallent.h: Likewise.
21860	* linux/s390/syscallent.h: (seccomp, getrandom, memfd_create, bpf,
21861	s390_pci_mmio_write, s390_pci_mmio_read, execveat): New entries.
21862	* linux/s390x/syscallent.h: Likewise.
21863	* linux/x86_64/syscallent.h (seccomp, getrandom, memfd_create,
21864	kexec_file_load, bpf, execveat): New entries.
21865	* linux/x32/syscallent.h: Likewise.
21866	* linux/xtensa/syscallent.h (seccomp, getrandom, memfd_create):
21867	New entries.
21868
218692015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
21870
21871	s390x: adjust some syscall entries.
21872	According to linux/arch/s390/include/uapi/asm/unistd.h, readdir is
21873	defined both on s390 and s390x, while getrlimit, _llseek, sendfile64,
21874	and fadvise64_64 are defined on s390 only.
21875
21876	* linux/s390x/syscallent.h (readdir): Add.
21877	(getrlimit, _llseek, sendfile64, fadvise64_64): Remove.
21878
218792015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
21880
21881	Change syscallent.h files to use designated initializers.
21882	Automatically convert all linux syscallent.h files to a form that uses
21883	designated initializers, with subsequent correction of whitespace
21884	indentation.
21885
21886	* linux/alpha/syscallent.h: Use designated initializers.
21887	* linux/arm/syscallent.h: Likewise.
21888	* linux/avr32/syscallent.h: Likewise.
21889	* linux/bfin/syscallent.h: Likewise.
21890	* linux/hppa/syscallent.h: Likewise.
21891	* linux/i386/syscallent.h: Likewise.
21892	* linux/ia64/syscallent.h: Likewise.
21893	* linux/m68k/syscallent.h: Likewise.
21894	* linux/microblaze/syscallent.h: Likewise.
21895	* linux/mips/syscallent-n32.h: Likewise.
21896	* linux/mips/syscallent-n64.h: Likewise.
21897	* linux/mips/syscallent-o32.h: Likewise.
21898	* linux/powerpc/syscallent.h: Likewise.
21899	* linux/s390/syscallent.h: Likewise.
21900	* linux/s390x/syscallent.h: Likewise.
21901	* linux/sh/syscallent.h: Likewise.
21902	* linux/sh64/syscallent.h: Likewise.
21903	* linux/sparc/syscallent.h: Likewise.
21904	* linux/x32/syscallent.h: Likewise.
21905	* linux/x86_64/syscallent.h: Likewise.
21906	* linux/xtensa/syscallent.h: Likewise.
21907
219082015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
21909
21910	Create generic 32-bit syscallent.h.
21911	Since arc/syscallent.h, metag/syscallent.h, or1k/syscallent.h, and
21912	tile/syscallent1.h share a lot of identical syscall entries described in
21913	<asm-generic/unistd.h>, move these entries to a new file 32/syscallent.h
21914	using the following automated conversion with subsequent correction of
21915	whitespace indentation:
21916
21917	sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^[[:space:]]*\[[[:space:]]*2\(4[4-9]\|5[0-9]\)/d' linux/arc/syscallent.h
21918
21919	* linux/32/syscallent.h: New file.
21920	* Makefile.am (EXTRA_DIST): Add it.
21921	* linux/arc/syscallent.h: Include "32/syscallent.h",
21922	remove generic 32-bit syscall entries, use designated initializers.
21923	* linux/metag/syscallent.h: Likewise.
21924	* linux/or1k/syscallent.h: Likewise.
21925	* linux/tile/syscallent1.h: Likewise.
21926
219272015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
21928
21929	tile: fix syscall entries.
21930	* linux/tile/syscallent1.h (truncate64, ftruncate64): Change nargs to 3.
21931	(pread64, pwrite64): Change nargs to 5.
21932	(llseek): Change sys_name to _llseek.
21933
21934	s390: fix fadvise64 and fadvise64_64 syscall entries.
21935	* linux/s390/syscallent.h (fadvise64, fadvise64_64): Change sys_func to
21936	printargs until special parsers for 31-bit 31 s390 emulation wrappers
21937	are written.
21938
21939	alpha: fix fadvise64 syscall entry.
21940	* linux/alpha/syscallent.h (fadvise64): Change sys_name to fadvise64.
21941
21942	tile: fix fadvise64_64 syscall entry.
21943	* linux/tile/syscallent1.h (fadvise64_64): Fix nargs, sys_func,
21944	and sys_name.
21945
21946	Fix getrlimit and ugetrlimit syscall entries.
21947	* linux/arm/syscallent.h (getrlimit, ugetrlimit): Fix sys_name.
21948	* linux/i386/syscallent.h: Likewise.
21949	* linux/m68k/syscallent.h: Likewise.
21950	* linux/microblaze/syscallent.h: Likewise.
21951	* linux/powerpc/syscallent.h: Likewise.
21952	* linux/avr32/syscallent.h (getrlimit): Fix sys_name.
21953	* linux/or1k/syscallent.h: Likewise.
21954	* linux/s390/syscallent.h (ugetrlimit): Fix sys_name.
21955	* linux/sh/syscallent.h: Likewise.
21956	* linux/sh64/syscallent.h: Likewise.
21957
21958	Fix umount and umount2 syscall entries.
21959	* linux/aarch64/syscallent1.h (umount): Change nargs to 1.
21960	* linux/avr32/syscallent.h: Likewise.
21961	* linux/xtensa/syscallent.h: Likewise.
21962	* linux/ia64/syscallent.h (umount2): Change nargs to 2.
21963	* linux/arm/syscallent.h (umount, umount2): Fix sys_name.
21964	* linux/bfin/syscallent.h: Likewise.
21965	* linux/i386/syscallent.h: Likewise.
21966	* linux/m68k/syscallent.h: Likewise.
21967	* linux/microblaze/syscallent.h: Likewise.
21968	* linux/powerpc/syscallent.h: Likewise.
21969	* linux/s390/syscallent.h: Likewise.
21970	* linux/s390x/syscallent.h: Likewise.
21971	* linux/sh/syscallent.h: Likewise.
21972	* linux/sh64/syscallent.h: Likewise.
21973	* linux/sparc/syscallent.h: Likewise.
21974	* linux/metag/syscallent.h: (umount2): Fix sys_name.
21975	* linux/or1k/syscallent.h: Likewise.
21976	* linux/x32/syscallent.h: Likewise.
21977	* linux/x86_64/syscallent.h: Likewise.
21978
21979	Fix sendfile64 syscall entries.
21980	* linux/arc/syscallent.h (sendfile64): Change sys_name to sendfile64.
21981	* linux/metag/syscallent.h: Likewise.
21982	* linux/or1k/syscallent.h: Likewise.
21983
21984	Fix number of arguments in ipc family syscall entries.
21985	* linux/64/syscallent.h (msgget, semget, semtimedop, semop, shmget,
21986	shmctl, shmat, shmdt): Fix nargs for direct ipc syscalls.
21987	* linux/alpha/syscallent.h (msgctl, msgget, msgrcv, semget, shmctl,
21988	shmdt, shmget, semtimedop): Likewise.
21989	* linux/avr32/syscallent.h (msgget, semget, semop, semtimedop, shmat,
21990	shmget, shmdt, shmctl): Likewise.
21991	* linux/bfin/syscallent.h (semget, semop, msgctl, msgget, msgrcv, shmat,
21992	* shmctl, shmdt, shmget, semtimedop): Likewise.
21993	* linux/hppa/syscallent.h (semop, semget, msgrcv, msgget, msgctl,
21994	semtimedop): Likewise.
21995	* linux/microblaze/syscallent.h (semtimedop, semget, semop, msgctl,
21996	msgget, msgrcv, shmat, shmctl, shmdt, shmget): Likewise.
21997	* linux/ia64/syscallent.h (semtimedop): Likewise.
21998	* linux/mips/syscallent-n32.h (semtimedop): Likewise.
21999	* linux/mips/syscallent-n64.h (semtimedop): Likewise.
22000	* linux/or1k/syscallent.h (msgget, msgctl, msgrcv, semget, semtimedop,
22001	semop, shmget, shmctl, shmat, shmdt): Likewise.
22002	* linux/sh64/syscallent.h (semget, msgget, shmget): Likewise.
22003	* linux/tile/syscallent1.h (msgget, semget, semtimedop, semop, shmget,
22004	shmctl, shmat, shmdt): Likewise.
22005	* linux/x32/syscallent.h (shmget, shmat, shmctl, semget, semop, shmdt,
22006	msgget, semtimedop): Likewise.
22007	* linux/x86_64/syscallent.h (shmget, shmat, shmctl, semget, semop,
22008	shmdt, msgget, semtimedop): Likewise.
22009	* linux/xtensa/syscallent.h (shmget, shmat, shmctl, shmdt, semtimedop,
22010	semget, semop, msgget, msgrcv, msgctl): Likewise.
22011
220122015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22013
22014	Create generic 64-bit syscallent.h.
22015	Since aarch64/syscallent1.h and tile/syscallent.h share a lot of
22016	identical syscall entries described in <asm-generic/unistd.h>, move
22017	these entries to a new file 64/syscallent.h using the following
22018	automated conversion with subsequent correction of whitespace
22019	indentation:
22020
22021	sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^\[[[:space:]]*2\(4[4-9]\|5[0-9]\)\]/d' linux/tile/syscallent.h
22022
22023	* linux/64/syscallent.h: New file.
22024	* Makefile.am (EXTRA_DIST): Add it.
22025	* linux/aarch64/syscallent1.h: Include "64/syscallent.h",
22026	remove generic 64-bit syscall entries, use designated initializers.
22027	* linux/tile/syscallent.h: Likewise.
22028
220292015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22030
22031	Fix nfsservctl syscall entries.
22032	* linux/arc/syscallent.h (nfsservctl): Set nargs, sys_func, and sys_name.
22033	* linux/metag/syscallent.h: Likewise.
22034
22035	Add missing syscall entries for sched_[gs]etattr and renameat2.
22036	* linux/alpha/syscallent.h (sched_setattr, sched_getattr, renameat2):
22037	New syscall entries.
22038	* linux/arc/syscallent.h: Likewise.
22039	* linux/metag/syscallent.h: Likewise.
22040	* linux/or1k/syscallent.h: Likewise.
22041	* linux/tile/syscallent.h: Likewise.
22042	* linux/tile/syscallent1.h: Likewise.
22043
22044	Fix NUMA related syscall entries.
22045	* linux/alpha/syscallent.h (mbind, get_mempolicy, set_mempolicy):
22046	Set sys_func.
22047	* linux/hppa/syscallent.h (mbind, get_mempolicy, set_mempolicy):
22048	Fix nargs, set sys_func.
22049	* linux/microblaze/syscallent.h (mbind): Fix nargs.
22050	* linux/mips/syscallent-n32.h (move_pages): Set sys_func.
22051	* linux/mips/syscallent-n64.h (move_pages): Likewise.
22052	* linux/mips/syscallent-o32.h (mbind): Fix nargs.
22053	* linux/or1k/syscallent.h (migrate_pages): Likewise.
22054	* linux/powerpc/syscallent.h (migrate_pages): Likewise.
22055	* linux/sh/syscallent.h (mbind): Likewise.
22056	* linux/sh64/syscallent.h (mbind): Likewise.
22057
22058	xtensa: fix syscall entries.
22059	* linux/xtensa/syscallent.h (sendmmsg): Fix sys_func and sys_name.
22060	(restart_syscall, io_setup, io_destroy, io_submit, io_getevents,
22061	io_cancel, add_key, request_key, keyctl): Set sys_func.
22062	(migrate_pages, mbind, get_mempolicy, set_mempolicy, move_pages,
22063	fstatat64): Fix nargs.
22064	(renameat2): New entry.
22065
22066	Fix sched_setparam syscall entries.
22067	* linux/aarch64/syscallent1.h (sched_setparam): Change nargs to 2.
22068	* linux/arm/syscallent.h (sched_setparam): Likewise.
22069	* linux/avr32/syscallent.h (sched_setparam): Likewise.
22070	* linux/bfin/syscallent.h (sched_setparam): Likewise.
22071	* linux/i386/syscallent.h (sched_setparam): Likewise.
22072	* linux/m68k/syscallent.h (sched_setparam): Likewise.
22073	* linux/microblaze/syscallent.h (sched_setparam): Likewise.
22074	* linux/s390/syscallent.h (sched_setparam): Likewise.
22075	* linux/s390x/syscallent.h (sched_setparam): Likewise.
22076	* linux/sh/syscallent.h (sched_setparam): Likewise.
22077	* linux/sh64/syscallent.h (sched_setparam): Likewise.
22078	* linux/tile/syscallent.h (sched_setparam): Likewise.
22079	* linux/tile/syscallent1.h (sched_setparam): Likewise.
22080	* linux/x32/syscallent.h (sched_setparam): Likewise.
22081	* linux/x86_64/syscallent.h (sched_setparam): Likewise.
22082
22083	arc: fix fanotify_mark syscall entry.
22084	* linux/arc/syscallent.h (fanotify_mark): Change nargs to 6.
22085
22086	ia64: add fallocate syscall entry.
22087	* linux/ia64/syscallent.h (fallocate): Add syscall entry.
22088
22089	Fix lookup_dcookie syscall entries.
22090	* linux/s390/syscallent.h (lookup_dcookie): Add syscall entry.
22091	* linux/s390x/syscallent.h (lookup_dcookie): Likewise.
22092	* linux/tile/syscallent.h (lookup_dcookie): Change nargs to 3.
22093	* linux/x32/syscallent.h (lookup_dcookie): Likewise.
22094
22095	aarch64: fix syscall names for statfs, fstatfs, truncate, and ftruncate.
22096	* linux/aarch64/syscallent1.h (statfs, fstatfs, truncate, ftruncate):
22097	Use correct syscall names.
22098
22099	aarch64: fix mlock syscall entry.
22100	* linux/aarch64/syscallent1.h (mlock): Change to mlock entry.
22101
22102	sh, sh64: fix mlock syscall entry.
22103	* linux/sh/syscallent.h (mlock): Change nargs to 2.
22104	* linux/sh64/syscallent.h (mlock): Likewise.
22105
22106	tile: fix swapon syscall entries.
22107	* linux/tile/syscallent.h (swapon): Change nargs to 2.
22108	* linux/tile/syscallent1.h (swapon): Likewise.
22109
221102015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22111
22112	ARM EABI: reserve some space for new syscalls.
22113	Reserve the same space for new syscalls on EABI as it is already
22114	reserved on OABI.
22115
22116	* linux/arm/syscallent.h [__ARM_EABI__] (ARM_FIRST_SHUFFLED_SYSCALL):
22117	Raise to 400.
22118
221192015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22120
22121	arm: rewrite shuffle_scno in a bit more readable way.
22122	* linux/arm/syscallent.h: Define ARM_FIRST_SHUFFLED_SYSCALL instead of
22123	ARM_LAST_ORDINARY_SYSCALL.
22124	* syscall.c [ARM || AARCH64] (shuffle_scno): Update.
22125
22126	tests: add tests for ipc syscalls decoding.
22127	* tests/ipc_msg.c: New file.
22128	* tests/ipc_sem.c: Likewise.
22129	* tests/ipc_shm.c: Likewise.
22130	* tests/ipc_msg.test: New test.
22131	* tests/ipc_sem.test: Likewise.
22132	* tests/ipc_shm.test: Likewise.
22133	* tests/Makefile.am (check_PROGRAMS): Add ipc_msg, ipc_sem, and ipc_shm.
22134	(TESTS): Add ipc_msg.test, ipc_sem.test, and ipc_shm.test.
22135	* tests/.gitignore: Add ipc_msg, ipc_sem, and ipc_shm.
22136
221372015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22138
22139	Fix indirect ipc subcall handling.
22140	indirect_ipccall used to guess whether currently decoded ipc syscall is
22141	an indirect subcall or not based on generic knowledge, while there is a
22142	robust method to identify indirect ipc subcalls.
22143
22144	* defs.h (TRACE_INDIRECT_SUBCALL): New flag.
22145	* ipc.c (indirect_ipccall): Check it.
22146	* linux/subcall.h: Set it.
22147
221482015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22149
22150	Move socket and ipc subcall entries to subcall.h.
22151	Syscall entries for socket and ipc subcalls are the same on all
22152	architectures, or at least they should be the same, so move them
22153	to the single file.
22154
22155	* linux/subcall.h: Add syscall entries for socket and ipc subcalls.
22156	* linux/arm/syscallent.h: Remove entries for socket and ipc subcalls.
22157	* linux/i386/syscallent.h: Likewise.
22158	* linux/m68k/syscallent.h: Likewise.
22159	* linux/powerpc/syscallent.h: Likewise.
22160	* linux/s390/syscallent.h: Likewise.
22161	* linux/s390x/syscallent.h: Likewise.
22162	* linux/sh/syscallent.h: Likewise.
22163	* linux/sh64/syscallent.h: Likewise.
22164	* linux/sparc/syscallent.h: Likewise.
22165
221662015-01-12  Dmitry V. Levin  <ldv@altlinux.org>
22167
22168	sh: fix typo introduced by commit v4.9-121-gd535b8b.
22169	* linux/sh/syscallent.h (getresgid32): Fix typo in sys_func and sys_name.
22170
221712015-01-10  Dmitry V. Levin  <ldv@altlinux.org>
22172
22173	Fix fanotify_mark decoding on 32-bit architectures.
22174	The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
22175	architectures it is split up into two syscall arguments.
22176
22177	* configure.ac (AC_CHECK_FUNCS): Add fanotify_mark.
22178	(AC_CHECK_HEADERS): Add sys/fanotify.h.
22179	* defs.h (getllval): New prototype.
22180	* util.c (getllval): New function based on printllval.
22181	(printllval): Use getllval.
22182	* fanotify.c (sys_fanotify_mark): Use getllval to properly decode
22183	64-bit mask and two syscall arguments followed by it.
22184	* tests/fanotify_mark.c: New file.
22185	* tests/fanotify_mark.test: New test.
22186	* tests/Makefile.am (check_PROGRAMS): Add fanotify_mark.
22187	(TESTS): Add fanotify_mark.test.
22188	* tests/.gitignore: Add fanotify_mark.
22189
221902015-01-09  Dmitry V. Levin  <ldv@altlinux.org>
22191
22192	v4l2: fix build on systems with older kernel headers.
22193	* v4l2.c (print_v4l2_format_fmt): Do not use
22194	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY unless it is defined.
22195	(v4l2_ioctl): Do not use VIDIOC_ENUM_FRAMESIZES and
22196	VIDIOC_ENUM_FRAMEINTERVALS unless they are defined.
22197
221982015-01-09  Dmitry V. Levin  <ldv@altlinux.org>
22199
22200	tests: fix build with awk that does not support switch-case.
22201	The switch-case statement is a gawk-specific feature which is not
22202	necessarily available, let's use traditional if-else statements instead.
22203
22204	* tests/uid.awk: Rewrite without switch-case statements.
22205
222062015-01-09  Dmitry V. Levin  <ldv@altlinux.org>
22207
22208	Fix build on systems that lack O_CLOEXEC definition.
22209	* xlat/timerfdflags.in [!TFD_CLOEXEC]: Check that O_CLOEXEC is defined.
22210
222112015-01-09  Dmitry V. Levin  <ldv@altlinux.org>
22212
22213	Fix build on systems that lack NETLINK_SOCK_DIAG definition.
22214	NETLINK_INET_DIAG was introduced in linux v2.6.14,
22215	NETLINK_SOCK_DIAG was added much later in linux v3.3.
22216
22217	* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]
22218	(NETLINK_SOCK_DIAG): Define.
22219	* socketutils.c: Likewise.
22220	* tests/netlink_unix_diag.c: Likewise.
22221
222222015-01-09  Dmitry V. Levin  <ldv@altlinux.org>
22223
22224	Cleanup local copy of linux/fanotify.h.
22225	* linux/fanotify.h: Remove macros and structures not used by
22226	fanotify_init and fanotify_mark parsers.
22227
22228	Fix "make dist" regression introduced by commit v4.9-125-g120e5db.
22229	* Makefile.am (EXTRA_DIST): Add linux/unix_diag.h.
22230
222312015-01-08  Dmitry V. Levin  <ldv@altlinux.org>
22232
22233	tests: fix build with fresh glibc.
22234	* tests/netlink_unix_diag.c: Include <stdint.h>.
22235
222362015-01-08  Dmitry V. Levin  <ldv@altlinux.org>
22237
22238	ioctlent.sh: handle linux/aufs_type.h properly.
22239	Before this change, ioctlent.sh could not recognize unusual constants
22240	defined by linux/aufs_type.h, resulting to ioctls.h with references to
22241	these constants without appropriate definitions in ioctldefs.h.
22242
22243	* linux/ioctlent.sh: Update the regexp that is used to lookup constants
22244	referenced by generated ioctls.h.
22245
222462015-01-08  Dmitry V. Levin  <ldv@altlinux.org>
22247
22248	tests: fix distcheck.
22249	* tests/stat32-v.test: Remove work files if the test is skipped.
22250
22251	Fix printing of time_t values set in the distant future.
22252	* util.c (sprinttime): Increase buffer size.
22253	* tests/stat64-v.test: Try to set modification time of the sample file
22254	to a value set in the distant future.
22255
22256	Use AC_CHECK_TYPES to check for struct statfs64.
22257	* m4/statfs.m4: Remove.
22258	* configure.ac (AC_STATFS64): Remove.
22259	(AC_CHECK_TYPES): Add struct statfs64.
22260	* statfs.c: Replace HAVE_STATFS64 with HAVE_STRUCT_STATFS64.
22261
22262	Use AC_CHECK_TYPES to check for struct stat64.
22263	* m4/stat.m4: Remove.
22264	* configure.ac (AC_STAT64): Remove.
22265	(AC_CHECK_TYPES): Add struct stat64.
22266	* file.c: Replace HAVE_STAT64 with HAVE_STRUCT_STAT64.
22267
22268	file.c: fix 32-bit stat decoding on 64-bit architectures.
22269	* file.c [SPARC || SPARC64] (struct stat): Remove, use generic
22270	definition from <asm/stat.h>.
22271	[SPARC64] (struct stat_sparc64, printstat_sparc64): Remove.
22272	[AARCH64 || X86_64 || X32 || POWERPC64 || SPARC64] (struct stat32,
22273	STAT32_PERSONALITY): Define.
22274	[STAT32_PERSONALITY] (struct stat_powerpc32): Rename to struct stat32.
22275	[STAT32_PERSONALITY] (printstat_powerpc32): Rename to printstat32.
22276	(printstat) [STAT32_PERSONALITY]: Call printstat32 when
22277	current_personality == STAT32_PERSONALITY.
22278	[HAVE_STAT64] (printstat64) [STAT32_PERSONALITY]: Call printstat when
22279	current_personality != STAT32_PERSONALITY.
22280	[!HAVE_STAT64] (sys_stat64): Fallback to sys_stat.
22281	[!HAVE_STAT64] (sys_fstat64): Fallback to sys_fstat.
22282
22283	sparc: reuse struct stat parser code for struct solstat decoding.
22284	* printstat.h: Parametrize major() and minor().
22285	* file.c [SPARC || SPARC64]: Define do_printstat_sol by instantiating
22286	printstat.h template.
22287	[SPARC || SPARC64] (printstatsol): Use do_printstat_sol.
22288
22289	ppc64: reuse struct stat parser code for struct stat_powerpc32 decoding.
22290	* file.c [POWERPC64]: Define do_printstat32 by instantiating printstat.h
22291	template.
22292	[POWERPC64] (printstat_powerpc32): Use do_printstat32.
22293
22294	file.c: group related parsers together.
22295	* file.c (sys_stat, sys_fstat): Collect in one place right before
22296	the definition of printstat64.
22297	(sys_stat64, sys_fstat64): Collect in one place right after the
22298	definition of printstat64.
22299
22300	file.c: collect scattered __old_kernel_stat related code.
22301	* file.c [HAVE_STRUCT___OLD_KERNEL_STAT] (convertoldstat, printoldstat,
22302	sys_oldstat, sys_oldfstat): Collect functions in one place.
22303
22304	Use the same source code for struct stat/stat64 decoding.
22305	* file.c: Define do_printstat64 by instantiating printstat.h template.
22306	(printstat64): Use do_printstat64.
22307
22308	x32: use generic printstat/printstat64 parsers.
22309	* file.c (printstat) [X32]: Define.
22310	(printstat64) [X32]: Use "struct stat64" instead of "struct stat".
22311	Use printstat for x32 personality processes.
22312	(printstat64_x32): Remove.
22313	(sys_stat64, sys_fstat64) [X32]: Use printstat64 instead of
22314	printstat64_x32.
22315
22316	x32: remove redundant definitions.
22317	* file.c [X32]: Do not define "struct stat" and "struct
22318	__old_kernel_stat" locally, use definitions provided by <asm/stat.h>.
22319	Do not define "struct stat64" exclusively, reuse another definition
22320	added earlier for X86_64.
22321
22322	Convert do_printstat to a template function.
22323	* printstat.h: New file.
22324	* Makefile.am (strace_SOURCES): Add it.
22325	* file.c: Include "printstat.h".
22326	(do_printstat): Move to printstat.h, parametrize its name
22327	and struct stat.
22328
22329	file.c: prepare realprintstat for parametrization.
22330	* file.c (realprintstat): Adjust format strings so that all 64-bit
22331	integer fields are printed with %llu format, and %u format is used for
22332	all the rest.  Rename to do_printstat.
22333	(printstat, printoldstat): Update callers.
22334
22335	tests: cleanup stat.test.
22336	* tests/stat.test: Rewrite in a more readable way.
22337
22338	tests: check verbose decoding of 32-bit and 64-bit struct stat.
22339	* tests/stat.c: New file.
22340	* tests/stat32.c: Likewise.
22341	* tests/stat32-v.test: New file.
22342	* tests/stat64-v.test: Likewise.
22343	* tests/Makefile.am (check_PROGRAMS): Add stat and stat32.
22344	(stat_CFLAGS): Define.
22345	(TESTS): Add stat32-v.test and stat64-v.test.
22346	* tests/.gitignore: Add stat and stat32.
22347
223482015-01-07  Dmitry V. Levin  <ldv@altlinux.org>
22349
22350	Cleanup struct stat.st_flags decoding.
22351	There are no symbolic constants defined for struct stat.st_flags,
22352	so decode this rare field as unsigned int.
22353
22354	* xlat/fileflags.in: Remove.
22355	* file.c (realprintstat, printstat64) [HAVE_STRUCT_STAT_ST_FLAGS]:
22356	Decode struct stat.st_flags as unsigned int.
22357
223582015-01-07  Dmitry V. Levin  <ldv@altlinux.org>
22359
22360	Drop struct stat.st_aclcnt and stat.st_level support.
22361	Remove the code that supports struct stat.st_aclcnt and stat.st_level
22362	decoding -- these fields are not defined in system headers.
22363
22364	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_aclcnt and
22365	struct stat.st_level.
22366	* file.c (realprintstat, printstat64)
22367	[HAVE_STRUCT_STAT_ST_ACLCNT || HAVE_STRUCT_STAT_ST_LEVEL]: Remove.
22368
223692015-01-07  Dmitry V. Levin  <ldv@altlinux.org>
22370
22371	tests: fix race condition in net-accept-connect based tests.
22372	Change all net-accept-connect based tests to use different unix domain
22373	socket addresses, so that these tests could be safely run in parallel.
22374
22375	* tests/net-accept-connect.c: Parametrize unix domain socket address.
22376	* tests/net-fd.test: Pass socket address to net-accept-connect.
22377	* tests/net.test: Likewise.
22378	* tests/unix-yy.test: Likewise.
22379	* tests/unix-yy-accept.awk: Update regexps.
22380	* tests/unix-yy-connect.awk: Likewise.
22381
223822014-12-31  Mike Frysinger  <vapier@gentoo.org>
22383
22384	timerfd: update flags decoding.
22385	The current code only decodes TFD_TIMER_ABSTIME when the kernel has
22386	a bunch of newer flags.  We have to handle fallbacks for all of them
22387	since the kernel doesn't currently export things to userspace.
22388
22389	* time.c: Include fcntl.h for O_* defines.
22390	(TFD_TIMER_ABSTIME): Move to xlat/timerfdflags.in.
22391	* xlat/timerfdflags.in: Add more definitions.
22392
223932014-12-29  Dmitry V. Levin  <ldv@altlinux.org>
22394
22395	sparc: fix fxstat decoding.
22396	* file.c [SPARC || SPARC64] (sys_fxstat): Print file descriptor
22397	using printfd.
22398
223992014-12-29  Dmitry V. Levin  <ldv@altlinux.org>
22400
22401	sparc: drop _STAT64_VER support.
22402	Starting with commit v4.6-240-g5afdf12, nobody compiles this
22403	non-Linux code.
22404
22405	* file.c [SPARC || SPARC64] (sys_xstat, sys_fxstat): Remove
22406	_STAT64_VER code.
22407
224082014-12-29  Dmitry V. Levin  <ldv@altlinux.org>
22409
22410	sparc: remove redundant sys_lxstat.
22411	* file.c [SPARC || SPARC64] (sys_lxstat): Remove.
22412	* linux/sparc/dummy2.h (solaris_lxstat): Alias to sys_xstat.
22413	* linux/sparc64/dummy2.h (solaris_lxstat): Likewise.
22414
224152014-12-28  Dmitry V. Levin  <ldv@altlinux.org>
22416
22417	file.c: do not include unused headers.
22418	* file.c: Do not include <fcntl.h>.
22419
224202014-12-27  Dmitry V. Levin  <ldv@altlinux.org>
22421
22422	Cleanup UTIME_NOW/UTIME_OMIT decoding.
22423	Move the code that's present in two copies from sprinttv()
22424	to a new helper function.
22425
22426	* time.c (do_sprinttv): New function.
22427	(sprinttv): Use it.
22428
224292014-12-27  Elliott Hughes  <enh@google.com>
22430
22431	Fix UTIME_NOW/UTIME_OMIT decoding.
22432	The kernel doesn't actually care what tv_sec is set to --- it only checks
22433	tv_nsec when looking for the special values.
22434
224352014-12-26  Dmitry V. Levin  <ldv@altlinux.org>
22436
22437	Make -yy output for inet sockets consistent with unix domain sockets.
22438	Prepend -yy output generated for INET/INET6 TCP/UDP sockets with their
22439	protocol name obtained using getxattr.
22440
22441	* socketutils.c (inet_parse_response): Add proto_name argument.
22442	Print proto_name for connected and unconnected sockets.
22443	(receive_responses): Add proto_name argument, pass it to the parser.
22444	(inet_print): Add proto_name argument, pass it to receive_responses.
22445	(unix_parse_response): Add proto_name argument.
22446	(print_sockaddr_by_inode): Pass protocol name to inet_print calls.
22447	* tests/net-yy-accept.awk: Update to match new output format.
22448	* tests/net-yy-connect.awk: Likewise.
22449
224502014-12-25  Dmitry V. Levin  <ldv@altlinux.org>
22451
22452	tests: robustify unix domain socket decoding test.
22453	Unix domain socket address family name is not universally decoded as
22454	AF_LOCAL, other names like AF_UNIX and AF_FILE are valid synonyms.
22455	Similarly, PF_UNIX and PF_FILE are valid synonyms for PF_LOCAL.
22456
22457	Some test regexps have to be properly initialized before they could
22458	be used, so make sure they are initialized before use.
22459
224602014-12-25  Dmitry V. Levin  <ldv@altlinux.org>
22461
22462	tests: fix unix domain socket decoding availability test.
22463	Since inet_diag and unix_diag interfaces are implemented by different
22464	kernel modules, they have to be tested separately.
22465
22466	* tests/netlink_unix_diag.c: New file.
22467	* tests/unix-yy.test: Use it.
22468	* tests/Makefile.am (check_PROGRAMS): Add it.
22469	* tests/.gitignore: Likewise.
22470
224712014-12-25  Masatake YAMATO  <yamato@redhat.com>
22472
22473	tests: add a test for decoding unix domain socket addresses.
22474	* tests/unix-yy-accept.awk: New file.
22475	* tests/unix-yy-connect.awk: New file.
22476	* tests/unix-yy.test: New test.
22477	* tests/Makefile.am (TESTS): Add it.
22478	(EXTRA_DIST): Add unix-yy-accept.awk and unix-yy-connect.awk.
22479
224802014-12-25  Masatake YAMATO  <yamato@redhat.com>
22481
22482	Support unix domain sockets in -yy option.
22483	This change extends -yy option to handle unix domain sockets:
22484	their peer addresses will be printed, similar to inet sockets.
22485
22486	For a listening socket, its socket inode and socket path are printed.
22487	For an accepted socket, its socket inode, the peer inode, and the
22488	socket path are printed.
22489	For a client socket, its socket inode and the peer inode are printed.
22490
22491	An example of a server side communication using netcat:
22492
22493		$ ./strace -yy -e network nc -l -U /tmp/example.sock
22494		socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
22495		setsockopt(3<UNIX:[14728348]>, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
22496		bind(3<UNIX:[14728348]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
22497		listen(3<UNIX:[14728348,"/tmp/example.sock"]>, 10) = 0
22498		accept(3<UNIX:[14728348,"/tmp/example.sock"]>, {sa_family=AF_LOCAL, NULL}, [2]) = 4<UNIX:[14727246->14727245,"/tmp/example.sock"]>
22499		recvfrom(4<UNIX:[14727246->14727245,"/tmp/example.sock"]>, "INPUT\n", 8192, 0, NULL, NULL) = 6
22500		INPUT
22501
22502	An example of a client side communication using netcat:
22503
22504		$ ./strace -yy -e network nc -U /tmp/example.sock
22505		socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
22506		connect(3<UNIX:[14727245]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
22507		getsockopt(3<UNIX:[14727245]>, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
22508		INPUT
22509		...
22510		sendto(3<UNIX:[14727245->14727246]>, "INPUT\n", 6, 0, NULL, 0) = 6
22511
22512	* linux/unix_diag.h: New file.
22513	* socketutils.c (send_query): Rename to inet_send_query.
22514	(parse_response): Rename to inet_parse_response.
22515	(unix_print, unix_send_query, unix_parse_response): New functions.
22516	(receive_responses): Add a new argument named parser: a function for
22517	handling protocol specific data parts of diag messages.
22518	(print_sockaddr_by_inode): Call unix_print.
22519	Replace NETLINK_INET_DIAG with NETLINK_SOCK_DIAG, they are equal
22520	but NETLINK_SOCK_DIAG looks more generic.
22521
225222014-12-16  Masatake YAMATO  <yamato@redhat.com>
22523
22524	Use the protocol name of a socket as a hint for peer address resolution.
22525	To resolve the peer address of socket, all combinations of families
22526	(AF_INET, AF_INET6) and protocols(IPPROTO_TCP, IPPROTO_UDP) were tried.
22527	This change utilizes the protocol name obtained via getxattr to specify
22528	the right combination.
22529
22530	* socketutils.c (inet_print): New helper function.
22531	(print_sockaddr_by_inode): Use it.  Utilize the protocol name
22532	associated with the given inode for resolving the peer socket
22533	address.  If the protocol name is NULL, resolve the address
22534	by trying combinations of families and protocols as before.
22535	* defs.h (print_sockaddr_by_inode): Update prototype.
22536	* util.c (printfd): Pass the protocol name associated with
22537	the given path to print_sockaddr_by_inode as the 2nd argument.
22538
225392014-12-16  Dmitry V. Levin  <ldv@altlinux.org>
22540
22541	Fix decoding of getgroups, getgroups32, setgroups, and setgroups32 syscalls
22542	Convert parsers of these syscalls to the same scheme as were applied to
22543	parsers of other uid/gid related syscalls.
22544	That is, define two sets of parsers on architectures that support
22545	(either directly or via multiarch) 16-bit and 32-bit gid getgroups
22546	and setgroups syscalls simultaneously, and reuse essentially the same
22547	code by parametrizing uid_t and names of parser functions.
22548
22549	* groups.c: Remove.
22550	(sys_getgroups, sys_setgroups): Move ...
22551	* uid.c: ... here and parametrize their names.
22552	* Makefile.am (strace_SOURCES): Remove groups.c.
22553	* linux/syscall.h (sys_getgroups32, sys_setgroups32): Remove.
22554	[NEED_UID16_PARSERS] (sys_getgroups16, sys_setgroups16): New prototypes.
22555	* linux/arm/syscallent.h: Rename sys_[gs]etgroups to sys_[gs]etgroups16,
22556	rename sys_[gs]etgroups32 to sys_[gs]etgroups.
22557	* linux/bfin/syscallent.h: Likewise.
22558	* linux/i386/syscallent.h: Likewise.
22559	* linux/m68k/syscallent.h: Likewise.
22560	* linux/microblaze/syscallent.h: Likewise.
22561	* linux/s390/syscallent.h: Likewise.
22562	* linux/sh/syscallent.h: Likewise.
22563	* linux/sh64/syscallent.h: Likewise.
22564	* linux/sparc/syscallent.h: Likewise.
22565	* tests/uid.c: Test for getgroups.
22566	* tests/uid16.c: Likewise.
22567	* tests/uid32.c: Test for getgroups32.
22568	* tests/uid.awk: Test for getgroups/getgroups32 decoding.
22569	* tests/uid.test: Trace getgroups/getgroups32 syscalls.
22570
225712014-12-16  Dmitry V. Levin  <ldv@altlinux.org>
22572
22573	Fix decoding of 16-bit *chown and [gs]et*[gu]id syscalls.
22574	Define two sets of parsers on architectures that support (either
22575	directly or via multiarch) 16-bit and 32-bit uid/gid syscalls
22576	simultaneously.  Since the code in these two sets is essentially
22577	the same and the key difference between them is the size of uid_t,
22578	implement it by parametrizing uid_t and names of parser functions.
22579
22580	* defs.h (NEED_UID16_PARSERS): New macro.
22581	* linux/syscall.h [NEED_UID16_PARSERS] (sys_chown16, sys_fchown16,
22582	sys_getresuid16, sys_getuid16, sys_setfsuid16, sys_setresuid16,
22583	sys_setreuid16, sys_setuid16): New prototypes.
22584	* linux/dummy.h (sys_geteuid16): Alias to sys_getuid16.
22585	(sys_getegid16, sys_getgid16, sys_getresgid16, sys_setfsgid16,
22586	sys_setgid16, sys_setregid16, sys_setresgid16): Alias to corresponding
22587	sys_*uid16 functions.
22588	* uid.c: Stop including <asm/posix_types.h>.
22589	Parametrize uid_t and names of all exported functions.
22590	(get_print_uid): New function.
22591	(sys_getresuid): Use it.
22592	(printuid): Check for (uid_t) -1.
22593	* uid16.c: New file.
22594	* Makefile.am (strace_SOURCES): Add it.
22595	* linux/arm/syscallent.h: Use sys_chown16, sys_fchown16, sys_getegid16,
22596	sys_geteuid16, sys_getgid16, sys_getresgid16, sys_getresuid16,
22597	sys_getuid16, sys_setfsgid16, sys_setfsuid16, sys_setgid16,
22598	sys_setregid16, sys_setresgid16, sys_setresuid16, sys_setreuid16,
22599	and sys_setuid16 parsers for *chown and [gs]et*[gu]id syscall entries.
22600	* linux/bfin/syscallent.h: Likewise.
22601	* linux/i386/syscallent.h: Likewise.
22602	* linux/m68k/syscallent.h: Likewise.
22603	* linux/microblaze/syscallent.h: Likewise.
22604	* linux/s390/syscallent.h: Likewise.
22605	* linux/sparc/syscallent.h: Likewise.
22606	* linux/sh/syscallent.h: Likewise.
22607	* linux/sh64/syscallent.h: Likewise.
22608	* tests/uid16.c: New file.
22609	* tests/uid16.test: New test.
22610	* tests/Makefile.am (CHECK_PROGRAMS): Add uid16.
22611	(TESTS): Add uid16.test.
22612	* tests/.gitignore: Add uid16.
22613
226142014-12-16  Dmitry V. Levin  <ldv@altlinux.org>
22615
22616	sh, sh64: fix uid/gid syscall entries.
22617	* linux/sh/syscallent.h: Replace printargs with real syscall
22618	parsers in *chown32 and [gs]et*[gu]id32 syscall entries.
22619	* linux/sh64/syscallent.h: Likewise.
22620
22621	s390: fix uid/gid syscall entries.
22622	* linux/s390/syscallent.h: Add "32" suffix to names of *chown32
22623	and [gs]et*[gu]id32 syscalls #198..216.
22624
22625	sparc: fix uid/gid syscall entries.
22626	* linux/sparc/syscallent.h: Add "32" suffix to names
22627	of [gs]etres[gu]id32 syscalls #108..112.
22628	Fix entry for syscall #112 from setresgid32 to setregid32.
22629
226302014-12-15  Dmitry V. Levin  <ldv@altlinux.org>
22631
22632	chown.c: split into separate files.
22633	This will make further uid/gid fixes simpler.
22634
22635	* fchownat.c: New file.
22636	* chown.c (sys_fchownat: Move to fchownat.c.
22637	(sys_chown, sys_fchown): Move to uid.c.
22638	* Makefile.am (strace_SOURCES): Remove chown.c, add fchownat.c.
22639
226402014-12-15  Dmitry V. Levin  <ldv@altlinux.org>
22641
22642	util.c: move printuid to uid.c.
22643	This will make further uid/gid fixes simpler.
22644
22645	* util.c (printuid): Move
22646	* uid.c: ... here.
22647
226482014-12-15  Dmitry V. Levin  <ldv@altlinux.org>
22649
22650	tests/uid.awk: rewrite in a more maintainable style.
22651	Since the test is virtually a FSM, rewrite it as a FSM.
22652
226532014-12-14  Dmitry V. Levin  <ldv@altlinux.org>
22654
22655	printuid: fix uid_t decoding on 64-bit architectures.
22656	It was not a good idea to treat uid_t as a long int type because
22657	the latter is twice larger than uid_t on 64-bit architectures.
22658
22659	* defs.h (printuid): Change uid argument type from "unsigned long"
22660	to "unsigned int".
22661	* util.c (printuid): Likewise.  When uid equals to -1, print "-1".
22662	* tests/uid.awk: New file.
22663	* tests/uid.c: New file.
22664	* tests/uid32.c: Likewise.
22665	* tests/uid.test: New test.
22666	* tests/uid32.test: Likewise.
22667	* tests/Makefile.am (CHECK_PROGRAMS): Add uid and uid32.
22668	(TESTS): Add uid.test and uid32.test.
22669	(EXTRA_DIST): Add uid.awk.
22670	* tests/.gitignore: Add uid and uid32.
22671
226722014-12-13  Dmitry V. Levin  <ldv@altlinux.org>
22673
22674	Update PTRACE_* constants.
22675	* xlat/ptrace_cmds.in: Add PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK,
22676	and PTRACE_SETSIGMASK.
22677
22678	Update SWAP_FLAG_* constants.
22679	* swapon.c: Ensure that SWAP_FLAG_DISCARD_ONCE and
22680	SWAP_FLAG_DISCARD_PAGES are defined.
22681	* xlat/swap_flags.in: Add SWAP_FLAG_DISCARD_ONCE and
22682	SWAP_FLAG_DISCARD_PAGES.
22683
226842014-12-11  Dmitry V. Levin  <ldv@altlinux.org>
22685
22686	Update SCHED_* constants.
22687	* xlat/schedulers.in: Add SCHED_BATCH, SCHED_ISO, SCHED_IDLE, and
22688	SCHED_DEADLINE.
22689
22690	Update prctl PR_* constants.
22691	* xlat/prctl_options.in: Add PR_SET_THP_DISABLE, PR_GET_THP_DISABLE,
22692	PR_MPX_ENABLE_MANAGEMENT, and PR_MPX_DISABLE_MANAGEMENT.
22693
226942014-12-11  Dmitry V. Levin  <ldv@altlinux.org>
22695
22696	Always compile sys_prctl parser.
22697	Since sys_prctl is referenced by syscallent files unconditionally,
22698	conditional compilation of sys_prctl depending on prctl availability is
22699	pointless.
22700
22701	* prctl.c (unalignctl_string, sys_prctl): Compile unconditionally.
22702
227032014-12-11  Dmitry V. Levin  <ldv@altlinux.org>
22704
22705	process.c: split struct_user_offsets into architecture-specific include files
22706	* Makefile.am (EXTRA_DIST): Add linux/alpha/userent.h,
22707	linux/arm/userent.h, linux/avr32/userent.h, linux/bfin/userent.h,
22708	linux/crisv10/userent.h, linux/crisv32/userent.h,
22709	linux/i386/userent.h, linux/i386/userent0.h, linux/ia64/userent.h,
22710	linux/m68k/userent.h, linux/microblaze/userent.h,
22711	linux/mips/userent.h, linux/or1k/userent.h, linux/powerpc/userent.h,
22712	linux/s390/userent.h, linux/s390/userent0.h, linux/s390/userent1.h,
22713	linux/s390x/userent.h, linux/sh/userent.h, linux/sh/userent0.h,
22714	linux/sh64/userent.h, linux/sparc/userent.h, linux/sparc64/userent.h,
22715	linux/tile/userent.h, linux/userent.h, linux/userent0.h,
22716	linux/x32/userent.h, linux/x86_64/userent.h, and
22717	linux/xtensa/userent.h.
22718	* process.c (struct_user_offsets): Split into architecture-specific
22719	include files, inculde userent.h.
22720
22721	process.c: include less headers.
22722	* process.c: Do not include <fcntl.h> and <sys/stat.h>.
22723	Reorder inclusion of xlat header files.
22724
22725	Unexport struct_user_offsets.
22726	* defs.h (struct_user_offsets): Remove.
22727	* process.c (struct_user_offsets): Make static.
22728
227292014-12-11  Dmitry V. Levin  <ldv@altlinux.org>
22730
22731	process.c: introduce XLAT_UOFF macro.
22732	Introduce XLAT_UOFF macro and use it to automatically transform
22733	struct_user_offsets array into a more readable and compact form.
22734
22735	for n in $(sed -n 's/^[[:space:]]*{[[:space:]]*uoff(\([a-z_0-9]\+\)),.*/\1/p' process.c |sort -u); do
22736		sed -i 's/^\([[:space:]]*\){[[:space:]]*uoff('"$n"'),[[:space:]]*"offsetof(struct user,[[:space:]]*'"$n"')"[[:space:]]*},$/\1XLAT_UOFF('"$n"'),/' process.c
22737	done
22738
22739	* process.c (XLAT_UOFF): New macro.
22740	(struct_user_offsets): Use it.
22741
227422014-12-11  Dmitry V. Levin  <ldv@altlinux.org>
22743
22744	process.c: move sethostname and gethostname parsers to a separate file.
22745	* hostname.c: New file.
22746	* Makefile.am (strace_SOURCES): Add it.
22747	* process.c (sys_sethostname, sys_gethostname): Move to hostname.c.
22748
22749	process.c: move exit parser to a separate file.
22750	* exit.c: New file.
22751	* Makefile.am (strace_SOURCES): Add it.
22752	* process.c (sys_exit): Move to exit.c.
22753
22754	process.c: move clone, setns, unshare, and fork parsers to a separate file
22755	* clone.c: New file.
22756	* Makefile.am (strace_SOURCES): Add it.
22757	* process.c: Move sys_clone, sys_setns, sys_unshare, sys_fork, and
22758	related code to clone.c.
22759
22760	process.c: move get*uid and set*uid parsers to a separate file.
22761	* uid.c: New file.
22762	* Makefile.am (strace_SOURCES): Add it.
22763	* process.c (sys_getuid, sys_setfsuid, sys_setuid, sys_getresuid,
22764	sys_setreuid, sys_setresuid): Move to uid.c.
22765
22766	process.c: move getgroups* and setgroups* parsers to a separate file.
22767	* groups.c: New file.
22768	* Makefile.am (strace_SOURCES): Add it.
22769	* process.c: Move sys_setgroups, sys_getgroups, sys_setgroups32,
22770	sys_getgroups32, and related code to groups.c.
22771
22772	process.c: move execve and execv parsers to a separate file.
22773	* execve.c: New file.
22774	* Makefile.am (strace_SOURCES): Add it.
22775	* process.c: Move sys_execve, sys_execv, and related code to execve.c.
22776
22777	process.c: move waitpid, wait4, osf_wait4, and waitid parsers to a separate file
22778	* wait.c: New file.
22779	* Makefile.am (strace_SOURCES): Add it.
22780	* process.c: Move sys_waitpid, sys_wait4, sys_osf_wait4, sys_waitid and
22781	related code to wait.c.
22782
22783	process.c: move uname parser to a separate file.
22784	* uname.c: New file.
22785	* Makefile.am (strace_SOURCES): Add it.
22786	* process.c (sys_uname): Move to uname.c.
22787
22788	process.c: move futex parser to a separate file.
22789	* futex.c: New file.
22790	* Makefile.am (strace_SOURCES): Add it.
22791	* process.c: Move sys_futex and related code to futex.c.
22792
22793	process.c: move get_robust_list parser to a separate file.
22794	* get_robust_list.c: New file.
22795	* Makefile.am (strace_SOURCES): Add it.
22796	* process.c (sys_get_robust_list): Move to get_robust_list.c.
22797
22798	process.c: move sched_* parsers to a separate file.
22799	* sched.c: New file.
22800	* Makefile.am (strace_SOURCES): Add it.
22801	* process.c: Move sys_sched_getscheduler, sys_sched_setscheduler,
22802	sys_sched_getparam, sys_sched_setparam, sys_sched_get_priority_min,
22803	sys_sched_rr_get_interval, and related code to sched.c.
22804
22805	process.c: move sched_setaffinity and sched_getaffinity parsers to a separate file
22806	* affinity.c: New file.
22807	* Makefile.am (strace_SOURCES): Add it.
22808	* process.c (sys_sched_setaffinity, sys_sched_getaffinity): Move
22809	to affinity.c.
22810
22811	process.c: move prctl and arch_prctl parsers to a separate file.
22812	* prctl.c: New file.
22813	* Makefile.am (strace_SOURCES): Add it.
22814	* process.c: Move sys_prctl, sys_arch_prctl, and related code to prctl.c.
22815
22816	process.c: move getcpu parser to a separate file.
22817	* getcpu.c: New file.
22818	* Makefile.am (strace_SOURCES): Add it.
22819	* process.c (sys_getcpu): Move to getcpu.c.
22820
22821	process.c: move process_vm_readv and process_vm_writev parsers to a separate file
22822	* process_vm.c: New file.
22823	* Makefile.am (strace_SOURCES): Add it.
22824	* process.c (sys_process_vm_readv, sys_process_vm_writev): Move
22825	to process_vm.c.
22826
22827	Implement decoding of fallocate FALLOC_FL_* flags.
22828	* xlat/falloc_flags.in: New file.
22829	* configure.ac (AC_CHECK_HEADERS): Add linux/falloc.h.
22830	* fallocate.c [HAVE_LINUX_FALLOC_H]: Include <linux/falloc.h>.
22831	Include xlat/falloc_flags.h.
22832	(sys_fallocate): Decode flags.
22833
22834	Fix decoding of renameat2 RENAME_* flags.
22835	* renameat.c: Include <linux/fs.h> where RENAME_NOREPLACE,
22836	RENAME_EXCHANGE, and RENAME_WHITEOUT are usually defined.
22837
22838	file.c: move open, openat, and creat parsers to a separate file.
22839	* open.c: New file.
22840	* Makefile.am (strace_SOURCES): Add it.
22841	* file.c: Move sys_open, sys_openat, sys_creat, and related code
22842	to open.c.
22843
22844	file.c: move access and faccessat parsers to a separate file.
22845	* access.c: New file.
22846	* Makefile.am (strace_SOURCES): Add it.
22847	* file.c: Move sys_access, sys_faccessat and related code to access.c.
22848
22849	file.c: move umask parser to a separate file.
22850	* umask.c: New file.
22851	* Makefile.am (strace_SOURCES): Add it.
22852	* file.c (sys_umask): Move to umask.c.
22853
22854	file.c: move lseek and llseek parsers to a separate file.
22855	* lseek.c: New file.
22856	* Makefile.am (strace_SOURCES): Add it.
22857	* file.c: Move sys_lseek, sys_llseek, and related code to lseek.c.
22858
22859	file.c: move readahead parser to a separate file.
22860	* readahead.c: New file.
22861	* Makefile.am (strace_SOURCES): Add it.
22862	* file.c (sys_readahead): Move to readahead.c.
22863
22864	file.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file
22865	* truncate.c: New file.
22866	* Makefile.am (strace_SOURCES): Add it.
22867	* file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64):
22868	Move to truncate.c.
22869
22870	file.c: move chdir parser to a separate file.
22871	* chdir.c: New file.
22872	* Makefile.am (strace_SOURCES): Add it.
22873	* file.c (sys_chdir): Move to chdir.c.
22874
22875	file.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file
22876	* link.c: New file.
22877	* Makefile.am (strace_SOURCES): Add it.
22878	* file.c: Move sys_link, sys_linkat, sys_unlinkat, sys_symlinkat, and
22879	related code to link.c.
22880
22881	file.c: move readlink and readlinkat parsers to a separate file.
22882	* readlink.c: New file.
22883	* Makefile.am (strace_SOURCES): Add it.
22884	* file.c (decode_readlink, sys_readlink, sys_readlinkat): Move
22885	to readlink.c.
22886
22887	file.c: move renameat and renameat2 parsers to a separate file.
22888	* renameat.c: New file.
22889	* Makefile.am (strace_SOURCES): Add it.
22890	* file.c: Move sys_renameat, sys_renameat2, and related code
22891	to renameat.c.
22892
22893	file.c: move chown, fchown, and fchownat parsers to a separate file.
22894	* chown.c: New file.
22895	* Makefile.am (strace_SOURCES): Add it.
22896	* file.c (sys_chown, sys_fchownat, sys_fchown): Move to chown.c.
22897
22898	Export at_flags.
22899	* defs.h (at_flags): New prototype.
22900
22901	file.c: move chmod, fchmod, and fchmodat parsers to a separate file.
22902	* chmod.c: New file.
22903	* Makefile.am (strace_SOURCES): Add it.
22904	* file.c (sys_chmod, sys_fchmodat, sys_fchmod): Move to chmod.c.
22905
22906	file.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file
22907	* utimes.c: New file.
22908	* Makefile.am (strace_SOURCES): Add it.
22909	* file.c (decode_utimes, sys_utimes, sys_futimesat, sys_utimensat,
22910	sys_osf_utimes): Move to utimes.c.
22911
22912	file.c: move utime parser to a separate file.
22913	* utime.c: New file.
22914	* Makefile.am (strace_SOURCES): Add it.
22915	* file.c (sys_utime): Move to utime.c.
22916
22917	Export sprinttime.
22918	* defs.h (sprinttime): New prototype.
22919	* file.c (sprinttime): Make global and move to util.c.
22920
22921	file.c: move mknod, mknodat, and xmknod parsers to a separate file.
22922	* mknod.c: New file.
22923	* Makefile.am (strace_SOURCES): Add it.
22924	* file.c: Move sys_mknod, sys_mknodat, sys_xmknod, and related code
22925	to mknod.c.
22926
22927	file.c: export sprintmode and move it to a separate file.
22928	* printmode.c: New file.
22929	* Makefile.am (strace_SOURCES): Add it.
22930	* defs.h (sprintmode): New prototype.
22931	* file.c (sprintmode): Make global and move to printmode.c.
22932
22933	file.c: move getcwd parser to a separate file.
22934	* getcwd.c: New file.
22935	* Makefile.am (strace_SOURCES): Add it.
22936	* file.c (sys_getcwd): Move to getcwd.c.
22937
22938	file.c: move *xattr parsers to a separate file.
22939	* xattr.c: New file.
22940	* Makefile.am (strace_SOURCES): Add it.
22941	* file.c: Move sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr,
22942	sys_listxattr, sys_flistxattr, sys_removexattr, sys_fremovexattr,
22943	and related code to xattr.c.
22944
22945	file.c: move fadvise64 and fadvise64_64 parsers to a separate file.
22946	* fadvise.c: New file.
22947	* Makefile.am (strace_SOURCES): Add it.
22948	* file.c: Move sys_fadvise64, sys_fadvise64_64, and related code
22949	to fadvise.c.
22950
22951	file.c: move sync_file_range and sync_file_range2 parsers to a separate file
22952	* sync_file_range.c: New file.
22953	* Makefile.am (strace_SOURCES): Add it.
22954	* file.c: Move sys_sync_file_range, sys_sync_file_range2, and related
22955	code to sync_file_range.c.
22956
22957	file.c: move fallocate parser to a separate file.
22958	* fallocate.c: New file.
22959	* Makefile.am (strace_SOURCES): Add it.
22960	* file.c (sys_fallocate): Move to fallocate.c.
22961
22962	file.c: move swapon parser to a separate file.
22963	* swapon.c: New file.
22964	* Makefile.am (strace_SOURCES): Add it.
22965	* file.c: Move sys_swapon and related code to swapon.c.
22966
229672014-12-06  Dmitry V. Levin  <ldv@altlinux.org>
22968
22969	Implement full decoding of 64-bit capabilities.
22970	Unlike v1 capabilities which are 32-bit, v2 and v3 are 64-bit, but
22971	before this change only lower 32 capability bits were decoded for
22972	v2 and v3.
22973
22974	* xlat/capabilities1.in: New file.
22975	* capability.c: Define v2/v3 CAP_* constants.
22976	Include xlat/capabilities1.h.
22977	(get_cap_header): New function.
22978	(print_cap_header): Update to use get_cap_header result.
22979	(print_cap_data): Decoder higher capability bits for v2 and v3.
22980	(sys_capget, sys_capset): Use get_cap_header, update print_cap_header
22981	and print_cap_data calls.
22982	* tests/caps.c: New file.
22983	* tests/caps.awk: New file.
22984	* tests/caps.test: New test.
22985	* tests/Makefile.am (CHECK_PROGRAMS): Add caps.
22986	(TESTS): Add caps.test.
22987	(EXTRA_DIST): Add caps.awk.
22988
229892014-12-06  Dmitry V. Levin  <ldv@altlinux.org>
22990
22991	Make parsers of capget and capset syscalls self-contained.
22992	Various versions of <linux/capability.h> used to require different
22993	workarounds to avoid conflicts with types defined by libc headers.
22994	Define all required types and constants locally to fix this issue.
22995
22996	* configure.ac (AC_CHECK_HEADERS): Remove linux/capability.h.
22997	* capability.c: Do not include <linux/capability.h>, remove workarounds
22998	for problematic versions of <linux/capability.h> file.
22999	Define CAP_* and _LINUX_CAPABILITY_VERSION_* constants as enums.
23000	(struct __user_cap_header_struct, struct __user_cap_data_struct): Define.
23001	* xlat/cap_version.in: Add #unconditional.
23002	* xlat/capabilities.in: Likewise.
23003
230042014-12-04  Dmitry V. Levin  <ldv@altlinux.org>
23005
23006	Remove system.c.
23007	All disjoint parts of system.c have been moved to separate files.
23008
23009	* system.c: Remove.
23010	* Makefile.am (strace_SOURCES): Remove it.
23011
230122014-12-04  Dmitry V. Levin  <ldv@altlinux.org>
23013
23014	Move mount parser to a separate file.
23015	* mount.c: New file.
23016	* Makefile.am (strace_SOURCES): Add it.
23017	* system.c: Move sys_mount and related code to mount.c.
23018
23019	Move umount2 parser to a separate file.
23020	* umount.c: New file.
23021	* Makefile.am (strace_SOURCES): Add it.
23022	* system.c: Move sys_umount2 and related code to umount.c.
23023
23024	Move personality parser to a separate file.
23025	* personality.c: New file.
23026	* Makefile.am (strace_SOURCES): Add it.
23027	* system.c: Move sys_personality and related code to personality.c.
23028
23029	Move syslog parser to a separate file.
23030	* syslog.c: New file.
23031	* Makefile.am (strace_SOURCES): Add it.
23032	* system.c: Move sys_syslog and related code to syslog.c.
23033
23034	Move cacheflush parser to a separate file.
23035	* cacheflush.c: New file.
23036	* Makefile.am (strace_SOURCES): Add it.
23037	* system.c: Move inclusion of <asm/cachectl.h> to cacheflush.c.
23038	[M68K, BFIN, SH]: Move to cacheflush.c.
23039
23040	bfin: move sram_alloc parser to a separate file.
23041	* sram_alloc.c: New file.
23042	* Makefile.am (strace_SOURCES): Add it.
23043	* system.c [BFIN]: Move sys_sram_alloc and related code to sram_alloc.c.
23044
23045	Move capget and capset parsers to a separate file.
23046	* capability.c: New file.
23047	* Makefile.am (strace_SOURCES): Add it.
23048	* system.c: Move inclusion of headers and macro definitions related
23049	to capget and capset decoding to capability.c.
23050	(print_cap_header, print_cap_data, sys_capget, sys_capset): Move
23051	to capability.c.
23052
230532014-12-03  Dmitry V. Levin  <ldv@altlinux.org>
23054
23055	Move sysctl parser to a separate file.
23056	* sysctl.c: New file.
23057	* Makefile.am (strace_SOURCES): Add it.
23058	* system.c: Move sys_sysctl and related code to sysctl.c.
23059
23060	mips: move sysmips parser to a separate file.
23061	* sysmips.c: New file.
23062	* Makefile.am (strace_SOURCES): Add it.
23063	* system.c: Fix typo in the check for <linux/utsname.h>.
23064	Move inclusions of <linux/utsname.h> and <asm/sysmips.h> to sysmips.c.
23065	[MIPS]: Likewise.
23066
23067	or1k: move or1k_atomic parser to a separate file.
23068	* or1k_atomic.c: New file.
23069	* Makefile.am (strace_SOURCES): Add it.
23070	* system.c [OR1K]: Move to or1k_atomic.c.
23071
230722014-12-02  Dmitry V. Levin  <ldv@altlinux.org>
23073
23074	Alias sys_setdomainname to sys_sethostname.
23075	Since parsers for setdomainname and sethostname syscalls are identical,
23076	replace sys_setdomainname with an alias to sys_sethostname.
23077
23078	* linux/dummy.h (sys_setdomainname): Alias to sys_sethostname.
23079	* linux/syscall.h (sys_setdomainname): Remove.
23080	* process.c (sys_setdomainname): Remove.
23081
230822014-12-02  Dmitry V. Levin  <ldv@altlinux.org>
23083
23084	Alias sys_getpeername to sys_getsockname.
23085	Since parsers for getpeername and getsockname syscalls are identical,
23086	replace sys_getpeername with an alias to sys_getsockname.
23087
23088	* linux/dummy.h (sys_getpeername): Alias to sys_getsockname.
23089	* linux/syscall.h (sys_getpeername): Remove.
23090	* net.c (sys_getpeername): Remove.
23091
230922014-12-02  Dmitry V. Levin  <ldv@altlinux.org>
23093
23094	Alias sys_stime to sys_time.
23095	Since parsers for stime and time syscalls are identical,
23096	replace sys_stime with an alias to sys_time.
23097
23098	* linux/dummy.h (sys_stime): Alias to sys_time.
23099	* linux/syscall.h (sys_stime): Remove.
23100	* time.c (sys_stime): Remove.
23101
231022014-12-02  Dmitry V. Levin  <ldv@altlinux.org>
23103
23104	Remove unused sys_mctl.
23105	Starting with commit v4.6-240-g5afdf12, nobody compiles this
23106	non-Linux code.
23107
23108	* mem.c [MC_SYNC]: Remove.
23109	* xlat/mctl_funcs.in: Remove.
23110	* xlat/mctl_lockas.in: Remove.
23111
231122014-12-01  Dmitry V. Levin  <ldv@altlinux.org>
23113
23114	Alias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat.
23115	Special parsers for mkdir and mkdirat are redundant because
23116	sys_chmod and sys_fchmodat implement the same decoding.
23117
23118	* file.c (decode_mkdir, sys_mkdir, sys_mkdirat): Remove.
23119	* linux/dummy.h (sys_mkdir): Alias to sys_chmod.
23120	(sys_mkdirat): Alias to sys_fchmodat.
23121	* linux/syscall.h (sys_mkdir, sys_mkdirat): Remove.
23122	* pathtrace.c (pathtrace_match): Do not check for sys_mkdirat.
23123
231242014-12-01  Dmitry V. Levin  <ldv@altlinux.org>
23125
23126	Remove unused <sys/acl.h> based code.
23127	Starting with commit v4.6-240-g5afdf12, nobody compiles this
23128	non-Linux code.
23129
23130	* configure.ac (AC_CHECK_HEADERS): Remove sys/acl.h.
23131	* file.c [HAVE_SYS_ACL_H]: Remove.
23132	* xlat/aclcmds.in: Remove.
23133
231342014-12-01  Dmitry V. Levin  <ldv@altlinux.org>
23135
23136	Remove unused <sys/asynch.h> based code.
23137	Starting with commit v4.6-240-g5afdf12, nobody compiles this
23138	non-Linux code.
23139
23140	* configure.ac (AC_CHECK_HEADERS): Remove sys/asynch.h.
23141	* file.c [HAVE_SYS_ASYNCH_H]: Remove.
23142
231432014-11-27  Masatake YAMATO  <yamato@redhat.com>
23144
23145	Print protocol name of socket descriptors with -yy option.
23146	For those socket descriptors that have no associated ip:port pairs
23147	(or when this information is not available), -yy option prints
23148	the same <socket:[INODE]> information as -y option, e.g.
23149
23150	$ strace -e sendto -yy ip l > /dev/null
23151	sendto(3<socket:[23456789]>, ...
23152
23153	This change makes -yy output more informative: instead of just
23154	printing "socket", the name of protocol behind the socket descriptor
23155	will be printed, e.g.
23156
23157	sendto(3<NETLINK:[23456789]>, ...
23158
23159	* configure.ac (AC_CHECK_HEADERS): Add sys/xattr.h.
23160	* tests/net-yy-accept.awk: Update to support protocol names.
23161	* tests/net-yy-connect.awk: Likewise.
23162	* util.c [HAVE_SYS_XATTR_H]: Include <sys/xattr.h>.
23163	(getfdproto): New function.
23164	(printfd): Use it.
23165
231662014-11-21  Dmitry V. Levin  <ldv@altlinux.org>
23167
23168	Replace MAXPATHLEN with PATH_MAX.
23169	MAXPATHLEN is defined to PATH_MAX, so replace the former with the latter.
23170
23171	* strace.c (startup_child): Replace MAXPATHLEN with PATH_MAX.
23172	* util.c (printpathn, printpath): Likewise.
23173
231742014-11-21  Mike Frysinger  <vapier@gentoo.org>
23175
23176	Decode FIFREEZE/FITHAW/FITRIM ioctls.
23177	The freeze/thaw ones are simple, but the trim is an interesting struct.
23178
23179	* block.c (block_ioctl): Handle FIFREEZE/FITHAW/FITRIM.
23180	* ioctl.c (ioctl_decode): Pass 'X' ioctls to block_ioctl.
23181
231822014-11-21  Dmitry V. Levin  <ldv@altlinux.org>
23183
23184	Include <sys/uio.h> unconditionally.
23185	Since <sys/uio.h> is standardized by POSIX and is present in all
23186	available versions of glibc, it's safe to assume that any usable
23187	libc implementation provides this header file.
23188
23189	* configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h.
23190	* io.c: Include <sys/uio.h> unconditionally.
23191	(tprint_iov_upto, tprint_iov, sys_readv, sys_writev,
23192	print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define
23193	unconditionally.
23194	* net.c: Include <sys/uio.h> unconditionally.
23195	* util.c: Include <sys/uio.h> unconditionally.
23196	(dumpiov): Define unconditionally.
23197
231982014-11-21  Dmitry V. Levin  <ldv@altlinux.org>
23199
23200	Consistently use C99 designated initializers in the new netlink code.
23201	* socketutils.c (send_query, receive_responses): Use designated
23202	initializers for sockaddr_nl, nlmsghdr, and inet_diag_req_v2 structures.
23203	* tests/netlink_inet_diag.c (send_query, check_responses): Likewise.
23204
232052014-11-20  Mike Frysinger  <vapier@gentoo.org>
23206
23207	Decode open's O_TMPFILE.
23208	* xlat/open_mode_flags.in: Add O_TMPFILE definition.
23209
232102014-11-11  Helge Deller  <deller@gmx.de>
23211
23212	hppa: update error codes and signal numbers.
23213	There are two important changes in here:
23214
23215	1. EWOULDBLOCK has been up to kernel 3.14 errorcode #246. Since hppa
23216	folks had problems with EWOULDBLOCK != EAGAIN, this was changed in
23217	kernel 3.14.
23218
23219	2. Starting with kernel 3.18, hppa folks changed some signal numbers in
23220	such a way that we end up with SIGRTMIN == 32, which brings hppa in sync
23221	with other linux ports.
23222
23223	Both were incompatible changes which basically broke hppa ABI, but since
23224	they have been merged into the kernel, we have to follow.
23225
232262014-11-11  Thomas De Schampheleire  <thomas.de.schampheleire@gmail.com>
23227
23228	stack trace support: fix check on symbol name presence.
23229	The output format of the stack trace is supposed to be different
23230	depending on whether symbol names are available in the build.
23231
23232	However, the check only verified the validity of the pointer, not of the
23233	string pointed to (which could be empty).
23234
23235	This commit fixes the check so that the original output:
23236
23237	mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
23238	 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
23239	 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
23240	 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
23241	 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
23242	 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
23243	 > /bin/busybox(+0x0) [0x62c60]
23244	 > /bin/busybox(+0x0) [0x4940]
23245	 > /bin/busybox(+0x0) [0x499c]
23246	 > /bin/busybox(+0x0) [0x4e08]
23247	 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
23248	 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]
23249
23250	becomes:
23251
23252	mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
23253	 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
23254	 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
23255	 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
23256	 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
23257	 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
23258	 > /bin/busybox() [0x62c60]
23259	 > /bin/busybox() [0x4940]
23260	 > /bin/busybox() [0x499c]
23261	 > /bin/busybox() [0x4e08]
23262	 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
23263	 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]
23264
23265	Acked-by: Masatake YAMATO <yamato@redhat.com>
23266
232672014-11-11  Masatake YAMATO  <yamato@redhat.com>
23268
23269	tests: add a test for decoding and dumping of recvmmsg/sendmmsg.
23270	* configure (AC_CHECK_FUNCS): Add sendmmsg.
23271	* tests/mmsg.c: New file.
23272	* tests/mmsg.expected: New file.
23273	* tests/mmsg.test: New test.
23274	* tests/.gitignore: Add mmsg.
23275	* tests/Makefile.am (CHECK_PROGRAMS): Add mmsg.
23276	(TESTS): Add mmsg.test.
23277	(EXTRA_DIST): Add mmsg.expected.
23278
232792014-11-11  Masatake YAMATO  <yamato@redhat.com>
23280
23281	Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg
23282	This patch is similar to what I did in commit
23283	02f9f6b386741a52f58e1b31ad4e7fff60781ef8.
23284	That commit was for sendmsg and recvmsg system calls.
23285	This one is for sendmmsg and recvmmsg system calls.
23286
23287	* defs.h (dumpiov_in_mmsghdr): New declaration.
23288	* net.c (extractmmsghdr): New function derived from printmmsghdr.
23289	(printmmsghdr): Use it.
23290	(dumpiov_in_mmsghdr): New function.
23291	* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_mmsghdr
23292	for recvmmsg and sendmmsg syscalls.
23293
232942014-11-11  Masatake YAMATO  <yamato@redhat.com>
23295
23296	Use the definition of struct mmsghdr if it is defined in build environment
23297	mmsghrd structure type is defined locally in printmmsghdr function.
23298
23299	However, more functions will refer the definition in modifications for
23300	supporting "-e write=set" and "-e read=set" option for sendmmsg and
23301	recvmmsg system calls.
23302
23303	After this change, the system definition of struct mmsghdr will be used
23304	if configure reports it is available, falling back to the old local
23305	definition.
23306
23307	* configure.ac (AC_CHECK_TYPES): Add struct mmsghdr.
23308	* net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
23309	(printmmsghdr): Use previously defined struct mmsghdr.
23310
233112014-11-11  Masatake YAMATO  <yamato@redhat.com>
23312
23313	Introduce a separate function to copy from msghdr32 to msghdr.
23314	This patch is an initial step for supporting "-e write=set" and
23315	"-e read=set" option for sendmmsg and recvmmsg system calls.
23316
23317	Coverting a data of msghdr32 to msghdr is needed both for
23318	{send,recv}msg and {send,recv}mmsg to decode parameters.
23319	To share the copying code in both decoders, a separate
23320	function named copy_from_msghdr32 is introduced.
23321
23322	* net.c [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]
23323	(copy_from_msghdr32): New function.
23324	(extractmsghdr) [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]: Use it.
23325
233262014-11-11  Dmitry V. Levin  <ldv@altlinux.org>
23327
23328	ioctlsort: rewrite build rules using noinst_PROGRAMS.
23329	* linux/ioctlsort.c: Rename to ioctlsort.c
23330	* Makefile.am (EXTRA_DIST): Rename linux/ioctlsort.c to ioctlsort.c.
23331	[MAINTAINER_MODE] (noinst_PROGRAMS): Add ioctlsort.
23332	(ioctlsort_SOURCES): Add ioctlsort.c.
23333	(nodist_ioctlsort_SOURCES): Add ioctls.h and ioctldefs.h.
23334	(CLEANFILES): Add $(nodist_ioctlsort_SOURCES).
23335	(ioctlsort.$(OBJEXT)): Likewise.
23336	(ioctlsort): Remove.
23337
233382014-11-11  Lubomir Rintel  <lkundrak@v3.sk>
23339
23340	Makefile.am: look for ioctl definitions in the kernel build tree by default
23341	While most of ioctl-related kernel headers are now exported by kernel's
23342	headers_install, some are still modules_install only.  The kernel's
23343	headers installed into /usr/include/ are usually headers_install'ed and
23344	therefore don't contain some internal headers we need.  The solution is
23345	to look for modules_install'ed headers for the running kernel, and fall
23346	back to old behavior if they aren't found.
23347
233482014-11-04  Lubomir Rintel  <lkundrak@v3.sk>
23349
23350	Dump details for Bluetooth socket operations.
23351	* configure.ac (AC_CHECK_HEADERS): Add bluetooth/bluetooth.h.
23352	* xlat/bt_protocols.in: New file.
23353	* net.c [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include bluetooth
23354	headers.
23355	[PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
23356	(printsock) [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Dump details
23357	for AF_BLUETOOTH sockets.
23358	(sys_socket) [PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Decode
23359	protocol for PF_BLUETOOTH sockets.
23360
233612014-11-04  Philippe De Muyter  <phdm@macqel.be>
23362
23363	Implement Video4Linux video-input ioctls decoder.
23364	Introduce v4l2.c, a decoder for the arguments of the video-input subset
23365	of the v4l2 ioctl's.  This is a combination of
23366	- previous work by Peter Zotov <whitequark@whitequark.org>, found at
23367	https://gist.githubusercontent.com/whitequark/1263207/raw/strace-4.6-v4l2-ioctls.patch
23368	- previous work by William Manley <will@williammanley.net>, found at
23369	http://marc.info/?l=strace&m=139395588520675
23370	- forward port, additions and fixes by Philippe De Muyter <phdm@macqel.be>
23371
23372	As v4l2 is a moving target, I have made v4l2.c compilable with ancient
23373	linux kernels by testing the availability of some macros.  It has been
23374	succesfully compiled on linux 3.10, 3.1, 2.6.31 and 2.6.22, and
23375	succesfully used on linux 3.10 with a camera device.
23376
23377	* configure.ac: Check for availabilty of V4L2_* enum constants.
23378	* Makefile.am (strace_SOURCES): Add v4l2.c.
23379	* defs.h (v4l2_ioctl): New prototype.
23380	* ioctl.c (ioctl_decode): Use v4l2_ioctl.
23381	* v4l2.c: New file.
23382	* xlat/v4l2_*.in: New files.
23383
23384	Cc: Peter Zotov <whitequark@whitequark.org>
23385	Cc: William Manley <will@williammanley.net>
23386
233872014-11-04  Dmitry V. Levin  <ldv@altlinux.org>
23388
23389	Update ioctl entries.
23390	* linux/ioctlent.h.in: Regenerate from v3.17 headers.
23391
23392	Remove ioctl header file names from the executable.
23393	* defs.h (struct ioctlent): Remove "doth" field.
23394	* Makefile.am ($(ioctlent_h)): Remove 1st field.
23395
233962014-11-04  Dmitry V. Levin  <ldv@altlinux.org>
23397
23398	Filter out redundant ioctl entries early.
23399	For two ioctl entries with the same code, if one's name is a prefix
23400	to another's name, keep the entry with a shorter name.  Filter out
23401	redundant ioctl entries at ioctlsort stage so that distributed
23402	ioctlent.h.in files will be already filtered.
23403
23404	* linux/ioctlsort.c (is_not_prefix): New function.
23405	(main): Use it.
23406	* linux/ioctlent-filter.awk: Remove.
23407	* Makefile.am (EXTRA_DIST): Remove linux/ioctlent-filter.awk.
23408	($(ioctlent_h)): Don't use linux/ioctlent-filter.awk.
23409
234102014-11-03  Dmitry V. Levin  <ldv@altlinux.org>
23411
23412	ioctlent.sh: update the list of directories exported by headers_install.
23413	* linux/ioctlent.sh: Add drm, mtd, rdma, video, and xen directories.
23414
234152014-11-01  Masatake YAMATO  <yamato@redhat.com>
23416
23417	Add a function for dumping iovec in msghdr used in sendmsg and recvmsg.
23418	Here is an example session:
23419
23420	    $ ./strace -e write=all ip link change dev enp0s25 mtu 1501 > /dev/null
23421	    sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"(...
23422	     * 40 bytes in buffer 0
23423	     | 00000  28 00 00 00 10 00 05 00  d0 d9 aa 53 00 00 00 00  (..........S.... |
23424	     | 00010  00 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  ................ |
23425	     | 00020  08 00 04 00 dd 05 00 00                           ........         |
23426	    ...
23427
23428	    $ ./strace -e read=all ip link show > /dev/null
23429	    recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"...
23430	     * 8192 bytes in buffer 0
23431	     | 00000  34 00 00 00 02 00 00 00  00 00 00 00 ff 23 00 00  4............#.. |
23432	     | 00010  ff ff ff ff 20 00 00 00  10 00 05 00 00 00 00 00  .... ........... |
23433	    ...
23434
23435	* defs.h (dumpiov_in_msghdr): New prototype.
23436	* net.c (extractmsghdr): New function derived from printmsghdr.
23437	(printmsghdr): Use extractmsghdr.
23438	(dumpiov_in_msghdr): New function.
23439	* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_msghdr for recvmsg
23440	and sendmsg syscalls.
23441
234422014-10-31  Maarten ter Huurne  <maarten@treewalker.org>
23443
23444	Include <linux/ptrace.h> regardless of <sys/reg.h> existence.
23445	This fixes compilation with musl libc.
23446	This approach was already used in process.c, so I assume it is safe.
23447
23448	* signal.c: Move [HAVE_LINUX_PTRACE_H] code out of [HAVE_SYS_REG_H] check.
23449	* syscall.c: Likewise.
23450	* util.c: Likewise.
23451
234522014-10-31  Dmitry V. Levin  <ldv@altlinux.org>
23453
23454	sock: decode SIOCSIFNAME on entering syscall.
23455	* sock.c (sock_ioctl): Handle SIOCSIFNAME on entering syscall.
23456
234572014-10-31  Mike Frysinger  <vapier@gentoo.org>
23458
23459	sock: fix decoding of SIOCSIFNAME.
23460	The decoding of SIOCSIFNAME is incorrect.  It does not use
23461	the ifr_index field to look things up, but ifr_newname.
23462
23463	* sock.c (sock_ioctl): Split out SIOCSIFNAME from SIOCGIFNAME and
23464	display ifr_newname.
23465
234662014-10-31  Mike Frysinger  <vapier@gentoo.org>
23467
23468	sock: fix decoding of struct ifreq.ifr_name.
23469	The ifr name fields of the ifreq structure might not be NUL terminated.
23470	If the user makes an ioctl call where they aren't, then strace ends up
23471	reading random content from its own stack.  Limit the printf lengths.
23472
23473	* sock.c (sock_ioctl): Add explicit length limits to ifr_name printfs.
23474
234752014-10-03  Elliott Hughes  <enh@google.com>
23476
23477	Don't risk truncating open flags by using mode_t.
23478	On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
23479	as their mode_t.  The open(2) flags are actually an int, so high ones
23480	like O_CLOEXEC get truncated if you coerce them to mode_t.
23481
23482	* defs.h (tprint_open_modes, sprint_open_modes): Change argument type
23483	from mode_t to int.
23484	* file.c (tprint_open_modes, sprint_open_modes): Likewise.
23485
234862014-09-29  Dmitry V. Levin  <ldv@altlinux.org>
23487
23488	Enhance sysinfo decoding.
23489	* configure.ac (AC_CHECK_MEMBERS): Check for struct sysinfo.totalhigh,
23490	struct sysinfo.freehigh, and struct sysinfo.mem_unit.
23491	* sysinfo.c (sys_sysinfo): Treat failed umove() call as syserror().
23492	Print totalhigh, freehigh, and mem_unit members when struct sysinfo
23493	supports them.
23494
23495	Move sysinfo parser to a separate file.
23496	* sysinfo.c: New file.
23497	* Makefile.am (strace_SOURCES): Add it.
23498	* resource.c (sys_sysinfo): Move to sysinfo.c.
23499
235002014-09-29  Dmitry V. Levin  <ldv@altlinux.org>
23501
23502	Fix build with musl libc.
23503	* resource.c: Include <sys/sysinfo.h> for struct sysinfo definition.
23504
23505	Reported-by: Steven Honeyman <stevenhoneyman@gmail.com>
23506
235072014-09-23  Dmitry V. Levin  <ldv@altlinux.org>
23508
23509	tests: cleanup checks for basic programs.
23510	* tests/init.sh: Check for cat and rm.
23511	* tests/getdents.test: Check for awk.
23512	* tests/ptrace_setoptions.test: Check for grep.
23513	* tests/net-fd.test: Do not check for rm.
23514	* tests/net.test: Likewise.
23515	* tests/scm_rights-fd.test: Likewise.
23516	* tests/stat.test: Likewise.
23517	* tests/uio.test: Likewise.
23518
23519	tests: add a test for -yy option.
23520	* tests/net-yy.test: New test.
23521	* tests/inet-accept-connect-send-recv.c: New file.
23522	* tests/netlink_inet_diag.c: Likewise.
23523	* tests/net-yy-accept.awk: Likewise.
23524	* tests/net-yy-connect.awk: Likewise.
23525	* tests/.gitignore: Add inet-accept-connect-send-recv,
23526	netlink_inet_diag, *.tmp-*, and *.tmp.*.
23527	* tests/Makefile.am (check_PROGRAMS): Add inet-accept-connect-send-recv
23528	and netlink_inet_diag.
23529	(TESTS): Add net-yy.test.
23530	(EXTRA_DIST): Add net-yy-accept.awk and net-yy-connect.awk.
23531
235322014-09-22  Dmitry V. Levin  <ldv@altlinux.org>
23533
23534	Move statfs related parsers to a separate file.
23535	* statfs.c: New file.
23536	* Makefile.am (strace_SOURCES): Add it.
23537	* file.c (sprintfstype, printstatfs, sys_statfs, sys_fstatfs): Move
23538	to statfs.c.
23539	[HAVE_STATFS64] (printstatfs64, printcompat_statfs64, sys_statfs64,
23540	sys_fstatfs64): Likewise.
23541	[ALPHA] (osf_statfs, osf_fstatfs): Likewise.
23542
23543	fsmagic: sort array by value and use bsearch for faster lookup.
23544	* defs.h (xlat_search): New prototype.
23545	* util.c (xlat_bsearch_compare, xlat_search): New functions.
23546	* file.c (sprintfstype): Use xlat_search for fsmagic lookup.
23547	* xlat/fsmagic.in: Sort by value and mark as not NULL-terminated.
23548	* tests/statfs.c: New file.
23549	* tests/statfs.test: New test.
23550	* tests/Makefile.am (check_PROGRAMS): Add statfs.
23551	(statfs_CFLAGS): Define.
23552	(TESTS): Add statfs.test.
23553	* tests/.gitignore: Add statfs.
23554
235552014-09-21  Dmitry V. Levin  <ldv@altlinux.org>
23556
23557	fsmagic: update from <linux/magic.h>
23558	* xlat/fsmagic.in: Add new constants from <linux/magic.h>.
23559	Reported by Elliott Hughes.
23560
235612014-09-17  Dmitry V. Levin  <ldv@altlinux.org>
23562
23563	Add -yy option: print ip and port associated with socket descriptors.
23564	When two ore more -y options are given, print local and remote ip:port
23565	pairs associated with socket descriptors.  This implementation uses
23566	NETLINK_INET_DIAG for sockaddr lookup; it's based on the patch
23567	prepared by Zubin Mithra as a part of his GSoC 2014 strace project.
23568
23569	* Makefile.am (strace_SOURCES): Add socketutils.c
23570	(EXTRA_DIST): Add linux/inet_diag.h and linux/sock_diag.h.
23571	* defs.h (print_sockaddr_by_inode): New prototype.
23572	* linux/inet_diag.h: New file.
23573	* linux/sock_diag.h: Likewise.
23574	* socketutils.c: Likewise.
23575	* strace.1: Document -yy option.
23576	* strace.c (usage): Likewise.
23577	* util.c (printfd): Use print_sockaddr_by_inode.
23578
235792014-09-17  Vicente Olivert Riera  <vincent@gentoo.org>
23580
23581	sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently.
23582	Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
23583	consistent with their use.
23584	If an architecture does not provide sa_restorer members but still
23585	defines SA_RESTORER macro, the latter has to be explicitly undefined.
23586
23587	This change fixes compilation failures like this one:
23588	signal.c: In function 'decode_old_sigaction':
23589	signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
23590	signal.c: In function 'decode_new_sigaction':
23591	signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'
23592
23593	* signal.c (struct old_sigaction, struct old_sigaction32,
23594	struct new_sigaction, struct new_sigaction32):
23595	Wrap sa_restorer member in #ifdef SA_RESTORER.
23596	(decode_old_sigaction, decode_new_sigaction):
23597	Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.
23598
235992014-09-17  Dmitry V. Levin  <ldv@altlinux.org>
23600
23601	Fix compilation warnings reported by gcc -Wsign-compare.
23602	* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
23603	* defs.h (struct tcb): Change 'currpers' type to unsigned.
23604	(struct xlat): Change 'val' type to unsigned
23605	(signame): Add 'const' qualifier to its argument.
23606	(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
23607	change its type to unsigned.
23608	(printpathn): Change the 3rd argument type to unsigned.
23609	(ioctl_lookup): Change 1st argument type to unsigned.
23610	* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
23611	* file.c (print_xattr_list): Fix comparisons between signed and unsigned
23612	long values.
23613	* ioctl.c (compare): Fix cast.
23614	(ioctl_lookup): Change 1st argument type to to unsigned.
23615	(ioctl_next_match): Change 'code' type to unsigned.
23616	* mem.c (sys_move_pages): Change 'i' type to unsigned.
23617	* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
23618	Print 'i' using %u format string.
23619	* process.c (sys_prctl): Change 'i' type to unsigned.
23620	(printargv): Change 'n' type to unsigned.
23621	(sys_ptrace): Change 'addr' type to unsigned.
23622	* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
23623	and change its type to unsigned.  Change 'i' and 'allocated' types
23624	to unsigned.
23625	* signal.c (signame): Add 'const' qualifier to its argument.
23626	Fix comparisons between signed and unsigned values.
23627	(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
23628	unsigned values.
23629	* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
23630	* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
23631	(detach): Change 'sig' type to unsigned.
23632	(startup_attach): Change 'tcbi' type to unsigned.
23633	(startup_child): Change 'm', 'n', and 'len' types to unsigned.
23634	(init): Use new variable to iterate 'tcbtab'.
23635	(pid2tcb): Change 'i' type to unsigned.
23636	(cleanup): Change 'i' and 'sig' types to unsigned.
23637	* syscall.c (update_personality): Change 'personality' argument type
23638	to unsigned.
23639	(struct qual_options): Change 'bitflag' type to unsigned.
23640	(reallocate_qual): Add 'const' qualifier to its argument and change its
23641	type to unsigned.
23642	(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
23643	Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
23644	Change 'p' type to signed int.
23645	(qual_syscall): Change 'bitflag' argument type to unsigned.
23646	Add 'const' qualifier to 'bitflag' and 'not' arguments.
23647	Change 'p' type to signed int.
23648	(qual_signal): Change 'bitflag' argument type to unsigned.
23649	Add 'const' qualifier to 'bitflag' and 'not' arguments.
23650	Change 'i' type to unsigned.
23651	(qual_desc): Change 'bitflag' argument type to unsigned.
23652	Add 'const' qualifier to 'bitflag' and 'not' arguments.
23653	(qualify): Change 'i' type to unsigned.
23654	(get_scno): Change 'currpers' type to unsigned.
23655	Fix a comparison between signed and unsigned values.
23656	* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
23657	Fix comparisons between signed and unsigned values.
23658	* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
23659	and change its type to unsigned.
23660	(printuid): Fix a comparison between signed and unsigned values.
23661	(printpathn): Change 'n' argument type to unsigned.
23662	(printstr): Change 'size' type to unsigned.
23663	Fix a comparison between signed and unsigned values.
23664	(setbpt): Change 'i' type to unsigned.
23665	* net.c (printsock): Silence a compilation warning.
23666	* reboot.c (sys_reboot): Likewise.
23667
236682014-09-11  Dmitry V. Levin  <ldv@altlinux.org>
23669
23670	Move dirent related parsers to a separate file.
23671	* dirent.c: New file.
23672	* Makefile.am (strace_SOURCES): Add it.
23673	* file.c (print_old_dirent, sys_readdir, sys_getdents, sys_getdents64):
23674	Move to dirent.c.
23675
23676	getdents, getdents64: fix potential out-of-bounds read issues.
23677	* file.c (sys_getdents): Check for invalid d_reclen.
23678	Avoid reading from uninitialized memory.
23679	(sys_getdents64): Likewise.
23680	* tests/getdents.awk: New file.
23681	* tests/getdents.test: New test.
23682	* tests/Makefile.am (TESTS): Add it.
23683	(EXTRA_DIST): Add getdents.awk.
23684
236852014-09-10  Dmitry V. Levin  <ldv@altlinux.org>
23686
23687	tprint_sock_type: remove unused parameter.
23688	* net.c (tprint_sock_type): Remove unused parameter 'tcp'.
23689	(sys_socket, sys_socketpair): Update callers.
23690
23691	printsock: fix decoding of unrecognized AF_PACKET packet types.
23692	* net.c (printsock): Fix fallback string for AF_PACKET packet types.
23693
236942014-09-09  Dmitry V. Levin  <ldv@altlinux.org>
23695
23696	decode_select: fix potential use of an uninitialized variable.
23697	A pointer to fd_set was used uninitialized when nfds == 0.
23698
23699	* desc.c (decode_select): Initialize fds.
23700
23701	Reported-by: Zubin Mithra <zubin.mithra@gmail.com>
23702
237032014-09-08  Dmitry V. Levin  <ldv@altlinux.org>
23704
23705	Use external libaio.h.
23706	Stop using an outdated partial copy of libaio.h, switch back to external
23707	libaio.h from libaio.
23708	This partially reverts commit 2df03c494eb3c36c4178eba35c374831031d1a58.
23709
23710	* aio.c: Drop a partial copy of libaio.h, include <libaio.h> instead.
23711	(print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
23712	(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
23713	HAVE_DECL_IO_CMD_PWRITEV.
23714	* configure.ac: Check for libaio.h and declaration it provides.
23715
237162014-08-19  Dmitry V. Levin  <ldv@altlinux.org>
23717
23718	maint: post-release administrivia.
23719	* NEWS: Add header line for next release.
23720
237212014-08-15  Dmitry V. Levin  <ldv@altlinux.org>
23722
23723	Prepare for 4.9 release.
23724	* NEWS: Update for 4.9 release.
23725	* debian/changelog: 4.9-1.
23726	* strace.spec: 4.9-1.
23727
23728	Sync strace.spec and debian/ with packages.
23729	* debian/changelog: Sync with 4.8-1.1.
23730	* debian/control: Likewise.
23731	* debian/rules: Likewise.
23732	* strace.spec: Sync with 4.8-5.
23733
23734	NEWS: Update for 4.9 release.
23735
237362014-08-15  Mike Frysinger  <vapier@gentoo.org>
23737
23738	Update syscall tables to the point where they include renameat2.
23739	* linux/dummy.h: Add printargs aliases for sys_sched_getattr and
23740	sys_sched_setattr.
23741	* linux/aarch64/syscallent1.h: Add kcmp/finit_module/sched_setattr/
23742	sched_getattr/renameat2.
23743	* linux/alpha/syscallent.h: Add kcmp/finit_module.
23744	* linux/arm/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
23745	* linux/hppa/syscallent.h: Add sched_setattr/sched_getattr/utimes/renameat2.
23746	* linux/i386/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
23747	* linux/ia64/syscallent.h: Likewise.
23748	* linux/m68k/syscallent.h: Likewise.
23749	* linux/microblaze/syscallent.h: Likewise.
23750	* linux/mips/syscallent-n32.h: Likewise.
23751	* linux/mips/syscallent-n64.h: Add getdents64/sched_setattr/sched_getattr/
23752	renameat2.
23753	* linux/mips/syscallent-o32.h: Add sched_setattr/sched_getattr/renameat2.
23754	* linux/powerpc/syscallent.h: Fix finit_module/kcmp order.  Add sched_setattr/
23755	sched_getattr/renameat2.
23756	* linux/s390/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
23757	* linux/s390x/syscallent.h: Likewise.
23758	* linux/sparc/syscallent.h: Likewise.
23759	* linux/x32/syscallent.h: Likewise.
23760	* linux/x86_64/syscallent.h: Likewise.
23761	* linux/xtensa/syscallent.h: Add sched_setattr/sched_getattr.
23762
23763	renameat2: add decoding support.
23764	* file.c (decode_renameat, sys_renameat2): New functions.
23765	(sys_renameat): Use decode_renameat.
23766	* pathtrace.c (pathtrace_match): Handle sys_renameat2.
23767	* linux/syscall.h (sys_renameat2): New prototype.
23768	* xlat/rename_flags.in: New file.
23769
237702014-08-14  Mike Frysinger  <vapier@gentoo.org>
23771
23772	CREDITS: fix generation in out of tree builds.
23773	The {...} code changes the working dir with `cd`, but the commands outside
23774	of that block expects to be in the original dir.  Change to a subshell so
23775	the path outside of this block remains unchanged.
23776
23777	* Makefile.am ($(srcdir)/CREDITS): Change {...} to (...).
23778
237792014-08-14  Mike Frysinger  <vapier@gentoo.org>
23780
23781	ia64: add missing syscalls.
23782	When the preadv/pwritev syscalls were added, the ones before it in the
23783	ia64 list were missed, so all the syscalls there and later were not in
23784	the right location (causing things to be decoded incorrectly).
23785
23786	Add the missing syscalls before preadv which also re-aligns all the
23787	syscalls after that point.  This fixes the uio.test.
23788
23789	* linux/ia64/syscallent.h: Add syscalls 1310 through 1318.
23790
237912014-08-14  Mike Frysinger  <vapier@gentoo.org>
23792
23793	ia64: fix sigaction decoding.
23794	Looks like ia64 doesn't have sa_restorer either, yet still defines
23795	SA_RESTORER.  Deploy the same trick that HPPA is using to make the
23796	test pass.
23797
23798	* signal.c (SA_RESTORER): Undefine when IA64 is defined.
23799	(struct new_sigaction) [IA64]: Disable sa_restorer.
23800
238012014-08-12  Dmitry V. Levin  <ldv@altlinux.org>
23802
23803	tests: skip detach-stopped.test when PTRACE_SEIZE doesn't work.
23804	detach-stopped.test is known to fail when PTRACE_SEIZE is not available,
23805	so skip the test in that case.
23806
23807	* tests/detach-stopped.test: Check for "strace -d" output and skip the
23808	test when it says that PTRACE_SEIZE doesn't work.
23809
238102014-08-11  Erik Johansson  <erik@ejohansson.se>
23811
23812	sh: fix syscall numbering for recv and sendto.
23813	* linux/sh/syscallent.h: Swap recv and sendto syscall entries.
23814
238152014-08-11  Mike Frysinger  <vapier@gentoo.org>
23816
23817	tests: fix uio building w/out preadv/pwritev.
23818	The preadv/pwritev symbols weren't added to glibc until the 2.10 release,
23819	so trying to build the uio test leads to link failures.  Add configure
23820	tests and update uio.test to handle this.
23821
23822	* configure.ac (AC_CHECK_FUNCS): Add preadv/pwritev.
23823	* tests/uio.c: Include config.h.
23824	(main): Check for HAVE_PREADV and HAVE_PWRITEV.
23825	* tests/uio.test: Check exit status of uio helper.
23826
238272014-08-11  Mike Frysinger  <vapier@gentoo.org>
23828
23829	tests: ignore *.tmp files.
23830	The tests like to generate random .tmp files, so ignore them.
23831
23832	* tests/.gitignore: Add *.tmp.
23833
238342014-08-11  Mike Frysinger  <vapier@gentoo.org>
23835
23836	tests: fix shell errors in detach tests.
23837	The current detach test code does:
23838		set -e
23839		...
23840		cleanup() {
23841			set +e
23842			kill ...
23843			wait ...
23844		}
23845		...
23846		cleanup
23847		exit 0
23848
23849	The problem is that while `set -e` is disabled for the body of the
23850	cleanup function, it isn't necessarily disabled in the caller scope.
23851	So if the return value of the cleanup function (`wait` in this case)
23852	is non-zero, the script ends up failing overall.
23853
23854	Add an explicit return 0 to the cleanup function so that we don't kill
23855	the overall test pipeline.
23856
23857	* tests/detach-running.test (cleanup): Add return 0.
23858	* tests/detach-sleeping.test (cleanup): Likewise.
23859	* tests/detach-stopped.test (cleanup): Likewise.
23860
238612014-08-11  Mike Frysinger  <vapier@gentoo.org>
23862
23863	set_ptracer_any: add a little documentation.
23864	This way I don't have to keep reading up on these options and wondering
23865	why the code isn't aborting when the call fails.
23866
23867	* tests/set_ptracer_any.c (main): Note prctl failures are ok.
23868
238692014-08-10  Mike Frysinger  <vapier@gentoo.org>
23870
23871	signal: fix thinko in sa_restorer.
23872	Previous commit here re-added the bugs trying to be fixed due to a
23873	logic thinko.  The patches were tested in isolation and hand merged
23874	later.  Oops.
23875
23876	* signal.c (struct new_sigaction): Change || to &&.
23877
238782014-08-09  Mike Frysinger  <vapier@gentoo.org>
23879
23880	sigaction test: support arches w/out SA_RESTORER and swapped args.
23881	Running Linux 3.15 (sparc64) and glibc 2.17 (sparc32) triggers a
23882	rt_sigaction call that does not use SA_RESTORER and has an order
23883	where it inserts a restorer and a size.  The current tests don't
23884	support that ordering, so add another regex.
23885
23886	* tests/sigaction.awk: Support no SA_RESTORER and swapped args.
23887
238882014-08-09  Mike Frysinger  <vapier@gentoo.org>
23889
23890	alpha/sparc: fix arg count for rt_sigaction.
23891	Both these arches have a rt_sigaction syscall that takes 5 args, not 4.
23892
23893	* linux/alpha/syscallent.h (rt_sigaction): Change nargs to 5.
23894	* linux/sparc/syscallent.h (rt_sigaction): Change nargs to 5.
23895
238962014-08-09  Mike Frysinger  <vapier@gentoo.org>
23897
23898	hppa: fix sigaction decoding.
23899	Since the rt_sigaction syscall on hppa doesn't have a sa_restorer,
23900	do not include it in the kernel struct.
23901
23902	We also have to undefine SA_RESTORER so that code doesn't try to
23903	use it.  The headers will export this, but the syscall doesn't
23904	actually respect it.
23905
23906	* signal.c (SA_RESTORER): Undefine when HPPA is defined.
23907	(struct new_sigaction): Disable sa_restorer on hppa.
23908
239092014-08-09  Mike Frysinger  <vapier@gentoo.org>
23910
23911	alpha: fix sigaction decoding.
23912	Since the rt_sigaction syscall on alpha doesn't have a sa_restorer,
23913	do not include it in the kernel struct.
23914
23915	* signal.c (struct new_sigaction): Disable sa_restorer on alpha.
23916
239172014-08-08  Dmitry V. Levin  <ldv@altlinux.org>
23918
23919	Prepare for -yy option support.
23920	* defs.h (show_fd_path): Change type to unsigned int.
23921	* strace.c (show_fd_path): Likewise.
23922	(init): Handle repeated -y option.
23923
239242014-08-07  Dmitry V. Levin  <ldv@altlinux.org>
23925
23926	Fix preadv/pwritev offset decoding on ILP32 architectures.
23927	This fixes regression introduced by the previous commit.
23928
23929	* io.c (print_llu_from_low_high_val) [SIZEOF_LONG != SIZEOF_LONG_LONG]:
23930	Cast argument to unsigned long before casting it to unsigned long long.
23931
239322014-08-07  Dmitry V. Levin  <ldv@altlinux.org>
23933
23934	Fix preadv/pwritev offset decoding on bigendian architectures.
23935	This partially reverts commit 7845a42b39e59e904d01e75e21f7bc7eb6462560.
23936
23937	* util.c (printllval): Remove align argument.
23938	* defs.h (printllval): Update prototype.
23939	(printllval_aligned, printllval_unaligned): Remove.
23940	* file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64,
23941	sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2,
23942	sys_fallocate): Replace printllval_aligned call with printllval.
23943	* io.c (sys_pread, sys_pwrite): Likewise.
23944	(print_llu_from_low_high_val): New function.
23945	(sys_preadv, sys_pwritev): Use it instead of printllval_unaligned.
23946
239472014-08-06  Dmitry V. Levin  <ldv@altlinux.org>
23948
23949	Decode file descriptors returned by accept and accept4 syscalls.
23950	* net.c (do_accept): Rename to do_sockname.
23951	(sys_accept, sys_accept4): Update callers, return RVAL_FD.
23952	(sys_getsockname, sys_getpeername): Call do_sockname directly.
23953	* tests/net-fd.test: Update.
23954
239552014-08-01  Mike Frysinger  <vapier@gentoo.org>
23956
23957	x32: update io_{setup,submit} syscalls.
23958	Starting in 3.16, these two syscalls have gotten their own entry
23959	point for x32.  See linux 7fd44dacdd803c0bbf38bf478d51d280902bb0f1.
23960
23961	* linux/x32/syscallent.h: Change existing io_{setup,submit} to 64bit,
23962	and add new entry points for x32 specifically.
23963
239642014-06-18  Max Filippov  <jcmvbkbc@gmail.com>
23965
23966	xtensa: sort values in struct_user_offsets.
23967	Otherwise ptrace syscall argument decoding is wrong:
23968	  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x4048eb]) = 0
23969	  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x3fa6cd30]) = 0
23970	  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x8040676d]) = 0
23971	instead of
23972	  ptrace(PTRACE_PEEKUSER, 296, pc, [0x4048eb]) = 0
23973	  ptrace(PTRACE_PEEKUSER, 296, a1, [0x3fa6cd30]) = 0
23974	  ptrace(PTRACE_PEEKUSER, 296, a0, [0x8040676d]) = 0
23975
23976	* process.c (struct_user_offsets) [XTENSA]: Sort values.
23977
239782014-06-18  Dmitry V. Levin  <ldv@altlinux.org>
23979
23980	Document -k option as experimental.
23981	strace -k does not produce a reliable output on all supported
23982	configurations yet, even basic strace-k.test is known to fail
23983	on some of them.
23984
23985	* strace.c (usage): Document -k option as experimental.
23986	* strace.1: Likewise.
23987	* NEWS: Likewise.
23988
239892014-06-18  Dmitry V. Levin  <ldv@altlinux.org>
23990
23991	tests: robustify -k test.
23992	Split stack-fcall.c into several compilation units so that intermediate
23993	function calls would not be optimized out by compiler.
23994
23995	* tests/stack-fcall.c: Move intermediate functions to ...
23996	* tests/stack-fcall-*.c: ... new files.
23997	* tests/Makefile.am (stack_fcall_SOURCES): Add stack-fcall-*.c.
23998
239992014-06-13  Dmitry V. Levin  <ldv@altlinux.org>
24000
24001	tests: enhance -k test.
24002	Add two more function calls to the stack.  Suggested by Masatake YAMATO.
24003
24004	* tests/stack-fcall.c (f1): Rename to f3.
24005	(f1, f2): New functions.
24006	* tests/strace-k.test: Update.
24007
240082014-06-13  Dmitry V. Levin  <ldv@altlinux.org>
24009
24010	unwind: ignore memory mappings that have no PROT_EXEC bit set.
24011	* unwind.c (build_mmap_cache): For each memory mapping being scanned,
24012	save its PROT_EXEC bit and skip the mapping if it is not set.
24013
24014	unwind: cleanup build_mmap_cache.
24015	* unwind.c (build_mmap_cache): Move local variables to the code branch
24016	where they are used.  Check return code of sscanf and strdup.  Do not
24017	treat unusual memory mappings as fatal errors.  Do not skip memory
24018	mappings with path names starting with "[".
24019
24020	unwind: remove unused field from mmap_cache_t.
24021	* unwind.c (mmap_cache_t): Remove "deleted" field.
24022	(build_mmap_cache): Remove initialization of "deleted" field.
24023
240242014-06-12  Dmitry V. Levin  <ldv@altlinux.org>
24025
24026	unwind: refactor stacktrace_walk.
24027	* unwind.c (stacktrace_walk): Move stack frame printing code
24028	to separate function print_stack_frame.
24029
24030	unwind: constify binary_filename and symbol_name functions arguments.
24031	* unwind.c (call_action_fn, print_call_cb, sprint_call_or_error,
24032	queue_put, queue_put_call): Add const qualifier to binary_filename and
24033	symbol_name arguments.
24034
240352014-06-11  Luca Clementi  <luca.clementi@gmail.com>
24036
24037	unwind: disable stack trace with multiple personalities.
24038	* unwind.c (unwind_cache_invalidate, unwind_print_stacktrace,
24039	unwind_capture_stacktrace): Disable stack tracing of non-default
24040	personality processes.
24041
240422014-06-05  Dmitry V. Levin  <ldv@altlinux.org>
24043
24044	unwind: rename function_off_set to function_offset.
24045	* unwind.c (call_action_fn, stacktrace_walk, STACK_ENTRY_SYMBOL_FMT,
24046	print_call_cb, sprint_call_or_error, queue_put, queue_put_call):
24047	Rename function_off_set to function_offset.
24048
24049	unwind: fix a bug in range updating of binary search.
24050	* unwind.c (print_stacktrace): Fix another off-by-one error in binary search.
24051
24052	unwind: use fopen64 instead of fopen.
24053	* unwind.c (fopen_for_input): Define to fopen64 iff
24054	[_LARGEFILE64_SOURCE && HAVE_FOPEN64], otherwise define it to fopen.
24055	(build_mmap_cache): Use fopen_for_input instead of fopen.
24056
240572014-06-05  Dmitry V. Levin  <ldv@altlinux.org>
24058
24059	unwind: fix build on 32-bit architectures.
24060	Fix compilation warnings in unwind.c on 32-bit architectures.
24061	On some architectures getuid is actually getuid32, so change the test
24062	to use getpid instead of getuid.
24063
24064	* unwind.c (STACK_ENTRY_SYMBOL_FMT): Explicitly cast function_off_set
24065	to unsigned long.
24066	(queue_put_error): Change the 3rd argument's type to unsigned long.
24067	* tests/stack-fcall.c (f1): Use getpid instead of getuid.
24068	* tests/strace-k.test: Likewise.
24069
240702014-06-05  Dmitry V. Levin  <ldv@altlinux.org>
24071
24072	tests: robustify -w option test.
24073	* tests/count.test: Allow nanosleep to spend a bit less time than 1 second.
24074
240752014-06-04  Dmitry V. Levin  <ldv@altlinux.org>
24076
24077	Fix delete_module decoding.
24078	* xlat/delete_module_flags.in: New file.
24079	* file.c (sys_delete_module): Move ...
24080	* bjm.c (sys_delete_module): ... to here.
24081	Decode 1st argument using printstr instead of printpath.
24082	* NEWS: Mention it.
24083
240842014-06-04  Zubin Mithra  <zubin.mithra@gmail.com>
24085
24086	Decode paths associated with file descriptors returned by syscalls.
24087	* defs.h (RVAL_FD): New macro.
24088	(RVAL_MASK, RVAL_STR, RVAL_NONE): Update.
24089	* desc.c (sys_dup, sys_delete_module): New functions.
24090	(do_dup2, decode_open, sys_creat): Change return value to RVAL_FD.
24091	* linux/dummy.h (sys_delete_module, sys_dup): Remove.
24092	* linux/syscall.h (sys_delete_module, sys_dup): New prototypes.
24093	* syscall.c (trace_syscall_exiting): Handle RVAL_FD.
24094
240952014-06-03  Dmitry V. Levin  <ldv@altlinux.org>
24096
24097	NEWS: Prepare for 4.9 release.
24098
24099	Warn about flags that have no effect with -c.
24100	* strace.c (init): Issue a warning if -i, -k, -r, -t, -T, or -y is used
24101	along with -c.
24102	This fixes Debian bug #443895.
24103
24104	debian: enable security hardening features.
24105	* debian/rules: Follow the advice in https://wiki.debian.org/Hardening
24106	and enable maximum hardening as for programs that handle untrusted data.
24107	Patch by Markus <waldeck@gmx.de>.
24108
241092014-06-03  Dmitry V. Levin  <ldv@altlinux.org>
24110
24111	debian: update control file.
24112	* debian/control (strace64): Fix a typo in package description.
24113	Patch by Pascal De Vuyst <pascal.devuyst@gmail.com>.
24114	(strace, strace-udeb): Add x32 to architecture list.
24115	Patch by Guillaume Morin <guillaume@morinfr.org>.
24116	(strace, strace-udeb): Add or1k to architecture list.
24117	Patch by Christian Svensson <debian@cmd.nu>.
24118	(strace, strace-udeb): Add arm64 to architecture list,
24119	and remove defunct arm.
24120	Patch by Wookey <wookey@debian.org>.
24121
24122	This fixes Debian bugs: #697625, #727018, #742235, #749956.
24123
241242014-06-03  Dmitry V. Levin  <ldv@altlinux.org>
24125
24126	manpage: minor corrections.
24127	$ groff -ww -mandoc -z strace.1
24128	strace.1:65: warning: macro `IX' not defined
24129
24130	* strace.1: define IX macro as empty for groff.
24131	Change remaining '-' as minus to '\-'.
24132	Have two word spaces after a full stop as an end of sentence.
24133	Use extra space ('\,' or '\/') between roman and italic characters.
24134	Based on patch by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>.
24135	This fixes Debian bug #725987.
24136
241372014-05-30  Masatake YAMATO  <yamato@redhat.com>
24138
24139	unwind: tests: add a test for -k option.
24140	* tests/stack-fcall.c: New test target.
24141	* tests/strace-k.test: New test driver.
24142	* tests/Makefile.am (check_PROGRAMS): Add stack-fcall.
24143	(TESTS): Add strace-k.test.
24144	* tests/.gitignore: Add stack-fcall.
24145
241462014-05-30  Masatake YAMATO  <yamato@redhat.com>
24147
24148	unwind: move stacktrace capturing and mmap cache invalidating to trace_syscall_entering
24149	Instead of handling stacktrace capturing and mmap cache invalidating in
24150	sys_* functions, handle them uniformly in trace_syscall_entering using
24151	new flags introduced by previous two commits.
24152
24153	The patch is simpler than its older version(v3).  The value of
24154	hide_log_until_execve is just ignored.  I found the value is nothing
24155	to do with this patch.  unwind_cache_invalidate is mentioned only
24156	once in trace_syscall_exiting.
24157	Both are suggested by Dmitry Levin.
24158
241592014-05-30  Dmitry V. Levin  <ldv@altlinux.org>
24160
24161	unwind: add SE and SI flags to syscall entries for all architectures.
24162	Add SE flag to execve, exit, and exit_group syscall entries.
24163	Add SI flag to brk, execve, mmap, mprotect, mremap, munmap,
24164	remap_file_pages, shmat, and shmdt syscall entries.
24165
241662014-05-30  Masatake YAMATO  <yamato@redhat.com>
24167
24168	unwind: introduce markers specifying the needs of special care in unwinding
24169	Some system calls require capturing the stack trace before they are
24170	processed in kernel.  Typical one is execve.  Some system calls require
24171	invalidating mmap cache after they are processed in kernel.
24172
24173	In current implementation these requirements are handled directly by
24174	appropriate syscall handlers.  However, it is difficult to keep the
24175	source code maintainable using this approach to cover all system calls
24176	which have such requirements.
24177
24178	A more generic way to implement this is to flag all syscalls that
24179	require special processing, and handle these flags right in
24180	trace_syscall_entering instead of changing syscall handlers.
24181
24182	This patch just defines new flags: STACKTRACE_INVALIDATE_CACHE and
24183	STACKTRACE_CAPTURE_ON_ENTER.
24184
24185	The names of macros are suggested by Dmitry Levin.
24186
241872014-05-30  Masatake YAMATO  <yamato@redhat.com>
24188
24189	unwind: enable dwarf cache of libunwind.
24190	Here is the benchmark of the dwarf cache.
24191
24192	Target program:
24193
24194	    #include <sched.h>
24195	    int main(void)
24196	    {
24197	      unsigned int max = 0x6fff, i;
24198	      for (i = 0; i < max; i++)
24199		sched_yield();
24200	      return 0;
24201	    }
24202
24203	Command line:
24204
24205		./strace -o /dev/null -k a.out
24206
24207	With the dwarf cache:
24208
24209	    real	0m12.081s
24210	    user	0m3.858s
24211	    sys 	0m8.194s
24212
24213	Without the dwarf cache:
24214
24215	    real	0m22.326s
24216	    user	0m5.218s
24217	    sys		0m16.952s
24218
242192014-05-30  Masatake YAMATO  <yamato@redhat.com>
24220
24221	unwind: report expected backtracing error.
24222	When a file mmap'ed to the target process is unlink'ed, backtracing the
24223	stack would fail.  Current implementation reports it as
24224	"backtracing_error".  To avoid confusion, the message is changed to
24225	"expected_backtracing_error".
24226
24227	Here is the reproducer:
24228
24229	  $ cat ./p-deleted.c
24230	  #include <unistd.h>
24231
24232	  int main(int argc, char **argv) {
24233	    return unlink(argv[0]) < 0;
24234	  }
24235
24236	  $ strace -e unlink -k ./p-deleted
24237	  unlink("./p-deleted")                   = 0
24238	   > /usr/lib64/libc-2.18.so(unlink+0x7) [0xe7f17]
24239	   > /home/yamato/var/strace/t_unwind/p-deleted (deleted)(+0x0) [0x575]
24240	   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
24241	   > backtracing_error [0x7ffff1365590]
24242	  +++ exited with 0 +++
24243
24244	p-deleted is deleted therefore backtracing_error is reported.  This
24245	patch records the deleted marker when making mmap cache and refers the
24246	recorded information in the case "backtracing_error" to switch the
24247	message.
24248
24249	Here is the output of this patch:
24250
24251	  $ strace -e unlink -k ./p-deleted
24252	  unlink("./p-deleted")                   = 0
24253	   > /usr/lib64/libc-2.18.so(unlink+0x7) [0xe7f17]
24254	   > /home/yamato/var/strace/t_unwind/p-deleted (deleted)(+0x0) [0x575]
24255	   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
24256	   > expected_backtracing_error [0x7ffff1365590]
24257	  +++ exited with 0 +++
24258
24259	This solution is not perfect: if a file is unlink'ed after making the
24260	mmap cache and before unwinding, strace cannot have a chance to record
24261	the deleted marker.
24262
24263	In this version of patch, hardcoded magic number used in comparing "(delete)"
24264	string is replaced with strlen as suggested by Dmitry Levin.
24265
24266	In old version of patch, the deleted entry was thrown away from mmap
24267	cache to avoid to report "backtracing_error".  In this patch I keep it,
24268	and just switch the error message.
24269	Inspired by the review comment from Dmitry Levin.
24270
242712014-05-30  Masatake YAMATO  <yamato@redhat.com>
24272
24273	unwind: call unwind_tcb_fin before printing detached message.
24274	captured stacktrace is printed in unwind_tcb_fin if tcp->queue is not
24275	empty.  This should happen before printing detached message, so
24276	unwind_tcb_fin is moved to the top of droptcb.
24277
24278	This is implicitly suggested by Dmitry Levin in patch review process.
24279
242802014-05-30  Masatake YAMATO  <yamato@redhat.com>
24281
24282	unwind: implement automatic mmap cache invalidation.
24283	A mmap cache belonging to a tcb was updated when a system call which
24284	changed the memory mapping was called.  This implementation was assumed
24285	the mapping was changed only by the tcb.  However, this assumption is
24286	incorrect if the target application is multi-threaded; more than two
24287	tcbs can shared the same memory mapping and a tcb can modify it without
24288	being noticed by the others.
24289
24290	This change introduces a global integer variable mmap_cache_generation,
24291	and mmap_cache_generation field to struct tcb.  The variable
24292	is incremented each time a process enters a syscall that can modify its
24293	memory mapping.  Each tcb records the value of this variable at the
24294	moment if  building its mmap cache.  Every mmap cache associated with
24295	the given tcb can be validated by comparing its mmap_cache_generation
24296	field with the variable mmap_cache_generation.
24297
24298	This implementation is inefficient.  If strace attaches two processes
24299	which don't share the memory mapping, rebuilding mmap cache of a tcb
24300	triggered by another tcb's mmap system call is not necessary.
24301
243022014-05-30  Masatake YAMATO  <yamato@redhat.com>
24303
24304	unwind: introduce queue_t for capturing stacktrace.
24305	This is the second step for splitting capturing from printing.
24306
24307	New `queue' field is added to tcb.  Captured stacktrace is stored here.
24308	The field is initialized/finalized at unwind_tcb_init/unwind_tcb_fin.
24309
24310	New API function unwind_capture_stacktrace is added.  This function
24311	captures the currest stack using stracktrace_walker and records it in
24312	tcb.  It's printing is delayed to the next call of
24313	unwind_print_stacktrace.
24314
24315	unwind_print_stacktrace is extended.  Now it checks queue field of
24316	the given tcb at the start of function.  If the function finds a
24317	captured stack trace, the latter is printed using stracktrace_walker.
24318
24319	Currently unwind_capture_stacktrace invocations are added directly to
24320	handlers of mmap, munmap, mprotect, and execve.
24321
24322	Here is the difference of output with/without patch:
24323
24324	(without patch)
24325	  execve("./test-fork", ["./test-fork"], [/* 56 vars */]) = 0
24326	   > /usr/lib64/ld-2.18.so(check_one_fd.part.0+0x82) [0x11f0]
24327
24328	(with patch)
24329	  execve("./test-fork", ["./test-fork"], [/* 54 vars */]) = 0
24330	   > /usr/lib64/libc-2.18.so(execve+0x7) [0xbcd27]
24331	   > /home/yamato/var/strace/strace(exec_or_die+0x10c) [0x26ac]
24332	   > /home/yamato/var/strace/strace(startup_child+0x346) [0x134f6]
24333	   > /home/yamato/var/strace/strace(init+0x89f) [0x13dff]
24334	   > /home/yamato/var/strace/strace(main+0xa) [0x26ca]
24335	   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
24336	   > /home/yamato/var/strace/strace(_start+0x29) [0x2799]
24337
24338	In older version output lines of captured elements were built when
24339	printing.  In this version they are built when capturing the stack.
24340	As result, unneeded dynamic memory allocations are avoided.
24341	Suggested by Luca Clementi.
24342
24343	In older version the combination of snprintf and realloc were used.
24344	In this version they are replaced with asprintf.
24345	Suggested by Dmitry Levin.
24346
243472014-05-30  Masatake YAMATO  <yamato@redhat.com>
24348
24349	unwind: introduce own debug macro.
24350	* unwind.c (DPRINTF): New macro, to be utilized in debugging cache
24351	management code.
24352
243532014-05-30  Masatake YAMATO  <yamato@redhat.com>
24354
24355	unwind: introduce stacktrace_walker.
24356	In current implementation, the stack trace is captured and printed at
24357	the same time, in trace_syscall_exiting.  This approach cannot
24358	provide user expected information when a system call changes the
24359	memory mapping.  In such cases, the stack trace should be captured on
24360	entering syscall and printed on exiting.
24361
24362	As the initial step for splitting capturing from printing, this change
24363	introduces stacktrace_walker utility function.  It can be used both for
24364	capturing in trace_syscall_entering and printing in
24365	trace_syscall_exiting.
24366
243672014-05-30  Masatake YAMATO  <yamato@redhat.com>
24368
24369	unwind: give all exported functions "unwind_" prefix.
24370	* unwind.c (init_unwind_addr_space): Rename to unwind_init.
24371	(init_libunwind_ui): Rename to unwind_tcb_init.
24372	(free_libunwind_ui): Rename to unwind_tcb_fin.
24373	(delete_mmap_cache): Rename to unwind_cache_invalidate.
24374	(print_stacktrace): Rename to unwind_print_stacktrace.
24375	* defs.h: Update prototypes.
24376	* mem.c: All callers updated.
24377	* process.c: Likewise.
24378	* strace.c: Likewise.
24379	* syscall.c: Likewise.
24380
243812014-05-30  Masatake YAMATO  <yamato@redhat.com>
24382
24383	unwind: delete mmap cache in free_libunwind_ui.
24384	free_libunwind_ui is expected to release all unwind related resources
24385	attached to tcp.
24386
24387	* strace.c (droptcb): Move delete_mmap_cache call ...
24388	* unwind.c (free_libunwind_ui): ... to here.
24389
243902014-05-30  Masatake YAMATO  <yamato@redhat.com>
24391
24392	unwind: make alloc_mmap_cache function local.
24393	* defs.h (alloc_mmap_cache): Remove.
24394	* unwind.c (alloc_mmap_cache): Add static qualifier.
24395
24396	unwind: fix a bug in range updating of binary search.
24397	* unwind.c (print_stacktrace): Fix off-by-one error in binary search.
24398
243992014-05-30  Luca Clementi  <luca.clementi@gmail.com>
24400
24401	Add -k option to print stack trace after each syscall.
24402	Print the stack trace of the traced process after each system call when
24403	-k option is specified.  It is implemented using libunwind to unwind the
24404	stack and to obtain the function name pointed by the IP.
24405
24406	Based on the code that was originally taken from strace-plus
24407	of Philip J. Guo.
24408
24409	* configure.ac: Add --with-libunwind option.  Check libunwind support.
24410	* Makefile.am: Add libunwind support.
24411	* defs.h (struct tcb) [USE_LIBUNWIND]: Append libunwind specific fields.
24412	[USE_LIBUNWIND] (stack_trace_enabled, alloc_mmap_cache,
24413	delete_mmap_cache, print_stacktrace): New prototypes.
24414	* mem.c (print_mmap, sys_munmap, sys_mprotect): Add libunwind support.
24415	* process.c (sys_execve): Likewise.
24416	* strace.c (usage, alloctcb, droptcb, init): Likewise.
24417	* syscall.c (trace_syscall_exiting): Likewise.
24418	* unwind.c: New file.
24419	* strace.1: Document -k option.
24420
244212014-05-30  Dmitry V. Levin  <ldv@altlinux.org>
24422
24423	sysctl: update CTL_*, KERN_*, NET_*, and VM_* constants.
24424	* configure.ac (AC_CHECK_DECLS): Add CTL_*, KERN_*, NET_*, and
24425	VM_* constants.
24426	* system.c (CTL_PROC, CTL_CPU): Remove definitions.
24427	* xlat/sysctl_*.in: Update.
24428
24429	Check for constants used by waitid function.
24430	* configure.ac (AC_CHECK_DECLS): Add P_* constants.
24431
24432	Check for LO_FLAGS_READ_ONLY constant.
24433	* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_READ_ONLY.
24434
24435	Compress blank lines.
24436	Suppress empty lines left after automated xlat conversion.
24437
24438	xlat: cleanup the aftermath of automatic conversion.
24439
24440	Generate xlat/*.in files.
24441	Automatically convert xlat structures from *.c files to xlat/*.in files
24442	using "./generate_xlat_in.sh *.c" command.
24443
24444	Rename several xlat structures to avoid collisions.
24445	* bjm.c (which): Rename to qm_which.
24446	* ipc.c (msg_flags): Rename to ipc_msg_flags.
24447	* time.c (which): Rename to itimer_which.
24448
24449	Enhance xlat generator.
24450	* xlat/gen.sh: Define all xlat structs not declared in defs.h as static.
24451	Some symbolic constants are not macros, extend #ifdef check to cover
24452	symbolic constants checked by AC_CHECK_DECLS.
24453	Handle complex symbolic constants in SYMBOL|... form.
24454	Handle symbolic constants in 1<<SYMBOL form.
24455	Handle numeric constants.
24456	Implement #unconditional directive that turns off preprocessor checks.
24457	Implement #unterminated directive that turns off adding XLAT_END.
24458
244592014-05-30  Dmitry V. Levin  <ldv@altlinux.org>
24460
24461	Use bootstrap script consistently.
24462	Now that ./xlat/gen.sh has to be run before autoreconf,
24463	replace all autoreconf calls with ./bootstrap call.
24464
24465	* bootstrap: Forward arguments to autoreconf.
24466	* build_static_example.sh: Replace autoreconf call with bootstrap call.
24467	* make-dist: Likewise.
24468	* qemu_multiarch_testing/README: Likewise.
24469
244702014-05-30  Mike Frysinger  <vapier@gentoo.org>
24471
24472	Implement xlat generator.
24473	* bootstrap: New file.
24474	* xlat/gen.sh: Likewise.
24475	* Makefile.am: Include xlat/Makemodule.am
24476	(EXTRA_DIST): Add $(XLAT_INPUT_FILES), $(XLAT_HEADER_FILES), and
24477	xlat/gen.sh.
24478
244792014-05-30  Dmitry V. Levin  <ldv@altlinux.org>
24480
24481	tests: fix SCM_RIGHTS test for big-endian systems.
24482	* tests/scm_rights.c (main): Send zero integer to avoid issues with
24483	endianness.
24484	* tests/scm_rights-fd.test: Update grep patterns.
24485
24486	Decode file descriptors passed via SCM_RIGHTS control messages.
24487	* net.c (printcmsghdr): Print descriptors from SCM_RIGHTS control
24488	messages using printfd.
24489	* tests/scm_rights.c: New file.
24490	* tests/scm_rights-fd.test: New test.
24491	* tests/Makefile.am (check_PROGRAMS): Add scm_rights.
24492	(TESTS): Add scm_rights-fd.test.
24493	* tests/.gitignore: Add scm_rights and uio.
24494
24495	tests: add a test for -c and -w options.
24496	* tests/count.test: New test.
24497	* tests/Makefile.am (TESTS): Add it.
24498
244992014-05-29  Mark Hills  <Mark.Hills@framestore.com>
24500
24501	Optionally produce stats on syscall latency.
24502	Time spent in system time is not useful where a syscall depends on some
24503	non-CPU resource, eg. typically open() or stat() to a network drive.
24504
24505	This patch adds a new flag (-w) to produce a summary of the time
24506	difference between beginning and end of the system call (ie. latency)
24507
24508	This functionality has been useful to profile slow processes that
24509	are not CPU-bound.
24510
245112014-05-29  Dmitry V. Levin  <ldv@altlinux.org>
24512
24513	Constify count_syscall function.
24514	* count.c (count_syscall): Add const qualifier to timeval argument and
24515	rename it.  Store the wall clock time spent while in syscall in separate
24516	timeval variable.
24517	* defs.h (count_syscall): Update prototype.
24518	* syscall.c (trace_syscall_exiting): Update count_syscall invocation.
24519
24520	Constify tv_* functions.
24521	* defs.h (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_mul, tv_div): Add
24522	const qualifier to read only arguments.
24523	* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_mul, tv_div):
24524	Likewise.
24525
245262014-05-28  Dmitry V. Levin  <ldv@altlinux.org>
24527
24528	Use printstr for sethostname, setdomainname, and gethostname decoding.
24529	The argument passed to sethostname and setdomainname syscalls, as well
24530	as the string returned by gethostname syscall, is not a pathname, so
24531	printpathn is not the right method for its decoding.
24532
24533	* process.c (sys_sethostname, sys_setdomainname): Decode 1st argument
24534	using printstr instead of printpathn.
24535	[ALPHA] (sys_gethostname): Likewise.
24536
245372014-05-21  James Hogan  <james.hogan@imgtec.com>
24538
24539	Fix {get,set}rlimit decoding with unreliable SIZEOF_RLIM_T.
24540	When strace is built with large file support definitions in CFLAGS (as
24541	may be provided by buildroot) the C library headers may expose a 64-bit
24542	rlim_t even though the struct rlimit fields used by the system call
24543	interface are only 32-bit.  The SIZEOF_RLIM_T will then be 8 which
24544	results in bad decoding of the getrlimit and setrlimit syscalls.
24545
24546	This is fixed by replacing unreliable SIZEOF_RLIM_T based checks with
24547	checks for current_wordsize.
24548
245492014-05-13  Masatake YAMATO  <yamato@redhat.com>
24550
24551	Enhance setns syscall decoding.
24552	* process.c (sys_setns): New function.
24553	Decode the 2nd syscall argument using clone_flags.
24554	* linux/syscall.h (sys_setns): New prototype.
24555	* linux/dummy.h (sys_setns): Remove.
24556
245572014-05-12  Dmitry V. Levin  <ldv@altlinux.org>
24558
24559	mips: fix syscall entries that should have TP flag set.
24560
24561	xtensa: fix unshare syscall entry.
24562
24563	alpha, hppa, mips n64: fix waitid syscall entry.
24564
24565	Add TM flag to shmat and shmdt syscall entries.
24566
24567	Alias sys_vfork to sys_fork.
24568	* process.c (sys_vfork): Remove.
24569	* linux/syscall.h (sys_vfork): Likewise.
24570	* linux/dummy.h (sys_vfork): Alias to sys_fork.
24571	* linux/alpha/syscallent.h: Fix vfork entry.
24572	* util.c (setbpt): Do not check for sys_vfork.
24573	* syscall.c (syscall_fixup_for_fork_exec): Likewise.
24574
245752014-04-17  Dmitry V. Levin  <ldv@altlinux.org>
24576
24577	epoll_ctl: fix EPOLL_CTL_DEL argument decoding.
24578	* desc.c (sys_epoll_ctl): Do not parse the event structure for
24579	EPOLL_CTL_DEL operation.
24580
24581	Reported-by: Марк Коренберг <socketpair@gmail.com>
24582
245832014-04-17  Dmitry V. Levin  <ldv@altlinux.org>
24584
24585	Update CLOCK_* constants.
24586	* time.c (clocknames): Add CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,
24587	CLOCK_BOOTTIME_ALARM, CLOCK_SGI_CYCLE, and CLOCK_TAI.
24588	Fixes RH#1088455.
24589
245902014-04-17  Dmitry V. Levin  <ldv@altlinux.org>
24591
24592	Fix preadv/pwritev offset decoding.
24593	* util.c (printllval): Add align argument.
24594	* defs.h (printllval): Update prototype.
24595	(printllval_aligned, printllval_unaligned): New macros.
24596	* file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64,
24597	sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2,
24598	sys_fallocate): Replace printllval call with printllval_aligned.
24599	* io.c (sys_pread, sys_pwrite): Likewise.
24600	(sys_preadv, sys_pwritev): Replace printllval call with
24601	printllval_unaligned.
24602	* linux/arm/syscallent.h: Set the number of preadv and pwritev
24603	arguments to 5.
24604	* linux/mips/syscallent-o32.h: Likewise.
24605	* linux/powerpc/syscallent.h: Likewise.
24606	* linux/sh/syscallent.h: Likewise.
24607	* linux/xtensa/syscallent.h: Likewise.
24608
24609	Reported-by: Dima Kogan <dima@secretsauce.net>
24610
246112014-04-16  Dmitry V. Levin  <ldv@altlinux.org>
24612
24613	tests: add a test for pread/pwrite and preadv/pwritev offset decoding.
24614	* tests/uio.c: New file.
24615	* tests/uio.test: New test.
24616	* tests/Makefile.am (check_PROGRAMS): Add uio.
24617	(uio_CFLAGS): Define.
24618	(TESTS): Add uio.test.
24619
246202014-04-10  Dmitry V. Levin  <ldv@altlinux.org>
24621
24622	Refactor LDT decoding.
24623	* configure.ac (AC_CHECK_TYPES): Remove struct user_desc.
24624	* ldt.c: New file.
24625	* Makefile.am (strace_SOURCES): Add ldt.c.
24626	* mem.c: Do not include <asm/ldt.h>.
24627	(print_ldt_entry): Remove.
24628	(sys_modify_ldt, sys_set_thread_area, sys_get_thread_area): Move...
24629	* ldt.c: ... here.
24630	* process.c: Do not include <asm/ldt.h>.
24631	(sys_clone) [I386 || X86_64 || X32]: Use print_user_desc.
24632
246332014-04-10  Denys Vlasenko  <dvlasenk@redhat.com>
24634
24635	Make int3 example in comments more cut-n-pastable.
24636	I found that I use it quite often. Lets make it so that
24637	after cut-n-pasting it into a file, there is no need
24638	to edit the result (e.g. no need to remove C comment
24639	chars from every line.
24640
246412014-04-09  Dmitry V. Levin  <ldv@altlinux.org>
24642
24643	mips: enable decoding of set_thread_area.
24644	* linux/dummy.h [MIPS]: Do not redirect sys_set_thread_area to printargs.
24645	* mem.c [MIPS] (sys_set_thread_area): Define.
24646
24647	x86_64, x32: enable decoding of modify_ldt, get_thread_area, and set_thread_area
24648	* linux/dummy.h [X86_64 || X32]: Do not redirect sys_modify_ldt,
24649	sys_get_thread_area, and sys_set_thread_area to printargs.
24650
24651	x32: decode clone LDT user_desc entries for x86 processes.
24652	* mem.c [X32]: Include asm/ldt.h.
24653	[X32] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area,
24654	sys_get_thread_area): Define.
24655	* process.c [X32]: Include asm/ldt.h.
24656	(sys_clone) [X32]: Decode LDT entry if current_personality == 1.
24657
246582014-04-09  Elliott Hughes  <enh@google.com>
24659
24660	x86-64: decode clone LDT user_desc entries for x86 processes.
24661	* mem.c [X86_64]: Include asm/ldt.h.
24662	[X86_64] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area,
24663	sys_get_thread_area): Define.
24664	* process.c [X86_64]: Include asm/ldt.h.
24665	(sys_clone) [X86_64]: Decode LDT entry if current_personality == 1.
24666
246672014-04-09  Dmitry V. Levin  <ldv@altlinux.org>
24668
24669	x32: fix clone(2) argument order for x86 processes.
24670	Apply the same fix that was made for x86_64.
24671
24672	* process.c [X32] (ARG_CTID, ARG_TLS): Take current
24673	personality into account.
24674
246752014-04-09  Elliott Hughes  <enh@google.com>
24676
24677	x86-64: fix clone(2) argument order for x86 processes.
24678	Without this patch, strace claims that parent_tidptr == tls, which is
24679	clearly wrong.  It is expected that parent_tidptr == child_tidptr.
24680
24681	* process.c [X86_64] (ARG_CTID, ARG_TLS): Take current
24682	personality into account.
24683
246842014-04-06  Elliott Hughes  <enh@google.com>
24685
24686	aarch64: Fix decoding of arm struct stat64.
24687	We need to handle this situation more like x86-64.  32-bit arm and i386
24688	actually have a common struct stat64, except the arm one must not be
24689	packed.  Additionally, on aarch64 the 32-bit personality is personality 0.
24690
246912014-03-20  Dmitry V. Levin  <ldv@altlinux.org>
24692
24693	ARM EABI: disable OABI support by default.
24694	OABI is rarely used in ARM EABI systems nowadays, so disable its support
24695	by default.  Add --enable-arm-oabi option to enable ARM OABI support.
24696
24697	* configure.ac: New option --enable-arm-oabi.
24698	* syscall.c (get_scno) [ARM]: Check ENABLE_ARM_OABI macro defined by
24699	configure instead of undocumented STRACE_KNOWS_ONLY_EABI macro.
24700
247012014-03-12  Elliott Hughes  <enh@google.com>
24702
24703	Fix stat decoding for LP64 bionic.
24704	Patch fb642bb6d63f7ffe2228bf48a6008bc8f56f67ff fixed building with
24705	HAVE_STAT64 for aarch64 with uapi kernel headers but not x86_64.
24706	The workaround needed to be applied to all LP64 architectures, not
24707	just aarch64.  This patch fixes that and adds an explanatory comment.
24708
247092014-03-11  Masatake YAMATO  <yamato@redhat.com>
24710
24711	Decode protocol argument for PF_NETLINK sockets.
24712	* net.c (protocols): Rename to inet_protocols.
24713	[PF_NETLINK] (netlink_protocols): New xlat structure.
24714	(sys_socket): Rename protocols to inet_protocols.
24715	[PF_NETLINK]: Decode protocol argument using netlink_protocols.
24716
24717	Acked-by: Mike Frysinger <vapier@gentoo.org>
24718
247192014-03-11  Dmitry V. Levin  <ldv@altlinux.org>
24720
24721	Cleanup socketpair decoding.
24722	The only supported domain for socketpair syscall is AF_UNIX, so
24723	no decoding related to other domains is required for socketpair.
24724
24725	* net.c (sys_socketpair): Remove support for PF_INET and PF_IPX domains,
24726	print the protocol argument as is.
24727
247282014-03-11  Dmitry V. Levin  <ldv@altlinux.org>
24729
24730	printsiginfo: add SIGSYS decoding.
24731	* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_syscall.
24732	* signal.c (SYS_SECCOMP): Define if not yet defined.
24733	(sigsys_codes): new xlat structure.
24734	(printsiginfo): Decode SIGSYS.
24735
24736	Update siginfo codes.
24737	* signal.c (siginfo_codes): Add SI_DETHREAD.
24738
24739	Factor out printing of si_pid and si_uid members of siginfo_t.
24740	* signal.c (printsigsource): New function.
24741	(printsiginfo): Use it.
24742
247432014-03-10  Elliott Hughes  <enh@google.com>
24744
24745	Improve SI_TIMER decoding.
24746	Decode siginfo_t more clearly for si_code SI_TIMER.
24747	The 'pid' is actually a POSIX timer id, and the 'uid' is actually the
24748	overrun.
24749	Also factor out the si_value dumping so it's the same for every si_code.
24750
247512014-03-03  Elliott Hughes  <enh@google.com>
24752
24753	aarch64: fix decoding of arm syscall numbers.
24754	If an aarch64 strace is tracing a process using the arm personality, it
24755	also needs to call the shuffle_scno function for the ARM-specific
24756	syscalls.
24757
24758	* syscall.c (shuffle_scno): Define on AARCH64.
24759	(get_scno) [AARCH64]: Call shuffle_scno when the tracee is in 32-bit mode.
24760
247612014-03-03  Dmitry V. Levin  <ldv@altlinux.org>
24762
24763	Fix fcntl decoding.
24764	Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined or
24765	not defined altogether.
24766	Do not assume that sizeof(off_t) < sizeof(long long) when F_SETLK64 is
24767	undefined.
24768
24769	This change fixes build with musl libc on x86.
24770
24771	* configure.ac: Define SIZEOF_OFF_T.
24772	* desc.c (USE_PRINTFLOCK64): New macro.
24773	(struct flock64, printflock64): Do not define on X32.
24774	(printflock): Replace X32 specific workaround with SIZEOF_OFF_T check.
24775	Fix printing off_t members of struct flock.
24776	(sys_fcntl): Use USE_PRINTFLOCK64.
24777
247782014-03-01  Dmitry V. Levin  <ldv@altlinux.org>
24779
24780	sys_fcntl: remove F_FREESP and F_FREESP64 support.
24781	F_FREESP and F_FREESP64 fcntl commands are not available in Linux
24782	and therefore the code implementing their decoding is useless.
24783	Besides that, F_FREESP64 decoding is too complicated to support.
24784
24785	* desc.c (fcntlcmds): Remove F_FREESP and F_FREESP64.
24786	Remove F_FREESP64 from the check whether to define struct flock64.
24787	(sys_fcntl): Remove F_FREESP and F_FREESP64 support.
24788
247892014-02-28  Elliott Hughes  <enh@google.com>
24790
24791	Add multi-personality support to struct old_sigaction decoding.
24792	struct sigaction is another structure that contains members
24793	whose size differs between 32-bit and 64-bit personalities.
24794
24795	* signal.c [HAVE_SIGACTION] (old_sigaction32): New structure.
24796	[HAVE_SIGACTION] (decode_old_sigaction): Decode 32-bit struct
24797	old_sigaction on a 64-bit host.
24798
247992014-02-28  Elliott Hughes  <enh@google.com>
24800
24801	Fix decoding of arm struct stat64 by aarch64 strace.
24802	aarch64's uapi header files have a struct stat but no struct stat64.
24803	To correctly decode a 32-bit process' s struct stat64 we need
24804	HAVE_STAT64, but then the build fails because there is no struct stat64.
24805	Luckily, the aarch64 struct stat is structurally equivalent to the arm
24806	struct stat64, so we can just reuse that.
24807
24808	* file.c [AARCH64] (stat64): Define to stat.
24809
248102014-02-28  Dmitry V. Levin  <ldv@altlinux.org>
24811
24812	Remove obsolete ioctlsort.c.
24813	The generic version of ioctlsort.c became obsolete after commit
24814	v4.6-240-g5afdf12 that removed its last non-Linux users.
24815
24816	* ioctlsort.c: Remove.
24817	* Makefile.am (EXTRA_DIST): Remove ioctlsort.c.
24818
24819	Reported-by: Elliott Hughes <enh@google.com>
24820
248212014-02-27  Dmitry V. Levin  <ldv@altlinux.org>
24822
24823	Add multi-personality support to stack_t decoding.
24824	stack_t is one of many structures that contain members
24825	whose size differs between 32-bit and 64-bit personalities.
24826
24827	* signal.c (print_stack_t): Decode 32-bit stack_t on a 64-bit host.
24828
24829	Reported-by: Elliott Hughes <enh@google.com>
24830
248312014-02-27  Dmitry V. Levin  <ldv@altlinux.org>
24832
24833	Rewrite signal mask decoding without sigset_t.
24834	The sigset_t provided by libc is not quite convenient.
24835	In glibc, sigset_t is an array with space for 1024 bits, which is much
24836	more than required: all architectures supported by Linux have only 64
24837	signals except MIPS, which has 128.
24838	In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than
24839	necessary.
24840
24841	With this change, signal mask is decoded without use of intermediate
24842	sigset_t structure, which saves us some cpu cycles in case of glibc with
24843	its inflated sigset_t, and enables build with libcs where sigset_t is
24844	broken.
24845
24846	Old implementation used to check each signal number in the given signal
24847	mask twice using sigismember().
24848	New implementation is based on popcount and next_set_bit() so it's
24849	noticeably faster.
24850
24851	* configure.ac: Check for __builtin_popcount.
24852	* signal.c: Ensure that NSIG >= 32.
24853	(sprintsigmask, sprintsigmask_long, printsigmask): Remove.
24854	(popcount32, sprintsigmask_n): New functions.
24855	(tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros.
24856	(print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask,
24857	sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use
24858	new signal mask decoding interface.
24859	* tests/sigaction.c (main): Add a test with almost filled signal mask.
24860	* tests/sigaction.awk: Update.
24861
248622014-02-26  Dmitry V. Levin  <ldv@altlinux.org>
24863
24864	Fix build with Bionic libc.
24865	Add generic tests for fopen64 and fputs_unlocked functions to fix build
24866	with Bionic libc that does not provide them.
24867
24868	* configure.ac (AC_CHECK_FUNCS): Add fopen64 and fputs_unlocked.
24869	* strace.c [_LARGEFILE64_SOURCE]: Use fopen instead of fopen64
24870	if !HAVE_FOPEN64.
24871	Use fputs instead of fputs_unlocked if !HAVE_FPUTS_UNLOCKED.
24872	* vsprintf.c: Use fputs instead of fputs_unlocked
24873	if !HAVE_FPUTS_UNLOCKED.
24874
24875	Reported-by: Elliott Hughes <enh@google.com>
24876
248772014-02-25  James Yang  <james.yang@freescale.com>
24878
24879	powerpc64: fix 64-bit process detection on embedded.
24880	* syscall.c (get_scno) [POWERPC64]: Fix 64-bit process detection
24881	on embedded powerpc.
24882
248832014-02-25  Dmitry V. Levin  <ldv@altlinux.org>
24884
24885	Do not compile scsi ioctl decoding if <scsi/sg.h> is not available.
24886	Add a generic test for <scsi/sg.h> availability to fix build with
24887	Bionic libc that does not provide <scsi/sg.h>.
24888
24889	* configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h.
24890	* ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H.
24891	* scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H.
24892
24893	Reported-by: Elliott Hughes <enh@google.com>
24894
248952014-02-14  Dmitry V. Levin  <ldv@altlinux.org>
24896
24897	Revert "Add support for Altera's Nios-II softcore architecture"
24898	The patch originally submitted by Ezequiel García was OK, but I somehow
24899	managed to mangle it so that most of the patch was not applied.
24900
24901	According to Ezequiel García, an architecture port based on the generic
24902	syscall ABI is in progress.
24903
24904	This reverts commit 61e426e87ac81be4b4ff9de581635b4ea585624f.
24905
249062014-02-08  Dmitry V. Levin  <ldv@altlinux.org>
24907
24908	tests: tighten sigaction check.
24909	* tests/sigaction.awk: Check that input conatins all expected lines.
24910
249112014-02-08  Dmitry V. Levin  <ldv@altlinux.org>
24912
24913	Fix sigaction reporting on non-x86 architectures.
24914	If SA_RESTORER is not defined by libc headers but defined by kernel
24915	headers, use the definition provided by kernel headers for proper
24916	sigaction decoding.
24917
24918	* signal.c [!SA_RESTORER]: Define to ASM_SA_RESTORER if the latter is
24919	defined, regardless of architecure.
24920
249212014-02-08  Dmitry V. Levin  <ldv@altlinux.org>
24922
24923	Check for SA_RESTORER definition in <asm/signal.h>
24924	Kernel header <asm/signal.h> cannot be included from regular code
24925	because it conflicts with libc headers, but SA_RESTORER is needed in
24926	signal.c, so SA_RESTORER value is forwarded from <asm/signal.h> to
24927	config.h using a configure check.
24928
24929	* configure.ac (ASM_SA_RESTORER): Define if SA_RESTORER is defined
24930	in <asm/signal.h>.
24931
249322014-02-07  Dmitry V. Levin  <ldv@altlinux.org>
24933
24934	arm: fix compilation warning.
24935	Fix "dereferencing type-punned pointer will break strict-aliasing rules"
24936	warning introduced by commit v4.8-54-g670b21b.
24937
24938	* signal.c (sys_sigreturn) [ARM]: Avoid dereferencing type-punned pointers.
24939
249402014-02-06  Dmitry V. Levin  <ldv@altlinux.org>
24941
24942	kexec: fix typo.
24943	* kexec.c (print_kexec_segments) [SUPPORTED_PERSONALITIES == 1]: Fix typo.
24944
249452014-02-06  Ezequiel Garcia  <ezequiel@vanguardiasur.com.ar>
24946
24947	Add support for Altera's Nios-II softcore architecture.
24948	This commit adds strace support for Altera's Nios-II official
24949	kernel port as found in git://git.rocketboards.org/linux-socfpga.git
24950
24951	Notice that this an out-of-tree kernel architectural port, and uses the
24952	legacy (non-generic) system call ABI. In particular, the port doesn't
24953	support PTRACE_GETREGSET, so the implementation is based on PTRACE_GETREGS.
24954
24955	Given it's mandatory for new architectures to support the generic
24956	syscall ABI and PTRACE_GETREGSET, if the nios2 architecure is ever
24957	mainlined, the strace support will have to be re-factored accordingly.
24958
24959	* linux/nios2/ioctlent.h.in: New file.
24960	* linux/nios2/syscallent.h: Likewise.
24961	* Makefile.am (EXTRA_DIST): Add linux/nios2/ioctlent.h.in and
24962	linux/nios2/syscallent.h.
24963	* configure.ac: Add NIOS2 to the list of supported architectures.
24964	* defs.h [NIOS2]: Use register reading system.
24965	* process.c (struct_user_offsets): Add NIOS2 support.
24966	* syscall.c (get_regs, get_scno, get_syscall_args,
24967	get_syscall_result, get_error): Likewise.
24968	* util.c (change_syscall): Likewise.
24969	* mem.c (sys_getpagesize): Define on NIOS2.
24970	* system.c [NIOS2] (sys_cacheflush, sys_nios2cmpxchg): New functions.
24971
24972	Acked-by: Mike Frysinger <vapier@gentoo.org>
24973
249742014-02-05  Dmitry V. Levin  <ldv@altlinux.org>
24975
24976	Implement add_key, keyctl, and request_key decoding.
24977	* keyctl.c: New file.
24978	* linux/keyctl.h: Likewise.
24979	* Makefile.am (strace_SOURCES): Add keyctl.c.
24980	(EXTRA_DIST): Add linux/keyctl.h.
24981	* linux/dummy.h (sys_add_key, sys_keyctl, sys_request_key): Remove.
24982	* linux/syscall.h (sys_add_key, sys_keyctl, sys_request_key): New
24983	prototypes.
24984
24985	Implement ioprio_get and ioprio_set decoding.
24986	* ioprio.c: New file.
24987	* Makefile.am (strace_SOURCES): Add ioprio.c.
24988	* linux/dummy.h (sys_ioprio_get, sys_ioprio_set): Remove.
24989	* linux/syscall.h (sys_ioprio_get, sys_ioprio_set): New prototypes.
24990
24991	Implement finit_module decoding.
24992	* bjm.c (module_init_flags): New xlat structure.
24993	(sys_finit_module): New function.
24994	* linux/dummy.h (sys_finit_module): Remove.
24995	* linux/syscall.h (sys_finit_module): New prototype.
24996
24997	Cleanup inotify syscalls decoding.
24998	* linux/inotify.h: New file.
24999	* file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch,
25000	sys_inotify_rm_watch, sys_inotify_init1): Move...
25001	* inotify.c: ... here.
25002	(inotify_modes): Rename to inotify_flags, convert to XLAT form.
25003	(inotify_init_flags): Convert to XLAT form.
25004	* Makefile.am (strace_SOURCES): Add inotify.c.
25005	(EXTRA_DIST): Add linux/inotify.h.
25006
25007	Enhance reboot decoding.
25008	* linux/reboot.h: New file.
25009	* system.c (bootflags1, bootflags2, bootflags3, sys_reboot): Move...
25010	* reboot.c: ... here.
25011	(bootflags2, bootflags3): Update constants.
25012	* Makefile.am (strace_SOURCES): Add reboot.c.
25013	(EXTRA_DIST): Add linux/reboot.h.
25014
25015	Implement kexec_load decoding.
25016	* kexec.c: New file.
25017	* linux/kexec.h: Likewise.
25018	* Makefile.am (strace_SOURCES): Add kexec.c.
25019	(EXTRA_DIST): Add linux/kexec.h.
25020	* linux/dummy.h (sys_kexec_load): Remove.
25021	* linux/syscall.h (sys_kexec_load): New prototype.
25022
25023	Use prepared editions of recently imported linux headers.
25024	* linux/fanotify.h: Replace with edition prepared with headers_install.sh.
25025	* linux/personality.h: Likewise.
25026
25027	Implement fanotify_init and fanotify_mark decoding.
25028	* fanotify.c: New file.
25029	* linux/fanotify.h: Likewise.
25030	* Makefile.am (strace_SOURCES): Add fanotify.c.
25031	(EXTRA_DIST): Add linux/fanotify.h.
25032	* defs.h (print_dirfd): New prototype.
25033	* file.c (print_dirfd): Export.
25034	* linux/dummy.h (sys_fanotify_init, sys_fanotify_mark): Remove.
25035	* linux/syscall.h (sys_fanotify_init, sys_fanotify_mark): New
25036	prototypes.
25037	* pathtrace.c (pathtrace_match): Handle sys_fanotify_init and
25038	sys_fanotify_mark.
25039
25040	Use XLAT_END macro.
25041	Automatically update all xlat structures using the following sed regexp:
25042	s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
25043
25044	Itroduce XLAT_END macro to make xlat structures more compact.
25045	* defs.h (XLAT_END): New macro.
25046
25047	Convert personality_options to XLAT form.
25048	* linux/personality.h: New file.
25049	* Makefile.am (EXTRA_DIST): Add it.
25050	* system.c: Include <linux/personality.h>.
25051	(personality_options): Update PER_* constants, convert to XLAT form.
25052
25053	Convert futexops to XLAT form.
25054	* process.c: Define FUTEX_*_PRIVATE macros.
25055	(futexops): Convert to XLAT form.
25056
25057	Convert sigev_value to XLAT form.
25058	* time.c (sigev_value): Convert to XLAT form.
25059	(printsigevent32, printsigevent): Update use of sigev_value.
25060
25061	Use XLAT macro.
25062	Automatically convert all xlat structures to XLAT form
25063	using the following sed regexp:
25064	s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
25065
250662014-02-05  Dmitry V. Levin  <ldv@altlinux.org>
25067
25068	Introduce XLAT macro to ease maintenance of xlat structures.
25069	* defs.h (XLAT): New macro.
25070
25071	Suggested-by: Mike Frysinger <vapier@gentoo.org>
25072
250732014-02-04  Stefan Sørensen  <stefan.sorensen@spectralink.com>
25074
25075	Decode ptp ioctls.
25076	* defs.h (ptp_ioctl): New prototype.
25077	* ioctl.c (ioctl_decode): Call ptp_ioctl when code is '='.
25078	* Makefile.am (strace_SOURCES): Add ptp.c.
25079	(EXTRA_DIST): Add linux/ptp_clock.h.
25080	* ptp.c: New file.
25081	* linux/ptp_clock.h: New file.
25082
250832014-02-03  Stefan Sørensen  <stefan.sorensen@spectralink.com>
25084
25085	Decode dynamic posix clocks.
25086	* time.c (cpuclocknames): New xlat structure.
25087	(printclockname): New function that decodes posix clock names,
25088	including dynamic fd encoded clocks.
25089	(sys_clock_settime, sys_clock_gettime, sys_clock_nanosleep,
25090	sys_clock_adjtime, sys_timer_create, sys_timerfd, sys_timerfd_create):
25091	Use it.
25092
25093	Update ADJ_* constants.
25094	* time.c (adjtimex_modes): Add ADJ_TAI, ADJ_SETOFFSET, ADJ_MICRO,
25095	ADJ_NANO, ADJ_OFFSET_SS_READ.
25096
250972014-02-02  Philippe Ombredanne  <pombredanne@nexb.com>
25098
25099	Add decoding of sockets descriptor 'paths' for network calls.
25100	* net.c (sys_bind, sys_listen, do_accept, sys_send, sys_sendto,
25101	sys_sendmsg, sys_sendmmsg, sys_recv, sys_recvfrom, sys_recvmsg,
25102	sys_recvmmsg, sys_shutdown, sys_getsockopt, sys_setsockopt): Decode
25103	socket descriptor arguments using printfd.
25104	* pathtrace.c (pathtrace_match): Also check TRACE_NETWORK syscalls
25105	that take socket descriptor arguments.
25106	* tests/net-fd.test: New test for socket descriptor arguments decoding.
25107	* tests/Makefile.am (TESTS): Add net-fd.test.
25108	(net-fd.log): New dependency on net.log.
25109
251102014-02-02  Dmitry V. Levin  <ldv@altlinux.org>
25111
25112	tests: rename all tests so that their names end in .test suffix.
25113	Due to automake limitations, some features work only for tests
25114	that end in one of the suffixes listed in TEST_EXTENSIONS.
25115
25116	* tests/detach-running: Rename to detach-running.test.
25117	* tests/detach-sleeping: Rename to detach-sleeping.test.
25118	* tests/detach-stopped: Rename to detach-stopped.test.
25119	* tests/net: Rename to net.test.
25120	* tests/ptrace_setoptions: Rename to ptrace_setoptions.test.
25121	* tests/qual_syscall: Rename to qual_syscall.test.
25122	* tests/sigaction.sh: Rename to sigaction.test.
25123	* tests/stat: Rename to stat.test.
25124	* tests/strace-f: Rename to strace-f.test.
25125	* tests/Makefile.am (TESTS): Update.
25126	(LOG_COMPILER): Rename to TEST_LOG_COMPILER.
25127
251282014-01-31  Mike Frysinger  <vapier@gentoo.org>
25129
25130	net: add more sockopt options.
25131	This syncs with the defines as available in linux-3.13.
25132
25133	* net.c (sockipoptions): Add IP_IPSEC_POLICY, IP_XFRM_POLICY,
25134	IP_PASSSEC, IP_TRANSPARENT, IP_ORIGDSTADDR, IP_RECVORIGDSTADDR,
25135	IP_MINTTL, IP_NODEFRAG, IP_UNBLOCK_SOURCE, IP_BLOCK_SOURCE,
25136	IP_ADD_SOURCE_MEMBERSHIP, IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_GROUP,
25137	MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE, MCAST_LEAVE_GROUP,
25138	MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP, IP_MULTICAST_ALL,
25139	IP_UNICAST_IF.
25140
251412014-01-08  Chris Dearman  <chris.dearman@imgtec.com>
25142
25143	mips: fix sigaction reporting.
25144	MIPS userland uses the same sigaction structure with a full signal
25145	mask for old_sigaction and new_sigaction and does does not have
25146	an sa_restorer field.
25147
25148	These changes have been tested on MIPS O32 big/little endian, MIPS N64
25149	big endian and x86-64.
25150
25151	* signal.c (old_sigaction) [MIPS]: Add definition for MIPS.
25152	(decode_old_sigaction) [MIPS]: Print sa_mask according to its definition.
25153	(new_sigaction) [MIPS]: Add definition for MIPS.
25154
251552014-01-08  Dmitry V. Levin  <ldv@altlinux.org>
25156
25157	Factor out struct sigaction printing code.
25158	* signal.c [HAVE_SIGACTION] (decode_old_sigaction): New function.
25159	[HAVE_SIGACTION] (sys_sigaction): Use it.
25160	(decode_new_sigaction): New function.
25161	(sys_rt_sigaction): Use it.
25162
251632014-01-08  Dmitry V. Levin  <ldv@altlinux.org>
25164
25165	tests: add a test for rt_sigaction output.
25166	Since "struct sigaction" varies between architectures, rt_sigaction
25167	decoding sometimes produces incorrect output.  This test is expected
25168	to catch basic rt_sigaction decoding bugs.
25169
25170	Based on a patch proposed by Chris Dearman.
25171
25172	* tests/sigaction.c: New file.
25173	* tests/sigaction.awk: Likewise.
25174	* tests/sigaction.sh: New test.
25175	* tests/Makefile.am (check_PROGRAMS): Add sigaction.
25176	(TESTS): Add sigaction.sh.
25177	(EXTRA_DIST): Add sigaction.awk.
25178	* tests/.gitignore: Add sigaction.
25179
251802014-01-05  Kirill A. Shutemov  <kirill.shutemov@linux.intel.com>
25181
25182	mem: add missed MAP_HUGETLB mmap flag.
25183	* mem.c (mmap_flags): Add MAP_HUGETLB mmap flag.
25184
25185	Acked-by: Mike Frysinger <vapier@gentoo.org>
25186
251872013-12-31  Mike Frysinger  <vapier@gentoo.org>
25188
25189	Delete old PTRACE_{PEEK,POKE}USR logic.
25190	The code base has settled on PTRACE_{PEEK,POKE}USER (with an E) and has
25191	logic in defs.h to make sure it's set sanely.  Delete this old logic as
25192	the defs.h takes care of it now.
25193
25194	* process.c: Delete PTRACE_PEEKUSR/PTRACE_POKEUSR defines.
25195	* signal.c: Likewise.
25196	* syscall.c: Delete PTRACE_PEEKUSR define.
25197	* util.c: Likewise.
25198
251992013-12-31  Mike Frysinger  <vapier@gentoo.org>
25200
25201	Decode the O_PATH flag.
25202	* file.c (open_mode_flags): Add O_PATH.
25203
252042013-11-13  Dmitry V. Levin  <ldv@altlinux.org>
25205
25206	Remove unused configure checks.
25207	* configure.ac (AC_CHECK_FUNCS): Remove _sys_siglist and sys_siglist.
25208	(AC_CHECK_DECLS): Likewise.
25209
252102013-11-13  Dmitry V. Levin  <ldv@altlinux.org>
25211
25212	Assume that <sys/ptrace.h> provides a valid ptrace prototype.
25213	We used to explicitly list architectures where <sys/ptrace.h> from glibc
25214	is known to provide a valid prototype for ptrace, and use a homegrown
25215	replacement for all the rest.  Situation seems to be better nowadays,
25216	glibc is not the only libc available, so let's use ptrace prototype from
25217	<sys/ptrace.h> by default, leaving the replacement for rare broken cases
25218	if any.
25219
25220	* defs.h: Use ptrace prototype workaround iff
25221	NEED_PTRACE_PROTOTYPE_WORKAROUND is defined.
25222
252232013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25224
25225	Stop using _LFS64_LARGEFILE.
25226	There is only one place left in the code where strace guesses whether
25227	libc provides LFS64 functions and structures.  The most natural thing to
25228	do there is to check for _LARGEFILE64_SOURCE - the macro provided by
25229	glibc.  Other libc implementations that provide nondegenerate LFS64
25230	interfaces are expected to define this macro as well.
25231
25232	* defs.h (_LFS64_LARGEFILE): Remove.
25233	* strace.c: Use _LARGEFILE64_SOURCE instead of _LFS64_LARGEFILE.
25234
252352013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25236
25237	Define truncate64, ftruncate64, and getdents64 decoders unconditionally.
25238	These decoders are referenced by most architectures, there were no
25239	undefined references so far because _LFS64_LARGEFILE appears to be
25240	always defined by glibc when _GNU_SOURCE is defined.
25241
25242	* file.c (sys_truncate64, sys_ftruncate64, sys_getdents64): Define
25243	unconditionally.
25244
252452013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25246
25247	Define printflock64 only if it is referenced by other code.
25248	* configure.ac (AC_CHECK_TYPES): Add struct flock64.
25249	* desc.c (HAVE_F_SETLK64, HAVE_F_SETLKW64, HAVE_F_GETLK64): New macros.
25250	[!HAVE_STRUCT_FLOCK64] (struct flock64): Define.
25251	(printflock64): Define only if referenced by other code.
25252	(sys_fcntl): Handle F_FREESP64, F_SETLK64, F_SETLKW64, and F_GETLK64 iff
25253	these constants are defined and differ from their non-64bit versions.
25254
252552013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25256
25257	Make PTRACE_PEEKUSER/PTRACE_POKEUSER checks less glibc specific.
25258	* configure.ac (AC_CHECK_DECLS): Add PTRACE_PEEKUSER and
25259	PTRACE_POKEUSER.
25260	* defs.h: Define PTRACE_PEEKUSER and PTRACE_POKEUSER only if
25261	they are not provided by <sys/ptrace.h>.
25262
25263	Reported by John Spencer.
25264
252652013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25266
25267	Remove unneeded redefinitions of IPPROTO_* macros.
25268	IPPROTO_* macros are defined by <netinet/in.h>, no need to redefine
25269	them.
25270
25271	* net.c (IPPROTO_EGP, IPPROTO_PUP, IPPROTO_IDP, IPPROTO_IGMP,
25272	IPPROTO_RAW, IPPROTO_MAX): Remove.
25273
25274	Reported by John Spencer.
25275
252762013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25277
25278	Remove unused AC_OFF_T_IS_LONG_LONG configure check.
25279	* configure.ac: Remove AC_OFF_T_IS_LONG_LONG.
25280	* m4/long_long.m4: Likewise.
25281
25282	Remove unused code.
25283	* configure.ac (AC_CHECK_TYPES): Remove struct opthdr and
25284	struct t_opthdr.
25285	* net.c (print_sock_optmgmt): Remove.
25286
252872013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25288
25289	Use struct sigcontext instead of struct sigcontext_struct.
25290	* configure.ac (AC_CHECK_TYPES): Remove struct sigcontext_struct.
25291	* signal.c (sys_sigreturn) [S390 || S390X || POWERPC || ALPHA): Replace
25292	struct sigcontext_struct with struct sigcontext.
25293
25294	Reported by John Spencer.
25295
252962013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25297
25298	Use standard names of sched_param structure members.
25299	* process.c (sys_sched_setscheduler, sys_sched_getparam,
25300	sys_sched_setparam): Use portable struct sched_param member name
25301	sched_priority instead of glibc specific __sched_priority.
25302
25303	Reported by John Spencer.
25304
253052013-11-12  Dmitry V. Levin  <ldv@altlinux.org>
25306
25307	Make SIGEV_THREAD_ID decoding less glibc specific.
25308	SIGEV_THREAD_ID decoding requires access to an internal member of
25309	struct sigevent.  There seems to be no portable way to do it besides
25310	adding a configure check.
25311
25312	* configure.ac (AC_CHECK_MEMBERS): Check for
25313	struct sigevent._sigev_un._pad and struct sigevent.__pad.
25314	* time.c (printsigevent): Use an appropriate struct sigevent member
25315	to print thread id.
25316
25317	Reported by John Spencer.
25318
253192013-11-11  Dmitry V. Levin  <ldv@altlinux.org>
25320
25321	Remove unused configure checks.
25322	* configure.ac (AC_CHECK_MEMBERS): Remove T_conn_res.QUEUE_ptr,
25323	T_conn_res.ACCEPTOR_id, dqblk.dqb_curblocks, sigcontext.sc_hi2.
25324
253252013-11-11  Dmitry V. Levin  <ldv@altlinux.org>
25326
25327	Assume "long long" availability.
25328	Most of the code already uses long long types unconditionally.
25329
25330	* configure.ac: Remove the check for long long.
25331	* file.c (printstat64): Remove HAVE_LONG_LONG checks, use %llu format
25332	string unconditionally.
25333
253342013-11-11  Dmitry V. Levin  <ldv@altlinux.org>
25335
25336	Include <sys/poll.h> only if there is no <poll.h>
25337	* pathtrace.c: Do not include <sys/poll.h> if <poll.h> is available.
25338	* stream.c: Likewise.
25339
25340	Move io_* syscalls decoding to a separate file.
25341	* desc.c (sys_io_setup, sys_io_destroy, sys_io_submit, sys_io_cancel,
25342	sys_io_getevents, declarations from libaio.h): Move to ...
25343	* aio.c: new file.
25344	* Makefile.am (strace_SOURCES): Add aio.c.
25345
253462013-11-11  Denys Vlasenko  <dvlasenk@redhat.com>
25347
25348	Stop using external libaio.h.
25349	This change incorporates a partial copy instead
25350	of using external libaio.h.
25351	Why?
25352	Because we want to properly decode 32-bit aio calls
25353	by 64-bit strace. For that, we need more definitions than
25354	libaio.h provides.
25355	(These defs are not done yet, but will eventually be done).
25356	Keeping our local 32-bit compat defs in sync with libaio.h
25357	_without seeing libaio structs_ is hard/more bug prone.
25358	A smaller benefit is that we don't need libaio installed.
25359
253602013-11-11  Denys Vlasenko  <dvlasenk@redhat.com>
25361
25362	sys_io_submit: simplify iocb_cmd_lookup() helper.
25363	This helper returns two values (a string and an enum).
25364	The caller prints the string. It's simpler to just print
25365	the string in the caller itself. This eliminates
25366	"return by reference" and more importantly, an intermediate
25367	static string buffer for the string result.
25368
25369	Since function of the helper is different now,
25370	it is renamed to tprint_lio_opcode().
25371
253722013-11-11  Denys Vlasenko  <dvlasenk@redhat.com>
25373
25374	sys_io_submit: stop traversing iocb vector after first failure.
25375	The program may use a very large nr but supply either outright
25376	invalid iocbpp[], or one with far fewer elements than nr.
25377	We used to try reading iocbpp[i] until i == nr.
25378	With this change, we stop on the first failure.
25379
253802013-11-09  Denys Vlasenko  <dvlasenk@redhat.com>
25381
25382	Fix pathtrace_match() to match recent fixes to select decoding.
25383
25384	Fix select decoding on e.g. 32-bit ppc process by 64-bit strace.
25385	Added next_set_bit() function which finds the next set bit,
25386	properly taking into account word size of the traced process.
25387	Use it in decode_select() instead of fd_isset().
25388	Also, properly round fdsize up to word size of traced process,
25389	not to strace's word size.
25390
253912013-11-06  Denys Vlasenko  <dvlasenk@redhat.com>
25392
25393	Speed up and explain fd_isset()
25394
253952013-11-05  Dr. David Alan Gilbert  <dave@treblig.org>
25396
25397	Add a test for the latest select decoding fix.
25398	* test/select.c (main): Add a test for nfds larger than FD_SETSIZE.
25399
254002013-11-05  Dmitry V. Levin  <ldv@altlinux.org>
25401
25402	Fix select decoding for glibc in _FORTIFY_SOURCE mode.
25403	glibc in _FORTIFY_SOURCE mode raises SIGABRT when descriptor greater
25404	or equal to FD_SETSIZE is passed to FD_ISSET.  Select family syscalls,
25405	however, can legitimately accept such descriptors.  To overcome this
25406	limitation, we have to replace FD_ISSET with an equivalent that imposes
25407	no such restrictions.
25408
25409	* desc.c (fd_isset): New function.
25410	(decode_select): Use it instead of FD_ISSET.
25411
254122013-11-05  Dmitry V. Levin  <ldv@altlinux.org>
25413
25414	More select decoding fixes.
25415	* desc.c (decode_select): Actually print arg[0] as int on entering
25416	syscall.  When arg[0] is negative, do not attempt to fetch and decode
25417	descriptor sets on entering syscall, kernel will reject it anyway.
25418	On exiting syscall, stop checking descriptor sets as soon as all
25419	returned descriptors are found.
25420
254212013-11-05  Denys Vlasenko  <dvlasenk@redhat.com>
25422
25423	Truncate arg[0] to int in select decoding.
25424	This matches kernel's behavior.
25425
25426	test/select.c: make comment more understandable.
25427
254282013-11-05  Dr. David Alan Gilbert  <dave@treblig.org>
25429
25430	Fix select decoding with bogus (huge or negative) nfds.
25431	We used to allocate and fetch bit arrays using a sanitized
25432	length, but then iterate over them with "j < arg[0]" condition,
25433	where arg[0] is not sanitized. This segfaults if arg[0] is huge
25434	or negative. This change fixes this.
25435
25436	Add test/select.c to capture the case.
25437
254382013-09-26  Ali Polatel  <alip@exherbo.org>
25439
25440	Work around conflict between <sys/ptrace.h> and <linux/ptrace.h>
25441	Since glibc-2.18~39 <sys/ptrace.h> defines ptrace_peeksiginfo_args
25442	which collides with <linux/ptrace.h>.
25443
25444	* configure.ac: Check for `struct ptrace_peeksiginfo_args' in
25445	<sys/ptrace.h>.
25446	* process.c: Work around potential conflict between <sys/ptrace.h>
25447	and <linux/ptrace.h> by redefining ptrace_peeksiginfo_args.
25448	* signal.c: Likewise.
25449	* syscall.c: Likewise.
25450	* util.c: Likewise.
25451
254522013-09-11  Vineet Gupta  <Vineet.Gupta1@synopsys.com>
25453
25454	Add support for ARC Cores from Synopsys.
25455	Take #2 on mainlining strace support for ARC (last one was 4.6 based back
25456	in March 2011), see
25457	http://sourceforge.net/p/strace/mailman/message/27210168/
25458
25459	The syscall ABI is asm-generic/unistd.h based (so no legacy syscalls),
25460	hence very similar to metag port.
25461
25462	test/* all seem to work well.
25463
25464	* linux/arc/ioctlent.h.in: New file.
25465	* linux/arc/syscallent.h: Likewise.
25466	* Makefile.am (EXTRA_DIST): Add linux/arc/ioctlent.h.in and
25467	linux/arc/syscallent.h.
25468	* configure.ac: Add ARC to the list of supported architectures.
25469	* defs.h: Add ARC support.
25470	* process.c (struct_user_offsets): Likewise.
25471	* signal.c (sys_sigreturn): Likewise.
25472	* syscall.c (print_pc, get_regset, get_regs, get_scno, get_syscall_args,
25473	get_syscall_result, get_error): Likewise.
25474	* util.c (change_syscall): Likewise.
25475
25476	Acked-by: Mike Frysinger <vapier@gentoo.org>
25477
254782013-09-11  William Manley  <william.manley@youview.com>
25479
25480	Add support for decoding sync_file_range.
25481	* file.c (sync_file_range_flags): New xlat structure.
25482	(sys_sync_file_range, sys_sync_file_range2): New functions.
25483	* linux/syscall.h (sys_sync_file_range, sys_sync_file_range2): New
25484	prototypes.
25485	* linux/dummy.h (sys_sync_file_range, sys_sync_file_range2): Remove.
25486	* linux/mips/syscallent-o32.h: Set the number of sync_file_range
25487	arguments to 7.
25488
254892013-09-11  Mike Frysinger  <vapier@gentoo.org>
25490
25491	fanotify_mark: fix number of args for 32bit arches.
25492	The fanotify_mark func takes a 64bit mask, so 32bit arches have to split
25493	it up into two fields.  When the syscall was added, it was listed as only
25494	having 5 fields total (since that's correct for 64bit systems).
25495
25496	* linux/arm/syscallent.h: Set the number of fanotify_mark arguments to 6.
25497	* linux/bfin/syscallent.h: Likewise.
25498	* linux/hppa/syscallent.h: Likewise.
25499	* linux/i386/syscallent.h: Likewise.
25500	* linux/m68k/syscallent.h: Likewise.
25501	* linux/metag/syscallent.h: Likewise.
25502	* linux/microblaze/syscallent.h: Likewise.
25503	* linux/mips/syscallent-o32.h: Likewise.
25504	* linux/or1k/syscallent.h: Likewise.
25505	* linux/powerpc/syscallent.h: Likewise.
25506	* linux/s390/syscallent.h: Likewise.
25507	* linux/sh/syscallent.h: Likewise.
25508	* linux/sparc/syscallent.h: Likewise.
25509	* linux/tile/syscallent1.h: Likewise.
25510
25511	Acked-by: Chris Metcalf <cmetcalf@tilera.com> [for tile]
25512
255132013-09-11  Dmitry V. Levin  <ldv@altlinux.org>
25514
25515	x86, x86_64: fix compilation warnings.
25516	Fix "dereferencing type-punned pointer will break strict-aliasing rules"
25517	warnings introduced by commit v4.8-52-gb51f364.
25518
25519	* signal.c (sys_sigreturn): Avoid dereferencing type-punned pointers.
25520
255212013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>
25522
25523	Remove rt parameter from [s]printsigmask()
25524	In almost all cases, the parameter was 1 ("decode RT sigs too").
25525	This change hardwires it to be 1.
25526
25527	The cases where it was 0 are, and why the change to "decode RT sigs too"
25528	is fine:
25529
25530	IA64: 64-bit arch, all 64 signals fit in one word in any case.
25531	S390[x]: sc.oldmask is a sigset_t on kernel side,
25532		(sigset_t *)&sc.oldmask[0] does contain all 64 signals.
25533	TILE: uc.uc_sigmask is a sigset_t on kernel side,
25534		memcpy(&sigm, &uc.uc_sigmask, NSIG / 8) copies all 64 signals.
25535
255362013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>
25537
25538	Convert some uses of long_to_sigmask+printsigmask to sprintsigmask_long.
25539	This allows to drop long_to_sigmask function,
25540	and a whole bunch of sigset_t variables.
25541
25542	Simplify some sigmask manipulations.
25543
25544	Add compat support for sys_pselect6.
25545
25546	I386: fix signedness mismatch warning.
25547	&i386_regs.esp is a pointer to long, not unsigned long.
25548	It needs a cast.
25549
255502013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>
25551
25552	Fix sigset printing via print_sigset().
25553	Replace print_sigset() with print_sigset_addr_len(),
25554	which takes not only addr, but also len parameter.
25555	This allows us to drop "do we need to print RT signals?" parameter,
25556	and this fixes RT signals printing in many syscalls.
25557
25558	sys_epoll_pwait: print RT signals too, print sigmask size argument.
25559
25560	sys_sigprocmask: print_sigset -> print_sigset_addr_len(current_wordsize),
25561	no change in functionality.
25562
25563	sys_sigpending: use print_sigset_addr_len(current_wordsize)
25564	instead of open-coding it.
25565
25566	sys_rt_sigprocmask: use print_sigset_addr_len instead of open-coding it.
25567	sys_rt_sigpending: ditto.
25568	sys_rt_sigsuspend: ditto.
25569	sys_rt_sigtimedwait: ditto.
25570
25571	do_signalfd: print_sigset -> print_sigset_addr_len. This fixes
25572	RT signals printing (wasn't showing them before).
25573
25574	sys_ppoll: ditto.
25575
25576	copy_sigset_len() is folded into its only user, print_sigset_addr_len(),
25577	and copy_sigset() is gone.
25578
25579	While at it, checked kernel sources and noted where kernel enforces
25580	sigset_size == NSIG / 8 (== sizeof(kernel_sigset_t)),
25581	and where it allows word-sized sigset_size ([rt_]sigpending).
25582
255832013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>
25584
25585	sys_rt_sigaction: fix sigset copying.
25586	In practice, we always copy as many bytes as syscall param says
25587	(8, or 16 on mips). However, malicious program can call sigaction
25588	with wrong sigset size. Such syscall will result in EINVAL,
25589	but we (strace) end up copying 128 bytes (sizeof(sigset_t)),
25590	which copyes some garbage from stack after struct sigaction.
25591
25592	Now we always copy NSIG / 8 bytes (which is 8 bytes, or 16 on mips).
25593
255942013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>
25595
25596	ARM: remove wrong NSIG = 32 define.
25597	ARM in fact has 64 signals (1..64), and NSIG should be 65
25598	(as usual, rememebr that NSIG_libc == NSIG_kernel+1).
25599
25600	I carefully reviewed all usages of NSIG. In syscall.c,
25601	the only usage is:
25602	        for (i = 0; i <= NSIG; i++)
25603	                if (strcasecmp(s, signame(i) + 3) == 0)...
25604	which is safe even if NSIG is way too big - signame(i)
25605	returns a well-formed string for any i.
25606
25607	In signal.c, memcpy(&sigset, &sc.sc_mask, NSIG / 8) is used by
25608	IA64 and TILE code, so ARM change can't affect it. And final
25609	usage is:
25610	 struct new_sigaction::unsigned long sa_mask[NSIG / sizeof(long)];
25611	It will grow on ARM (and become correct in the process).
25612	Its only use is
25613	 memcpy(&sigset, &sa.sa_mask, NSIG / 8);
25614	 printsigmask(&sigset, 1);
25615	which used to copy garbage in high bits, now it will copy actual data.
25616
256172013-07-17  Denys Vlasenko  <dvlasenk@redhat.com>
25618
25619	ARM: fix sigreturn decoding.
25620	Decoding of test/sigreturn testcase:
25621	Was:
25622	sigreturn() (mask [QUIT TRAP ABRT BUS SEGV USR2 PIPE STKFLT STOP XCPU VTALRM PROF WINCH IO PWR RTMIN]) = 0
25623	Now:
25624	sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0
25625
256262013-07-16  Denys Vlasenko  <dvlasenk@redhat.com>
25627
25628	Group USE_CUSTOM_PRINTF define with other tweakables.
25629	No code changes.
25630
256312013-07-16  Denys Vlasenko  <dvlasenk@redhat.com>
25632
25633	Improve sigreturn decoding on x86 to show RT signal bits too.
25634	This includes decoding of 32-bit sigreturn by 64-bit strace,
25635	which previously wasn't done.
25636
25637	Added a test for it.
25638
256392013-07-12  Anton Blanchard  <anton@samba.org>
25640
25641	powerpc: enhance 32/64bit detection.
25642	We were using uname to determine if userspace was 32 or 64bit.
25643	This fails when we have a 64bit kernel and a 32bit userspace.
25644
25645	* configure.ac (powerpc*): Similar to x86, use a runtime test
25646	to determine if we are 32 or 64bit.
25647
256482013-07-12  Anton Blanchard  <anton@samba.org>
25649
25650	powerpc: fix some compiler warnings.
25651	Fix a number of differing signedness warnings when building on
25652	powerpc.
25653
25654	powerpc: fix iflag build issue (static -> extern)
25655
256562013-07-10  Denys Vlasenko  <dvlasenk@redhat.com>
25657
25658	PTRACE_SEIZE can set ptrace options immediately, use this feature.
25659	This eliminates some rare bugs, such as post-execve SIGTRAP
25660	generation when we attach to a process, and it manages to finish
25661	execve'ing before we set TRACEEXEC option to suppress that.
25662
256632013-07-08  Denys Vlasenko  <dvlasenk@redhat.com>
25664
25665	If -o|logger is in use, exit trace loop if nprocs == 0.
25666
25667	Exit trace loop if got ECHILD, not if nprocs == 0.
25668	Comment gives a testcase which wasn't handled correctly
25669	by the old code.
25670
256712013-07-07  Denys Vlasenko  <dvlasenk@redhat.com>
25672
25673	s390[x]: get rid of syscall_mode, delete code which never triggers.
25674	Before this change, the logic was as follows:
25675	syscall entry:
25676	  get_scno:
25677	    syscall_mode = GPR2
25678	    scno = syscall_mode unless syscall_mode == -ENOSYS
25679	    (if -ENOSYS, scn is retrieved by decoding current insn)
25680	  fixup:
25681	    gpr2 = GPR2
25682	    syscall_mode = scno unless syscall_mode == -ENOSYS
25683	    if (gpr2 != syscall_mode) stray_entry
25684	syscall exit:
25685	  get_res:
25686	    gpr2 = GRP2
25687	  fixup:
25688	    syscall_mode = scno unless syscall_mode == -ENOSYS
25689	    if (WAITEXECVE && gpr2 in (-ENOSYS, scno)) gpr2 = 0;
25690	  get_error:
25691	    gpr2 is retval
25692
25693	Entry fixup's if() can never trigger:
25694	regardless whether GPR2 is -ENOSYS or not, syscall_mode is always
25695	equal to GRP2 value there. So it can be removed.
25696
25697	On sysexit path, syscall mode is never used.
25698
25699	Therefore, syscall_mode variable is deleted. grp2 is read from
25700	GPR2 register in get_scno, redundant read in entry fixup is removed.
25701	As a result, entry fixup's s390 code block vanishes completely.
25702
25703	gpr2 variable is renamed s390_gpr2 to match the convention used
25704	by other arches.
25705
257062013-07-04  Denys Vlasenko  <dvlasenk@redhat.com>
25707
25708	ARM: add STRACE_KNOWS_ONLY_EABI define which can be used to omit OABI support
25709
25710	Add paranoia check before passing a long to pid2tcb(int pid)
25711
257122013-07-02  Denys Vlasenko  <dvlasenk@redhat.com>
25713
25714	In debug output, show waitpid status with 6 hex digits, not 4.
25715	This shows event byte values better (without variable offset):
25716
25717	 [wait(0x01057f) = 29491] WIFSTOPPED,sig=SIGTRAP,EVENT_FORK (1)
25718	 [wait(0x80057f) = 29492] WIFSTOPPED,sig=SIGTRAP,EVENT_STOP (128)
25719	         ^^
25720
257212013-07-02  Denys Vlasenko  <dvlasenk@redhat.com>
25722
25723	Replace suspicious popen_pid assignment with an obviously correct one.
25724	popen_pid = vfork() does work correctly, but for a subtle reason
25725	that wrong assignment of 0 happens in the child _first_,
25726	and _then_ correct value overwrites it in the parent.
25727
25728	(And in a hyphothetical system where vfork = fork,
25729	popen_pid wouldn't be shared, so it will also be ok.)
25730
25731	However, it's not necessary to be difficult.
25732	This change makes it so that assignment is done only in parent.
25733
257342013-07-01  Denys Vlasenko  <dvlasenk@redhat.com>
25735
25736	Convert trace() from returning int to returning void.
25737	The cleanup sequence in error cases, and on normal code path
25738	was nearly the same, no point in duplicating it.
25739
25740	Remove ia64-specific printing of current address on signal delivery.
25741	The address is printed anyway by printleader() if -i is active.
25742
25743	Rename ia32 to ia64_ia32mode, and make it bool, not long.
25744	Grepping for just ia32 was turning up many false positives.
25745
257462013-06-30  Denys Vlasenko  <dvlasenk@redhat.com>
25747
25748	Fold is_restart_error() into its sole user.
25749
257502013-06-29  Denys Vlasenko  <dvlasenk@redhat.com>
25751
25752	Update qemu_multiarch_testing/README.
25753
257542013-06-28  Denys Vlasenko  <dvlasenk@redhat.com>
25755
25756	sys_clone: add a comment about CLONE_PTRACE and CLONE_UNTRACED.
25757	No code changes.
25758
25759	POWERPC: get rid of "static long ppc_result"
25760
25761	POWERPC: read ppc_regs.nip if -i.
25762
25763	POWERPC: if GETREGS fails with EIO, don't try it again.
25764
25765	Get rid of powerpc_getreg(), it's a copy of upeek()
25766
25767	Change upeek() to take pid, not full tcp.
25768	This will be used by next change.
25769
257702013-06-26  Anton Blanchard  <anton@samba.org>
25771
25772	powerpc: Provide a fallback for old kernels without PTRACE_GETREGS.
25773	PTRACE_GETREGS was added to the ppc kernel in 2.6.23. In order to
25774	provide backward compatibility for very old kernels, add a manual
25775	fallback.
25776
25777	* syscall.c (powerpc_getreg, powerpc_getregs_old): New functions.
25778	(get_regs): Call powerpc_getregs_old if PTRACE_GETREGS is not supported.
25779
257802013-06-26  Anton Blanchard  <anton@samba.org>
25781
25782	powerpc: Use PTRACE_GETREGS to fetch all registers.
25783	* defs.h: declare ppc_regs and get_regs_error.
25784	* signal.c (sys_sigreturn): Use ppc_regs instead of upeek.
25785	* syscall.c: define ppc_regs.
25786	(printcall): Use ppc_regs instead of upeek.
25787	(get_scno): Replace multiple upeek calls with one PTRACE_GETREGS call.
25788	(get_syscall_result): Likewise.
25789
257902013-06-26  Denys Vlasenko  <dvlasenk@redhat.com>
25791
25792	Another manpage tweak.
25793
25794	Manpage update.
25795
25796	Update build_static_example.sh.
25797	Now it also contains a tested example of i686 build on 64-bit host.
25798
25799	In -f mode, do not assume that new pid is stopped - handle exits too.
25800
258012013-06-26  Denys Vlasenko  <dvlasenk@redhat.com>
25802
25803	Set strace_child only in the right branch.
25804	"strace_child = pid" assignment was racing in NOMMU case
25805	because of vfork (no way to know which process would win).
25806
25807	After this change, strace_child is set to nonzero only
25808	in one process after [v]fork.
25809
258102013-06-26  Denys Vlasenko  <dvlasenk@redhat.com>
25811
25812	Get rid of TCB_INUSE and TCB_STRACE_CHILD.
25813	We can use tcb::pid == 0 as an indicator of free tcb,
25814	and we already have strace_child variable which holds
25815	pid of our child, if any.
25816
258172013-06-21  Denys Vlasenko  <dvlasenk@redhat.com>
25818
25819	Fix debug output of wait4 result (was reusing buf[] on unknown events)
25820
25821	Show PTRACE_EVENT_STOP correctly in debug output.
25822
258232013-06-21  Denys Vlasenko  <dvlasenk@redhat.com>
25824
25825	Panic a bit less when we see an unknown pid.
25826	I stumbeld over this case when I used "exec stace ...".
25827
25828	* strace.c (trace): Do not exit if we see an unknown pid in wait4.
25829
258302013-06-21  Denys Vlasenko  <dvlasenk@redhat.com>
25831
25832	detach(): Reorganize code. Logic is the same.
25833	* strace.c (detach): Use goto's instead of excessive nesting.
25834	Drop sigstop_expected and interrupt_done variables.
25835
25836	Eat pending SIGSTOP _before_ PTRACE_DETACH in detach()
25837	* strace.c (detach): If TCB_IGNORE_ONE_SIGSTOP is set,
25838	di not PTRACE_DETACH - wait for SIGSTOP first.
25839
258402013-06-20  Denys Vlasenko  <dvlasenk@redhat.com>
25841
25842	detach(): warn if we see ECHILD from waitpid.
25843	* strace.c (detach): Warn if we see ECHILD from waitpid.
25844	Explain in comments that we don't normally expect !WIFSTOPPED
25845	either, and also that PTRACE_CONT failure isn't expected
25846	(the "break" there is a "I'm confused, bailing out" code style)..
25847
25848	Improve error messages in detach()
25849	* strace.c (detach): Change return type from int to void.
25850	Improve error meesages: show PID, tell exactly which operation fails.
25851
258522013-06-20  Denys Vlasenko  <dvlasenk@redhat.com>
25853
25854	Remove workarounds for ancient kernels lacking __WALL.
25855	__WALL is available and working at least since 2.4 kernels: 10 years ago.
25856
25857	* strace (detach): Remove workarounds for ancient kernels lacking __WALL.
25858	Add missing EINTR check.
25859	(trace): Remove workarounds for ancient kernels lacking __WALL.
25860	Remove redundant double error printout.
25861
258622013-06-20  Denys Vlasenko  <dvlasenk@redhat.com>
25863
25864	USE_SEIZE: fix detaching from stopped processes.
25865	V3: split SEIZE/!SEIZE code paths to reduce confusion.
25866	Extensively comment every possible case.
25867	Verified that all tests/detach* tests work in both SEIZE and !SEIZE
25868	cases.
25869
25870	* strace.c (detach): If PTRACE_SEIZE API is in use, stop the tracee
25871	using PTRACE_INTERRUPT instead of sending it a SIGSTOP.
25872	In a subsequent waitpid loop, correctly wait and suppress SIGSTOP
25873	on detach if PTRACE_INTERRUPT wasn't used, or wait for any ptrace
25874	stop and detach without suppressing signals.
25875
258762013-06-19  Dmitry V. Levin  <ldv@altlinux.org>
25877
25878	tests: disable /proc based checks when /proc is not mounted.
25879	* tests/detach-running: Disable /proc based checks when
25880	/proc/self/status is not available.
25881	* tests/detach-sleeping: Likewise.
25882	* tests/detach-stopped: Likewise.
25883
258842013-06-19  Denys Vlasenko  <dvlasenk@redhat.com>
25885
25886	tests/detach-{running,sleeping,stopped}: check post-detach state.
25887	Check that traced process still exists and is in a right state
25888	after strace detached from it.
25889
258902013-06-19  Dmitry V. Levin  <ldv@altlinux.org>
25891
25892	tests: ensure that strace can detach from running processes.
25893	* tests/detach-running: New test.
25894	* tests/Makefile.am (TESTS): Add it.
25895
25896	tests: ensure that strace does not leave sleeping processes stopped.
25897	* tests/detach-sleeping: Do not send SIGCONT to the sleeping process.
25898
258992013-06-18  Dmitry V. Levin  <ldv@altlinux.org>
25900
25901	tests: fix parallel-tests support in detach-* tests.
25902	* tests/detach-sleeping: Use $LOG file for set_ptracer_any output.
25903	* tests/detach-stopped: Likewise.
25904
25905	tests: parametrize "sleep 1"
25906	* tests/init.sh (SLEEP_A_BIT): New variable.
25907	* tests/detach-sleeping: Use it.
25908	* tests/detach-stopped: Likewise.
25909
25910	tests: ensure that strace can detach from sleeping and stopped processes
25911	* tests/set_ptracer_any.c: New file.
25912	* tests/detach-sleeping: New test.
25913	* tests/detach-stopped: Likewise.
25914	* tests/Makefile.am (check_PROGRAMS): Add set_ptracer_any.
25915	(TESTS): Add detach-sleeping and detach-stopped.
25916	* tests/.gitignore: Add set_ptracer_any.
25917
259182013-06-18  Dmitry V. Levin  <ldv@altlinux.org>
25919
25920	tests: enhance timeout checks.
25921	Run each test using a wrapper that does all necessary timeout checks.
25922
25923	* tests/run.sh: New file.
25924	* tests/Makefile.am (EXTRA_DIST, LOG_COMPILER): Add it.
25925	* tests/init.sh (check_strace, check_timeout): Remove.
25926	* tests/detach-stopped: Update callers.
25927	* tests/net: Likewise.
25928	* tests/ptrace_setoptions: Likewise.
25929	* tests/qual_syscall: Likewise.
25930	* tests/stat: Likewise.
25931	* tests/strace-f: Likewise.
25932
259332013-06-18  Dmitry V. Levin  <ldv@altlinux.org>
25934
25935	tests: enable parallel-tests support.
25936	* configure.ac (AM_INIT_AUTOMAKE): Add parallel-tests.
25937
25938	tests: prepare for parallel-tests support.
25939	* tests/Makefile.am (CLEANFILES): Calculate dynamically from TESTS.
25940	* tests/init.sh (LOG): New variable.
25941	* tests/detach-stopped: Use it.
25942	* tests/net: Likewise.
25943	* tests/qual_syscall: Likewise.
25944	* tests/stat: Likewise.
25945	* tests/strace-f: Likewise.
25946
259472013-06-18  Denys Vlasenko  <dvlasenk@redhat.com>
25948
25949	Cleanups. No logic changes.
25950	* defs.h: Define new ptrace constants unconditionally.
25951	* strace.c (detach): Fix comment.
25952	(trace): Remove now unnecessary "if USE_SEIZE".
25953
259542013-06-05  Dmitry V. Levin  <ldv@altlinux.org>
25955
25956	maint: post-release administrivia.
25957	* NEWS: Add header line for next release.
25958
259592013-06-03  Dmitry V. Levin  <ldv@altlinux.org>
25960
25961	ioctlent: add UAPI support.
25962	* Makefile.am (IOCTLSORT_INCLUDEDIR): Define.
25963	(ioctlsort): Use it.
25964	* linux/ioctlent.sh (lookup_ioctls): Look into uapi directory tree.
25965	Strip "uapi/" prefix from output path names.
25966	* linux/ioctlent.h.in: Regenerate from v3.9 headers.
25967	* NEWS: Mention it.
25968
25969	Prepare for 4.8 release.
25970	* NEWS: Update for 4.8 release.
25971	* debian/changelog: 4.8-1.
25972	* strace.spec: 4.8-1.
25973
259742013-06-02  Dmitry V. Levin  <ldv@altlinux.org>
25975
25976	Fix "make dist" on recently added architectures.
25977	* Makefile.am (EXTRA_DIST): Add linux/aarch64/errnoent1.h,
25978	linux/aarch64/ioctlent.h.in, linux/aarch64/ioctlent1.h,
25979	linux/aarch64/signalent1.h, linux/aarch64/syscallent.h,
25980	linux/aarch64/syscallent1.h, linux/metag/ioctlent.h.in,
25981	linux/metag/syscallent.h, linux/or1k/ioctlent.h.in,
25982	linux/or1k/syscallent.h, linux/tile/errnoent1.h, linux/tile/ioctlent1.h,
25983	linux/tile/signalent1.h, linux/tile/syscallent1.h, linux/ubi-user.h,
25984	linux/xtensa/ioctlent.h.in, and linux/xtensa/syscallent.h.
25985
25986	Fix "make dist" regression introduced by commit v4.7-184-gd648f29.
25987	* Makefile.am (EXTRA_DIST): Add linux/ubi-user.h.
25988
259892013-05-28  Dmitry V. Levin  <ldv@altlinux.org>
25990
25991	Do not suppress signal delivery messages with -qq.
25992	Current implementation of -qq does not allow suppressing exit status
25993	messages without suppressing signal delivery messages, which is not
25994	good.  There is a traditional "-e signal=none" syntax that can be used
25995	to suppress all signal delivery messages.
25996	This partially reverts commit v4.7-222-g01997cf.
25997
25998	* strace.c (trace): Do not suppress signal delivery messages with -qq.
25999	* strace.1: Update documentation about -qq option.
26000
260012013-05-23  Chris Metcalf  <cmetcalf@tilera.com>
26002
26003	tile: use siginfo_t, not struct siginfo.
26004	As of glibc 2.16, "struct siginfo" is no longer supported,
26005	and "siginfo_t" must be used instead.
26006
26007	tile: remove MAP_CACHE_xxx support in mem.c.
26008	These flags support functionality in mmap() that has not been
26009	pushed back to the community, and which may or may not eventually
26010	end up being the final community model.  In the interim, having
26011	these flags unconditionally present for "#ifdef TILE" just means
26012	that the TILE build breaks if using the community versions of
26013	the kernel and glibc, so just revert the code until such time
26014	as it may end up in the community.
26015
260162013-05-17  Mike Frysinger  <vapier@gentoo.org>
26017
26018	Rename COPYRIGHT to COPYING.
26019	The standard name people have adopted is "COPYING" rather than
26020	"COPYRIGHT".  Use that as a lot of license scanning tools look for it.
26021
26022	* COPYRIGHT: Rename to ...
26023	* COPYING: ... this.
26024	* Makefile.am (EXTRA_DIST): Rename COPYRIGHT to COPYING.
26025	* README: Likewise.
26026	* strace.spec (%files): Likewise.
26027
260282013-05-17  Dmitry V. Levin  <ldv@altlinux.org>
26029
26030	Sync strace.spec and debian/ with packages.
26031	* debian/changelog: Sync with 4.7-1.
26032	* debian/strace.docs: Likewise.
26033	* strace.spec: Sync with 4.7-3.
26034
26035	Update PTRACE_O_* constants.
26036	* process.c (ptrace_setoptions_flags): Sync with Linux 3.9.
26037
26038	Update AF_*, PF_*, MSG_*, and TCP_* constants.
26039	* net.c (domains, addrfams, protocols, socktcpoptions): Sync with
26040	Linux 3.9.
26041
260422013-05-14  Dmitry V. Levin  <ldv@altlinux.org>
26043
26044	NOMMU: do not hide startup syscalls unless in -D mode.
26045	On NOMMU systems in "strace PROG" case, we have no way to attach to
26046	the tracee before it calls execve unless in -D mode.  That is, the
26047	first execve call is very likely to be missed, and setting
26048	hide_log_until_execve just results to empty log.
26049
26050	* strace.c (init) [NOMMU_SYSTEM]: Do not set hide_log_until_execve
26051	unless in -D mode.
26052
260532013-05-14  Dmitry V. Levin  <ldv@altlinux.org>
26054
26055	Make -D mode work when the Yama LSM is enabled.
26056	* strace.c [HAVE_PRCTL]: Include sys/prctl.h.
26057	(startup_child) [HAVE_PRCTL && PR_SET_PTRACER && PR_SET_PTRACER_ANY]:
26058	In -D mode, allow tracing the process that is going to become the
26059	tracee.
26060
26061	Update PR_* constants.
26062	* process.c (prctl_options): Add PR_SET_PTRACER.
26063
260642013-05-14  Denys Vlasenko  <dvlasenk@redhat.com>
26065
26066	Hide startup syscalls.
26067	Tested with "./strace [-D] [-q] [-bexecve] env true",
26068	all cases seem to work.
26069
26070	* defs.h: Declare new variable: bool hide_log_until_execve.
26071	* strace.c: Define hide_log_until_execve.
26072	Rename skip_startup_execve to skip_one_b_execve.
26073	(startup_child): Do not set skip_one_b_execve = 1 here.
26074	(init): If "strace PROG" case (as opposed to "strace -pPID"),
26075	set skip_one_b_execve and hide_log_until_execve to 1.
26076	(trace): Don't print signal messages if hide_log_until_execve == 1.
26077	* syscall.c (trace_syscall_entering):
26078	Skip syscall printing if hide_log_until_execve == 1.
26079	Reset hide_log_until_execve if we enter execve syscall.
26080	(trace_syscall_exiting): Skip syscall printing if hide_log_until_execve == 1.
26081
260822013-05-13  Daniel P. Berrange  <berrange@redhat.com>
26083
26084	Allow -q to be repeated for very quiet output.
26085	Even with the -q flag specified, tracing output is still mixed
26086	with messages about signals and process exit status, which is
26087	often irrelevant.  Allow the -q option to be repeated to force
26088	the suppression of signals / exit status info too.
26089
26090	* defs.h: Change 'qflag' from 'bool' to 'unsigned int'.
26091	* strace.1: Document ability to repeat '-q' option.
26092	* strace.c: Allow '-q' to be repeated to quieten process
26093	exit status and signal messages.
26094
260952013-05-11  Dmitry V. Levin  <ldv@altlinux.org>
26096
26097	mips o32: fix syscall table.
26098	* linux/mips/syscallent-o32.h: Add entries for getpmsg, putpmsg,
26099	get_mempolicy, set_mempolicy and vserver.  Fix names for umount,
26100	umount2, mmap, mmap2, pread64, pwrite64, sigaltstack and fstatat64
26101	syscalls.
26102
261032013-05-10  Dmitry V. Levin  <ldv@altlinux.org>
26104
26105	mips n64: fix syscall table.
26106	* linux/mips/syscallent-n64.h: Add entries for get_mempolicy,
26107	set_mempolicy and timerfd syscalls.  Fix entry for socket syscall.
26108	Fix names for pread64, pwrite64, shmat, rt_sigsuspend, sigaltstack
26109	and umount2 syscalls.
26110
26111	mips n32: fix syscall table.
26112	* linux/mips/syscallent-n32.h: Add entries for mbind, get_mempolicy,
26113	set_mempolicy and timerfd syscalls.  Fix entry for socket syscall.
26114	Fix handlers for truncate, ftruncate and getdents64 syscalls.
26115	Fix names for pread64, pwrite64, shmat, rt_sigsuspend, sigaltstack,
26116	umount2, and getdents64 syscalls.
26117
261182013-05-08  Dmitry V. Levin  <ldv@altlinux.org>
26119
26120	sync_file_range: fix number of syscall arguments.
26121	* linux/avr32/syscallent.h: Set the number of sync_file_range arguments
26122	to 6.
26123	* linux/bfin/syscallent.h: Likewise.
26124	* linux/hppa/syscallent.h: Likewise.
26125	* linux/i386/syscallent.h: Likewise.
26126	* linux/m68k/syscallent.h: Likewise.
26127	* linux/microblaze/syscallent.h: Likewise.
26128	* linux/mips/syscallent-o32.h: Likewise.
26129	* linux/or1k/syscallent.h: Likewise.
26130	* linux/s390/syscallent.h: Likewise.
26131	* linux/sh/syscallent.h: Likewise.
26132	* linux/powerpc/syscallent.h: Change sync_file_range to
26133	sync_file_range2, set the number of sync_file_range2 arguments to 6.
26134	* linux/tile/syscallent.h: Change sync_file_range to sync_file_range2,
26135	set the number of sync_file_range2 arguments to 4.
26136	* linux/tile/syscallent1.h: Change sync_file_range to sync_file_range2.
26137	update handler.
26138	* linux/xtensa/syscallent.h: Likewise.
26139
26140	Add syscall entries for new linux syscalls.
26141	* linux/dummy.h: Add printargs aliases for sys_finit_module, sys_kcmp
26142	and sys_sync_file_range2.
26143	* linux/alpha/syscallent.h: Add entries for process_vm_readv
26144	and process_vm_writev.
26145	* linux/bfin/syscallent.h: Likewise.
26146	* linux/arm/syscallent.h: Add entries for sync_file_range2, kcmp
26147	and finit_module.
26148	* linux/hppa/syscallent.h: Add entries for process_vm_readv,
26149	process_vm_writev, kcmp and finit_module.
26150	* linux/tile/syscallent.h: Likewise.
26151	* linux/tile/syscallent1.h: Likewise.
26152	* linux/ia64/syscallent.h: Add entry for finit_module.
26153	* linux/i386/syscallent.h: Add entries for kcmp and finit_module.
26154	* linux/m68k/syscallent.h: Likewise.
26155	* linux/metag/syscallent.h: Likewise.
26156	* linux/microblaze/syscallent.h: Likewise.
26157	* linux/mips/syscallent-n32.h: Likewise.
26158	* linux/mips/syscallent-n64.h: Likewise.
26159	* linux/mips/syscallent-o32.h: Likewise.
26160	* linux/or1k/syscallent.h: Likewise.
26161	* linux/powerpc/syscallent.h: Likewise.
26162	* linux/sh/syscallent.h: Likewise.
26163	* linux/sh64/syscallent.h: Likewise.
26164	* linux/x32/syscallent.h: Likewise.
26165	* linux/x86_64/syscallent.h: Likewise.
26166	* linux/xtensa/syscallent.h: Likewise.
26167	* linux/s390/syscallent.h: Add entries for s390_runtime_instr, kcmp
26168	and finit_module.
26169	* linux/s390x/syscallent.h: Likewise.
26170	* linux/sparc/syscallent.h: Add entries for kern_features, kcmp
26171	and finit_module.
26172
26173	tests/net: fix portability issues.
26174	* tests/net-accept-connect.c: Fix address length passed to bind()
26175	and connect().
26176	* tests/net: Update regexps.
26177
26178	tests: add a test for basic network syscalls.
26179	* tests/.gitignore: Add net-accept-connect, *.o and *.log.*.
26180	* tests/Makefile.am (AM_CFLAGS): New variable.
26181	(check_PROGRAMS): Add net-accept-connect.
26182	(TESTS): Add net.
26183	* tests/net-accept-connect.c: New file.
26184	* tests/net: New file.
26185
26186	tests: do not skip tests when timeout utility is not available.
26187	* tests/init.sh (check_timeout): New function.
26188	* tests/ptrace_setoptions: Use it.
26189	* tests/qual_syscall: Likewise.
26190	* tests/stat: Likewise.
26191	* tests/strace-f: Likewise.
26192
261932013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26194
26195	Move subcall decoding configuration out of the common code.
26196	* Makefile.am (EXTRA_DIST): Add linux/subcall.h.
26197	* linux/syscall.h (SYS_socket_subcall): Remove.
26198	(SYS_socket_nsubcalls, SYS_ipc_subcall, SYS_ipc_nsubcalls): Move to ...
26199	* linux/subcall.h: ... new file.
26200	* linux/arm/syscallent.h: Define SYS_socket_subcall, include subcall.h.
26201	* linux/i386/syscallent.h: Likewise.
26202	* linux/m68k/syscallent.h: Likewise.
26203	* linux/powerpc/syscallent.h: Likewise.
26204	* linux/s390/syscallent.h: Likewise.
26205	* linux/s390x/syscallent.h: Likewise.
26206	* linux/sh/syscallent.h: Likewise.
26207	* linux/sh64/syscallent.h: Likewise.
26208	* linux/sparc/syscallent.h: Likewise.
26209
26210	Suggested by Mike Frysinger and Chris Metcalf.
26211
262122013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26213
26214	sparc: remove some unused declarations and macros.
26215	* linux/syscall.h [SPARC || SPARC64] (sys_msgsys, sys_semsys,
26216	sys_shmsys): Remove declarations.
26217	[SPARC || SPARC64] (SYS_semsys_subcall, SYS_semsys_nsubcalls,
26218	SYS_msgsys_subcall, SYS_msgsys_nsubcalls, SYS_shmsys_subcall,
26219	SYS_shmsys_nsubcalls): Remove macros.
26220
262212013-05-07  Mike Frysinger  <vapier@gentoo.org>
26222
26223	mips: fix build regression.
26224	The recent commit (2690fadc8b35190dddd29274a7405bac13adc469) shuffled
26225	the mips headers around causing it to check the ABI defines before it
26226	included the header which set those up.  Now all mips builds fail with:
26227		In file included from count.c:36:0:
26228		defs.h:48:4: error: #error Unsupported _MIPS_SIM
26229
26230	* defs.h [MIPS]: Move sgidefs.h above _MIPS_SIM check.
26231
262322013-05-07  James Hogan  <james.hogan@imgtec.com>
26233
26234	metag: rename llseek syscall to _llseek.
26235	The raw llseek syscall is called _llseek from userland, so fix the
26236	naming of it for metag to allow the stat test to pass.
26237
26238	* linux/metag/syscallent.h: Rename llseek syscall to _llseek.
26239
262402013-05-07  James Hogan  <james.hogan@imgtec.com>
26241
26242	metag: disable socket and ipc subcall support.
26243	The metag architecture also uses dedicated syscalls and doesn't need to
26244	multiplex ipc and socket subcalls.
26245
26246	* linux/syscall.h [METAG]: Do not define SYS_socket_subcall and
26247	SYS_ipc_subcall.
26248
262492013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26250
26251	pread, pwrite: fix number of syscall arguments.
26252	The number of pread and pwrite arguments depends on architecture and
26253	personality.  For 64bit and ilp32 it equals to 4, for unaligned
26254	32bit it equals to 5, and for aligned 32bit it equals to 6.
26255
26256	* linux/aarch64/syscallent1.h: Change the number of pread and pwrite
26257	arguments to 4.
26258	* linux/alpha/syscallent.h: Likewise.
26259	* linux/mips/syscallent-n32.h: Likewise.
26260	* linux/mips/syscallent-n64.h: Likewise.
26261	* linux/s390x/syscallent.h: Likewise.
26262	* linux/sh64/syscallent.h: Likewise.
26263	* linux/tile/syscallent.h: Likewise.
26264	* linux/x32/syscallent.h: Likewise.
26265	* linux/x86_64/syscallent.h: Likewise.
26266	* linux/or1k/syscallent.h: Change the number of pread and pwrite
26267	arguments to 5.
26268
262692013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26270
26271	preadv, pwritev: fix number of syscall arguments.
26272	The number of preadv and pwritev arguments depends on architecture and
26273	personality.  For 64bit and ilp32 it equals to 4, for unaligned 32bit
26274	it equals to 5, and for aligned 32bit it equals to 6.
26275
26276	* linux/aarch64/syscallent1.h: Change the number of preadv and pwritev
26277	arguments to 4.
26278	* linux/alpha/syscallent.h: Likewise.
26279	* linux/ia64/syscallent.h: Likewise.
26280	* linux/mips/syscallent-n32.h: Likewise.
26281	* linux/mips/syscallent-n64.h: Likewise.
26282	* linux/s390x/syscallent.h: Likewise.
26283	* linux/sh64/syscallent.h: Likewise.
26284	* linux/tile/syscallent.h: Likewise.
26285	* linux/x32/syscallent.h: Likewise.
26286	* linux/x86_64/syscallent.h: Likewise.
26287	* linux/powerpc/syscallent.h: Change the number of preadv and pwritev
26288	arguments to 6.
26289	* linux/sh/syscallent.h: Likewise.
26290	* linux/xtensa/syscallent.h: Likewise.
26291
262922013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26293
26294	ftruncate64, truncate64: fix number of syscall arguments.
26295	The number of ftruncate64/truncate64 arguments depends on architecture
26296	and personality.  For 64bit and ilp32 it equals to 2, for unaligned
26297	32bit it equals to 3, and for aligned 32bit it equals to 4.
26298
26299	* linux/or1k/syscallent.h: Change the number of ftruncate64 and
26300	truncate64 arguments to 3.
26301	* linux/sh/syscallent.h: Likewise.
26302	* linux/sh64/syscallent.h: Change ftruncate64 and truncate64 handlers.
26303	* linux/sparc/syscallent.h: Change ftruncate64 handler, change the
26304	number of its arguments to 3.
26305	* linux/xtensa/syscallent.h: Change the number of ftruncate64 and
26306	truncate64 arguments to 4.
26307
263082013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26309
26310	fallocate: fix number of syscall arguments.
26311	The number of fallocate arguments depends on architecture and
26312	personality.  For 64bit and ilp32 it equals to 4,
26313	for 32bit it equals to 6.
26314
26315	* linux/aarch64/syscallent1.h: Change the number of fallocate arguments
26316	to 4.
26317	* linux/alpha/syscallent.h: Likewise.
26318	* linux/mips/syscallent-n32.h: Likewise.
26319	* linux/mips/syscallent-n64.h: Likewise.
26320	* linux/s390x/syscallent.h: Likewise.
26321	* linux/sh64/syscallent.h: Likewise.
26322	* linux/tile/syscallent.h: Likewise.
26323	* linux/x32/syscallent.h: Likewise.
26324	* linux/x86_64/syscallent.h: Likewise.
26325	* linux/microblaze/syscallent.h: Set fallocate handler and flags.
26326
263272013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26328
26329	fadvise64, fadvise64_64: fix handlers and number of syscall arguments.
26330	The number of fadvise64 arguments depends on architecture and
26331	personality.  For 64bit and ilp32 it equals to 4, for unaligned
26332	32bit it equals to 5, and for aligned 32bit it equals to 6.
26333
26334	The number of fadvise64_64 arguments is 4 for 64bit and ilp32, for
26335	unaligned 32bit and most of aligned 32bit it equals to 6, and for
26336	mips o32 it equals to 7.
26337
26338	* linux/alpha/syscallent.h: Set fadvise64 handler.
26339	* linux/s390/syscallent.h: Likewise.
26340	* linux/hppa/syscallent.h: Set fadvise64_64 handler, change the number
26341	of syscall arguments to 6.
26342	* linux/ia64/syscallent.h: Change the number of fadvise64 arguments
26343	to 4.
26344	* linux/mips/syscallent-n32.h: Likewise.
26345	* linux/tile/syscallent1.h: Change the number of fadvise64 arguments
26346	to 5.
26347	* linux/mips/syscallent-o32.h: Change the number of fadvise64_64
26348	arguments to 7.
26349	* linux/s390x/syscallent.h: Change fadvise64_64 handler.  Set fadvise64
26350	handler.  Change numbers of fadvise64 and fadvise64_64 arguments to 4.
26351	* linux/sh64/syscallent.h: Change fadvise64_64 handler.
26352	Change numbers of fadvise64 and fadvise64_64 arguments to 4.
26353	* linux/sparc/syscallent.h: Set fadvise64 and fadvise64_64 handlers,
26354	change numbers of their arguments to 5 and 6.
26355	* linux/x86_64/syscallent.h: Change fadvise64 handler.
26356
263572013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26358
26359	mips o32: raise the max number of syscall arguments to 7.
26360	On mips o32, fadvise64_64 takes 7 arguments.
26361
26362	* defs.h [LINUX_MIPSO32]: Raise MAX_ARGS to 7.
26363
263642013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26365
26366	mips: split syscallent.h.
26367	linux/mips/syscallent.h consisted of several parts that had little in
26368	common.  Split them into separate files to ease maintenance.
26369
26370	* linux/mips/syscallent-compat.h: New file.
26371	* linux/mips/syscallent-n32.h: Likewise.
26372	* linux/mips/syscallent-n64.h: Likewise.
26373	* linux/mips/syscallent-o32.h: Likewise.
26374	* linux/mips/syscallent.h: Include them.
26375	* Makefile.am (EXTRA_DIST): Add them.
26376
263772013-05-07  Dmitry V. Levin  <ldv@altlinux.org>
26378
26379	readahead: fix number of syscall arguments.
26380	The number of readahead arguments depends on architecture and
26381	personality.  For 64bit and ilp32 it equals to 3, for unaligned 32bit it
26382	equals to 4, and for aligned 32bit it equals to 5.
26383
26384	* linux/aarch64/syscallent1.h: Set number of readahead arguments to 3.
26385	* linux/alpha/syscallent.h: Likewise.
26386	* linux/ia64/syscallent.h: Likewise.
26387	* linux/s390x/syscallent.h: Likewise.
26388	* linux/sh64/syscallent.h: Likewise.
26389	* linux/x32/syscallent.h: Likewise.
26390	* linux/x86_64/syscallent.h: Likewise.
26391	* linux/or1k/syscallent.h: Set number of readahead arguments to 4.
26392	* linux/sh/syscallent.h: Likewise.
26393	* linux/tile/syscallent.h: Likewise.
26394	* linux/xtensa/syscallent.h: Set number of readahead arguments to 5.
26395
263962013-05-06  Dmitry V. Levin  <ldv@altlinux.org>
26397
26398	linux/syscall.h: make subcall decoding configuration more readable.
26399	* linux/syscall.h: Inverse and sort the subcall ifdef,
26400	add a comment why subcall decoding support is not enabled
26401	on some architectures.
26402
264032013-05-06  Chris Zankel  <chris@zankel.net>
26404
26405	xtensa: disable socket and ipc subcall support.
26406	The Xtensa architecture also uses dedicated syscalls and doesn't
26407	need to multiplex ipc and socket subcalls.
26408
26409	* linux/syscall.h [XTENSA]: Do not define SYS_socket_subcall and
26410	SYS_ipc_subcall.
26411
264122013-05-06  Dmitry V. Levin  <ldv@altlinux.org>
26413
26414	Fix syscall flags.
26415	* linux/aarch64/syscallent1.h: Fix syscall flags for send.
26416	* linux/alpha/syscallent.h: Fix syscall flags for fchdir, getcwd,
26417	oldumount, sigaltstack, umount, uselib, and utimes.
26418	* linux/arm/syscallent.h: Fix syscall flags for close, creat, dup, dup2,
26419	fchdir, fchmod, fchown, fchown32, fcntl, fcntl64, fdatasync, flock,
26420	fsetxattr, fsync, getdents, getdents64, ioctl, oldfstat, oldselect,
26421	open, pipe, poll, pread, pwrite, read, readahead, readdir, readv,
26422	select, socketcall, write, and writev.
26423	* linux/avr32/syscallent.h: Fix syscall flags for inotify_init and
26424	unshare.
26425	* linux/bfin/syscallent.h: Fix syscall flags for pread64 and pwrite64.
26426	* linux/hppa/syscallent.h: Fix syscall flags for fchdir, flistxattr,
26427	getcwd, pause, signal, umount2, uselib, utime, and vfork.
26428	* linux/ia64/syscallent.h: Fix syscall flags for creat, fchdir,
26429	lstat, umount, uselib, and utimes.  Fix syscall handlers for
26430	fgetxattr, flistxattr, fremovexattr, and fsetxattr.
26431	* linux/m68k/syscallent.h: Fix syscall flags for close, creat, dup,
26432	dup2, fchdir, fchmod, fchown, fchown32, fcntl, fcntl64, fdatasync,
26433	flock, fsetxattr, getdents, ioctl, oldfstat, oldselect, open, pipe,
26434	poll, pread64, pwrite64, read, readahead, readdir, readv, select,
26435	socketcall, write, and writev.
26436	* linux/metag/syscallent.h: Fix syscall flags for fanotify_init,
26437	prlimit64, process_vm_readv, process_vm_writev, and quotactl.
26438	* linux/microblaze/syscallent.h: Fix syscall flags for close, creat,
26439	dup, dup2, fchdir, fchmod, fchown, fchown32, fcntl, fcntl64,
26440	fdatasync, flock, fsetxattr, getdents, ioctl, oldfstat, oldselect,
26441	open, perf_event_open, pipe, poll, pread64, pwrite64, read, readahead,
26442	readdir, readv, select, socketcall, write, and writev.
26443	* linux/mips/syscallent.h: Fix syscall flags for close, creat, dup,
26444	dup2, fchdir, fchmod, fchown, fcntl, fcntl64, fdatasync, flock,
26445	fsetxattr, getdents, getdents64, getxattr, ioctl, lgetxattr,
26446	listxattr, llistxattr, lremovexattr, lsetxattr, oldfstat, open, pipe,
26447	pivot_root, poll, pread, pwrite, read, readahead, readv, removexattr,
26448	select, setxattr, socketcall, statfs, write, and writev.
26449	* linux/or1k/syscallent.h: Fix syscall flags for fchdir and quotactl.
26450	* linux/powerpc/syscallent.h: Fix syscall flags for fchdir.
26451	* linux/sh/syscallent.h: Fix syscall flags for getcwd.
26452	* linux/sparc/syscallent.h: Fix syscall flags for getresgid, getresuid,
26453	setresgid, setresgid32, and setresuid.
26454	* linux/xtensa/syscallent.h: Fix syscall flags for close, creat, dup,
26455	dup2, fallocate, fchdir, fchmod, fchown, fcntl, fcntl64, fdatasync,
26456	flock, fsetxattr, fstatfs, fstatfs64, fsync, getdents, getdents64,
26457	ioctl, open, pipe, pivot_root, poll, pread64, pwrite64, read,
26458	readahead, readv, rt_sigreturn, select, setfsgid, setfsuid, setuid,
26459	swapoff, times, utime, write, and writev.
26460
26461	tests/stat: enhance regexps.
26462	* tests/stat: Enhance regexps that check tracing of stat/stat64 and
26463	fstatat/fstatat64 syscalls.
26464
264652013-05-06  Chris Metcalf  <cmetcalf@tilera.com>
26466
26467	tests/stat: support fstatat syscall for stat()
26468	Newer Linux architectures don't support the stat/stat64 syscalls.
26469	Instead they use fstatat() with AT_FDCWD and an extra flags argument.
26470	Support seeing this output in the 'strace -efile' test.
26471
26472	As part of this change, use "grep -E -x" syntax consistently for
26473	all stat tests, since the number of \(foo\)\? expressions was becoming
26474	pretty unwieldy.
26475
26476	* tests/stat: Update stat/stat64 check regexp to handle architectures
26477	that use fstatat instead.  Use "grep -E -x" syntax consistently.
26478
264792013-05-06  Dmitry V. Levin  <ldv@altlinux.org>
26480
26481	ARM OABI: fix 64-bit arguments decoding.
26482	ARM OABI and ARM EABI have different function parameters passing rules,
26483	see commit v4.6-11-g7a5b08f for details.
26484
26485	* util.c (printllval): Do not align argument number in case of ARM OABI.
26486	* file.c (sys_fadvise64_64): Likewise.
26487
264882013-05-06  Mike Frysinger  <vapier@gentoo.org>
26489
26490	printllval: fix 64bit unpacking on mips/o32 and xtensa.
26491	The mips/o32 ABI and xtensa arch also do 64bit aligning, so add it to the
26492	printllval list for this.
26493
26494	Normally for sys_fadvise64_64 we'd handle the same list of arches, but
26495	mips/o32 ABI is funky and doesn't shift -- it has 7 args.  So just add
26496	xtensa to it.
26497
26498	* file.c (sys_fadvise64_64): Add XTENSA to the shifted list.
26499	* util.c (printllval): Add LINUX_MIPSO32 and XTENSA to the shifted list.
26500
265012013-05-06  Chris Metcalf  <cmetcalf@tilera.com>
26502
26503	tile: disable socket and ipc subcall support.
26504	The tile arch just has the dedicated syscalls, so disable
26505	the logic for parsing subcalls.
26506
26507	* linux/syscall.h [TILE]: Do not define SYS_socket_subcall and
26508	SYS_ipc_subcall.
26509
265102013-05-06  Mike Frysinger  <vapier@gentoo.org>
26511
26512	Blackfin: disable socketcall and ipc subcall support.
26513	The Blackfin arch does not have a socketcall or ipc subcall
26514	(it has dedicated syscalls broken out), so disable the logic for it.
26515
26516	* linux/syscall.h [BFIN]: Do not define SYS_socket_subcall and
26517	SYS_ipc_subcall.
26518
265192013-05-05  Mike Frysinger  <vapier@gentoo.org>
26520
26521	s390: fix # of args truncate64/ftruncate64 takes.
26522	* linux/s390/syscallent.h: Change nargs to 3 for truncate64/ftruncate64.
26523
265242013-05-05  Mike Frysinger  <vapier@gentoo.org>
26525
26526	mtd: clamp ubi name strings.
26527	Since the length fields with the ubi volnames are signed 16bit values,
26528	make sure we clamp that number to the size of the buffer we've allocated
26529	on the stack to prevent buffer overflows.
26530
26531	* mtd.c (ubi_ioctl): Clamp length to string_quote to 0/UBI_MAX_VOLUME_NAME.
26532	Check the return of string_quote and tweak the output accordingly.
26533
265342013-05-04  Dmitry V. Levin  <ldv@altlinux.org>
26535
26536	printxval: support more architectures.
26537	* configure.ac: Define SIZEOF_LONG_LONG.
26538	* util.c (printllval): Handle all architectures with sizeof(long) > 4
26539	and sizeof(long) == sizeof(long long).
26540
265412013-05-04  Mike Frysinger  <vapier@gentoo.org>
26542
26543	Fix building for sparc64 targets.
26544	* util.c (printllval): Handle SPARC64 define.
26545
26546	Fix building for mips n64 targets.
26547	* util.c (printllval): Handle LINUX_MIPSN64 define.
26548
265492013-05-03  Dmitry V. Levin  <ldv@altlinux.org>
26550
26551	hppa: fix stat64 and fstat64 decoding.
26552	* file.c [HPPA]: Do not redefine stat64 to hpux_stat64.
26553
26554	arm, aarch64, ppc: fix printllval-based decoders.
26555	* util.c (printllval) [ARM || POWERPC]: Align argument number.
26556	[AARCH64]: Align argument number in 32bit mode.
26557	* file.c (sys_fadvise64_64) [ARM || POWERPC]: Remove no longer needed
26558	printllval workaround.
26559	[AARCH64]: Fix printing POSIX_FADV_* constants in 32bit mode.
26560
265612013-05-02  Mike Frysinger  <vapier@gentoo.org>
26562
26563	Decode mtd/ubi ioctls.
26564	Been playing with UBI of late and it'd help if I could see what it was
26565	doing.  Not entirely sure about the decoding of UBI_IOCVOLUP -- it takes
26566	a pointer to a 64bit value, not a strict.
26567
26568	* util.c (MAX, MIN): Move to ...
26569	* defs.h (MAX, MIN): ... here.
26570	(CLAMP): Define.
26571	(ubi_ioctl): New prototype.
26572	* ioctl.c (ioctl_decode): Call ubi_ioctl when code is 'o' or 'O'.
26573	* mtd.c: Include ubi user API header.
26574	(ubi_volume_types): New enum decode.
26575	(ubi_volume_props): Likewise.
26576	(ubi_ioctl): Define.
26577	* linux/ubi-user.h: Import from linux 3.8.
26578
265792013-05-02  Mike Frysinger  <vapier@gentoo.org>
26580
26581	test: add mtd/ubi test helpers.
26582	I used these to develop the mtd/ubi ioctl decoders.
26583
26584	* test/.gitignore: Add mtd/ubi.
26585	* test/Makefile: Declare all tests in a PROGS var.
26586	Declare build targets .PHONY.
26587	(all): Depend on $(PROGS) instead of hardcoded list.
26588	(clean): Remove $(PROGS) instead of hardcoded list.
26589	* test/mtd.c: New file.
26590	* test/ubi.c: Likewise.
26591
265922013-05-02  Mike Frysinger  <vapier@gentoo.org>
26593
26594	test: include headers for used funcs.
26595	These funcs use things like wait/write/read/strcmp but sometimes
26596	don't include the right header for them.
26597
26598	* test/Makefile: Add -Wall to CFLAGS.
26599	* test/clone.c: Include unistd.h.
26600	* test/fork.c: Include sys/wait.h.
26601	* test/sig.c: Include unistd.h.
26602	* test/sigkill_rain.c: Include sys/wait.h.
26603	* test/vfork.c: Include sys/wait.h.
26604	* test/wait_must_be_interruptible.c: Include string.h
26605
266062013-05-02  Dmitry V. Levin  <ldv@altlinux.org>
26607
26608	ia64: fix compilation warnings introduced by commit v4.7-174-g44f0ed1.
26609	* linux/ia64/syscallent.h: Undefine sys_oldlstat, sys_lstat and
26610	sys_lstat64 before redefining them to printargs.
26611
26612	Reported-by: Mike Frysinger <vapier@gentoo.org>
26613
266142013-05-02  Mike Frysinger  <vapier@gentoo.org>
26615
26616	tests: stat: fix clean up of sample file.
26617	* tests/stat: Also rm the sample file at the end of the test.
26618
26619	Ignore more files.
26620	* .gitignore: Add gdb related files.
26621	* tests/.gitignore: Ignore test logs.
26622
266232013-05-02  Dmitry V. Levin  <ldv@altlinux.org>
26624
26625	x32: fix decoding of i386 truncate and ftruncate syscalls.
26626	* linux/x32/syscallent1.h: Remove sys_*truncate64 redirections.
26627
26628	x32: fix printllval-based decoders of i386 syscalls.
26629	* util.c (printllval) [X32]: Handle i386 personality.
26630
26631	tests: add basic test for ftruncate, lseek and stat family syscalls.
26632	* tests/stat: New test.
26633	* tests/Makefile.am (TESTS): Add stat.
26634
266352013-05-01  Dmitry V. Levin  <ldv@altlinux.org>
26636
26637	x32: fix build regressions introduced by commit v4.7-96-g8435d67.
26638	* desc.c (printflock) [X32]: Add special handling required for
26639	this architecture with sizeof(long) < sizeof(off_t).
26640	* file.c [X32] (struct stat64): Add __attribute__((packed)).
26641	[X32] (HAVE_STAT64): Define.
26642	(printstat) [X32]: Redirect to printstat64.
26643	(printstat64) [X32]: Use "struct stat" instead of "struct stat64".
26644	[X32] (realprintstat64): Rename to printstat64_x32.
26645	(sys_stat64, sys_fstat64) [X32]: Remove second definitions of these
26646	functions.  Call printstat64_x32 instead of printstat64
26647	* linux/x32/syscallent.h: Fix handlers for truncate and ftruncate.
26648
26649	Alias sys_*lstat* syscall printing functions.
26650	* file.c (sys_lstat, sys_lstat64, sys_oldlstat): Remove.
26651	* linux/dummy.h: Move !HAVE_STRUCT___OLD_KERNEL_STAT aliases forward.
26652	(sys_lstat): Alias to sys_stat.
26653	(sys_lstat64): Alias to sys_stat64.
26654	(sys_oldlstat): Alias to sys_oldstat.
26655	* linux/syscall.h (sys_lstat, sys_lstat64, sys_oldlstat): Remove.
26656	* linux/x32/syscallent1.h (sys_lstat64): Remove.
26657
26658	x86_64: decode __old_kernel_stat based syscalls.
26659	* linux/x86_64/syscallent1.h: Remove sys_old*stat redirections.
26660
26661	x32: fix decoding of __old_kernel_stat based syscalls.
26662	* file.c [X32] (struct __old_kernel_stat): Define.
26663	* linux/x32/syscallent1.h: Remove sys_old*stat redirections.
26664
266652013-05-01  James Hogan  <james.hogan@imgtec.com>
26666
26667	test/threaded_execve: fix on metag.
26668	The metag ABI has stacks growing upwards so clone expects the stack
26669	argument to point at the bottom of the stack instead of the top.
26670
26671	* test/threaded_execve.c [__metag__]: Define clone2 differently
26672	to avoid a segfault at runtime.
26673
266742013-05-01  James Hogan  <james.hogan@imgtec.com>
26675
26676	test/skodic: make a bit more portable.
26677	* test/skodic.c (main): Don't use MAP_FIXED since valid virtual addresses
26678	vary between architectures (as far as I can tell the use of MAP_FIXED is
26679	not relevant to the test).  Also don't assume the file desriptor returned
26680	by open call is 3 when passing it to mmap.
26681
266822013-05-01  Mike Frysinger  <vapier@gentoo.org>
26683
26684	printllval: handle s390x.
26685	This is a 64bit arch w/no personalities, so fix printing.
26686	It can now trace a simple call like readahead:
26687	$ cat test.c
26688	main(){readahead(-1, (unsigned long long)1 << 50, 0);}
26689	$ gcc test.c
26690	$ ./strace -ereadahead ./a.out
26691	readahead(-1, 1125899906842624, 0)      = -1 EBADF (Bad file descriptor)
26692
26693	* util.c (printllval): Handle S390X define.
26694
266952013-05-01  Mike Frysinger  <vapier@gentoo.org>
26696
26697	Stop using old AM_CONFIG_HEADER macro.
26698	Building with automake-1.13 throws an error:
26699	configure.ac:6: error: 'AM_CONFIG_HEADER': this macro is obsolete.
26700	    You should use the 'AC_CONFIG_HEADERS' macro instead.
26701
26702	* configure.ac (AM_CONFIG_HEADER): Rename to AC_CONFIG_HEADERS.
26703
267042013-04-30  Dmitry V. Levin  <ldv@altlinux.org>
26705
26706	build: introduce git-version-gen.
26707	* .gitignore: Add .version.
26708	* Makefile.am (EXTRA_DIST, BUILT_SOURCES): Add $(srcdir)/.version.
26709	Add rules to check NEWS, generate $(srcdir)/.version and
26710	$(distdir)/.tarball-version files.
26711	Change ChangeLog and CREDITS generation rules to depend on
26712	$(srcdir)/.version instead of $(srcdir)/.git/refs/heads/*.
26713	* NEWS: Add dates to recent releases.
26714	* configure.ac (AC_INIT): Use git-version-gen.
26715	(AM_INIT_AUTOMAKE): Remove check-news.
26716	* git-version-gen: Import from gnulib.
26717	* make-dist: Check NEWS.
26718
26719	Makefile.am: sort long lists to ease maintenance.
26720	* Makefile.am (strace_SOURCES, EXTRA_DIST): Sort, place one list element
26721	per line.
26722
26723	build: fix "make dist" regression introduced by commit v4.7-105-g7270de5
26724	* Makefile.am (EXTRA_DIST): Remove linux/arm/syscallent1.h,
26725	linux/arm/signalent1.h, linux/arm/ioctlent1.h and linux/arm/errnoent1.h.
26726
26727	build: fix "make dist" regression introduced by commit v4.7-29-g17e3860.
26728	* Makefile.am (EXTRA_DIST): Add linux/ioctlent-filter.awk.
26729
267302013-04-30  Mike Frysinger  <vapier@gentoo.org>
26731
26732	Blackfin: tweak sram_alloc syscall decode.
26733	* system.c (sys_sram_alloc): The 2nd argument of sram_alloc syscall
26734	is a bit field, not a specific value, so decode it as such.
26735
267362013-03-31  Zev Weiss  <zev@bewilderbeest.net>
26737
26738	Print io_submit() offsets in decimal.
26739	This makes output formatting more consistent with pread()/pwrite(),
26740	which print their offset parameters in decimal.
26741
26742	* desc.c (sys_io_submit): Change offset output format from %llx to %lld.
26743
267442013-03-30  Andreas Schwab  <schwab@suse.de>
26745
26746	Fix building outside source directory.
26747	The file linux/ioctlent.h is generated in the build directory, so
26748	"../ioctlent.h" won't find it.
26749
26750	* linux/aarch64/ioctlent1.h: Remove "../" from include file name.
26751	* linux/powerpc/ioctlent1.h: Likewise.
26752	* linux/tile/ioctlent1.h: Likewise.
26753	* linux/x32/ioctlent1.h: Likewise.
26754	* linux/x86_64/ioctlent1.h: Likewise.
26755	* linux/x86_64/ioctlent2.h: Likewise.
26756
267572013-03-30  Andreas Schwab  <schwab@suse.de>
26758
26759	AArch64: Fix printing of long long value.
26760	* util.c (printllval): Fix printing of long long values on
26761	AArch64.
26762
267632013-03-27  Dmitry V. Levin  <ldv@altlinux.org>
26764
26765	Update PR_* constants.
26766	* process.c (prctl_options): Add more PR_* constants from linux/prctl.h.
26767
267682013-03-25  Chris Zankel  <chris@zankel.net>
26769
26770	Add support for the XTENSA architecture.
26771	* configure.ac: Add XTENSA to the list of supported architectures.
26772	* defs.h: Add XTENSA support.
26773	* linux/xtensa/syscallent.h: New file.
26774	* linux/xtensa/ioctlent.h.in: Likewise.
26775	* process.c (struct_user_offsets): Add XTENSA support.
26776	* signal.c (sys_sigreturn): Likewise.
26777	* syscall.c (printcall, get_scno, get_syscall_args,
26778	  get_syscall_result, get_error): Likewise.
26779	* util.c (change_syscall): Likewise.
26780
267812013-03-22  Denys Vlasenko  <vda.linux@googlemail.com>
26782
26783	Add example script which builds static (possibly cross-compiled) strace.
26784
267852013-03-21  Dmitry V. Levin  <ldv@altlinux.org>
26786
26787	Use 64-bit versions of stat, readdir and setrlimit functions when available
26788	strace already has a mechanism to use fopen64 for output when the 64-bit
26789	version of fopen is available on 32-bit architectures.  Apply this
26790	mechanism for other three functions to make strace fully adopted for
26791	64-bit types.
26792
26793	* strace.c (struct_stat, stat_file, struct_dirent, read_dir,
26794	struct_rlimit, set_rlimit): New macros.
26795	(startup_attach): Use read_dir.
26796	(startup_child): Use struct_stat and stat_file.
26797	(main): Use struct_rlimit and set_rlimit.
26798
267992013-03-20  Dmitry V. Levin  <ldv@altlinux.org>
26800
26801	Do not use struct dirent in readdir decoding.
26802	struct dirent from libc should not be used for umove'ing into because it
26803	contains fixed size d_name.
26804
26805	* file.c (printdir): Rename to print_old_dirent.
26806	[SH64]: Decode using struct kernel_dirent.
26807	[!SH64]: Decode using an open-coded struct with 32-bit d_ino and d_off.
26808	(sys_readdir): Update.
26809
268102013-03-20  Dmitry V. Levin  <ldv@altlinux.org>
26811
26812	Do not use off_t in sendfile decoding.
26813	sendfile parser used to decode off_t* parameter as a pointer to host
26814	off_t type.  With this change, it is decoded as a pointer to target long
26815	type.
26816
26817	* io.c (print_off_t): New function.
26818	(sys_sendfile): Use it.
26819	* linux/aarch64/syscallent1.h: Use sys_sendfile64 for sendfile decoding.
26820	* linux/tile/syscallent.h: Likewise.
26821	* linux/x32/syscallent.h: Likewise.
26822	* linux/x86_64/syscallent.h: Likewise.
26823	* linux/hppa/syscallent.h: Use sys_sendfile64 for sendfile64 decoding.
26824	* linux/metag/syscallent.h: Correct sendfile syscall name.
26825	* linux/or1k/syscallent.h: Likewise.
26826
268272013-03-18  Dmitry V. Levin  <ldv@altlinux.org>
26828
26829	Fix build with older versions of libaio.h.
26830	* configure.ac: When libaio.h is available, check for
26831	struct iocb.u.c.flags, IO_CMD_PWRITE and IO_CMD_PWRITEV.
26832	* desc.c (print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
26833	(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
26834	HAVE_DECL_IO_CMD_PWRITEV.
26835
26836	Fix io_submit decoding.
26837	* desc.c (print_common_flags, sys_io_submit): Add missing ", " to
26838	SUB_COMMON output, remove extra ", " from SUB_VECTOR output.
26839
268402013-03-18  Maxin B. John  <maxin.john@enea.com>
26841
26842	tests: relax check_prog to allow timeout command provided by busybox.
26843	Busybox version of timeout doesn't have --version option.
26844	Relax check_prog to handle those cases.
26845
26846	* tests/init.sh (check_prog): Use type builtin to check program
26847	availability.
26848
268492013-03-18  Dmitry V. Levin  <ldv@altlinux.org>
26850
26851	Reorganize get_regs code, hopefully without functional changes.
26852	* syscall.c [I386 || ARM || OR1K || METAG] (ARCH_REGS_FOR_GETREGSET):
26853	New macro.
26854	(get_regset): Implement for AARCH64, METAG, OR1K and X32.
26855	(get_regs) [AARCH64 || METAG || OR1K || X32]: Use it.
26856
26857	arm, i386: use PTRACE_GETREGSET if available.
26858	* syscall.c [ARM || I386 || X86_64] (get_regset): New function.
26859	(get_regs) [ARM || I386 || X86_64]: Use it.
26860
26861	Include <sys/uio.h> and <elf.h> on all architectures.
26862	* syscall.c: Include <sys/uio.h> and <elf.h> on all architectures.
26863
26864	x86-64: enhance PTRACE_GETREGSET test.
26865	* syscall.c (get_regs) [X86_64]: Check whether PTRACE_GETREGSET
26866	works regardless of the kernel version.
26867
26868	x32: use PTRACE_GETREGSET unconditionally.
26869	* syscall.c (get_regs) [X32]: Assume that PTRACE_GETREGSET always works
26870	regardless of the kernel version.
26871
26872	x86-64, x32: do not include linux/ptrace.h unnecessarily.
26873	* syscall.c [X86_64 || X32]: Stop including linux/ptrace.h.
26874
26875	i386, tile, x32: do not redefine ptrace prototype.
26876	* defs.h [I386 || TILE || X32]: Use ptrace prototype from sys/ptrace.h.
26877
26878	ptrace: decode note segment descriptor types.
26879	* configure.ac (AC_CHECK_HEADERS): Add elf.h.
26880	* process.c: Include elf.h.
26881	(nt_descriptor_types): New xlat structure.
26882	(sys_ptrace): Use it.
26883
268842013-03-14  Dmitry V. Levin  <ldv@altlinux.org>
26885
26886	Update MADV_* constants.
26887	* mem.c (madvise_cmds): Add more MADV_* constants from
26888	asm-generic/mman-common.h
26889
26890	Reported-by: Robin Hack <hack.robin@gmail.com>
26891
268922013-03-07  Denys Vlasenko  <vda.linux@googlemail.com>
26893
26894	Tweaks for -c: fixed setitimer/getitimer hack; optimized call_summary_pers()
26895	count_syscall() was calling setitimer/getitimer once in order to find
26896	smallest "tick" OS uses in time accounting, in order to use it
26897	for syscalls which apparently spent less than that time in syscall.
26898	The code assumed that this "tick" is not zero... but it is zero
26899	on linux-3.6.11. Which means that this hack doesn't work...
26900
26901	At least this change prevents this measurement from being done
26902	_repeatedly_, by initializing one_tick to -1, not 0.
26903
26904	While at it, added comments in count_syscall() explaining what we are doing.
26905
26906	Optimized call_summary_pers() a bit, by eliminating redundant tv -> float
26907	conversions, and prevented 0.0/0.0 which was resulting in "% time"
26908	being shown as "-nan" if total CPU time spent was 0.000000
26909	(try "strace -c /bin/true").
26910
26911	The code seems to seriously underestimate CPU usage:
26912	"strace -c ls -lR /usr/share >/dev/null" shows total time spent
26913	in syscalls to be only ~10..20% of what "time ls -lR /usr/share >/dev/null"
26914	shows.
26915
26916	It might be useful to have a mode where we show wall clock time
26917	spent in syscalls, not CPU time. It might also be more accurate.
26918
26919	   text	   data	    bss	    dec	    hex	filename
26920	 245019	    676	   5708	 251403	  3d60b	strace_old
26921	 244923	    684	   5676	 251283	  3d593	strace
26922
269232013-03-06  Denys Vlasenko  <vda.linux@googlemail.com>
26924
26925	Open-code isprint(c) and isspace(c)
26926	We don't call setlocale, thus we always use C locale.
26927	But libc supports various other locales, and therefore
26928	its ctype interface is general and at times inefficient.
26929	For example, in glibc these macros result in function call,
26930	whereas for e.g. isprint(c) just c >= ' ' && c <= 0x7e
26931	suffices.
26932
26933	By open-coding ctype checks (we have only 4 of them)
26934	we avoid function calls, we get smaller code:
26935
26936	   text	   data	    bss	    dec	    hex	filename
26937	 245127	    680	   5708	 251515	  3d67b	strace_old
26938	 245019	    676	   5708	 251403	  3d60b	strace
26939
26940	and we don't link in ctype tables (beneficial for static builds).
26941
269422013-03-06  Denys Vlasenko  <vda.linux@googlemail.com>
26943
26944	Makefile: add commented-out tweak to generate link map.
26945
26946	Stop using a large static buffer in getfdpath.
26947	   text	   data	    bss	    dec	    hex	filename
26948	 245075	    680	   9836	 255591	  3e667	strace_old
26949	 245143	    680	   5708	 251531	  3d68b	strace
26950
269512013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>
26952
26953	Fix wrongly indented closing curly brace. No code changes.
26954
26955	strace_vfprintf: if malloc fails, exit gracefully.
26956
269572013-03-05  Dmitry V. Levin  <ldv@altlinux.org>
26958
26959	Use sysconf(_SC_PAGESIZE) instead of hardcoded PAGE_SHIFT.
26960	PAGE_SHIFT couldn't be reliably obtained at compile time,
26961	thanks to Chris Metcalf for the hint.
26962
26963	* mem.c: Do not include <sys/user.h>.
26964	[SH64] Do not include <asm/page.h>.
26965	(get_pagesize): New function.
26966	(sys_mmap_pgoff, sys_old_mmap_pgoff): Use it.
26967
269682013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>
26969
26970	Emit better message for ERESTARTNOHAND return.
26971
26972	Disable STREAMS syscalls for non-SPARC.
26973	   text	   data	    bss	    dec	    hex	filename
26974	   3002	      0	   1024	   4026	    fba	stream.o.old
26975	   1729	      0	   1024	   2753	    ac1	stream.o
26976
26977	Fix printstrbufarg's address argument to be long, not int.
26978
26979	Remove variable tracing_paths and check in pathtrace_match.
26980
269812013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>
26982
26983	Use dynamically-sized selected[] array for -P PATH.
26984	While at it, added a small optimization of not remembering
26985	the path twice if it happens to be the same.
26986
26987	   text	   data	    bss	    dec	    hex	filename
26988	 245111	    680	  10860	 256651	  3ea8b	strace_old
26989	 245075	    680	   9804	 255559	  3e647	strace
26990
269912013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>
26992
26993	metag,or1k: whitesace style fix. no code changes.
26994
26995	Assorted fixes to syscallent.h.
26996	or1k was missing TM on many memory-related syscalls
26997	sys_lookup_dcookie is 3-arg on 64-bit arches, and isn't TF
26998	sys_recvmsg is 3-arg on all arches
26999	sys_nfsservctl is 3-arg on all arches
27000	sys_timerfd_create is 2-arg on all arches
27001	sys_[f]truncate64 is 4-arg or 3-arg, never 5-arg
27002	truncate64 is TF
27003	sys_[l]lseek is TD
27004	fstat[64] is TD
27005
270062013-03-05  James Hogan  <james.hogan@imgtec.com>
27007
27008	Add support for Imagination Technologies Meta.
27009	Add support for Imagination Technologies Meta architecture (the
27010	architecture/ABI is usually referred to as metag in code). The Meta
27011	Linux kernel port is in the process of being upstreamed for v3.9 so it
27012	uses generic system call numbers.
27013
27014	sys_lookup_dcookie writes a filename to buffer argument, so I've set
27015	TF flag.
27016	nfsservctl appears to be set to sys_ni_syscall in asm-generic/unistd.h
27017	so I've left it blank.
27018	truncate64/ftruncate64/pread64/pwrite64/readahead have unaligned 64bit
27019	args which are packed tightly on metag, so less arguments on metag.
27020	fchdir/llseek takes a file descriptor so s/TF/TD/
27021	sync_file_range has 2 64bit args so uses 6 args, so s/4/6/
27022	timerfd_create/msgget/msgctl/msgrcv/semget/segtimedop/semop/shmget/
27023	shmctl/shmat/shmdt/recvmsg/migrate_pages have different number of args.
27024	oldgetrlimit is just getrlimit for metag.
27025	add TM flag to various memory syscalls.
27026	metag doesn't directly use sys_mmap_pgoff for mmap2.
27027	prlimit64/process_vm_readv/process_vm_writev take a pid so add TP flag.
27028	fanotify_init doesn't appear to take a file descriptor so remove TD.
27029	Add kcmp syscall.
27030
27031	Cc: Christian Svensson <blue@cmd.nu>
27032
270332013-03-01  Denys Vlasenko  <vda.linux@googlemail.com>
27034
27035	umovestr: speed up check for NUL byte in the fetched word.
27036
270372013-03-01  Dmitry V. Levin  <ldv@altlinux.org>
27038
27039	Fix trace=set regression introduced by commit v4.7-111-g9cbc15b.
27040	* syscall.c (qual_syscall, qualify): Pass personality down to
27041	qualify_one.
27042	* tests/qual_syscall: New test.
27043	* tests/Makefile.am (TESTS): Add qual_syscall.
27044
270452013-03-01  Chris Metcalf  <cmetcalf@tilera.com>
27046
27047	tile: handle printllval like x86_64 or powerpc64.
27048	Without this fix the tilegx build fails when it hits the new #error
27049	about SIZEOF_LONG > 4.
27050
27051	* util.c (printllval): Fix printing of long long values on TILE.
27052
270532013-02-27  Denys Vlasenko  <vda.linux@googlemail.com>
27054
27055	Make -b take SYSCALL param, document it in --help and in manpage.
27056	To not waste an option letter for just one trick,
27057	extend -b to take a parameter:
27058	"on which syscalls do you want to detach?".
27059	Currently supports only execve.
27060
27061	While at it, fixed (by removing non-Linux and stale info)
27062	and extended manpage text about -f.
27063
270642013-02-26  Dmitry V. Levin  <ldv@altlinux.org>
27065
27066	Cleanup umoven and umovestr.
27067	Cleanup sloppy error handling.
27068
27069	First, EFAULT kind of errors from process_vm_readv by itself is not
27070	something unusual, so a warning message will not be issued unless a
27071	short read is detected.
27072
27073	Second, clients of umoven and umovestr are not prepared to detect and
27074	handle short reads that can happen in these functions.  The most safe
27075	way to handle them is to return an error code.
27076
27077	* util.c (umoven, umovestr): Cleanup handling of errors coming from
27078	process_vm_readv and PTRACE_PEEKDATA.
27079
270802013-02-26  Dmitry V. Levin  <ldv@altlinux.org>
27081
27082	pathtrace: fix umovestr return code check.
27083	* pathtrace.c (upathmatch): Only NUL-terminated strings can be
27084	path-matched, so fix the umovestr return code check to filter out
27085	unsuitable strings.
27086
270872013-02-26  Dmitry V. Levin  <ldv@altlinux.org>
27088
27089	Fix compilation errors uncovered by -Werror=enum-compare.
27090	This fixes regression introduced by commit v4.7-111-g9cbc15b.
27091
27092	* syscall.c: Merge all nsyscalls* enums into single enum.
27093	Likewise merge nerrnos*, nsignals*, and nioctlents* into single enums.
27094
270952013-02-26  Denys Vlasenko  <vda.linux@googlemail.com>
27096
27097	Mass replace error_msg("%s", "literal") -> error_msg("literal")
27098	There is no need to print literal strings through "%s".
27099	Only untrusted strings such as filenames need that.
27100
271012013-02-26  Ben Noordhuis  <info@bnoordhuis.nl>
27102
27103	Make umoven report success as 0, not >=0, stop returning success on partial reads
27104	umoven() uses process_vm_readv() when available but it returns the
27105	return value of that syscall, which is the number of bytes copied,
27106	while its callers expect it to simply return zero on success.
27107
27108	It was causing syscalls that take a user-space argument to print
27109	the abbreviated version, e.g.:
27110
27111	  epoll_ctl(5, EPOLL_CTL_ADD, 10, {...})
27112
27113	Instead of:
27114
27115	  epoll_ctl(5, EPOLL_CTL_ADD, 10, {EPOLLIN, {u32=10, u64=10}})
27116
27117	* util.c (umoven): Make umove[n] report success as 0, not >=0,
27118	stop returning "success" on partial reads.
27119
271202013-02-26  Denys Vlasenko  <vda.linux@googlemail.com>
27121
27122	Assorted NOMMU fixes.
27123	With -D, strdup'ing of pathname is necessary only on NOMMU.
27124
27125	Don't set skip_startup_execve to 1 if NOMMU and not in daemonized mode
27126	(try "strace [-D] -b env echo HI" to see whether we detach on correct execve).
27127
27128	Fix test_ptrace_FOO shortcuts on NOMMU to always assume success
27129	and _properly_ set all variables.
27130
271312013-02-26  Denys Vlasenko  <vda.linux@googlemail.com>
27132
27133	Shorten help text - no need to show deprecated option -F.
27134
271352013-02-23  Denys Vlasenko  <vda.linux@googlemail.com>
27136
27137	Merge adjacent tprint's.
27138
27139	Correct i > MAX_NSYSCALLS commparison: should be i >= MAX_NSYSCALLS.
27140
271412013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>
27142
27143	Fix wrong offset display in dumpstr.
27144	BTW, the new code from prev commit is 5 times faster
27145	than old one :)
27146
271472013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>
27148
27149	Fix a bug in dumpstr (no null termination). Essentially rewrote dumpstr.
27150	This is a 14 year old bug (!).
27151
27152	It wasn't biting us merely because outstr[80] was static, thus ended up
27153	in bss and whatever was after it "accidentally" provided the NUL byte.
27154	When dumpstr was changed to use on-stack buffer, the bug reared its ugly head.
27155
27156	This is a rewrite which is smaller and should be significantly faster
27157	for _long_ strings.
27158
27159	   text	   data	    bss	    dec	    hex	filename
27160	 244627	    680	  10860	 256167	  3e8a7	strace.t9/strace
27161	 244563	    680	  10860	 256103	  3e867	strace.ta/strace
27162
27163	* util.c (dumpstr): Rewrite to be faster and smaller.
27164
271652013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>
27166
27167	Eliminate MAX_QUALS, make qualifier array dynamic.
27168	MAX_QUALS was 2048, even though most arches used less than 500 entries
27169	in it. MAX_QUALS had to be maintained by hand to be higher than syscall
27170	count. It also limited the highest possible fd to track.
27171
27172	This change makes qual_flagsN[] arrays start sized to the required minimum
27173	(number of syscalls) and grow dynamically if user requested
27174	-e read=BIGNUM. As a precaution, BIGNUM should be < 2^15, but this limit
27175	can be raised with no cost for normal strace invocations.
27176
27177	qual_flags is now a define to qual_vec[current_personality].
27178
27179	As a bonus, this patch aliases sysent, errnoent, signalent, ioctlent
27180	names in one-personality arches to their corresponding <foo>0 arrays,
27181	removing one indirection level.
27182
27183	  text   data    bss    dec    hex filename
27184	244471    700  12928 258099  3f033 strace.t7/strace
27185	244627    680  10860 256167  3e8a7 strace.t8/strace
27186
271872013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>
27188
27189	Create and use struct_sysent and struct_ioctlent typedefs.
27190	This is a preparatory mass replace patch with no code changes.
27191
27192	The future change will need to typedef sysent to sysent0,
27193	which results in compile failures when "struct sysent" string
27194	gets mangled into "struct sysent0".
27195
271962013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>
27197
27198	Use tcp->qual_flg instead of qual_flags[] in verbose() and abbrev()
27199	We have hundreds of uses of these macros.
27200	Result is more efficient and 1.1 kbyte shorter code:
27201
27202	  text	   data	    bss	    dec	    hex	filename
27203	245579	    700	  12928	 259207	  3f487	strace.t5/strace
27204	244471	    700	  12928	 258099	  3f033	strace.t6/strace
27205
272062013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>
27207
27208	Remove unused QUAL_FAULT code (was used by non-Linux code only).
27209
272102013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>
27211
27212	Use uint8_t for qual_flags[] instead of ints.
27213	Resulting bss reduction is ~6kbytes:
27214
27215	   text	   data	    bss	    dec	    hex	filename
27216	 245703	    700	  19072	 265475	  40d03	strace.t4/strace
27217	 245687	    700	  12928	 259315	  3f4f3	strace.t5/strace
27218
272192013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>
27220
27221	Eliminate many SCNO_IS_VALID checks.
27222	By adding tcp->s_ent pointer tot syscall table entry,
27223	we can replace sysent[tcp->scno] references by tcp->s_ent.
27224	More importantly, we may ensure that tcp->s_ent is always valid,
27225	regardless of tcp->scno value. This allows us to drop
27226	SCNO_IS_VALID(tcp->scno) checks before we access syscall
27227	table entry.
27228
27229	We can optimize (qual_flags[tcp->scno] & QUAL_foo) checks
27230	with a similar technique.
27231
27232	Resulting code shrink:
27233	   text    data     bss     dec     hex filename
27234	 245975     700   19072  265747   40e13 strace.t3/strace
27235	 245703     700   19072  265475   40d03 strace.t4/strace
27236
27237	* count.c (count_syscall): Use cheaper SCNO_IN_RANGE() check.
27238	* defs.h: Add "int qual_flg" and "const struct sysent *s_ent"
27239	to struct tcb. Remove "int u_nargs" from it.
27240	Add UNDEFINED_SCNO constant which will mark undefined scnos
27241	in tcp->qual_flg.
27242	* pathtrace.c (pathtrace_match): Drop SCNO_IS_VALID check.
27243	Use tcp->s_ent instead of sysent[tcp->scno].
27244	* process.c (sys_prctl): Use tcp->s_ent->nargs instead of tcp->u_nargs.
27245	(sys_waitid): Likewise.
27246	* strace.c (init): Add compile-time check that DEFAULT_QUAL_FLAGS
27247	constant is consistent with init code.
27248	* syscall.c (decode_socket_subcall): Use tcp->s_ent->nargs
27249	instead of tcp->u_nargs. Set tcp->qual_flg and tcp->s_ent.
27250	(decode_ipc_subcall): Likewise.
27251	(printargs): Use tcp->s_ent->nargs instead of tcp->u_nargs.
27252	(printargs_lu): Likewise.
27253	(printargs_ld): Likewise.
27254	(get_scno): [MIPS,ALPHA] Use cheaper SCNO_IN_RANGE() check.
27255	If !SCNO_IS_VALID, set tcp->s_ent and tcp->qual_flg to default values.
27256	(internal_fork): Use tcp->s_ent instead of sysent[tcp->scno].
27257	(syscall_fixup_for_fork_exec): Remove SCNO_IS_VALID check.
27258	Use tcp->s_ent instead of sysent[tcp->scno].
27259	(get_syscall_args): Likewise.
27260	(get_error): Drop SCNO_IS_VALID check where it is redundant.
27261	(dumpio): Drop SCNO_IS_VALID check where it is redundant.
27262	Use tcp->s_ent instead of sysent[tcp->scno].
27263	(trace_syscall_entering): Use (tcp->qual_flg & UNDEFINED_SCNO) instead
27264	of SCNO_IS_VALID check. Use tcp->s_ent instead of sysent[tcp->scno].
27265	Drop SCNO_IS_VALID check where it is redundant.
27266	Print undefined syscall name with undefined_scno_name(tcp).
27267	(trace_syscall_exiting): Likewise.
27268	* util.c (setbpt): Use tcp->s_ent instead of sysent[tcp->scno].
27269
272702013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>
27271
27272	ARM: make it one-personality arch.
27273	ARM in fact _is_ one personality.
27274
27275	We had two personalities for it because it has a handful of
27276	syscalls with huge scnos (0x000f00xx).
27277
27278	Extending syscall table to have [0x000f0005] index is of course
27279	not a good idea.
27280
27281	Someone decided to handle that by having a separate personality
27282	just for these syscalls.
27283
27284	But multi-personality arch does a bit more work in other parts.
27285
27286	This patch is another alternative: "move" 0x000f00nn syscalls
27287	down to the entries just above last ordinary syscall,
27288	by manipulating scno if it falls into the 0x000f00xx range.
27289
27290	In order to not worsen genuine undefined scnos' printing,
27291	the code remaps scno back to actual value before printing
27292	"syscall_NNN" string.
27293
27294	* defs.h: Remove multi-reprsonality defines from ARM.
27295	* syscall.c (shuffle_scno): New function.
27296	(undefined_scno_name): New function.
27297	(get_scno): [ARM] Replace personality setting with scno shuffling.
27298	(trace_syscall_entering): Print unknown syscall name using
27299	undefined_scno_name().
27300	(trace_syscall_exiting): Likewise.
27301	* linux/arm/syscallent.h: Add ARM specific syscalls at the end.
27302	* linux/arm/errnoent1.h: Deleted.
27303	* linux/arm/ioctlent1.h: Deleted.
27304	* linux/arm/signalent1.h: Deleted.
27305	* linux/arm/syscallent1.h: Deleted.
27306
273072013-02-20  Denys Vlasenko  <vda.linux@googlemail.com>
27308
27309	arm: shorten syscall table for EABI - no point in storing NULL entries.
27310	Also, reformatted ARM code in get_scno(), mostly improved comments,
27311	without code changes.
27312
27313	Use the same style of includes in linux/*/* files.
27314	While at it, fix some comments which say
27315	"we use i386 syscalls/ioctls/errnos" but in reality
27316	common ones are used.
27317
273182013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>
27319
27320	Fix compiler warnings.
27321	With constant current_wordsize == 4 and 32-bit longs,
27322	gcc was spooked by "1ul << (8 * current_wordsize)" = "1ul << 32".
27323
27324	Make such places conditional on SIZEOF_LONG > 4.
27325
273262013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>
27327
27328	Improve comment text. No code changes.
27329
273302013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>
27331
27332	Fix NOMMU + daemonized tracer SEGV.
27333	pathname[] was getting destroyed, execve of garbage pathname
27334	failing, and to top it off, the tracer's stack was also
27335	smashed and trecer segfaulted.
27336
27337	* strace.c (exec_or_die): New function.
27338	(startup_child): Don't use pathname[] contents after vfork,
27339	make a malloced copy instead. Explain "NOMMU + -D bug"
27340	and how we work around it.
27341
273422013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>
27343
27344	Make it possible to to do test builds for NOMMU architectures.
27345	And while using it, I discovered that -D doesn't work too well
27346	on NOMMU. Added a comment about it.
27347
273482013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>
27349
27350	Clean up mmap decoding.
27351	Previous code merges too many similar, but different ways
27352	of decoding mmap. For example, sys_old_mmap is "params in memory"
27353	API... except SH[64], where it is "params in regs",
27354	i.e. what sys_mmap ("new mmap") function does on other arches!
27355
27356	It's much simpler when every mmap handler has same API regardless
27357	of arch. Where API means whether params are in regs or in memory,
27358	and whether offset is in bytes, pages, or 4k blocks.
27359
27360	Then we just insert correct function pointers into
27361	arch syscall tables.
27362
27363	It turns out there are four common mmap APIs over
27364	all architectures which exist in Linux kernel,
27365	and one outlier for S390.
27366
27367	A number of mmap decoders were plain wrong in arch tables.
27368	For example, BFIN has no old_mmap. It returns ENOSYS.
27369	I checked kernel sources for all arches nad fixed the tables.
27370
27371	There was dead code for x86_64 for old_mmap:
27372	x86_64 has no old_mmap.
27373
27374	* mem.c: Refactor mmap functions so that we have five mmap syscall
27375	handlers, each with the fixed API (not varying by arch).
27376	* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
27377	* linux/syscall.h: Declare new mmap syscall handler functions.
27378	* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
27379	* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
27380	* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
27381	* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
27382	* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
27383	* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
27384	* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
27385	* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
27386	* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
27387	* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
27388	* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
27389	* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
27390	* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
27391	* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
27392	* linux/sh64/syscallent.h: Likewise.
27393	* linux/sparc/syscallent1.h: mmap is TD|TM.
27394	* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
27395
273962013-02-18  Denys Vlasenko  <vda.linux@googlemail.com>
27397
27398	Remove unused function sys_mmap64.
27399	No wonder that it is unused.
27400	It's code looked quite questionable.
27401
27402	* mem.c (sys_mmap64): Remove this function.
27403
274042013-02-18  Denys Vlasenko  <vda.linux@googlemail.com>
27405
27406	Remove code which supports systems with long long off_t.
27407	While looking at mmap mess, did experimenting in order
27408	to figure out what gets used when.
27409
27410	Tried building armv4tl, armv5l, armv6l, mips, mipsel, i686,
27411	x86_64 and none of they have long long off_t,
27412	which isn't suprprising: we aren't using glibc defines
27413	which enable that.
27414
27415	Moreover, we SHOULD NOT use off_t in syscall decode!
27416	Its size depends on libc, not on arch! I.e. it is essentially
27417	unpredictable and can even in theory vary on the same arch
27418	with different libc.
27419
27420	We should use longs or long longs, in a way which matches
27421	architectural ABI for the given syscall. There are usually
27422	*at most* two permutations, no need to add yet another variable
27423	(sizeof(off_t)) to the mix.
27424
27425	This change removes almost all HAVE_LONG_LONG_OFF_T conditionals,
27426	which will reveal further possible simplifications.
27427
27428	* mem.c: Remove code conditional on HAVE_LONG_LONG_OFF_T.
27429	As a result, never remap sys_mmap64 to sys_mmap.
27430	(print_mmap): Compile unconditionally.
27431	(sys_old_mmap): Compile unconditionally.
27432	(sys_mmap): Compile unconditionally.
27433	* io.c (sys_sendfile): Add a FIXME comment.
27434	* file.c: Remove code conditional on HAVE_LONG_LONG_OFF_T.
27435	As a result, never remap sys_*stat64 to sys_*stat etc.
27436	(sys_truncate): Compile unconditionally.
27437	(realprintstat): Likewise.
27438	(sys_stat): Likewise.
27439	(sys_fstat): Likewise.
27440	(sys_lstat): Likewise.
27441	* desc.c (printflock): Likewise.
27442
274432013-02-18  Denys Vlasenko  <vda.linux@googlemail.com>
27444
27445	Fixes in "new" mmap.
27446	* mem.c (sys_mmap): Ensure unsigned expansion of tcp->u_arg[5].
27447	Add page shift of offset for I386.
27448	Use tcp->ext_arg[5] as offset for X32.
27449	(sys_old_mmap): [X32] Remove this function, X32 doesn't use is.
27450
27451	Preliminary simplifications in mmap functions.
27452	* mem.c: Move "define sys_mmap64 sys_mmap" from the top
27453	to the only place it affects.
27454	(print_mmap): Make offset argument unsigned, for safer implicit conversions.
27455	(sys_old_mmap): [IA64] use unsigned narrow_arg[].
27456	Cast u_arg[5] (offset param) to unsigned long, to prevent erroneous signed
27457	expansion.
27458
274592013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>
27460
27461	Remove broken HAVE_LONG_LONG conditionals.
27462	We use printllval without HAVE_LONG_LONG guards in many places,
27463	but define it only if HAVE_LONG_LONG. This means that
27464	on !HAVE_LONG_LONG systems we won't build for some time now.
27465
27466	* defs.h: Remove HAVE_LONG_LONG guard around LONG_LONG() macro
27467	and printllval() function declaration.
27468	* util.c: Remove HAVE_LONG_LONG guard around printllval()
27469	function definition.
27470	(printllval): Add compile-time error check for using wrong
27471	if branch. Explain places where we deliberately use mismatched
27472	types for printf formats.
27473
274742013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>
27475
27476	Use explicit long type instead of off_t.
27477	* file.c (sys_lseek): Use long instead of off_t.
27478
27479	Merge two identical tables.
27480	* defs.h: Declare whence_codes[].
27481	* desc.c: Delete static whence[].
27482	(printflock[64]): Use whence_codes.
27483	* file.c: Make whence_codes[] non-static.
27484	Add SEEK_DATA and SEEK_HOLE to them.
27485
274862013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>
27487
27488	Remove wrong x32-specific lseek.
27489	Testing confirmed what I suspected: x32 lseek uses kernel-sized
27490	(i.e. wide) long for offset parameter.
27491
27492	* file.c: Delete sys_lseek32.
27493	* linux/syscall.h: Likewise.
27494	* linux/x32/syscallent1.h: Likewise.
27495	* test/x32_lseek.c: New file.
27496
274972013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>
27498
27499	Fix SEGV in lseek.
27500	I found hard way why the code was using "_whence" name.
27501
27502	* file.c: Rename whence[] to whence_codes[].
27503	(sys_lseek): Fix printxval() to use whence_codes[].
27504	(sys_lseek32): Likewise.
27505
275062013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>
27507
27508	Comment inner workings of sys_[l]lseek.
27509	The code doesn't look fully correct to me, but I need to experiment
27510	on actual x32 machine before I start "fixing" things.
27511	For now, add comments, and optimize out one tprints() call...
27512
27513	* file.c (sys_lseek): Rename '_whence' as 'whence'.
27514	Merge printing of ", " into subsequent tprintf.
27515	(sys_lseek32): Likewise.
27516	(sys_llseek): Likewise.
27517
275182013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>
27519
27520	Cosmetic fixes to syscall tables, no code changes.
27521
275222013-02-16  Denys Vlasenko  <vda.linux@googlemail.com>
27523
27524	Make linux/mips/syscallent.h smaller.
27525	* linux/mips/syscallent.h: Remove trailing empty elements.
27526	Compactify huge stretches of NULL elements in the middle.
27527
27528	Simple optimization in get_error.
27529	* defs.h: Define SCNO_IN_RANGE(scno) macro.
27530	* syscall.c (get_error): Change return type to void.
27531	Use SCNO_IN_RANGE instead of SCNO_IS_VALID.
27532	(trace_syscall_exiting): Stop checking get_error() return value.
27533
27534	Mass rename of SCNO_IN_RANGE define to SCNO_IS_VALID.
27535
27536	Finish prefixing regs struct names with arch_
27537	* defs: Rename regs -> sparc_regs.
27538	* signal.c (sys_sigreturn): Use new variable name.
27539	* syscall.c: Rename regs -> sparc_regs, regs -> avr32_regs.
27540	(getrval2): Use new variable names.
27541	(printcall): Likewise.
27542
275432013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>
27544
27545	Use the same type for i386_regs on 32-bit and 64-bit x86.
27546	* defs.h: Stop including <asm/ptrace.h> for x86.
27547	Change i386_regs from "struct pt_regs" to "struct user_regs_struct".
27548	* syscall.c: Likewise.
27549
27550	Fix build error on Tile.
27551	* syscall.c (get_scno): [TILE] Remove TCB_WAITEXECVE check,
27552	it is never true on Tile, and stopped compiling when
27553	TCB_WAITEXECVE define was removed for Tile.
27554
275552013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>
27556
27557	x86: zero-extend 32-bit args in syscall entry instead of sign-extension.
27558	Zero-extension is slightly more common that sign-extension:
27559	all pointers are zero-extended, and some other params are unsigned.
27560
27561	Whereas signed ones (fds, pids, etc) are often treated as
27562	_32-bit ints_ even by kernel, so just unconditionally casting
27563	such tcp->u_arg[N] to int works.
27564
27565	* syscall.c (get_syscall_args): [X86] Zero-extend 32-bit args
27566	instead of sign-extension.
27567
275682013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>
27569
27570	Macroize conditional signed widening operation.
27571	* defs.h: Define widen_to_long() macro.
27572	* signal.c (sys_kill): Use it instead of open-coding it.
27573	(sys_tgkill): Use widen_to_long() on pids.
27574	* resource.c (decode_rlimit): Formatting fix.
27575
275762013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>
27577
27578	A better handling of current_wordsize.
27579	On x86_64:
27580	  text	   data	    bss	    dec	    hex	filename
27581	435661	  26628	  47424	 509713	  7c711	strace_old
27582	435501	  26612	  47440	 509553	  7c671	strace_new_clever_wordsize
27583
27584	On x32 and arm it should be even better, current_wordsize becomes
27585	a constant there.
27586
27587	* defs.h: Declare current_wordsize as a variable if needed,
27588	else declare as a constant define.
27589	Remove declatation of personality_wordsize[].
27590	* syscall.c: Make personality_wordsize[] static.
27591	Declare current_wordsize as a variable if needed.
27592	(set_personality): Set current_wordsize only if non-constant.
27593
275942013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>
27595
27596	Remove unnecessary "return 0" statements.
27597	* util.c (change_syscall): Remove dummy "return 0"s.
27598
275992013-02-14  Denys Vlasenko  <vda.linux@googlemail.com>
27600
27601	x86: fix required kernel version for GETREGSET.
27602	* syscall.c (get_regs): [X86] Use GETREGSET only if kernel >= 2.6.35
27603
27604	Whitespace fix, no code changes.
27605
276062013-02-14  Christian Svensson  <blue@cmd.nu>
27607
27608	Add support for the OpenRISC 1000 platform.
27609	* configure.ac: Added or1k architecture..
27610	* defs.h: Added or1k to use register reading system.
27611	* linux/or1k/ioctlent.h.in: Use i386 ioctls.
27612	* linux/or1k/syscallent.h: New file.
27613	* process.c: Added or1k register defs to struct_user_offsets[].
27614	* syscall.c: Added or1k_io iovec for or1k GETREGSET,
27615	  regset structure for or1k.
27616	  (printcall): Added handling for or1k.
27617	  (get_regs): Likewise.
27618	  (get_scno): Likewise.
27619	  (get_syscall_args): Likewise.
27620	  (get_syscall_result): Likewise.
27621	  (get_error): Likewise.
27622	* util.c (change_syscall): Added dummy handling for or1k.
27623	* system.c (sys_or1k_atomic): New function (or1k specific syscall).
27624
276252013-02-14  Denys Vlasenko  <vda.linux@googlemail.com>
27626
27627	[X86] Use ptrace(PTRACE_GETREGSET, NT_PRSTATUS) to get registers.
27628	Unlike PTRACE_GETREGS, this new method detects 32-bit processes
27629	reliably, without checking segment register values which
27630	are undocumented and aren't part of any sort of API.
27631	While at it, also fixed x32 detection to use __X32_SYSCALL_BIT,
27632	as it should have been from the beginning.
27633
27634	* defs.h: Declare os_release and KERNEL_VERSION.
27635	* strace.c: Make os_release non-static, remove KERNEL_VERSION define.
27636	* syscall.c: New struct i386_user_regs_struct,
27637	static union x86_regs_union and struct iovec x86_io.
27638	(printcall): Use i386_regs or x86_64_regs depending on x86_io.iov_len.
27639	(get_regs): On x86 and kernels 2.6.30+, use PTRACE_GETREGSET,
27640	on earlier kernels fall back to old method.
27641	(get_scno): [X86] Determine personality based on regset size
27642	on scno & __X32_SYSCALL_BIT.
27643	(syscall_fixup_on_sysenter): Use i386_regs or x86_64_regs depending
27644	on x86_io.iov_len.
27645	(get_syscall_args): Likewise.
27646	(get_error): Likewise.
27647
276482013-02-13  Denys Vlasenko  <vda.linux@googlemail.com>
27649
27650	Rename some register statics by prefixing their names with arch.
27651	This makes it easier to grep for them.
27652
27653	* syscall.c: Rename variables:
27654	r0 -> bfin_r0,alpha_r0,sh_r0.
27655	a3 -> mips_a3.
27656	r2 -> mips_r2.
27657	(get_scno): Use new variable names.
27658	(get_syscall_result): Likewise.
27659	(get_error): Likewise.
27660
276612013-02-13  Denys Vlasenko  <vda.linux@googlemail.com>
27662
27663	Factor out code to check addr, fetch and print siginfo.
27664	* defs.h: Declare new function printsiginfo_at(tcp, addr).
27665	* process.c (sys_waitid): Use printsiginfo_at().
27666	(sys_ptrace): Likewise.
27667	* signal.c: (printsiginfo_at): Implement this new function.
27668	(sys_rt_sigsuspend): Use printsiginfo_at().
27669	(sys_rt_sigtimedwait): Likewise.
27670
27671	Decode struct iov in PTRACE_GET/SETREGSET.
27672	* process.c (sys_ptrace): Decode struct iov in PTRACE_GET/SETREGSET.
27673
276742013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>
27675
27676	Unify representations of struct user fields for subarchitectures.
27677	* process.c: Unify MIPS and LINUX_MIPSN32, and SH and SH64 parts of
27678	struct_user_offsets[].
27679
27680	Add start_code and start_data members of struct user.
27681	* process.c: Add start_code and start_data members of struct user
27682	in struct_user_offsets[], where appropriate.
27683
27684	Remove hacks for old kernels for architectures which require new kernels
27685	* util.c (change_syscall): For MICROBLAZE, replace code
27686	with dummy "return 0" and a comment explaining why that is ok
27687	for this architecture.
27688
276892013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>
27690
27691	Remove stray syscall result reading code on syscall entry for s390.
27692	This is a leftover from sysenter/sysexit split.
27693	I can't run-test it, but from code inspection it seems to be correct.
27694
27695	* syscall.c (get_scno): Remove stray syscall result reading for s390[x].
27696
276972013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>
27698
27699	Deobfuscate definitions of struct user offsets.
27700	The maze of ifdefs/ifndefs was scaring new contributors.
27701	Format it so that every arch has its own ifdef block.
27702
27703	* process.c: Deobfuscate definitions of struct user offsets.
27704
277052013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>
27706
27707	Remove hacks for old kernels for architectures which require new kernels
27708	* defs.h: Do not define TCB_WAITEXECVE for AARCH64.
27709	* util.c (change_syscall): For AARCH64 and X32, replace code
27710	with dummy "return 0" and a comment explaining why that is ok
27711	for these architectures.
27712
27713	Remove old kernel hacks for architectures which require new kernels.
27714	* defs.h: Do not define TCB_WAITEXECVE for AVR32, BFIN and TILE.
27715	* util.c (change_syscall): For AVR32, BFIN and TILE, replace code
27716	with dummy "return 0" and a comment explaining why that is ok
27717	for these architectures.
27718
27719	Handle recv[m]msg for non-native 32-bit personality syscalls.
27720	* net.c (printmsghdr): If current_wordsize is 4 and long is wider than it,
27721	read 32-bit struct msghdr and expand it into a native one before using it.
27722	(printmmsghdr): Likewise for struct mmsghdr.
27723
277242013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>
27725
27726	Fix is_negated_errno() check for X32.
27727	X32's return value is 64-bit. We were truncating it to 32-bit long
27728	before checking for -errno.
27729
27730	* syscall.c (is_negated_errno_x32): New function.
27731	(get_error): Use is_negated_errno_x32 for X32 architecture.
27732
277332013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>
27734
27735	Remove unused / ambiguously used defines.
27736	We sometimes use LINUXSPARC and sometimes (more often)
27737	use "defined(SPARC) || defined(SPARC64)". Better to use
27738	one construct consistently.
27739	LINUX_MIPS64 is altogether unused.
27740
27741	* defs.h: Remove LINUXSPARC and LINUX_MIPS64 defines.
27742	Move PTRACE_xxx compat defines up, before arch-specific
27743	machinery. Use defined(SPARC) || defined(SPARC64)
27744	instead of LINUXSPARC.
27745	* file.c: Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC.
27746	* signal.c: Likewise.
27747
277482013-02-11  Denys Vlasenko  <vda.linux@googlemail.com>
27749
27750	Preparatory patch for "new" x86 personality detection.
27751	* syscall.c: Move PT_FLAGS_COMPAT define to its only user, get_scno().
27752	Rename arm_regs_union's fields to names less likely to collide with
27753	system defines.
27754	(get_regs): Use sizeof(arm_regs_union) instead of sizeof(aarch64_regs).
27755	This should be the same, but htis way it's cleaner.
27756	Remove __X32_SYSCALL_MASK and use __X32_SYSCALL_BIT instead.
27757	Explain 64-bit check in X32 build better.
27758
277592013-02-09  Dmitry V. Levin  <ldv@altlinux.org>
27760
27761	Fix sigaltstack decoder.
27762	strace used to hang when decoding sigaltstack called with invalid
27763	stack_t pointers because of mishandling umove() return code.
27764
27765	* signal.c (print_stack_t): Handle unfetchable stack_t properly.
27766	Change return type to void.
27767	(sys_sigaltstack): Update print_stack_t() usage.
27768
27769	Reported-by: kawillia@ucalgary.ca
27770
277712013-02-09  Mike Frysinger  <vapier@gentoo.org>
27772
27773	Fix decoding of sysctl() when oldval fields are NULL.
27774	If you call glibc's syscall wrapper like so:
27775		static int name[] = { CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE };
27776		int buffer[2] = { 32768, 61000 };
27777		size_t size = sizeof(buffer);
27778		sysctl(name, 3, 0, 0, buffer, size);
27779	(note that oldval/oldlenp are NULL).
27780
27781	The current strace code complains like so:
27782	_sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, process_vm_readv: Bad address
27783	(nil), 0, 0x7fffe23c3960, 8}) = -1 EACCES (Permission denied)
27784
27785	Since passing NULL for the old values is valid, handle that explicitly.
27786	This also simplifies the code a bit by splitting up the handling of the
27787	new and old args so that we only handle the new args once.
27788
27789	Now the output looks like:
27790	_sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, NULL, 0, 0x7fff8c0c91b0, 8) = -1 EACCES (Permission denied)
27791
27792	* system.c (sys_sysctl): Check if info.oldval is NULL first.  Move the
27793	processing of oldlen/info.newval/info.newlen out so they always get
27794	executed.  Fix the format strings so we use %lu for unsigned long rather
27795	than a mix of %ld and %lu.
27796
277972013-02-08  Denys Vlasenko  <vda.linux@googlemail.com>
27798
27799	If we are on a glibc system, assume it's at least glibc 2.1.
27800	It is not likely anyone uses glibc older that that:
27801	glibc 2.1.1 was released in 1999
27802
27803	* net.c: Remove test for glibc >= 2.1.
27804	* signal.c: Remove code which is compiled only for glibc < 2.1.
27805	* util.c: Likewise.
27806
278072013-02-08  Denys Vlasenko  <vda.linux@googlemail.com>
27808
27809	S390: stop using needlessly static long pc variable.
27810	* syscall.c: Remove "static long pc" variable.
27811	(get_scno): Use an automatic long variable instead of a static.
27812
27813	Dying suddenly with abort() is rude, avoid if possible.
27814	* file.c (sys_utime): Don't call abort() if wordsize is strange.
27815	Instead, warn user about it.
27816	* desc.c (printflock): Use the same message string as in sys_utime.
27817
27818	Remove vestigial hacks around non-Linux struct sigactions.
27819	* signal.c: Stop using __sighandler_t glibc'ism. Remove SA_HANDLER macro.
27820	Explain why we can't use "sa_handler" as a field name.
27821	(sys_sigaction): Use __sa_handler instead of SA_HANDLER macro.
27822	(sys_rt_sigaction): Likewise.
27823
278242013-02-08  Denys Vlasenko  <vda.linux@googlemail.com>
27825
27826	Optimize AArch64 handling of 32-bit personality.
27827	By putting aarch64_regs and arm_regs into a union,
27828	register copying is eliminated.
27829	No need to check and change personality on syscall exit.
27830
27831	* defs.h: Remove unused NUM_ARM_REGS define. Fix indentation.
27832	* syscall.c: Put aarch64_regs and arm_regs into a union.
27833	(update_personality): Shorten bitness message.
27834	(printcall): Add commented-out PC printing.
27835	(get_regs): Remove now-unnecessary 64-to-32 bits register copying.
27836	(get_syscall_result): Drop personality changing code.
27837
278382013-02-07  Denys Vlasenko  <vda.linux@googlemail.com>
27839
27840	Rename some register statics by prefixing their names with arch.
27841	This makes it easier to grep for them.
27842
27843	* syscall.c: Make IA64's r8, r10 global variables static.
27844	Rename variables:
27845	r8,r10 -> ia64_r8,ia64_r10.
27846	d0 -> m68k_d0.
27847	a3 -> alpha_a3.
27848	r28 -> hppa_r28.
27849	r9 -> sh64_r9.
27850	r10 -> cris_r10.
27851	r3 -> microblaze_r3.
27852	(get_scno): Use new variable names.
27853	(syscall_fixup_on_sysenter): Likewise.
27854	(get_syscall_result): Likewise.
27855	(get_error): Likewise.
27856
278572013-02-06  Denys Vlasenko  <vda.linux@googlemail.com>
27858
27859	Rename ARM's regs structure to arm_regs.
27860	Compile-tested.
27861
27862	* defs.h: Rename regs structure to arm_regs.
27863	* syscall.c: Likewise.
27864	(printcall): Use new name instead of old one.
27865	(get_regs): Likewise.
27866	(get_scno): Likewise.
27867	(get_syscall_args): Likewise.
27868	(get_error): Likewise.
27869	* signal.c (sys_sigreturn): Likewise.
27870
278712013-02-06  Denys Vlasenko  <vda.linux@googlemail.com>
27872
27873	Stop needlessly using static variable.
27874	* syscall.c: Remove static long psr.
27875	(get_scno): Use local psr variable.
27876	(get_syscall_result): Likewise.
27877
278782013-02-06  Denys Vlasenko  <vda.linux@googlemail.com>
27879
27880	Shortcut tests for fork/exec syscalls.
27881	This change should speed up strace by a tiny bit.
27882
27883	More importantly, it makes it much more clear that
27884	fork and exec fixups are not necessary for any reasonably
27885	recent kernels. IOW: syscall_fixup_for_fork_exec() and its callees
27886	are all dead code.
27887
27888	* defs.h: Declare new need_fork_exec_workarounds flag variable.
27889	* strace.c: Define need_fork_exec_workarounds flag variable.
27890	(test_ptrace_setoptions_followfork): Return 0/1 as success/fail indicator.
27891	(test_ptrace_setoptions_for_all): Likewise.
27892	(init): Set need_fork_exec_workarounds to TRUE if needed.
27893	* syscall.c: Rename internal_syscall() to syscall_fixup_for_fork_exec().
27894	(trace_syscall_entering): Call syscall_fixup_for_fork_exec() only if
27895	need_fork_exec_workarounds == TRUE.
27896	(trace_syscall_exiting): Likewise.
27897
278982013-02-05  Ben Noordhuis  <info@bnoordhuis.nl>
27899
27900	Improve perf_event_open argument decoding.
27901	* configure.ac (AC_CHECK_HEADERS): Add linux/perf_event.h.
27902	* desc.c [HAVE_LINUX_PERF_EVENT_H]: Include <linux/perf_event.h>.
27903	(perf_event_open_flags): New xlat structure.
27904	(sys_perf_event_open): New function.
27905	* linux/dummy.h (sys_perf_event_open): Remove.
27906	* linux/syscall.h (sys_perf_event_open): New prototype.
27907
279082013-02-05  Chris Metcalf  <cmetcalf@tilera.com>
27909
27910	tile: fix merge skew with new get_regs architecture.
27911	* defs.h [TILE]: Declare clear_regs(), get_regs() and get_regs_error.
27912	* syscall.c (get_regs) [TILE]: Fix merge skew.
27913	(printcall) [TILE]: fix a compiler warning about pt_reg_t in
27914	a printf expression.
27915
279162013-02-05  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>
27917
27918	mount: decode MS_NOSEC.
27919	* system.c (MS_NOSEC): Define.
27920	(mount_flags): Add MS_NOSEC.
27921
27922	mmap: decode MAP_UNINITIALIZED.
27923	* mem.c (mmap_flags): Add MAP_UNINITIALIZED.
27924
279252013-02-05  Dmitry V. Levin  <ldv@altlinux.org>
27926
27927	Print 64-bit instruction pointers zero padded.
27928	* syscall.c (printcall): Print 64-bit instruction pointers zero padded.
27929
27930	x86_64: fix compilation warning introduced in previous commit.
27931	* syscall.c (printcall): Cast x86_64_regs.rip to the type being printed.
27932
279332013-02-05  Denys Vlasenko  <vda.linux@googlemail.com>
27934
27935	Simple bug fix for x86_86.
27936	* syscall.c (printcall): Use x86_64_regs.rip, not x86_64_regs.ip.
27937
279382013-02-05  Chris Metcalf  <cmetcalf@tilera.com>
27939
27940	Add tilegx support to strace.
27941	tilegx support has been in the kernel since 3.0.
27942	In addition, fix some issues with the tilepro support already
27943	present in strace, primarily the decision to use the
27944	<asm/unistd.h> numbering space for system calls.
27945
27946	* defs.h [TILE]: Include <asm/ptrace.h> and provide an extern
27947	struct pt_regs tile_regs for efficiency.  Provide compat 32-bit
27948	personality via SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE,
27949	PERSONALITY1_WORDSIZE, and DEFAULT_PERSONALITY.
27950	* linux/tile/errnoent1.h: New file, includes linux/errnoent.h.
27951	* linux/tile/ioctlent1.h: New file, includes linux/ioctlent.h.
27952	* linux/tile/signalent1.h: New file, includes linux/signalent.h.
27953	* linux/tile/syscallent.h: Update with new asm-generic syscalls.
27954	The version previously committed was the from the first tile patch
27955	to LKML, which subsequently was changed to use <asm-generic/unistd.h>.
27956	* linux/tile/syscallent1.h: Copy from linux/tile/syscallent.h.
27957	* mem.c (addtileflags) [TILE]: use %ld properly for a "long" variable.
27958	* process.c [TILE]: Choose clone arguments correctly and properly
27959	suppress all "struct user" related offsets in user_struct_offsets.
27960	* signal.c [TILE]: Use tile_regs not upeek.
27961	* syscall.c (update_personality) [TILE]: Print mode.
27962	(PT_FLAGS_COMPAT) [TILE]: Provide if not in system headers.
27963	(tile_regs) [TILE]: Define 'struct pt_regs' variable to hold state.
27964	(get_regs) [TILE]: use PTRACE_GETREGS to set tile_regs rather than using upeek.
27965	(get_scno) [TILE]: Set personality.
27966	(get_syscall_args) [TILE]: Use tile_regs.
27967	(get_syscall_result) [TILE]: Update tile_regs.
27968	(get_error) [TILE]: Use tile_regs.
27969	(printcall) [TILE]: Print pc.
27970	(arg0_offset, arg1_offset, restore_arg0, restore_arg1) [TILE]:
27971	Properly handle tile call semantics and support tilegx.
27972
279732013-02-05  Denys Vlasenko  <vda.linux@googlemail.com>
27974
27975	Small optimization for SPARC[64] get_scno.
27976	* syscall.c: Remove static unsigned long trap veriable.
27977	(get_scno): Use local trap variable.
27978
27979	Do not compile getrval2() if not needed.
27980	* syscall.c (getrval2): Do not compile it for architetures where
27981	it isn't ever used.
27982
279832013-02-05  Denys Vlasenko  <vda.linux@googlemail.com>
27984
27985	Optimize out PTRACE_PEEKUSER with -i.
27986	strace -i was fetching PC with a separate PEEKUSER
27987	despite having GETREGS data:
27988
27989	ptrace(PTRACE_GETREGS, 22331, 0, 0x8087f00) = 0
27990	ptrace(PTRACE_PEEKUSER, 22331, 4*EIP, [0x80dd7b7]) = 0
27991	write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82
27992	ptrace(PTRACE_SYSCALL, 22331, 0, SIG_0) = 0
27993
27994	Now it does this:
27995
27996	ptrace(PTRACE_GETREGS, 22549, 0, 0x8087ea0) = 0
27997	write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82
27998	ptrace(PTRACE_SYSCALL, 22549, 0, SIG_0) = 0
27999
28000	Analogous improvement in sys_sigreturn() is also implemented.
28001
28002	* defs.h: Declare extern struct pt_regs regs for SPARC[64] and ARM.
28003	Declare clear_regs(), get_regs() and get_regs_error flag variable.
28004	* strace.c (trace): Call get_regs(pid) as soon as we know the tcb
28005	and that it is stopped.
28006	* syscall.c (get_regs): New function. Used to fetch registers early,
28007	just after tracee has stopped.
28008	(printcall): Move it here from util.c. Use global regs.REG data,
28009	if available on the arch, instead of re-fetching it.
28010	(get_scno): Use global regs.REG data.
28011	(get_syscall_result): Likewise.
28012	* signal.c (sys_sigreturn): Likewise.
28013	* util.c (printcall): Moved to syscall.c.
28014
280152012-12-15  Stanislav Brabec  <sbrabec@suse.cz>
28016
28017	Fix sys_semtimedop decoding on s390x.
28018	The s390 and s390x pass semtimedop arguments differently from other
28019	architectures.  sys_semtimedop parser was fixed for s390 by commit
28020	v4.6-177-ge0f5fd8, and s390x requires the same fix.
28021
28022	* linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390x.
28023
280242012-12-08  Dmitry V. Levin  <ldv@altlinux.org>
28025
28026	Fix *xattr decoding.
28027	* file.c (print_xattr_val): Do not attempt to decode a zero sized array.
28028	Fixes RH#885233.
28029
280302012-12-08  Stanislav Brabec  <sbrabec@suse.cz>
28031
28032	sys_semtimedop: fix timeval argument index in wrapped call.
28033	Looking at the implementation of wrapped semtimedop() call inside glibc
28034	and kernel, I started to believe that timeval should be located in
28035	tcp->u_arg[4] and not tcp->u_arg[5].  Fortunately, tcp->u_arg[5] now
28036	works correctly as well, due to side effects of decode_ipc_subcall().
28037
28038	declaration in header:
28039	int semtimedop(semid, *sops, nsops, *timeout);
28040	                 0      1      2        3
28041
28042	sys_ipc arguments in glibc on all patforms except s390*:
28043	semid, (int) nsops, 0, CHECK_N (sops, nsops), timeout
28044	  0            1    2            3                4
28045	We have to use indexes: 0 3 1 4
28046
28047	sys_ipc arguments on s390*:
28048	semid, (int) nsops, timeout, sops
28049	  0            1       2       3
28050	We have to use indexes: 0 3 1 2
28051
28052	* ipc.c (sys_semtimedop) [!S390]: Fix timeval argument index in
28053	indirect_ipccall case.
28054
280552012-12-06  John Spencer  <maillist-strace@barfooze.de>
28056
28057	Fix glibc version checks.
28058	* util.c: Check if __GLIBC__ is defined before using it.
28059	* signal.c: Likewise.  Fix __GLIBC_MINOR__ checks.
28060
280612012-11-29  James Hogan  <james.hogan@imgtec.com>
28062
28063	Add state argument to change_syscall and fix SPARC.
28064	Add a state argument to change_syscall() so that SPARC can modify that
28065	instead of read-modify-writing the whole register set.  This function is
28066	always called within an arg_setup/arg_finish_change sequence which on
28067	certain architectures like SPARC will also be doing a read-modify-write.
28068	This prevents the second write (from arg_finish_change) from undoing the
28069	effects of the change_syscall call.
28070
28071	* util.c (change_syscall): Move below definition of arg_setup_state.
28072	Add state argument.
28073	[SPARC || SPARC64] Change to set state->u_regs[U_REG_G1] rather than
28074	read-modify-writing it with PTRACE_GETREGS and PTRACE_SETREGS.
28075	(setbpt, clearbpt): Pass state argument to change_syscall.
28076
280772012-11-12  Steve McIntyre  <steve.mcintyre@linaro.org>
28078
28079	Add support for tracing 32-bit ARM EABI binaries on AArch64.
28080	* defs.h [AARCH64]: Copy in the definition of arm_pt_regs and the
28081	accessor macros, so it's possible to build on AArch64 without
28082	ARM system headers.  Set SUPPORTED_PERSONALITIES to 2.
28083	Define PERSONALITY0_WORDSIZE and PERSONALITY1_WORDSIZE.
28084	Set DEFAULT_PERSONALITY to 1.
28085	* linux/aarch64/errnoent1.h: New file, includes generic errnoent.h.
28086	* linux/aarch64/ioctlent1.h: New file, includes generic ioctlent.h.
28087	* linux/aarch64/signalent1.h: New file, includes generic signalent.h.
28088	* linux/aarch64/syscallent1.h: Rename from linux/aarch64/syscallent.h.
28089	* linux/aarch64/syscallent.h: New file, includes arm/syscallent.h.
28090	* syscall.c [AARCH64]: Define aarch64_regs.
28091	(update_personality) [AARCH64]: Add debug output.
28092	(get_scno) [AARCH64]: Determine if we're in ARM or AArch64 mode by
28093	checking the size of the returned uio structure from PTRACE_GETREGSET
28094	and interpret the structure accordingly.
28095	(get_syscall_result): Likewise.
28096	(get_syscall_args): Merge the AArch64 and ARM sections so that on
28097	AArch64 we can fall back to supporting the ARM personality.
28098	(get_error): Likewise.
28099
281002012-11-12  Dmitry V. Levin  <ldv@altlinux.org>
28101
28102	Move asm-generic ioctl definitions to linux/ioctlent.h.in.
28103	* linux/ioctlent.h.in: Add asm-generic ioctl entries from all
28104	linux/*/ioctlent.h.in files.
28105	* linux/bfin/ioctlent.h.in: Remove asm-generic ioctl entries.
28106	* linux/i386/ioctlent.h.in: Likewise.
28107	* linux/powerpc/ioctlent.h.in: Likewise.
28108	* linux/s390/ioctlent.h.in: Likewise.
28109	* linux/sparc/ioctlent.h.in: Likewise.
28110
281112012-10-27  Dmitry V. Levin  <ldv@altlinux.org>
28112
28113	Filter out redundant "*32" ioctl entries.
28114	* linux/ioctlent-filter.awk: New file.
28115	* Makefile.am: Use it.
28116	* linux/ioctlent.h.in: Removed redundant "*32" entries.
28117
281182012-10-26  Dmitry V. Levin  <ldv@altlinux.org>
28119
28120	Enhance quotactl decoding.
28121	* quota.c (sys_quotactl): Decode 2nd syscall argument using printpath.
28122	* pathtrace.c (pathtrace_match): Add quotactl support.
28123	* linux/*/syscallent.h: Add TF flag to quotactl entry.
28124
281252012-10-26  Steve McIntyre  <steve.mcintyre@linaro.org>
28126
28127	Add AArch64 support to strace.
28128	AArch64 has been included in linux from 3.7 onwards.
28129	Add support for AArch64 in strace, tested on linux in a simulator.
28130
28131	* configure.ac: Support AArch64.
28132	* defs.h [AARCH64]: Include <sys/ptrace.h>, define TCB_WAITEXECVE.
28133	* ipc.c (indirect_ipccall): Support AArch64.
28134	* process.c (struct_user_offsets): Likewise.
28135	* syscall.c [AARCH64]: Include <asm/ptrace.h>,  <sys/uio.h>, and
28136	<elf.h>.  Define struct user_pt_regs regs.
28137	(get_scno, get_syscall_result): Support AArch64 using PTRACE_GETREGSET.
28138	(get_syscall_args, get_error): Support AArch64.
28139	* linux/aarch64/ioctlent.h.in: New file.
28140	* linux/aarch64/syscallent.h: New file, based on linux 3.7 version of
28141	asm-generic/unistd.h.
28142
281432012-10-26  Steve McIntyre  <steve.mcintyre@linaro.org>
28144
28145	linux: add new errno values for EPROBE_DEFER and EOPENSTALE.
28146	New definitions match updates in Linux 3.4 and Linux 3.5 respectively.
28147
28148	* linux/errnoent.h (ERRNO_517): Change to EPROBE_DEFER.
28149	(ERRNO_518): Change to EOPENSTALE.
28150
281512012-10-26  Namhyung Kim  <namhyung.kim@lge.com>
28152
28153	Add -e trace=memory option.
28154	Add a new 'memory' category for tracing memory mapping related syscalls.
28155
28156	Affected syscalls are: break, brk, get_mempolicy, madvise, mbind,
28157	migrate_pages, mincore, mlock, mlockall, mmap, move_pages, mprotect,
28158	mremap, msync, munlock, munlockall, munmap, remap_file_pages, and
28159	set_mempolicy.
28160
28161	* defs.h (TRACE_MEMORY): New macro.
28162	* syscall.c (lookup_class): Handle trace=memory option.
28163	* strace.1: Document it.
28164	* linux/alpha/syscallent.h: Add TM flag to memory mapping related syscalls.
28165	* linux/arm/syscallent.h: Likewise.
28166	* linux/avr32/syscallent.h: Likewise.
28167	* linux/bfin/syscallent.h: Likewise.
28168	* linux/hppa/syscallent.h: Likewise.
28169	* linux/i386/syscallent.h: Likewise.
28170	* linux/ia64/syscallent.h: Likewise.
28171	* linux/m68k/syscallent.h: Likewise.
28172	* linux/microblaze/syscallent.h: Likewise.
28173	* linux/mips/syscallent.h: Likewise.
28174	* linux/powerpc/syscallent.h: Likewise.
28175	* linux/s390/syscallent.h: Likewise.
28176	* linux/s390x/syscallent.h: Likewise.
28177	* linux/sh/syscallent.h: Likewise.
28178	* linux/sh64/syscallent.h: Likewise.
28179	* linux/sparc/syscallent.h: Likewise.
28180	* linux/tile/syscallent.h: Likewise.
28181	* linux/x32/syscallent.h: Likewise.
28182	* linux/x86_64/syscallent.h: Likewise.
28183
281842012-09-28  Mike Frysinger  <vapier@gentoo.org>
28185
28186	x32: add 64bit annotation too.
28187	Since someone can invoke these entry points directly with syscall(),
28188	at least decode their name and show that they're 64bit versions rather
28189	than just showing syscall_###.
28190
28191	* linux/x32/syscallent.h: Sync all missing entries below 312 with x86_64.
28192
281932012-09-28  Dmitry V. Levin  <ldv@altlinux.org>
28194
28195	Ignore fflush(3) return value.
28196	strace used to honor fflush(3) return value in trace_syscall_entering
28197	which resulted to tracees not being PTRACE_SYSCALL'ed which in turn
28198	caused nasty hangups like this one:
28199
28200	$ strace -o'|:' pwd
28201	|:: Broken pipe
28202
28203	There is little strace can do in case of fflush(3) returning EOF, and
28204	hangup is certainly not the best solution for the issue.
28205
28206	* syscall.c (trace_syscall_entering): Ignore fflush(3) return value.
28207
282082012-09-28  Dmitry V. Levin  <ldv@altlinux.org>
28209
28210	Use perror_msg instead of perror.
28211	* signal.c (sys_sigreturn): Use perror_msg instead of perror.
28212	* strace.c (tprintf, tprints, detach, startup_attach): Likewise.
28213	* syscall.c (get_scno): Likewise.
28214	* util.c (umoven, umovestr): Likewise.
28215
282162012-09-27  Denys Vlasenko  <vda.linux@googlemail.com>
28217
28218	process_vm_readv may return ESRCH if tracee was killed, don't complain.
28219	Discovered by running test/sigkill_rain under strace.
28220
28221	* util.c (umoven): Do not emit error message if process_vm_readv
28222	fails with ESRCH.
28223	(umovestr): LikeWise.
28224
282252012-09-13  Denys Vlasenko  <vda.linux@googlemail.com>
28226
28227	Trivial fixes, no code changes.
28228	* strace.c: Fix compiler warning message about tgkill - we don't use it.
28229	Fix indentation of preprocessor directives.
28230	(trace): Remove outdated comment.
28231
282322012-08-24  Dmitry V. Levin  <ldv@altlinux.org>
28233
28234	Always check setreuid return code.
28235	* strace.c (startup_child): Check setreuid return code.
28236
282372012-08-24  Mike Frysinger  <vapier@gentoo.org>
28238
28239	x32: update {g,s}etsockopt syscall numbers.
28240	Starting with linux 3.6 (and backported to earlier kernels), these two
28241	syscalls have changed numbers (moving from native to compat entry points).
28242	Update the strace syscall list accordingly.
28243
28244	* linux/x32/syscallent.h: Move setsockopt from 54 to 541, and move
28245	getsockopt from 55 to 542.
28246
282472012-08-16  Dmitry V. Levin  <ldv@altlinux.org>
28248
28249	Decode file type returned by getdents system call.
28250	* file.c (sys_getdents): Decode d_type in unabbreviated mode.
28251
282522012-07-12  Dmitry V. Levin  <ldv@altlinux.org>
28253
28254	Close pipe and wait for the pipe process termination.
28255	In case of normal strace termination, when the trace output is
28256	redirected to a file or a pipe, close it and wait for the pipe
28257	process termination.
28258
28259	* strace.c (main): Before normal exit, close shared_log when it
28260	differs from stderr, and wait for popen_pid termination.
28261
282622012-07-10  Denys Vlasenko  <vda.linux@googlemail.com>
28263
28264	Enable usage of PTRACE_SEIZE.
28265	* defs.h: Define USE_SEIZE to 1. Remove PTRACE_SEIZE_DEVEL
28266	and PTRACE_EVENT_STOP1.
28267	* strace.c (ptrace_attach_or_seize): Replace PTRACE_SEIZE_DEVEL
28268	with 0.
28269	(trace): Do not check for PTRACE_EVENT_STOP1.
28270
282712012-06-05  Mike Frysinger  <vapier@gentoo.org>
28272
28273	x32: update syscall table.
28274	This syncs with the syscall table as it is in linux 3.4.
28275
28276	* linux/x32/syscallent.h (59): Fix comment typo.
28277	(78): Add missing getdents entry.
28278	(174): Delete create_module entry (not in the kernel).
28279	(181, 182, 183, 184, 185): Add missing entries.
28280	(524, 536, 539, 540): Fix spacing.
28281
282822012-05-18  Denys Vlasenko  <vda.linux@googlemail.com>
28283
28284	Merge adjacent printing operations in a few places.
28285	* file.c (sys_readahead): Merge tprints() with following printllval().
28286	(sys_ftruncate64): Likewise.
28287	(sys_fadvise64): Likewise.
28288	(sys_fadvise64_64): Likewise.
28289	(sys_fallocate): Merge tprints() with following tprintf().
28290
282912012-05-16  Denys Vlasenko  <vda.linux@googlemail.com>
28292
28293	Use %d printf format instead of %i everywhere.
28294	* loop.c (loop_ioctl): Use %d instead of %i.
28295	* mtd.c (mtd_ioctl): Likewise.
28296
28297	Fix a few goofs in sys_sysctl()
28298	* system.c (sys_sysctl): Cast pointer to long, not size_t,
28299	when we intend to use it as an address. Set oldlen to 0 prior
28300	to reading into it - we want to have deterministic result
28301	if read fails.
28302
283032012-05-16  Denys Vlasenko  <vda.linux@googlemail.com>
28304
28305	Stop using non-standard %Zu and %Zd formats for size_t printing.
28306	The documented formats are %zu and %zd, but since our (normally disabled)
28307	"fast" printf code doesn't support those too, I convert them to %lu and %ld.
28308
28309	* bjm.c (sys_query_module): Convert %Zd usages to %lu.
28310	* system.c (sys_sysctl): Likewise.
28311
283122012-05-15  Denys Vlasenko  <vda.linux@googlemail.com>
28313
28314	Remove outdated comment about suspending new tracees.
28315	We no longer track parent/child relationship between tracees.
28316	Therefore, we no longer suspend new tracee until parent is seen
28317	exiting form [v]fork/clone. The comment is obsolete.
28318
28319	* strace.c (trace): Remove outdated comment.
28320
283212012-05-15  Denys Vlasenko  <vda.linux@googlemail.com>
28322
28323	Make sure current_wordsize and PERSONALITY0_WORDSIZE are ints in all arches
28324	On 64bit systems with a single personality, they used to be sizeof(long),
28325	which has type "long", not "int", which complicates printf formats.
28326
28327	* defs.h: Ensure that PERSONALITY0_WORDSIZE;s tyoe is int.
28328	This in turn makes sure current_wordsize is also an int.
28329	* count.c (call_summary): Revert the change which added cast to int.
28330
283312012-05-15  Dmitry V. Levin  <ldv@altlinux.org>
28332
28333	Add configure --enable-gcc-Werror option.
28334	* configure.ac: New option --enable-gcc-Werror.
28335
28336	Make x86-64 build free of artificial warnings.
28337	* signal.c (sys_sigreturn): Do not issue "no sys_sigreturn" warning
28338	on X86_64.
28339
283402012-05-14  Dmitry V. Levin  <ldv@altlinux.org>
28341
28342	Fix kernel release string parsing.
28343	* strace.c (get_os_release): Handle "X.Y-something" utsname.release
28344	strings properly.
28345
28346	Reported-by: Bryce Gibson <bryce@gibson-consulting.com.au>
28347
283482012-05-14  Denys Vlasenko  <vda.linux@googlemail.com>
28349
28350	On clearing "breakpopint", restore syscall number too.
28351	This fixes Fedora bug 659382.
28352	Low risk: this code is not supposed to be used on any non-acient kernel.
28353
28354	* util.c (clearbpt): Restore syscall number too.
28355
283562012-05-05  Mike Frysinger  <vapier@gentoo.org>
28357
28358	util: fix building when glibc has a stub process_vm_readv.
28359	If you have a newer glibc which provides process_vm_readv, but it is built
28360	against older kernel headers which lack __NR_process_vm_readv, the library
28361	will contain a stub implementation that just returns ENOSYS.  Autoconf
28362	checks for this case explicitly and will declare it as unavailable.  So we
28363	end up in a case where the headers provide the prototype, but autoconf has
28364	not defined HAVE_PROCESS_VM_READV, so we hit the same build failure again:
28365
28366	util.c:738:16: error: static declaration of 'process_vm_readv' follows non-static declaration
28367	/usr/include/bits/uio.h:58:16: note: previous declaration of 'process_vm_readv' was here
28368
28369	So rename our local function to something unique, and add a define so the
28370	callers all hit the right place.
28371
28372	* util.c (strace_process_vm_readv): Rename from process_vm_readv.
28373	(process_vm_readv): Define to strace_process_vm_readv.
28374
283752012-05-03  Dmitry V. Levin  <ldv@altlinux.org>
28376
28377	doc: describe documentation policy.
28378	* README-hacking: Describe documentation policy.
28379
283802012-05-02  Dmitry V. Levin  <ldv@altlinux.org>
28381
28382	maint: post-release administrivia.
28383	* NEWS: Add header line for next release.
28384
28385	Prepare for 4.7 release.
28386	* configure.ac: Version 4.7.
28387	* debian/changelog: 4.7-1.
28388	* strace.spec: 4.7-1.
28389
28390	Fix build with <linux/loop.h> from 2.6.18 kernel headers.
28391	* configure.ac: Check for LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN
28392	declarations.
28393	* loop.c (loop_flags_options): Use LO_FLAGS_AUTOCLEAR and
28394	LO_FLAGS_PARTSCAN only when appropriate declarations are available.
28395	(loop_ioctl): Use LOOP_SET_CAPACITY only when it is defined.
28396
283972012-05-01  Dmitry V. Levin  <ldv@altlinux.org>
28398
28399	* vsprintf.c: Check for USE_CUSTOM_PRINTF earlier.
28400
28401	Remove duplicate names from CREDITS.
28402	* .mailmap: Merge email addresses.
28403	* CREDITS.in: Remove a duplicate name.
28404
284052012-05-01  Dmitry V. Levin  <ldv@altlinux.org>
28406
28407	tests: raise strace check timeout to 60 seconds.
28408	* tests/init.sh (check_timeout): New variable.
28409	* tests/ptrace_setoptions: Use it.
28410	* tests/strace-f: Likewise.
28411
28412	Reported-by: Mike Frysinger <vapier@gentoo.org>
28413
284142012-05-01  Dmitry V. Levin  <ldv@altlinux.org>
28415
28416	Update STA_* constants.
28417	* time.c (adjtimex_status): Add STA_NANO, STA_MODE, and STA_CLK.
28418	* NEWS (Improvements): Mention it.
28419
28420	NEWS: update for release.
28421	* NEWS (Improvements): Mention recent recvmsg/recvmmsg decoders
28422	enhancements.
28423	(Portability): Add a recommendation for the minimum Linux kernel
28424	version to use.
28425
28426	Make printing of utsname.domainname more portable.
28427	* configure.ac: Check for struct utsname.domainname field.
28428	* process.c (sys_uname): Print utsname.domainname when the field is
28429	available.
28430
284312012-05-01  Dmitry V. Levin  <ldv@altlinux.org>
28432
28433	Fix recvmmsg decode: do not show more data than actually returned.
28434	This change complements recent fix for recvmsg decoding.
28435
28436	* net.c (printmmsghdr): Add msg_len parameter to pass down to do_msghdr.
28437	When this parameter is zero, pass mmsghdr.msg_len to do_msghdr instead.
28438	(decode_mmsg): Add msg_len parameter, pass it down to printmmsghdr.
28439	(sys_sendmmsg): Call decode_mmsg with msg_len == (unsigned long) -1L.
28440	(sys_recvmmsg): Call decode_mmsg with msg_len == 0.
28441
284422012-05-01  Dmitry V. Levin  <ldv@altlinux.org>
28443
28444	Remove recently introduced use of ULONG_MAX.
28445	* io.c: Remove limits.h inclusion.
28446	(tprint_iov): Use "(unsigned long) -1L" instead of "ULONG_MAX".
28447	* net.c: Remove limits.h inclusion.
28448	(printmmsghdr, sys_sendmsg): Use "(unsigned long) -1L" instead of
28449	"ULONG_MAX".
28450
284512012-04-28  Denys Vlasenko  <vda.linux@googlemail.com>
28452
28453	Enable printing of uts.domainname in uname syscall.
28454	* process.c (sys_uname): Enable printing of uts.domainname
28455
284562012-04-28  Denys Vlasenko  <vda.linux@googlemail.com>
28457
28458	Fix printstr's len parameter width.
28459	We often pass syscall params and other long-sized values
28460	as printstr(len). Truncating them to int may be a bad thing.
28461
28462	* defs.h: Change len parameter's type from int to long in
28463	string_quote and printstr function declarations.
28464	* util.c (string_quote): Special-case only len==-1, not all len<0.
28465	(printstr): Likewise.
28466
284672012-04-28  Denys Vlasenko  <vda.linux@googlemail.com>
28468
28469	Fix recvmsg decode: do not show more data than actually returned.
28470	I noticed that "hostname -d" talks over netlink and gets 20 bytes
28471	of response, but we show entire 1024 bytes of iov.
28472	This changes fixes that.
28473
28474	* defs.h: New function tprint_iov_upto.
28475	* io.c (tprint_iov_upto): Definition of this function.
28476	(tprint_iov): Call tprint_iov_upto.
28477	* net.c (do_msghdr): Add data_size parameter, pass it down to tprint_iov_upto.
28478	(printmsghdr): Add data_size parameter, pass it down to do_msghdr.
28479	(printmmsghdr): Call do_msghdr with data_size==ULONG_MAX.
28480	(sys_sendmsg): Call printmsghdr with data_size==ULONG_MAX.
28481	(sys_recvmsg): Call printmsghdr with data_size==tcp->u_rval.
28482
284832012-04-27  Dmitry V. Levin  <ldv@altlinux.org>
28484
28485	Package strace-log-merge.
28486	* strace.spec (%files): Add strace-log-merge.
28487
284882012-04-27  Mike Frysinger  <vapier@gentoo.org>
28489
28490	NEWS: clarify & fix typo.
28491
284922012-04-27  Mike Frysinger  <vapier@gentoo.org>
28493
28494	Cast current_wordsize to an int.
28495	On 64bit systems with a single personality, we see:
28496	count.c: In function 'call_summary':
28497	count.c:223:5: warning: format '%u' expects type 'unsigned int',
28498		but argument 3 has type 'long unsigned int'
28499
28500	Since on multi-personality systems this is an array of ints, cast
28501	the multiplication to an int and update the printf format.
28502
28503	* count.c (call_summary): Change %u to %d and cast first argument to int.
28504
285052012-04-20  Dmitry V. Levin  <ldv@altlinux.org>
28506
28507	Update NEWS for upcoming 4.7 release.
28508	* NEWS: Update for 4.7 release.
28509
28510	Sync strace.spec and debian/ with packages.
28511	* debian/changelog: Sync with 4.5.20-2.3.
28512	* debian/control: Likewise.
28513	* strace.spec: Sync with 4.6-2.
28514
285152012-04-18  Mike Frysinger  <vapier@gentoo.org>
28516
28517	Decode /dev/loop ioctls.
28518	Needed to debug some losetup failures, and it's easier when you can see
28519	what the kernel is getting vs what you think you're sending, so add some
28520	decoders for those ioctls.
28521
28522	* loop.c: New file.
28523	* Makefile.am (strace_SOURCES): Add loop.c.
28524	* defs.h (loop_ioctl): New prototype.
28525	(string_quote): Likewise.
28526	* ioctl.c (ioctl_decode): Call loop_ioctl when code is 'L'.
28527	* util.c (string_quote): Remove static keyword.
28528
285292012-04-18  H.J. Lu  <hongjiu.lu@intel.com>
28530
28531	x32: add ia32 support.
28532	* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent1.h,
28533	linux/x32/ioctlent1.h, linux/x32/signalent1.h and
28534	linux/x32/syscallent1.h.
28535	* configure.ac: Remove AC_GNU_SOURCE, obsoleted by
28536	AC_USE_SYSTEM_EXTENSIONS.
28537	* defs.h (SUPPORTED_PERSONALITIES): Set to 2 for X32.
28538	(PERSONALITY1_WORDSIZE): Set to 4 for X32.
28539	* file.c (stat64): New struct for X32.
28540	(sys_lseek32): New function for X32.
28541	(stat64): Undef.
28542	(sys_fstat64): Likewise.
28543	(sys_stat64): Likewise.
28544	(realprintstat64): New function for X32.
28545	(sys_fstat64): Likewise.
28546	(sys_stat64): Likewise.
28547	* mem.c (sys_old_mmap): New function for X32.
28548	* pathtrace.c (pathtrace_match): Also check sys_old_mmap for X32.
28549	* syscall.c (update_personality): Add X32 support.
28550	(get_scno): Support currpers == 1 for X32.
28551	* linux/syscall.h (sys_lseek32): New function prototype for X32.
28552	* linux/x32/errnoent1.h: New file.
28553	* linux/x32/ioctlent1.h: Likewise.
28554	* linux/x32/signalent1.h: Likewise.
28555	* linux/x32/syscallent1.h: Likewise.
28556
285572012-04-17  H.J. Lu  <hongjiu.lu@intel.com>
28558
28559	Cast clock_t type to unsigned long long.
28560	* resource.c (sys_times): Cast clock_t type to unsigned long long.
28561	* signal.c (printsiginfo): Likewise.
28562
285632012-04-16  Denys Vlasenko  <vda.linux@googlemail.com>
28564
28565	Add custom (faster) vfprintf implementation (disabled by default)
28566	* defs.h: Declare strace_vfprintf either as a alias to vfprintf
28567	or as a bona fide function. USE_CUSTOM_PRINTF define controls whether
28568	we use strace_vfprintf. By default, we don't.
28569	* strace.c (tprintf): Call strace_vfprintf instead of vfprintf.
28570	* vsprintf.c: New file, implements strace_vfprintf.
28571
285722012-04-16  Denys Vlasenko  <vda.linux@googlemail.com>
28573
28574	Stop using %h[h]u format specifiers.
28575	This is needed for simplified printf, and reduces code size a bit.
28576
28577	* block.c (block_ioctl): Cast the value to unsinged and use %u
28578	instead of using %hu.
28579	* desc.c (sys_io_cancel): Likewise.
28580	* resource.c (sys_sysinfo): Likewise.
28581
285822012-04-16  Denys Vlasenko  <vda.linux@googlemail.com>
28583
28584	Trivial speed optimization.
28585	* strace.c (tprints): Use fputs_unlocked instead of fputs.
28586
285872012-04-16  H.J. Lu  <hongjiu.lu@intel.com>
28588
28589	Fix a problem with sys_lseek on x32.
28590	* file.c (sys_lseek): Use MIPS-n32 variant also for x32
28591
285922012-04-16  H.J. Lu  <hongjiu.lu@intel.com>
28593
28594	Add x32 support to strace.
28595	X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
28596	32bit pointers.  At system call level, x32 is also identical to x86-64,
28597	as shown by many changes like "defined(X86_64) || defined(X32)".  The
28598	main differerence bewteen x32 and x86-64 is off_t in x32 is long long
28599	instead of long.
28600
28601	This patch adds x32 support to strace.  Tested on Linux/x32.
28602
28603	* configure.ac: Support X32.
28604	* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
28605	Set PERSONALITY2_WORDSIZE to 4 for X86_64.
28606	Add tcb::ext_arg for X32.
28607	* file.c (stat): New for X32.
28608	(sys_lseek): Use 64-bit version for X32.
28609	(printstat64): Check current_personality != 1 for X86_64.
28610	* ipc.c (indirect_ipccall): Check current_personality == 1
28611	for X86_64.
28612	* mem.c (sys_mmap64): Also use tcp->u_arg for X32.  Print NULL
28613	for zero address.  Call printllval for offset for X32.
28614	* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
28615	X32.
28616	* process.c (ARG_FLAGS): Defined for X32.
28617	(ARG_STACK): Likewise.
28618	(ARG_PTID): Likewise.
28619	(change_syscall): Handle X32.
28620	(struct_user_offsets): Support X32.
28621	(sys_arch_prctl): Likewise.
28622	* signal.c: Include <asm/sigcontext.h> for X32.
28623	(SA_RESTORER): Also define for X32.
28624	* syscall.c (update_personality): Support X32 for X86_64.
28625	(is_restart_error): Likewise.
28626	(syscall_fixup_on_sysenter): Likewise.
28627	(get_syscall_args): Likewise.
28628	(get_syscall_result): Likewise.
28629	(get_error): Likewise.
28630	(__X32_SYSCALL_BIT): Define if not defined.
28631	(__X32_SYSCALL_MASK): Likewise.
28632	(get_scno): Check DS register value for X32.  Use
28633	__X32_SYSCALL_MASK on X32 system calls.
28634	* util.c (printllval): Use ext_arg for X32.
28635	(printcall): Support X32.
28636	(change_syscall): Likewise.
28637	(arg0_offset): Likewise.
28638	(arg1_offset): Likewise.
28639	* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
28640	linux/x32/ioctlent.h.in, linux/x32/signalent.h,
28641	linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
28642	linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
28643	linux/x86_64/syscallent2.h.
28644	* linux/x32/errnoent.h: New.
28645	* linux/x32/ioctlent.h.in: Likewise.
28646	* linux/x32/signalent.h: Likewise.
28647	* linux/x32/syscallent.h: Likewise.
28648	* linux/x86_64/errnoent2.h: Likewise.
28649	* linux/x86_64/ioctlent2.h: Likewise.
28650	* linux/x86_64/signalent2.h: Likewise.
28651	* linux/x86_64/syscallent2.h: Likewise.
28652
286532012-04-16  H.J. Lu  <hongjiu.lu@intel.com>
28654
28655	Restore tcb::u_lrval; fix lseek on MIPS-n32.
28656	Linux kernel v3.4 adds x32 support.  Both x32 and n32 use 64bit offset
28657	for lseek parameter and return value.  We need u_lrval to handle it
28658	properly.  Also we shouldn't check HAVE_LONG_LONG_OFF_T for n32 lseek.
28659	This patch fixes it properly and prepares lseek for x32.
28660
28661	* defs.h (tcb): Restore tcb::u_lrval field, RVAL_Lfoo constants.
28662	Set RVAL_MASK to 7.
28663	* file.c (sys_lseek): Print 64bit offset and return RVAL_LUDECIMAL
28664	for n32.
28665	* syscall.c (get_error): Set u_lrval for MIPS-n32.
28666	(trace_syscall_exiting): Handle RVAL_Lfoo return value types.
28667
286682012-04-06  Mike Frysinger  <vapier@gentoo.org>
28669
28670	Decode mtd ioctls.
28671	I got tired of figuring out mtd structures (which show up a lot
28672	in the embedded space), so add decoders for those ioctls.
28673
28674	* defs.h (mtd_ioctl): New prototype.
28675	(print_loff_t): Likewise.
28676	* io.c (print_loff_t): Delete static keyword
28677	* ioctl.c (ioctl_decode): Call mtd_ioctl when code is 'M'.
28678	* Makefile.am (strace_SOURCES): Add mtd.c.
28679	(EXTRA_DIST): Add linux/mtd-abi.h.
28680	* mtd.c: New file.
28681	* linux/mtd-abi.h: New file.
28682
286832012-04-05  Mike Frysinger  <vapier@gentoo.org>
28684
28685	Fix indefinite hang on no-mmu systems.
28686	The ptrace setoptions code will fork a child which goes to sleep and
28687	expects the parent to continue on to do tests.  Unfortunately, this
28688	does not work on no-mmu systems as fork() is actually vfork() and any
28689	vforked children will hang the parent until it exits or execs.
28690
28691	We might be able to make this test work on no-mmu systems with a bit
28692	of work, but easier to just disable this for the release so it works
28693	now.
28694
28695	* strace.c (test_ptrace_setoptions_for_all): Return if strace_vforked.
28696
286972012-03-29  Denys Vlasenko  <vda.linux@googlemail.com>
28698
28699	Makefile.am: whitespace fix.
28700
287012012-03-27  Anton Blanchard  <anton@samba.org>
28702
28703	powerpc: Add syscall entries for direct socket system calls.
28704	* linux/powerpc/syscallent.h: Add direct socket system calls.
28705
287062012-03-26  Dmitry V. Levin  <ldv@altlinux.org>
28707
28708	qual_syscall: fix potential NULL dereference.
28709	Fix regression introduced by commit
28710	c1371ebc400fe9578908beca87f2bf407daf1506
28711
28712	* syscall.c (qual_syscall): Handle null sys_name.
28713
28714	Reported-by: Fr. Br. George <george@altlinux.org>
28715
287162012-03-26  Dmitry V. Levin  <ldv@altlinux.org>
28717
28718	strace-log-merge: fix file suffix calculation.
28719	* strace-log-merge: Quote file prefix to fix file suffix calculation.
28720
28721	Reported-by: Denys Vlasenko <vda.linux@googlemail.com>
28722	Suggested-by: Andreas Schwab <schwab@linux-m68k.org>
28723
287242012-03-26  Denys Vlasenko  <vda.linux@googlemail.com>
28725
28726	Remove unreachable code.
28727	* strace.c (process_opt_p_list): Remove unreachable code.
28728
28729	manpage: remove false info about -p being limited to 32 processes.
28730
28731	Tweak help text and manpage (added -In to manpage)
28732
287332012-03-25  Dmitry V. Levin  <ldv@altlinux.org>
28734
28735	printstr: check for potential integer overflow.
28736	* util.c (printstr): Check for potential integer overflow during outstr
28737	buffer size calculation.
28738
28739	Robustify parsing of numbers from strings.
28740	* defs.h (string_to_uint): New prototype.
28741	* util.c (string_to_uint): New function.
28742	* strace.c (error_opt_arg): New function.
28743	(process_opt_p_list): Use string_to_uint instead of atoi.
28744	Terminate in case of invalid process id.
28745	(init): Use string_to_uint instead of atoi.
28746	Use error_opt_arg in case of invalid option argument.
28747	* syscall.c (qual_syscall, qual_signal, qual_desc): Use string_to_uint
28748	instead of atoi.
28749
28750	strace-log-merge: enhance usage error diagnostics.
28751	* strace-log-merge: Add --help option.  Check number of arguments.
28752	Issue an error message when no strace output was merged.
28753
28754	configure.ac: sort lists and use m4_normalize to ease maintenance.
28755	* configure.ac (AC_CHECK_FUNCS, AC_CHECK_HEADERS, AC_CHECK_MEMBERS,
28756	AC_CHECK_DECLS): Sort lists, use m4_normalize.
28757
287582012-03-23  Denys Vlasenko  <vda.linux@googlemail.com>
28759
28760	Simple optimizations.
28761	Why open-coding isdigit is a good idea?
28762
28763	Before: call   __ctype_b_loc
28764	        movzbl (%ebx),%edx
28765	        mov    (%eax),%eax
28766	        testb  $0x8,0x1(%eax,%edx,2)
28767	        je     lbl
28768
28769	After:  movzbl (%eax),%edx
28770	        sub    $0x30,%edx
28771	        cmp    $0x9,%dl
28772	        ja     lbl
28773
28774	   text	   data	    bss	    dec	    hex	filename
28775	 236869	    704	  18944	 256517	  3ea05	strace.before
28776	 236719	    700	  18944	 256363	  3e96b	strace
28777
28778	* defs.h: Alias sigemptyset to __sigemptyset on glibc.
28779	* syscall.c (qual_syscall): Open-code isdigit.
28780	(qual_desc): Likewise.
28781	(qual_signal): Open-code isdigit. Remove string copying
28782	which was done for no apparent reason.
28783
287842012-03-23  Denys Vlasenko  <vda.linux@googlemail.com>
28785
28786	Reorder declarations in defs.h. No code changes.
28787	* defs.h: Reorder declarations (such as: keep all printing functions together).
28788
287892012-03-22  Denys Vlasenko  <vda.linux@googlemail.com>
28790
28791	Simplify current tcp switching and current column handling.
28792	Instead of using "static FILE *outf and static unsigned int curcol"
28793	to cache current outfile and its position, we can simply
28794	remember current tcb and use its ->outf and ->curcol.
28795	This allows to drop numerous "tcp->curcol = curcol" ops in trace().
28796
28797	Turns out we can't drop "static FILE *outf", but now its role is
28798	a bit clearer: it newer changes after init, stays == stderr or
28799	opened to shared log (which may be the same thing if neither -o
28800	nor -ff was specified). Let's rename it then.
28801
28802	   text	   data	    bss	    dec	    hex	filename
28803	 236953	    704	  18944	 256601	  3ea59	strace.before.prev.commit
28804	 236905	    704	  18944	 256553	  3ea29	strace.before
28805	 236869	    704	  18944	 256517	  3ea05	strace
28806
28807	* strace.c: Replace curcol static variable by struct tcb *current_tcp.
28808	Rename static FILE *outf to shared_log (since it no longer caches tcp->outf).
28809	(ptrace_restart): Use current_tcp->curcol instead of curcol.
28810	(tprintf): Check current_tcp != NULL instead of outf != NULL.
28811	Use current_tcp->outf instead of outf, current_tcp->curcol instead of curcol.
28812	(tprints): Likewise.
28813	(line_ended): Likewise.
28814	(printleader): Switch current tcb by "current_tcp = tcp" istead of
28815	assignments to outf and curcol.
28816	(droptcb): Set current_tcp to NULL if we dropped it.
28817	(startup_child): Rename outf to shared_log.
28818	(init): Likewise.
28819	(cleanup): Likewise.
28820	(trace): Simplify current tcp switching and current column handling.
28821
288222012-03-22  Denys Vlasenko  <vda.linux@googlemail.com>
28823
28824	Make threaded execve handling code more reabable and somewhat simpler.
28825	* strace.c (droptcb): Remove outfname check in "outfname && followfork >= 2" -
28826	with recent changes, followfork >= 2 check guarantees that outfile
28827	was specified, and _is already opened_.
28828	(trace): Move tcb existence check before threaded execve handling.
28829	This allows to remove tcp != NULL checks in threaded execve handling.
28830	Rewrite threaded execve handling code to be less indented,
28831	keeping the same logic.
28832
288332012-03-21  Denys Vlasenko  <vda.linux@googlemail.com>
28834
28835	simple cleanups in defs.h. No logic changes.
28836	* defs.h: Move offsetof macro definition into "libc stuff" section.
28837	Renumber TCB_foo constants (smaller constants -> sometimes smaller code).
28838	Remove uoff macro.
28839	* process.c: Move uoff macro here (sole user).
28840
28841	Show "+++ exited..." with -C.
28842	* strace.c (trace): Show "+++ exited..." with -C too.
28843	Save tcp->curcol after PTRACE_LISTEN failure too, just in case.
28844
28845	Slight tweak to qemu_multiarch_testing scripts.
28846
288472012-03-21  Denys Vlasenko  <vda.linux@googlemail.com>
28848
28849	Replace reprinting decision logic.
28850	After this change, we no longer need to decide when we need
28851	to set TCB_REPRINT, and when we don't: it's never needed :)
28852
28853	Well, almost. That pesky pid-changing execve needs special treatment.
28854	If not it, it'd be possible to nuke TCB_REPRINT...
28855
28856	While at it, fix a case of mishandled -C.
28857
28858	* strace.c (printleader): Do not set TCB_REPRINT.
28859	(trace): Set TCB_REPRINT only for execve with changing pid.
28860	Fix mishandling of -C.
28861	* syscall.c (trace_syscall_entering): Do not clear TCB_REPRINT.
28862	(trace_syscall_exiting): Replace reprinting decision logic.
28863	Remove call to printargs(): it is known to just return 0 here.
28864
288652012-03-21  Denys Vlasenko  <vda.linux@googlemail.com>
28866
28867	Report some ptrace failures; nuke tcp->ptrace_errno.
28868	Report some (not all) ptrace errors, namely,
28869	errors on ptrace restart operations.
28870
28871	Before: 10533 sendto(-1, 0x804895e, 17, 0, NULL, 0 <unfinished ...>
28872	After:  10533 sendto(-1, 0x804895e, 17, 0, NULL, 0 <ptrace(SYSCALL):No such process>
28873
28874	This tells user that strace failed to let sendto syscall
28875	to be entered - process was dead at that point of time.
28876	It is (marginally) better than to always say "<unfinished ...>"
28877
28878	While at it, patch removes tcp->ptrace_errno.
28879	I added it many months ago, and it looks that after all
28880	it is not needed for ptrace error detection: I failed to execute
28881	a single existing code path which is accessible
28882	through that variable only.
28883
28884	* defs.h: Remove struct tcp::ptrace_errno field.
28885	* strace.c (ptrace_restart): Emit message to log on error.
28886	(printleader): Remove "if (printing_tcp->ptrace_errno)..." code.
28887	(trace): Remove !tcp->ptrace_errno check, it's always true.
28888
288892012-03-20  Denys Vlasenko  <vda.linux@googlemail.com>
28890
28891	Eliminate redundant checks of res variable.
28892	* syscall.c (trace_syscall_entering): Eliminate redundant checks of res variable.
28893	(trace_syscall_exiting): Likewise.
28894
28895	Rename POWERPC-specific static variable result to ppc_result.
28896	* syscall.c: Rename POWERPC-specific static variable result to ppc_result.
28897
28898	Remove redundant checks in syscall entry/exit, rename badly named function
28899	* syscall.c (syscall_enter): Rename to get_syscall_args.
28900	Document its return values.
28901	(trace_syscall_entering): Don't check get_syscall_args() return
28902	value for 0, it never returns that.
28903	(syscall_fixup_on_sysexit): Make it return void.
28904	(trace_syscall_exiting): Fix up syscall_fixup_on_sysexit()
28905	call site accordingly.
28906
28907	Trivial tweaks. No logic changes.
28908	* process.c (sys_ptrace): Remove unneeded line wrapping.
28909	* syscall.c (trace_syscall_entering): Use tprints() instead of tprintf().
28910
28911	Make ptrace_restart() static. No code changes.
28912	* defs.h: Remove ptrace_restart() declaration.
28913	* strace.c (ptrace_restart): Move its definition here.
28914	* util.c (ptrace_restart): Remove its definition.
28915
289162012-03-20  Dmitry V. Levin  <ldv@altlinux.org>
28917
28918	Do not include limits.h unnecessarily.
28919	* ioctl.c: Remove limits.h inclusion left after the reverted change.
28920
289212012-03-20  Denys Vlasenko  <vda.linux@googlemail.com>
28922
28923	Partially revert last change.
28924	Thank you Dmitry for spotting it.
28925
28926	* ioctl.c (compare): Partially revert last change - the new
28927	comparison logic was buggy.
28928
289292012-03-20  Denys Vlasenko  <vda.linux@googlemail.com>
28930
28931	Simplify search in ioctl table.
28932	   text	   data	    bss	    dec	    hex	filename
28933	 236973	    704	  18944	 256621	  3ea6d	strace.before
28934	 236929	    704	  18944	 256577	  3ea41	strace
28935
28936	* ioctl.c (compare): Simplify generation of compare result.
28937	(ioctl_lookup): Pass key directly, not as part of dummy struct.
28938	(ioctl_next_match): More readable code. No logic changes.
28939
289402012-03-19  Denys Vlasenko  <vda.linux@googlemail.com>
28941
28942	Update qemu build script: now tries to upload result back to host.
28943
289442012-03-19  Denys Vlasenko  <vda.linux@googlemail.com>
28945
28946	Shrink space needed by undefined syscalls in syscall tables.
28947	Undefined syscall looked like this before this change:
28948	{ 5,    0,      printargs,              "SYS_53"                },
28949	That is, "SYS_53" string had to be allocated and stored in strace binary.
28950	Since now SCNO_IN_RANGE() macro requires sysent[scno].sys_func != NULL
28951	for valid syscalls, we can replace printargs with NULL in such lines
28952	and make them "invalid", thus not requiring syscall name string.
28953
28954	Savings on i386:
28955	   text	   data	    bss	    dec	    hex	filename
28956	 237389	    704	  18944	 257037	  3ec0d	strace.before
28957	 236973	    704	  18944	 256621	  3ea6d	strace
28958	Savings on mips:
28959	 336551  153692   38320  528563   810b3 strace.before
28960	 275543  153688   38320  467551   7225f strace
28961
28962	Tested to still decode undefined syscalls correctly (syscall no. 222 on i386).
28963
28964	* linux/*/syscallent.h: Replace 'printargs, "SYS_nnn"' with
28965	'NULL, NULL'.
28966
289672012-03-19  Denys Vlasenko  <vda.linux@googlemail.com>
28968
28969	Optimize code if we have only one personality.
28970	On i386:
28971	   text	   data	    bss	    dec	    hex	filename
28972	 238025	    672	  18980	 257677	  3ee8d	strace.before
28973	 237389	    704	  18944	 257037	  3ec0d	strace
28974
28975	* defs.h: Define PERSONALITY0_WORDSIZE as sizeof(long) if not defined.
28976	Introduce new define, current_wordsize as
28977	(personality_wordsize[current_personality]).
28978	Make set_personality() no-op, current_personality constant zero,
28979	current_wordsize as PERSONALITY0_WORDSIZE if we have only one personality.
28980	* count.c (call_summary): Use current_wordsize instead of
28981	personality_wordsize[current_personality].
28982	* desc.c (printflock): Likewise.
28983	* file.c (sys_utime): Likewise.
28984	* io.c (tprint_iov): Likewise.
28985	* process.c (printargv): Likewise.
28986	* resource.c (decode_rlimit): Likewise.
28987	* signal.c (sys_kill): Likewise.
28988	(sys_rt_sigaction): Likewise.
28989	* time.c (sprinttv): Likewise.
28990	(sprint_timespec): Likewise.
28991	(printitv_bitness): Likewise.
28992	(tprint_timex): Likewise.
28993	(printsigevent): Likewise.
28994	* util.c (dumpiov): Likewise.
28995	(umoven): Likewise.
28996	(umovestr): Likewise.
28997	* syscall.c: Initialize sysent to sysent0 etc.
28998	Make current_personality, personality_wordsize[], set_personality()
28999	conditional on SUPPORTED_PERSONALITIES > 1.
29000
290012012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>
29002
29003	Fix mips64 build failure: sys_pwrite64 doesn't exist.
29004	sys_pwrite seems to do the same thing as sys_pwrite64
29005	which we deleted when we removed non-Linux code.
29006
29007	* linux/mips/syscallent.h: s/sys_pwrite64/sys_pwrite/
29008
290092012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>
29010
29011	qemu_multiarch_testing/: a directory with scripts for build testing.
29012
290132012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>
29014
29015	Make internal_fork and internal_exec static.
29016	   text	   data	    bss	    dec	    hex	filename
29017	 237917	    672	  18980	 257569	  3ee21	strace
29018	 237845	    672	  18980	 257497	  3edd9	strace_new
29019
29020	* defs.h: Remove declarations of internal_fork and internal_exec.
29021	* process.c: Remove definitions of internal_fork and internal_exec.
29022	* syscall.c: Move them here.
29023	(internal_syscall): Return void instead of int. We were always
29024	returning zero, and callers weren't checking it anyway.
29025
290262012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>
29027
29028	Remove code which is not used on Linux.
29029	Compile tested in qemu on armv4l,armv4tl,armv5l,armv6l,i686,
29030	mipsel,mips,x86_64
29031
29032	* syscall.c: Remove code which handles RVAL_Lfoo constants.
29033	* defs.h: Remove struct tcb::u_lrval member - it is never set.
29034	Remove RVAL_Lfoo constants which signify return of "long" result -
29035	they are never used.
29036
290372012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>
29038
29039	Remove unused version of sys_lseek.
29040	It is buggy: it returns RVAL_LUDECIMAL, which means the return value
29041	is in tcp->u_lrval. But tcp->u_lrval is never set
29042	(on Linux - it used to be set on other OSes).
29043
29044	* file.c (sys_lseek): Remove a version of this function which is
29045	supposed to be used if off_t is long long. It appears to be buggy
29046	and unused.
29047
290482012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>
29049
29050	Revert "Remove underscores from a few syscall names which have them"
29051	This reverts commit 31972d52b1059d8faca1c5f417c2db1a90b868ae.
29052
290532012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>
29054
29055	Simplify sys_lseek64 conditional compilation.
29056	It looks like sys_lseek64() is never used.
29057	For one, it is buggy (always shows 0 return value), and no one complains.
29058
29059	From code inspection: sys_lseek64 name is not used anywhere.
29060	It is defined to sys_lseek if HAVE_LONG_LONG_OFF_T is true.
29061	Thus, if !HAVE_LONG_LONG_OFF_T, it is never used.
29062	Therefore "if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T"
29063	conditional it sits in can be simplified to
29064	"if HAVE_LONG_LONG_OFF_T".
29065	Therefore, we can move it a bit up and merge with
29066	"if !HAVE_LONG_LONG_OFF_T, use this sys_lseek()" code block,
29067	by addind an "else" clause to it.
29068	To simplify it more, drop define and just rename sys_lseek64 ->
29069	sys_lseek.
29070
29071	Since the function is buggy, I think it is unused and we can
29072	just drop it. (I checked: at least I386 never uses it).
29073
29074	* file.c (sys_lseek64): Rename to sys_lseek; don't compile it
29075	if _LFS64_LARGEFILE but !HAVE_LONG_LONG_OFF_T since in this case
29076	it is never used.
29077
290782012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>
29079
29080	Remove underscores from a few syscall names which have them.
29081	Affected names are "_newselect", "_llseek", "_sysctl".
29082	I see no apparent reason why they have leading underscores.
29083	Moreover, some arches have underscored names and some have
29084	non-underscored ones. This is not consistent.
29085
29086	I verified that every architectire I touched did not have
29087	a similarly named syscall without underscore, thus this change
29088	does not introduce new ambiquities.
29089
29090	I left "_exit" untouched for now, but the same points stand for it too:
29091	some architectures use "exit" and no one complains. So why many
29092	arches are using "_exit"?
29093
29094	* linux/*/syscallent.h: Remove underscores from displayed
29095	syscall names for _newselect, _llseek, _sysctl.
29096
290972012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>
29098
29099	Remove unused struct tcb::baddr field.
29100	* defs.h: Remove unused struct tcb::baddr field.
29101
29102	Remove unused PTRACE_WRITE{TEXT,DATA} constants (they are from SunOS)
29103	* util.c: Remove unused PTRACE_WRITE{TEXT,DATA} constants.
29104
29105	Reindent case labels. No code changes.
29106	* net.c (printsockopt): Reindent case labels.
29107	* signal.c (sys_signal): Likewise.
29108
29109	Remove unused constants. No code changes.
29110	* syscall.c: Remove unused ENOIOCTLCMD constant. Fix indentation.
29111	* util.c: Remove unused CLONE_STOPPED constant.
29112
29113	Move change_syscall() to its only user and make it static.
29114	* defs.h: Remove declaration of change_syscall().
29115	* process.c (change_syscall): Remove definition of this function.
29116	* util.c (change_syscall): Add definition of change_syscall().
29117
29118	MAP_ANON is the same as MAP_ANONYMOUS, no need to have the former.
29119	* mem.c: Do not allocate string for MAP_ANON if it is the same as
29120	MAP_ANONYMOUS.
29121
29122	Indentation and whitespace fixes. No code changes.
29123
29124	test/threaded_execve: make it also test a case when leader is not in syscall
29125
291262012-03-16  Dmitry V. Levin  <ldv@altlinux.org>
29127
29128	Implement prlimit64 decoding, rewrite [gs]etrlimit decoding.
29129	* configure.ac: Remove AC_RLIM_T_IS_LONG_LONG call.
29130	Define SIZEOF_RLIM_T.
29131	* m4/long_long.m4 (AC_RLIM_T_IS_LONG_LONG): Remove.
29132	* linux/dummy.h (sys_prlimit64): Remove.
29133	* linux/syscall.h (sys_prlimit64): New prototype.
29134	* resource.c (resources): Reindent, add RLIMIT_RTTIME.
29135	(sprintrlim, print_rlimit32, sys_getrlimit, sys_setrlimit): Remove.
29136	[HAVE_LONG_LONG_RLIM_T]: Remove dead code.
29137	[_LFS64_LARGEFILE || HAVE_LONG_LONG_RLIM_T]: Likewise.
29138	(sprint_rlim64, print_rlimit64, decode_rlimit64, sprint_rlim32,
29139	print_rlimit32, decode_rlimit, sys_getrlimit, sys_setrlimit,
29140	sys_prlimit64): New functions.
29141
291422012-03-16  Denys Vlasenko  <vda.linux@googlemail.com>
29143
29144	Remove another "interrupt to quit" message.
29145	* strace.c (startup_attach): Remove another "interrupt to quit" message.
29146
29147	Fix "strace -oFILE -ff -p<nonexistant_pid>" behavior.
29148	* strace.c (newoutf): Set tcp->outf in non-ff mode too.
29149	(alloctcb): This define is removed.
29150	(alloc_tcb): Renamed to alloctcb. Does not set tcp->outf anymore.
29151	Lost 'command_options_parsed' flag parameter.
29152	(startup_attach): Do not say "interrupt to quit" in attach message -
29153	^C does not work in all cases, we mislead users.
29154	Call newoutf(tcp) after successful attach.
29155	(startup_child): Call newoutf(tcp) after successful attach.
29156	(trace): Call newoutf(tcp) when we picked up already attached child.
29157
291582012-03-16  Denys Vlasenko  <vda.linux@googlemail.com>
29159
29160	Make alloc_tcb and droptcb static. No code changes.
29161	The change is trivial. Diff is large because it is confused
29162	by function definitions being moved around.
29163
29164	* defs.h: Remove declarations of alloc_tcb and droptcb.
29165	* strace.c: Make alloc_tcb and droptcb static.
29166	Shuffle functions around to make compiler happy.
29167
291682012-03-16  Denys Vlasenko  <vda.linux@googlemail.com>
29169
29170	Tidy up includes and copyright notices, fix indentation.
29171	The files not mentioned in changelog below had only
29172	copyright notices fixes and indentation fixes.
29173
29174	* defs.h: Include <stdint.h> and <inttypes.h>.
29175	* file.c: Do not include <inttypes.h>.
29176	Move struct kernel_dirent declaration below top include block.
29177	* block.c: Do not include <stdint.h> and <inttypes.h>.
29178	* quota.c: Likewise.
29179	* desc.c: Likewise.
29180	* signal.c: Likewise.
29181
291822012-03-16  Dmitry V. Levin  <ldv@altlinux.org>
29183
29184	scsi.c: add copyright header.
29185	* scsi.c: This file was added back in 2007 without a copyright header.
29186	Add it now.
29187
291882012-03-15  Dmitry V. Levin  <ldv@altlinux.org>
29189
29190	Enhance capget and capset syscalls decoding.
29191	* system.c (cap_version): New xlat structure.
29192	(print_cap_header, print_cap_data): New functions.
29193	(sys_capget, sys_capset): Use them.
29194
29195	Remove unused code.
29196	* syscall.c (subcall_style, decode_subcall): Remove.
29197	[SYS_socket_subcall] (decode_socket_subcall): New function, based on
29198	decode_subcall in deref_style.
29199	[SYS_ipc_subcall] (decode_ipc_subcall): New function, based on
29200	decode_subcall in shift_style.
29201	(trace_syscall_entering): Use decode_socket_subcall and
29202	decode_ipc_subcall instead of decode_subcall.
29203
29204	Fix IPC decoding on alpha and arm.
29205	* ipc.c (indirect_ipccall): Return 0 on ALPHA and ARM EABI.
29206	(sys_shmat): Use indirect_ipccall for proper return value decoding.
29207
29208	arm: fix compilation warnings.
29209	* configure.ac: Define SIZEOF_LONG.
29210	* signal.c (sys_rt_sigaction) [SUPPORTED_PERSONALITIES > 1]: Help
29211	compiler to optimize out unreachable code that is not expected to work
29212	on platforms where sizeof(long) <= 4.
29213
292142012-03-15  Dmitry V. Levin  <ldv@altlinux.org>
29215
29216	tests: robustify again buggy shells.
29217	* tests/init.sh (check_strace): Use "${parameter:-word}" shell syntax
29218	instead of "${parameter-word}".
29219
29220	Reported-by: Mike Frysinger <vapier@gentoo.org>
29221
292222012-03-15  Mike Frysinger  <vapier@gentoo.org>
29223
29224	improve ifdef check with decode_subcall.
29225	Use the same ifdef logic around the call sites of decode_subcall()
29226	to protect the definition of the func itself.  This fixes warnings
29227	for targets like hppa which don't use this func.
29228
29229	* syscall.c (decode_subcall): Wrap in SYS_socket_subcall and
29230	SYS_ipc_subcall define checks.
29231
292322012-03-15  Mike Frysinger  <vapier@gentoo.org>
29233
29234	alpha: fix decode of osf_sigprocmask.
29235	The alpha sigprocmask syscall is special in that it comes from OSF rather
29236	than the style that everyone else uses.
29237
29238	Tested with this simple code:
29239	$ cat test.c
29240	#include <signal.h>
29241	main() {
29242		sigset_t set, oldset;
29243		sigemptyset(&set);
29244		sigaddset(&set, SIGINT);
29245		sigaddset(&set, SIGHUP);
29246		sigprocmask(SIG_SETMASK, &set, &oldset);
29247		sigprocmask(SIG_UNBLOCK, &oldset, &set);
29248		sleep(3);
29249	}
29250	$ gcc test.c && ./strace ./a.out
29251	...
29252	osf_sigprocmask(SIG_SETMASK, [HUP INT]) = 0 (old mask [])
29253	osf_sigprocmask(SIG_UNBLOCK, [])        = 0x3 (old mask [HUP INT])
29254	osf_sigprocmask(SIG_BLOCK, [CHLD])      = 0x3 (old mask [HUP INT])
29255	...
29256
29257	* linux/alpha/syscallent.h: Call sys_sigprocmask for osf_sigprocmask,
29258	and change number of arguments to two.
29259	* signal.c (sys_sigprocmask): Fix decoding of alpha osf sigprocmask.
29260
292612012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>
29262
29263	Fix array size calculation in previous commit.
29264	* pathtrace.c (getfdpath): Fix array size calculation.
29265
292662012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>
29267
29268	pathtrace_select() is never called with NULL, remove dead code.
29269	pathtrace_select() is only called for -P FILE options,
29270	and FILE is never a NULL pointer.
29271
29272	   text	   data	    bss	    dec	    hex	filename
29273	 239453	    672	  19012	 259137	  3f441	strace.before
29274	 239329	    672	  19012	 259013	  3f3c5	strace
29275
29276	* pathtrace.c (pathtrace_select): Remove "if (path == NULL)...".
29277	(pathtrace_select): Remove code which only executes if path == NULL.
29278	The code was also buggy, it can free non-malloced pointer.
29279	(getfdpath): Simplify snprintf to sprintf.
29280	(pathmatch): Use strcmp() == 0 idiom for string equality test.
29281	(pathtrace_match): Likewise.
29282
292832012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>
29284
29285	manpage: remove bugs which are fixed.
29286	"A traced process ignores SIGSTOP" - fixed, expected to be in linux-3.4.x.
29287	"A traced process which tries to block SIGTRAP will be sent a SIGSTOP
29288	in an attempt to force continuation of tracing." - not needed
29289	and no longer done.
29290	"On Linux, exciting as it would be, tracing the init process is forbidden"
29291	- not true anymore.
29292	"When a traced process receives a SIGTRAP signal not
29293	associated with tracing, strace will not report that signal correctly."
29294	- not true anymore.
29295
29296	Simplify SIGCHLD handler setting.
29297	* strace.c (init): Set SIGCHLD to SIG_DFL earlier.
29298	(startup_child): Do not bother restoring SIGCHLD handler.
29299
29300	When reporting signals, use short signal names (SIGfoo) instead of strerror
29301	* defs.h: Remove strsignal declaration.
29302	* signal.c: Better check for SI_FROMUSER define.
29303	* strace.c (strerror): Remove this function.
29304	(trace): Use short signal names (SIGfoo) instead of strerror.
29305
29306	Remove TODO file: it's eleven years old and completely outdated.
29307
29308	Clean up defs.h order. No code changes.
29309	* defs.h: Group together related declarations. No code changes.
29310
293112012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>
29312
29313	Fix lame kernel version checking code.
29314	The code "os_release[0] >= '3'" is not good for any
29315	finer-grained checks such as "kernel >= 3.2.1".
29316	Let's proactively fix it.
29317
29318	* strace.c: Change os_release from string to integer.
29319	(get_os_release): Parse uname.release to KERNEL_VERSION
29320	representation.
29321	(init): Convert kernel version check to KERNEL_VERSION.
29322
293232012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>
29324
29325	Experimental support for "detach on execve" feature.
29326	* strace.c: Define new detach_on_execve, skip_startup_execve bool variables.
29327	(init): Set detach_on_execve on -b, set skip_startup_execve if
29328	"strace PROG" form is used.
29329	(trace): Detach from process if -b and we see PTRACE_EVENT_EXEC event.
29330
29331	Simple fixes.
29332	* strace.c (usage): Document -d; document that -F is deprecated.
29333	(droptcb): Print "<detached ...>" correctly for non-ff mode too.
29334	(detach): Suppress a warning.
29335
29336	Remove an outdated comment.
29337	* defs.h: Remove an outdated comment.
29338
29339	Remove extra include directives. No code changes.
29340	* defs.h: Include <signal.h> unconditionally.
29341	Other files were doing it unconditionally, so no harm done.
29342	* bjm.c: Remove system includes which are already included by defs.h.
29343	* pathtrace.c: Likewise.
29344	* process.c: Likewise.
29345	* signal.c: Likewise.
29346	* strace.c: Likewise.
29347	* stream.c: Likewise.
29348	* syscall.c: Likewise.
29349	* system.c: Likewise.
29350	* util.c: Likewise.
29351
293522012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>
29353
29354	Tidy up order of includes; make bool variables explicit.
29355	Bool variables are more compact in data and (on x86) on code too:
29356
29357	   text	   data	    bss	    dec	    hex	filename
29358	 237950	    676	  19044	 257670	  3ee86	strace.before
29359	 237838	    676	  19012	 257526	  3edf6	strace
29360
29361	* defs.h: Group library includes at the top of the file.
29362	Rename dtime to Tflag, debug to debug_flag.
29363	Change debug_flag,Tflag,qflag,not_failing_only,show_fd_path,tracing_paths
29364	variable declarations from int to bool.
29365	* strace.c: Change corresponding definitions. Do the same for static
29366	variables iflag,rflag,print_pid_pfx.
29367	Rename dtime to Tflag, debug to debug_flag.
29368	* syscall.c: Rename dtime to Tflag, debug to debug_flag.
29369
293702012-03-15  Dmitry V. Levin  <ldv@altlinux.org>
29371
29372	Fix compiler warnings about breaking strict-aliasing rules.
29373	* system.c (sys_capget, sys_capset): Use proxy unions to cast long*
29374	pointers to cap_user_header_t and cap_user_data_t pointers without
29375	breaking strict-aliasing rules.
29376
29377	Reported-by: Mike Frysinger <vapier@gentoo.org>
29378
293792012-03-15  Mike Frysinger  <vapier@gentoo.org>
29380
29381	ppc64: drop unused pid variable.
29382	* syscall.c (get_scno) [POWERPC64]: Delete unused pid variable.
29383
293842012-03-15  Dmitry V. Levin  <ldv@altlinux.org>
29385
29386	ia64: fix compilation warnings.
29387	* linux/ia64/syscallent.h: Remove improper defines and undefs.
29388
29389	Reported-by: Mike Frysinger <vapier@gentoo.org>
29390
293912012-03-15  Dmitry V. Levin  <ldv@altlinux.org>
29392
29393	Ensure that SWAP_FLAG_* constants are defined.
29394	* file.c: Define those of SWAP_FLAG_* constants which are not yet
29395	provided by <sys/swap.h>.
29396
29397	Reported-by: Mike Frysinger <vapier@gentoo.org>
29398
293992012-03-14  Dmitry V. Levin  <ldv@altlinux.org>
29400
29401	Enhance *listxattr syscalls decoding.
29402	* file.c (print_xattr_list): New function.
29403	(sys_listxattr, sys_flistxattr): Use it.
29404
294052012-03-13  Dmitry V. Levin  <ldv@altlinux.org>
29406
29407	Fix *at syscalls flags decoding.
29408	Several *at decoders were defining own incomplete *atflags xlat
29409	structures.  That was error prone, and fchownat decoder actually
29410	failed to recognize AT_EMPTY_PATH.  Merging these incomplete
29411	structures into the single at_flags xlat structure will fix
29412	flags handling in all these decoders altogether.
29413
29414	* file.c: Define all AT_* constants used by *at decoders.
29415	(at_flags): New xlat structure, with records for all AT_* constants.
29416	(fstatatflags, linkat_flags, unlinkatflags): Remove.
29417	(sys_newfstatat, sys_linkat, sys_unlinkat, sys_fchownat,
29418	sys_utimensat):  Use at_flags.
29419
294202012-03-13  Dmitry V. Levin  <ldv@altlinux.org>
29421
29422	Fix linkat flags decoding.
29423	* file.c (linkat_flags): New xlat structure.
29424	(sys_linkat): Decode flags using linkat_flags.
29425
29426	Implement sys_rt_tgsigqueueinfo syscall decoder.
29427	* linux/dummy.h (sys_rt_tgsigqueueinfo): Remove.
29428	* linux/syscall.h (sys_rt_tgsigqueueinfo): New prototype.
29429	* signal.c (print_sigqueueinfo): New function, based on
29430	sys_rt_sigqueueinfo.
29431	(sys_rt_sigqueueinfo): Use print_sigqueueinfo.
29432	(sys_rt_tgsigqueueinfo): New function.
29433
29434	Implement syslog syscall decoder.
29435	* linux/dummy.h (sys_syslog): Remove.
29436	* linux/syscall.h (sys_syslog): New prototype.
29437	* system.c (syslog_action_type): New xlat structure.
29438	(sys_syslog): New function.
29439
294402012-03-13  Denys Vlasenko  <vda.linux@googlemail.com>
29441
29442	Less ugly debug display of ptrace events.
29443	* strace.c (trace): Less ugly debug display of ptrace events.
29444
29445	Make manpage mention that -p "`pidof PROG`" works.
29446
294472012-03-13  Denys Vlasenko  <vda.linux@googlemail.com>
29448
29449	Fix logging for "strace -o FILE -ff test/threaded_execve" test case.
29450	Our logic which was deciding whether to print "<unfinished ...>"
29451	thingy wasn't working properly for -ff case.
29452
29453	* defs.h: Group log generation-related declarations together.
29454	Add a large comment which explains how it works.
29455	Add declaration of line_ended() function.
29456	* strace.c (line_ended): New function which sets up internal data
29457	to indicate that previous line was finished.
29458	(printleader): Change logic to fix log generation in -ff mode.
29459	(newoutf): Make check for -ff mode consistent with other places.
29460	(droptcb): Print "<detached ...>" if last line for this tcp wasn't finished.
29461	(cleanup): Remove code to print "<unfinished ...>", printleader()
29462	or detach() will do it instead.
29463	(trace): Remove code to print "<unfinished ...>".
29464	Add code which finishes threaded execve's incomplete line
29465	with " <pid changed to PID ...>" message. Replace printing_tcp = NULL
29466	followed by fflush() by line_ended() call.
29467	* process.c (sys_exit): Call line_ended() to indicate that we finished priting.
29468	* syscall.c (trace_syscall_exiting): Set printing_tcp to current tcp.
29469	Call line_ended() to indicate that we finished priting.
29470	Remove call to fflush(), it is done by line_ended() now.
29471
294722012-03-13  Dmitry V. Levin  <ldv@altlinux.org>
29473
29474	net.c: recognize MSG_WAITFORONE.
29475	* net.c (msg_flags): Add MSG_WAITFORONE.
29476
294772012-03-12  Denys Vlasenko  <vda.linux@googlemail.com>
29478
29479	Treat -ff without -o FILE as single -f.
29480	* strace.c (init): Treat -ff without -o FILE as single -f.
29481
29482	Style fix. No code changes.
29483	* strace.c (process_opt_p_list): Style fix.
29484
294852012-03-12  Denys Vlasenko  <vda.linux@googlemail.com>
29486
29487	Reduce stack usage by ~0.5k.
29488	main() uses ~0.5k of stack for local variables and such. When we enter
29489	main tracing loop, most of these variables are no longer used.
29490	But they still take up stack for the entire life of strace.
29491	We can avoid this wastage if we move init code into a separate function.
29492	(Need to be careful and not allow automatic inlining).
29493
29494	* strace.c (init): New function. Most of pre-existing code of
29495	main is now living here.
29496	(main): Call init() to do initialization.
29497
294982012-03-12  Denys Vlasenko  <vda.linux@googlemail.com>
29499
29500	Preparatory cosmetic changes for the next commit.
29501	* strace.c (tprintf): Move function up in the source file. No code changes.
29502	(tprints): Likewise.
29503	(printleader): Likewise.
29504	(tabto): Likewise.
29505
295062012-03-11  Dmitry V. Levin  <ldv@altlinux.org>
29507
29508	Implement sendmmsg syscall decoder.
29509	* linux/dummy.h (sys_sendmmsg): Remove.
29510	* linux/syscall.h (sys_sendmmsg): New prototype.
29511	* net.c (printmmsghdr): Add index argument specifying the element in
29512	mmsghdr array to print.
29513	(decode_mmsg): New function, prints the whole mmsghdr array, its length
29514	and message flags.
29515	(sys_sendmmsg): New function.
29516	(sys_recvmmsg): Use decode_mmsg to fix mmsghdr array decoding.
29517
29518	Implement sched_rr_get_interval syscall decoder.
29519	* linux/dummy.h (sys_sched_rr_get_interval): Remove.
29520	* linux/syscall.h (sys_sched_rr_get_interval): New prototype.
29521	* process.c (sys_sched_rr_get_interval): New function.
29522
29523	Implement migrate_pages syscall decoder.
29524	* linux/dummy.h (sys_migrate_pages): Remove.
29525	* linux/syscall.h (sys_migrate_pages): New prototype.
29526	* mem.c (sys_migrate_pages): New function.
29527
29528	Implement get_robust_list syscall decoder.
29529	* linux/dummy.h (sys_get_robust_list): Remove.
29530	* linux/syscall.h (sys_get_robust_list): New prototype.
29531	* process.c (sys_get_robust_list): New function.
29532
29533	Define sys_set_robust_list as an alias to sys_munmap.
29534	* linux/dummy.h (sys_set_robust_list): Redefine to sys_munmap.
29535
29536	Implement clock_adjtime syscall decoder.
29537	* linux/dummy.h (sys_clock_adjtime): Remove.
29538	* linux/syscall.h (sys_clock_adjtime): New prototype.
29539	* time.c (do_adjtimex): New function, based on sys_adjtimex.
29540	(sys_adjtimex): Use it.
29541	(sys_clock_adjtime): New function.
29542
29543	Define sys_setns as an alias to sys_inotify_rm_watch.
29544	* linux/dummy.h (sys_setns): Redefine to sys_inotify_rm_watch.
29545
29546	Sort definitions of dummy parsers.  No code changes.
29547	* linux/dummy.h: Sort definitions of parsers implemented as aliases.
29548
29549	Correct inotify_rm_watch decoder.
29550	* file.c (sys_inotify_rm_watch): Print second argument as int.
29551
29552	Alias sys_fsync to sys_close.
29553	* file.c (sys_fsync): Remove.
29554	* linux/syscall.h (sys_fsync): Likewise.
29555	* linux/dummy.h (sys_fsync): Alias to sys_close.
29556	* linux/m68k/syscallent.h: Add TD flag to fsync entry.
29557	* linux/microblaze/syscallent.h: Likewise.
29558	* linux/mips/syscallent.h: Likewise.
29559
295602012-03-10  Dmitry V. Levin  <ldv@altlinux.org>
29561
29562	Update ioctl entries.
29563	* linux/ioctlent.h.in: Regenerate from v3.3 headers.
29564	* linux/i386/ioctlent.h.in: Likewise.
29565
29566	strace-log-merge: cleanup.
29567	* strace-log-merge: Redirect usage to stderr, make the check
29568	for numeric suffix simpler.
29569
29570	Add syscall entries for new linux syscalls.
29571	* linux/i386/syscallent.h: Update process_vm_writev handler.
29572	* linux/powerpc/syscallent.h: Likewise.
29573	* linux/x86_64/syscallent.h: Likewise.
29574	* linux/alpha/syscallent.h: Add entries for accept4 and sendmmsg.
29575	* linux/arm/syscallent.h: Add entries for process_vm_readv and
29576	process_vm_writev.
29577	* linux/m68k/syscallent.h: Likewise.
29578	* linux/mips/syscallent.h: Likewise.
29579	* linux/s390/syscallent.h: Likewise.
29580	* linux/s390x/syscallent.h: Likewise.
29581	* linux/sh/syscallent.h: Likewise.
29582	* linux/sh64/syscallent.h: Likewise.
29583	* linux/sparc/syscallent.h: Likewise.
29584	* linux/ia64/syscallent.h: Add entries for process_vm_readv,
29585	process_vm_writev and accept4.
29586	* linux/microblaze/syscallent.h: Add entries for sendmmsg,
29587	process_vm_readv and process_vm_writev.
29588
29589	Implement process_vm_writev decoder.
29590	* process.c (sys_process_vm_writev): New function.
29591	* linux/syscall.h (sys_process_vm_writev): New prototype.
29592
29593	Output iovec length in vmsplice and process_vm_readv decoders.
29594	* io.c (sys_vmsplice): Output iovec length.
29595	* process.c (sys_process_vm_readv): Likewise.
29596
295972012-03-09  Dmitry V. Levin  <ldv@altlinux.org>
29598
29599	swapon: decode swap flags.
29600	* file.c: Include <sys/swap.h>.
29601	(swap_flags): New xlat structure.
29602	(sys_swapon): New function.
29603	* linux/dummy.h (sys_swapon): Remove.
29604	* linux/syscall.h (sys_swapon): New declaration.
29605
296062012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>
29607
29608	Trivial simplification.
29609	* strace.c (detach): Use waitpid instead of wait4.
29610
296112012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>
29612
29613	Don't consider PROG to be our child in "strace -D PROG" case.
29614	TCB_STRACE_CHILD is used for the case when "strace PROG" is ^C-ed
29615	or something like that. strace should not just exit - it should
29616	do something with its child (such as signal it too).
29617
29618	In -D case, PROG is not really a child of _strace_, it is a child
29619	of strace's parent. It's ok to handle it exactly as an attached process.
29620
29621	While we are at it, remove nonsensical special-casing of TCB_STRACE_CHILD
29622	in printing of "<unfinished ...>" message.
29623
29624	* strace.c (startup_attach): Don't set TCB_STRACE_CHILD if -D.
29625	(trace): Print "<unfinished ...>" on error regardless of TCB_STRACE_CHILD.
29626
296272012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>
29628
29629	Fix the case where we try to detach unattached processes.
29630	Before this change:
29631	$ strace -D -p1
29632	strace: -D and -p are mutually exclusive options
29633	Process 1 detached  <==== WRONG! (and we try to SIGSTOP it!!!)
29634
29635	* defs.h: Change the meaning of TCB_ATTACHED: now it means "this tracee
29636	is attached to us". Add TCB_STRACE_CHILD: "this tracee is our child".
29637	* strace.c (kill_save_errno): Move up. No code changes.
29638	(process_opt_p_list): Don't set TCB_ATTACHED on new tcb.
29639	(startup_attach): Change how we work with TCB_ATTACHED.
29640	Set TCB_STRACE_CHILD on -D.
29641	(startup_child): Use kill_save_errno instead of kill.
29642	Set TCB_ATTACHED and TCB_STRACE_CHILD on attached strace child.
29643	If we are in -D case, don't set TCB_ATTACHED (we aren't attached yet).
29644	(detach): do not do PTRACE_DETACH if TCB_ATTACHED is not set.
29645	(cleanup): Check TCB_STRACE_CHILD instead of TCB_ATTACHED.
29646	(trace): Likewise.
29647
296482012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>
29649
29650	Call PTRACE_CONT with addr=0.
29651	* strace.c (trace): Call PTRACE_CONT with addr=0.
29652
29653	install strace-log-merge by "make install"
29654
29655	strace_log_merge: new file. Helper to merge timestamped strace -ff logs.
29656
296572012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>
29658
29659	Fix PID prefix printing in "strace -oLOG -ff -p1 -p2 -p3" case.
29660	In this case we were printing PIDs to LOG.* files
29661	even though it is not necessary.
29662
29663	The fix is in the addition of "&& followfork < 2" condition.
29664
29665	* strace.c: Remove pflag_seen variable, add print_pid_pfx one.
29666	(process_opt_p_list): Do not pflag_seen++.
29667	(main): Use "nprocs != 0" condition instead of "pflag_seen != 0".
29668	Set print_pid_pfx before entering main tracing loop.
29669	(printleader): Use print_pid_pfx to decide whether to print pid prefix.
29670
296712012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>
29672
29673	Allow -p PID to take comma or whitespace-separated list of PIDs.
29674	* defs.h: Clarify meaning of TCB_ATTACHED. No code changes.
29675	* strace.c (process_opt_p_list): New function.
29676	(main): Call process_opt_p_list to process -p PIDs argument.
29677
296782012-03-08  Denys Vlasenko  <vda.linux@googlemail.com>
29679
29680	Pass addr=0 instead of 1 into restarting ptrace calls.
29681	While we are at it, fold do_ptrace into its lone caller.
29682	We no longer set tcp->ptrace_errno = ESRCH on ESRC error in upeek.
29683	Other code paths where ptrace fails wern't doing it, and the code which
29684	checks tcp->ptrace_errno even assumes it is never set to ESRCH.
29685	(It was me who added this code sometime ago, so it was my fault
29686	that it was a bit messy)
29687
29688	I ran sigkill_rain test and verified that unfinished syscalls are
29689	still handled correctly.
29690
29691	* util.c (ptrace_restart): Do not pass addr=1 to ptrace(), pass 0 instead.
29692	I have no idea why we were passing 1. Ptrace documentation says
29693	that addr parameter is ignored.
29694	(do_ptrace): Remove this function.
29695	(upeek): Use ptrace() instead of do_ptrace().
29696	* defs.h: Remove do_ptrace() declaration.
29697
296982012-03-08  Denys Vlasenko  <vda.linux@googlemail.com>
29699
29700	Trivial tweaks to error messages.
29701	* strace.c (test_ptrace_setoptions_followfork): Use kill_save_errno
29702	instead of kill.
29703	(trace): Use perror_msg instead of perror.
29704	* count.c (set_sortby): Use error_msg_and_die instead of fprintf.
29705	* syscall.c (qualify): Likewise.
29706	* util.c (ptrace_restart): Expand error message.
29707	(umoven): Likewise.
29708	(umovestr): Likewise.
29709	(upeek): Use perror_msg instead of sprintf + perror.
29710
297112012-02-28  Denys Vlasenko  <vda.linux@googlemail.com>
29712
29713	Remove stray sys_swapon() declaration.
29714	* linux/syscall.h: Remove stray sys_swapon() declaration.
29715	* linux/mips/syscallent.h: Include dummy.h with correct relative path.
29716	* linux/dummy.h: Tweak one place where spaces are used instead of tabs.
29717	* linux/dummy_check.sh: New script. It helps in finding stray syscall
29718	handler declarations.
29719
297202012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>
29721
29722	Correct syscall entries for t[g]kill.
29723	* linux/hppa/syscallent.h: Make tgkill use sys_tgkill, not printargs.
29724	* linux/sh/syscallent.h: Change tkill type TD -> TS.
29725	* linux/sh64/syscallent.h: Likewise.
29726	* linux/mips/syscallent.h: Change tkill type 0 -> TS.
29727	* linux/x86_64/syscallent.h: Likewise.
29728	* linux/avr32/syscallent.h: Likewise.
29729
297302012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>
29731
29732	Assorted trivial optimizations.
29733	   text	   data	    bss	    dec	    hex	filename
29734	 236448	    672	  19044	 256164	  3e8a4	strace.before
29735	 236360	    672	  19044	 256076	  3e84c	strace
29736
29737	* file.c (sprintmode): Use smaller static buffer, eliminate strlen call.
29738	(sprinttime): Use smaller static buffer.
29739	(printstat_sparc64): Coalesce two printing calls into one.
29740	(printstat_powerpc32): Likewise.
29741	(printcompat_statfs6): Likewise.
29742	(sys_utime): Do not fetch personality_wordsize[current_personality]
29743	repeatedly - cache it in local variable instead.
29744	* process.c (printargv): Likewise.
29745	* resource.c (sprintrlim): Return const char*, not char*. This allows
29746	to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer.
29747	(sprintrlim64): Likewise.
29748	* strace.c (strerror): Use smaller static buffer.
29749	(strsignal): Likewise.
29750
297512012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>
29752
29753	Alias a few more syscall printing functions.
29754	   text	   data	    bss	    dec	    hex	filename
29755	 237384	    672	  19044	 257100	  3ec4c	strace.before
29756	 236448	    672	  19044	 256164	  3e8a4	strace
29757
29758	* defs.h: Declare new functions printargs_lu(), printargs_ld()
29759	which simply print syscall all args as unsigned or signed longs.
29760	* desc.c (sys_epoll_create): Call printargs_ld() instead of open-coding it.
29761	* linux/syscall.h: Remove declarations of the following functions:
29762	sys_alarm, sys_getresgid, sys_getsid, sys_nice, sys_setgid, sys_setpgid,
29763	sys_setpgrp, sys_setregid, sys_setresgid.
29764	* process.c (sys_setgid): Delete this function: now aliased to sys_setuid().
29765	(sys_getresgid): Delete this function: now aliased to sys_getresuid().
29766	(sys_setregid): Delete this function: now aliased to sys_setreuid().
29767	(sys_setresgid): Delete this function: now aliased to sys_setresuid().
29768	(sys_setpgrp): Delete this function: now aliased to printargs_lu().
29769	(sys_getsid): Likewise.
29770	(sys_setpgid): Likewise.
29771	(sys_alarm): Likewise.
29772	(sys_getpgrp): Delete this function: was unused - was already shadowed
29773	by a define in linux/dummy.h.
29774	(sys_setsid): Likewise.
29775	(sys_getpgid): Likewise.
29776	* resource.c (sys_nice): Delete this function: now aliased to printargs_ld().
29777	* linux/dummy.h: Define new aliases (see above for the list).
29778	* syscall.c (printargs_lu): New function.
29779	(printargs_ld): New function.
29780
297812012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>
29782
29783	Style fixes, no code changes.
29784	* desc.c (sys_io_getevents): Indentation fix.
29785	* file.c (sys_xstat): Remove space after function name.
29786	(decode_mknod): Indentation fix.
29787	* net.c (printsockopt): Indentation fix.
29788	* process.c (unalignctl_string): Indentation fix.
29789	(sys_sched_getscheduler): Remove space after ! operator.
29790
297912012-02-25  Dmitry V. Levin  <ldv@altlinux.org>
29792
29793	Compress blank lines.
29794	Suppress repeated empty lines left after automated code removal.
29795	This change was made by filtering every source code file through
29796	"cat -s".
29797
297982012-02-25  Dmitry V. Levin  <ldv@altlinux.org>
29799
29800	Remove parts of automake machinery which are not needed on Linux.
29801	This change is a verbatim part of Dmitry's changes to remove support
29802	for non-Linux architectures.
29803
29804	* Makefile.am: Don't install PORTING file. Install README-linux-ptrace file.
29805	Set OS variable to linux unconditionally.
29806	* configure.ac: Remove code to set opsys variable, and its usage.
29807	Remove checks for headers which are never present on Linux.
29808	* m4/stat.m4: Remove 'ifdef LINUX' check.
29809	* m4/statfs.m4: Likewise.
29810
298112012-02-25  Dmitry V. Levin  <ldv@altlinux.org>
29812
29813	Remove and update documentation.
29814	This change is a verbatim part of Dmitry's changes to remove support
29815	for non-Linux architectures.
29816
29817	* PORTING: Deleted.
29818	* INSTALL: Modified.
29819	* README: Modified.
29820	* strace.1: Modified: bugs should be reported to mailing list, not Debian.
29821	* strace.spec: do not install PORTING file.
29822
298232012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>
29824
29825	Remove a few more code parts which are unused on Linux.
29826	This change is abapted from Dmitry's changes to remove support for
29827	non-Linux architectures.
29828
29829	* Makefile.am: Remove if LINUX/endif pairs.
29830	* defs.h: Remove stream_ioctl() declaration.
29831	* ioctl.c (ioctl_decode): Remove 'ifdef HAVE_SYS_STREAM_H' block.
29832	* resource.c: Use 'defined(FOO)' instead of 'defined FOO' form.
29833	* util.c: Likewise.
29834	* signal.c: Remove conditional includes which are never used on Linux.
29835	* stream.c: Likewise.
29836	* file.c: Remove excessive empty lines.
29837
298382012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>
29839
29840	Build fixes after non-Linux code removal.
29841	* configure.ac: Remove calls to proc-based ptrace checks.
29842	* proc.c: Remove, it's empty now.
29843	* Makefile.am: Remove reference to proc.c.
29844	* net.c: Remove trailing newlines.
29845	* quota.c: Likewise
29846	* resource.c: Likewise
29847	* strace.c: Likewise
29848	* stream.c: Likewise
29849	* time.c: Likewise
29850
29851	Fix defined(FOO) style.
29852	* file.c: Consistently use defined(FOO) instead of defined (FOO).
29853	* mem.c: Likewise.
29854	* net.c: Likewise.
29855	* signal.c: Likewise.
29856	* sock.c: Likewise.
29857	* linux/mips/syscallent.h: Likewise.
29858
29859	Reindent preprocessor directives in util.c; fix style.
29860	* util.c: Fix indentation of preprocessor directives broken by
29861	automatic removal of non-Linux code. Fix style to use consistent
29862	defined(FOO) instead of defined (FOO).
29863
29864	Reindent preprocessor directives in syscall.c; fix style.
29865	* syscall.c: Fix indentation of preprocessor directives broken by
29866	automatic removal of non-Linux code. Fix style to use consistent
29867	defined(FOO) instead of defined (FOO).
29868
29869	Reindent defs.h preprocessor directives.
29870	* defs.h: Fix indentation of preprocessor directives broken by
29871	automatic removal of non-Linux code.
29872
29873	Cleanup after non-Linux code removal.
29874	Conditions such as defined(LINUX) are always true now,
29875	defined(FREEBSD) etc are always false.
29876	When if directive has them as subexpressions, it can be simplified.
29877	Another trivial changes here are fixes for directive indentation.
29878
298792012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>
29880
29881	Manual removal of non-Linux source, documentation, etc.
29882	Remove non-Linux source directories: freebsd/, svr4/, sunos4/, svr4/.
29883	Remove README-freebsd, README-sunos4, README-svr4, m4/procfs.m4.
29884
29885	linux/sparc/{errnoent1,ioctlent1,signalent1}.h used to point to svr4/ files -
29886	replace their contents with copies of used (and now deleted) files.
29887	Make linux/sparc64/{errnoent1,ioctlent1,signalent1}.h include these files
29888	instead of svr4/* ones.
29889
29890	Makefile.am: remove references to deleted files.
29891	configure.ac: Remove a few tests which make no sense on Linux.
29892	Man page: remove non-Linux quirks information.
29893
298942012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>
29895
29896	Automated removal of non-Linux code.
29897	This change is generated by running every source through the following command:
29898
29899	unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD
29900	-USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS
29901	-UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c
29902
299032012-02-24  Denys Vlasenko  <vda.linux@googlemail.com>
29904
29905	When accessing data blocks, truncate addr to wordsize.
29906	* util.c (umoven): Truncate addr to wordsize before use.
29907
299082012-02-22  Dmitry V. Levin  <ldv@altlinux.org>
29909
29910	strace.1: fix a typo.
29911	* strace.1: Fix a typo in example description.
29912	This fixes Debian bug #653309.
29913
29914	Fix sockaddr_un.sun_path name in decoded output.
29915	* net.c (printsock): Show sockaddr_un.sun_path as "sun_path".
29916	This fixes Debian bug #554946.
29917
29918	Avoid potential core file clobbering on exit.
29919	* strace.c (main): Set RLIMIT_CORE to zero before terminating itself
29920	with a deadly signal.
29921	This fixes Debian bug #656398.
29922
299232012-02-20  Dmitry V. Levin  <ldv@altlinux.org>
29924
29925	Eliminate native_scno and known_scno.
29926	* defs.h (known_scno): Remove.
29927	(sysent): Remove native_scno field.
29928	* process.c [IA64]: Replace known_scno(tcp) with tcp->scno.
29929	(internal_fork) [USE_PROCFS || !LINUX]: Likewise.
29930	* syscall.c: Do not define NR_SYSCALL_BASE.
29931	(known_scno): Remove.
29932	(syscall_fixup_on_sysenter) [USE_PROCFS]: Replace known_scno(tcp)
29933	with tcp->scno.
29934	(trace_syscall_entering) [SVR4 || FREEBSD || SUNOS4]: Likewise.
29935	(syscall_fixup_on_sysexit) [SUNOS4]: Likewise.
29936
29937	Remove initialization of native_scno field.
29938	* linux/i386/syscallent.h: Remove native_scno initialization for clone,
29939	fork and vfork.
29940	* linux/ia64/syscallent.h (sys_fork, sys_vfork): Remove redirections
29941	to printargs.
29942	* linux/syscall.h [IA64]: Do not define SYS_fork and SYS_vfork.
29943	* util.c (printcall) [IA64]: Likewise.
29944	(setbpt): Use sys_func to check for clone, fork and vfork syscalls.
29945
29946	Do not use SYS_ipc and SYS_socketcall.
29947	* linux/dummy.h (sys_ipc, sys_socketcall): Remove redirections to
29948	printargs.
29949	* linux/ia64/syscallent.h: Likewise.
29950	* linux/i386/syscallent.h: Remove native_scno initialization for "ipc"
29951	and "socketcall".
29952	* linux/syscall.h (sys_ipc, sys_socketcall): New prototypes.
29953	(SYS_ipc, SYS_socketcall): Remove no longer used constants.
29954	[IA64]: Remove undefining of ipc and socket SYS_* constants.
29955	[SPARC || SPARC64]: Remove unused ipc SYS_* constants.
29956	* ipc.c (sys_ipc): New function.
29957	* sock.c (sys_socketcall): Likewise.
29958	* syscall.c (trace_syscall_entering): Use sys_func to check for ipc and
29959	socket subcalls.
29960
299612012-02-20  Dmitry V. Levin  <ldv@altlinux.org>
29962
29963	Remove initialization of native_scno field for most of syscalls.
29964	The native_scno field is not so much used in the code than before.
29965	In many cases sys_func is checked instead, and for most of syscall
29966	entries there is no need to initialize native_scno.
29967
29968	* linux/i386/syscallent.h: Remove native_scno initialization for
29969	_exit, read, write, waitpid, execve, wait4, sysfs, readv, writev,
29970	pread64, pwrite64, exit_group, waitid, send, recv, sendto and
29971	recvfrom syscall entries.
29972	* linux/syscall.h: Do not define no longer used SYS_waitid and
29973	SYS_sub_* constants.
29974	[IA64]: Do not define SYS_waitpid and SYS32_* constants.
29975	* defs.h: Do not define no longer used  __NR_exit_group constant.
29976	* strace.c [USE_PROCFS] (proc_open): Use sys_func to check for execve.
29977
299782012-02-14  Mike Frysinger  <vapier@gentoo.org>
29979
29980	util: check for process_vm_readv in C library.
29981	glibc-2.15 provides process_vm_readv, so trying to provide it ourselves
29982	with that version fails.
29983
29984	* configure.ac (AC_CHECK_FUNCS): Add process_vm_readv.
29985	* util.c: Handle HAVE_PROCESS_VM_READV.
29986
299872012-02-09  Denys Vlasenko  <vda.linux@googlemail.com>
29988
29989	README-linux-ptrace: correct the description of suppressed signals.
29990
299912012-02-06  Dmitry V. Levin  <ldv@altlinux.org>
29992
29993	strace -P: fix handling of invalid syscalls.
29994	* pathtrace.c (pathtrace_match): Check the given syscall number using
29995	SCNO_IN_RANGE.
29996
299972012-02-06  H.J. Lu  <hongjiu.lu@intel.com>
29998
29999	Skip the syscall entry if the sys_func field is NULL.
30000	Avoid NULL dereference when there are holes in sysent tables.
30001	It can happen with syscall (number, ...) and number is in those holes.
30002	There are no targets with holey systent tables so far, but at least
30003	one such a target, x32, is already on the horizon.
30004
30005	* defs.h (SCNO_IN_RANGE): Also check the sys_func field.
30006
300072012-02-06  H.J. Lu  <hongjiu.lu@intel.com>
30008
30009	Define RLIM64_INFINITY only if not defined.
30010	* resource.c (RLIM64_INFINITY): Define only if it isn't defined.
30011
300122012-02-06  H.J. Lu  <hongjiu.lu@intel.com>
30013
30014	Cast to long for %l in printf.
30015	Cast a value to long for %l in printf to avoid compiler warning
30016	on systems where it may be long long.
30017
30018	* count.c (call_summary_pers): Cast to long.
30019	* ipc.c (sys_mq_open, printmqattr): Likewise.
30020	* quota.c (decode_cmd_data): Likewise.
30021	* resource.c (sys_sysinfo): Likewise.
30022	* time.c (tprint_timex): Likewise.
30023
300242012-02-06  H.J. Lu  <hongjiu.lu@intel.com>
30025
30026	Check HAVE_LONG_LONG_OFF_T when printing offset.
30027	When HAVE_LONG_LONG_OFF_T is defined, we need to use %llu to print
30028	offset.
30029
30030	* io.c (sys_sendfile): Check HAVE_LONG_LONG_OFF_T when printing
30031	offset.
30032
300332012-02-06  H.J. Lu  <hongjiu.lu@intel.com>
30034
30035	Define old stat functions only if needed.
30036	When HAVE_LONG_LONG_OFF_T is defined, those old stat functions aren't
30037	used and strace won't link since they use realprintstat which isn't
30038	defined when HAVE_LONG_LONG_OFF_T is defined.
30039
30040	* file.c (convertoldstat, sys_oldstat, sys_oldfstat, sys_oldlstat):
30041	Define only if HAVE_LONG_LONG_OFF_T isn't defined.
30042
300432012-02-06  H.J. Lu  <hongjiu.lu@intel.com>
30044
30045	Print NULL for zero address in sys_mmap64.
30046	* mem.c (sys_mmap64): Print NULL for zero address so that it is
30047	consistent with sys_mmap.
30048
300492012-02-04  Dmitry V. Levin  <ldv@altlinux.org>
30050
30051	Remove unused sys_pread64 and sys_pwrite64 parsers on Linux.
30052	* io.c [HAVE_LONG_LONG_OFF_T]: Remove sys_pread64 and sys_pwrite64
30053	aliases.
30054	(sys_pread64, sys_pwrite64): Define these functions only on
30055	[SVR4 && _LFS64_LARGEFILE] platform.
30056	* linux/mips/syscallent.h: Use sys_pread and sys_pwrite to handle
30057	appropriate syscalls.
30058	* linux/syscall.h (sys_pread64, sys_pwrite64): Remove.
30059	* syscall.c (dumpio): Check sys_pread64 and sys_pwrite64 only on
30060	[SVR4 && _LFS64_LARGEFILE] platform.
30061
300622012-02-03  Denys Vlasenko  <vda.linux@googlemail.com>
30063
30064	Trivial changes to help text. No code changes.
30065	* strace.c (usage): Tweak help text: remove unpaired closing brackets,
30066	make -V and -h sit on separate lines (hard to see them otherwise).
30067
300682012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>
30069
30070	Simple optimizations.
30071	   text	   data	    bss	    dec	    hex	filename
30072	 239474	    672	  20484	 260630	  3fa16	strace.before
30073	 239234	    668	  19044	 258946	  3f382	strace
30074
30075	* file.c (sprint_open_modes): Reduce static buffer size.
30076	Simplify separator printing.
30077	* signal.c (sprintsigmask): Reduce static buffer size.
30078	Simplify separator printing and printing of almost full masks.
30079	Use stpcpy instead of sprintf and strcpy+strlen.
30080	* strace.c (startup_child): Don't strchr() for ':' twice in a row.
30081	* util.c (sprintflags): Exit loop early if possible.
30082
300832012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>
30084
30085	Trivial optimization.
30086	* strace.c (cleanup): Read 'interrupted' volatile variable only once.
30087
300882012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>
30089
30090	Make interactive-ness directly controllable via command line option.
30091	Defaults are often ok, but when they are not, people get confused.
30092	"Why can't I kill strace?" and "Why strace dies on ^C when I want
30093	to _tracee_ to die instead?" are typical complaints.
30094
30095	* strace.c: Replace 'interactive' variable with 'opt_intr' variable.
30096	Define INTR_foo constants for its possible values.
30097	Define 'interactive' as a macro.
30098	(usage): Document -I n option.
30099	(main): Parse -I n option, modify signal handling to accomidate new
30100	-I 1 and -I 4 modes.
30101
301022012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>
30103
30104	Suppress compiler warning.
30105	* strace.c (trace): Frame potentially unused label with ifdef/endif.
30106
30107	On Ctrl-C induced detach, send SIGINT to child tracee, not SIGTERM.
30108	* strace.c (interrupt): Remember signal number.
30109	(cleanup): If we exiting due to signal, send that signal to child tracee.
30110
301112012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>
30112
30113	Add experimental code to use PTRACE_SEIZE, disabled by default.
30114	All new code is predicated on "ifdef USE_SEIZE". If it is not defined,
30115	behavior is not changed.
30116
30117	If USE_SEIZE is enabled and run-time check shows that PTRACE_SEIZE works, then:
30118	- All attaching is done with PTRACE_SEIZE + PTRACE_INTERRUPT.
30119	  This means that we no longer generate (and possibly race with) SIGSTOP.
30120	- PTRACE_EVENT_STOP will be generated if tracee is group-stopped.
30121	  When we detect it, we issue PTRACE_LISTEN instead of PTRACE_SYSCALL.
30122	  This leaves tracee stopped. This fixes the inability to SIGSTOP or ^Z
30123	  a straced process.
30124
30125	* defs.h: Add commented-out "define USE_SEIZE 1" and define PTRACE_SEIZE
30126	and related constants.
30127	* strace.c: New variable post_attach_sigstop shows whether we age going
30128	to expect SIGSTOP on attach (IOW: are we going to use PTRACE_SEIZE).
30129	(ptrace_attach_or_seize): New function. Uses PTRACE_ATTACH or
30130	PTRACE_SEIZE + PTRACE_INTERRUPT to attach to given pid.
30131	(startup_attach): Use ptrace_attach_or_seize() instead of ptrace(PTRACE_ATTACH).
30132	(startup_child): Conditionally use alternative attach method using PTRACE_SEIZE.
30133	(test_ptrace_setoptions_followfork): More robust parameters to PTRACE_TRACEME.
30134	(test_ptrace_seize): New function to test whether PTRACE_SEIZE works.
30135	(main): Call test_ptrace_seize() while initializing.
30136	(trace): If PTRACE_EVENT_STOP is seen, restart using PTRACE_LISTEN in order
30137	to not let tracee run.
30138	* process.c: Decode PTRACE_SEIZE, PTRACE_INTERRUPT, PTRACE_LISTEN.
30139	* util.c (ptrace_restart): Add "LISTEN" to a possible error message.
30140
301412012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>
30142
30143	process_vm_readv gets EINVAL if process is gone (SIGKILLed). Don't complain.
30144	* util.c (umoven): Don't complain on EINVAL from process_vm_readv.
30145	(umovestr): Likewise.
30146
30147	Revert last change. Add a comment to prevent further misunderstanding.
30148	* time.c (sys_nanosleep): Display remaining time only on interrupt.
30149
30150	Fix nanosleep decoding: second argument was not shown after success.
30151	* time.c (sys_nanosleep): Fix bug - inverted is_restart_error() check.
30152	* syscall.c (is_restart_error): Remove redundant check.
30153
301542012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>
30155
30156	Use process_vm_readv instead of PTRACE_PEEKDATA to read data blocks.
30157	Currently, we use PTRACE_PEEKDATA to read things like filenames and
30158	data passed by I/O syscalls.
30159	PTRACE_PEEKDATA gets one word per syscall. This is VERY expensive.
30160	For example, in order to print fstat syscall, we need to perform
30161	more than twenty trips into kernel to fetch one struct stat!
30162
30163	Kernel 3.2 got a new syscall, process_vm_readv(), which can be used to
30164	copy data blocks out of process' address space.
30165
30166	This change uses it in umoven() and umovestr() functions if possible,
30167	with fallback to old method if process_vm_readv() fails.
30168	If it returns ENOSYS, we don't try to use it anymore, eliminating
30169	overhead of trying it on older kernels.
30170
30171	Result of "time strace -oLOG ls -l /usr/lib >/dev/null":
30172	before patch: 0.372s
30173	After patch:  0.262s
30174
30175	* util.c (process_vm_readv): Wrapper to call process_vm_readv syscall.
30176	(umoven): Use process_vm_readv for block reads of tracee memory.
30177	(umovestr): Likewise.
30178	* linux/syscall.h: Declare new function sys_process_vm_readv.
30179	* process.c (sys_process_vm_readv): Decoder for new syscall.
30180	* linux/i386/syscallent.h: Add process_vm_readv, process_vm_writev syscalls.
30181	* linux/x86_64/syscallent.h: Likewise.
30182	* linux/powerpc/syscallent.h: Likewise.
30183
301842012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>
30185
30186	Fix a case of broken output if last seen syscall was exit.
30187	* defs.h: Rename tcp_last to printing_tcp. Explain what it means.
30188	Remove printtrailer() function.
30189	* process.c (sys_exit): Convert printtrailer() call to "printing_tcp = NULL".
30190	* strace.c: Add new variable printing_tcp.
30191	(cleanup): Convert printtrailer() call to "printing_tcp = NULL".
30192	(trace): Likewise.
30193	(trace): Fix checks for incomplete line - it was working wrongly if last syscall was exit.
30194	(printleader): Set printing_tcp.
30195	(printtrailer): Remove this function.
30196	* syscall.c: Remove tcp_last variable.
30197	(trace_syscall_entering): Don't set printing_tcp, printleader call now does it.
30198	(trace_syscall_exiting): Convert printtrailer() call to "printing_tcp = NULL".
30199
302002012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>
30201
30202	Fix handling of test/threaded_execve.c testcase.
30203	Since 3.0, Linux has a way to identify which thread execve'ed.
30204	This patch makes use of it in order to properly dispose
30205	of disappeared ("superseded") thread leader,
30206	and replace it with execve'ed thread.
30207
30208	Before this patch, strace was "leaking" thread which exec'ed.
30209	It was thinking that it still runs. It would look like this:
30210
30211	18460 pause( <unfinished ...>     <=== thread leader
30212	18466 execve("/proc/self/exe", ["exe", "exe"], [/* 47 vars */] <unfinished ...>
30213	18465 +++ exited with 0 +++       <=== exits from other threads
30214	18460 <... pause resumed> )             = 0
30215
30216	The last line is wrong: it's not pause resumed, it's execve resumed.
30217	If thread leader would do exit instead of pause, it is much worse:
30218	strace panics because it thinks it sees return from exit syscall!
30219
30220	And strace isn't aware 18466 (exec'ed thread) is gone.
30221	It still thinks it's executes execve syscall.
30222
30223	* strace.c: New variable "static char *os_release".
30224	(get_os_release): New static function.
30225	(main): Call get_os_release to retrieve Linux version.
30226	(trace): If we see PTRACE_EVENT_EXEC, retrieve old pid, and if it
30227	differs from new one, free one of tcbs and print correct messages.
30228
302292012-01-27  Denys Vlasenko  <vda.linux@googlemail.com>
30230
30231	Fix readlink result display - was printing bogus "..." semi-randomly.
30232	* file.c (decode_readlink): Use printstr() instead of printpathn().
30233
30234	Add new test program: test/threaded_execve.c.
30235
30236	Make pid2tcb static.
30237	* defs.h: Remove pid2tcb declaration.
30238	* strace.c (pid2tcb): Make this function static.
30239
302402012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>
30241
30242	Per Dmitry's request, remove paranoid check in verror_msg()
30243	* strace.c (verror_msg): Remove redundant check for msg != NULL.
30244
30245	More robust error check for vasprintf.
30246	* strace.c (verror_msg): More robust error check for vasprintf.
30247
302482012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>
30249
30250	Slightly more compact handling of argv[]
30251	   text	   data	    bss	    dec	    hex	filename
30252	 238274	    672	  20484	 259430	  3f566	strace.before
30253	 238226	    672	  20484	 259382	  3f536	strace
30254
30255	* strace.c (main): Slightly more compact handling of argv[]
30256
302572012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>
30258
30259	Trivial optimization.
30260	* strace.c: Set default interactive = 1 statically instead
30261	of doing it in main().
30262
302632012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>
30264
30265	Allocate -o OUTFILE buffer only if needed.
30266	   text	   data	    bss	    dec	    hex	filename
30267	 238258	    668	  28676	 267602	  41552	strace.before
30268	 238274	    668	  20484	 259426	  3f562	strace
30269
30270	* strace.c (main): Allocate -o OUTFILE buffer only if needed:
30271	unused buffer in bss is not entirely free.
30272
302732012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>
30274
30275	Use single fprintf in verror_msg()
30276	This change partially reverts commit 44d0532.
30277
30278	In code before commit 44d0532, single fprintf was used on purpose:
30279	we want to send entire message as one write() call. Since stderr
30280	is unbuffered, separate fprintf's to it always result in separate
30281	writes, they are not coalesced. If we aren't the only program
30282	which writes to this particular stderr, this may result
30283	in interleaved messages.
30284
30285	Since this function is not performance critical, I guess
30286	it's ok to make it less efficient.
30287
30288	* strace.c (verror_msg): Attempt to print the message in single
30289	write operation. Use separate fprintfs as a fallback if malloc fails.
30290
302912012-01-21  Denys Vlasenko  <vda.linux@googlemail.com>
30292
30293	Improve code readability (logic is unchanged)
30294	* util.c (umoven): Move assignment out of function call. Make assignment
30295	to a flag variable later, closer to the place where it will be used.
30296	(umovestr): Likewise.
30297	(uload): Likewise.
30298
302992012-01-20  Denys Vlasenko  <vda.linux@googlemail.com>
30300
30301	Change umovestr API: return > 0 instead of 0 if NUL was seen.
30302	* pathtrace.c (upathmatch): Adjust umovestr return value check for new API.
30303	* util.c (printpathn): Use umovestr() > 0 return value for more efficient
30304	(and robust - we don't depend on "no overwrote past NUL" behavior anymore)
30305	handling of terminating NUL.
30306	(printstr): Remove useless NUL placement before umovestr() call.
30307	Allocate 1 byte more to outstr[] array - for NUL.
30308	(umovestr): Change to return 1 if NUL was seen.
30309
30310	umovestr result may have no NUL, use "%.*s" instead of "%s" to print it.
30311	* system.c (sys_mount): Be careful when printing umovestr result,
30312	it may have no terminating NUL.
30313	(sys_sysmips): Likewise.
30314
303152012-01-20  Denys Vlasenko  <vda.linux@googlemail.com>
30316
30317	Eliminate code duplication in time printing, reduce a few static buffers
30318	   text	   data	    bss	    dec	    hex	filename
30319	 238454	    664	  28772	 267890	  41672	strace.before
30320	 238106	    664	  28676	 267446	  414b6	strace
30321
30322	* defs.h: Add TIMESPEC_TEXT_BUFSIZE and TIMEVAL_TEXT_BUFSIZE defines.
30323	Add 'int special' parameter to sprinttv().
30324	* time.c (sprinttv): Add 'int special' parameter, and use it
30325	similarly to 'int special' parameter of printtv_bitness().
30326	(printtv_bitness): Use sprinttv() instead of duplicating its code.
30327	(print_timespec): Use sprint_timespec() instead of duplicating
30328	its code.
30329	* desc.c (decode_select): Use TIMEVAL_TEXT_BUFSIZE instead of 128
30330	when checking remaining buffer size.
30331	* net.c (sys_recvmsg): Use TIMESPEC_TEXT_BUFSIZE instead of 128
30332	for static buffer size.
30333	* stream.c (decode_poll): Use TIMESPEC_TEXT_BUFSIZE instead of 128
30334	when checking remaining buffer size.
30335
303362012-01-19  Denys Vlasenko  <dvlasenk@redhat.com>
30337
30338	Reduce bss usage and speed up string printing.
30339	   text	   data	    bss	    dec	    hex	filename
30340	 237913	    660	  49284	 287857	  46471	strace.before
30341	 237973	    660	  28772	 267405	  4148d	strace
30342
30343	This reduces L1 D-cache pressure a bit: instead of dirtying
30344	20k of bss, we will reuse already dirty stack area.
30345
30346	* util.c (printpathn): Use on-stack buffers instead of static ones.
30347	Saves 5*MAXPATHLEN in bss.
30348	(printstr): Use tprints() instead of tprintf("%s") when printing
30349	formatted string. May be a bit faster, depending on libc.
30350
303512012-01-18  Andreas Schwab  <schwab@linux-m68k.org>
30352
30353	Add support for compat_statfs64.
30354	* file.c (struct compat_statfs64, printcompat_statfs64): Define.
30355	(sys_statfs64, sys_fstatfs64): Use it.
30356
30357	Add support for statfs64.f_flags.
30358	* file.c (printstatfs64): Print f_flags if available.
30359
30360	Fix missing parens.
30361	* signal.c (sys_sigreturn): Add missing parens.
30362
303632012-01-18  Denys Vlasenko  <dvlasenk@redhat.com>
30364
30365	Get rid of TCB_SIGTRAPPED.
30366	On attempts to block or set SIGTRAP handler,
30367	for example, using sigaction syscall, we generate
30368	an additional SIGSTOP.
30369
30370	This change gets rid of this SIGSTOP sending/ignoring.
30371	It appears to work just fine.
30372
30373	It also works if I force strace to not use PTRACE_O_TRACESYSGOOD,
30374	which means strace stops will be marked with SIGTRAP,
30375	not (SIGTRAP | 0x80) - I wondered maybe that's when
30376	this hack is needed.
30377
30378	So, why we even have TCB_SIGTRAPPED? No one knows. It predates
30379	version control: this code was present in the initial commit,
30380	in 1999. No adequate comments, either.
30381
30382	Moreover, TCB_SIGTRAPPED is not set in sys_rt_sigaction
30383	and sys_sigprocmask syscalls - the ones which are most usually
30384	used to implement signal blocking, it is only set in obsolete
30385	sys_signal, sys_sigaction, sys_sigsetmask, and in some dead
30386	non-Linux code.
30387
30388	I think whatever bug it was fixing is gone long ago -
30389	at least as long as sys_rt_sigaction is used by glibc.
30390	Again, since glibc (and uclibc) uses sys_rt_sigaction
30391	and sys_sigprocmask, modified code paths are not used
30392	by most programs anyway.
30393
30394	* defs.h: Remove definition of TCB_SIGTRAPPED.
30395	* signal.c (sys_sigvec): Don't set TCB_SIGTRAPPED and don't send SIGSTOP.
30396	(sys_sigsetmask): Likewise.
30397	(sys_sigaction): Likewise.
30398	(sys_signal): Likewise.
30399	* strace.c (trace): Remove code which executes if TCB_SIGTRAPPED is set.
30400
304012012-01-18  Denys Vlasenko  <dvlasenk@redhat.com>
30402
30403	When we write log, flush output buffers in a few more cases.
30404	I observed a case when signal delivery message was buffered
30405	by stdio until it was flushed along with the next syscall
30406	entry message.
30407
30408	* strace.c (trace): Flush output buffers in a few more cases.
30409
304102012-01-18  Denys Vlasenko  <dvlasenk@redhat.com>
30411
30412	Fix old sigaction display.
30413	* signal.c (sys_sigaction): Fix display of sigaction with
30414	SIG_DFL/SIG_IGN handlers.
30415
30416	Change x86_64_regs struct type from pt_regs to user_regs_struct.
30417	* syscall.c: Change x86_64_regs struct type from
30418	pt_regs to user_regs_struct, and explain the change in comment.
30419
304202012-01-17  Dmitry V. Levin  <ldv@altlinux.org>
30421
30422	Fix struct pt_regs declaration on i386 and x86-64.
30423	* defs.h [I386] (i386_regs): Replace definition with declaration.
30424	[X86_64] (x86_64_regs): Remove.
30425	* syscall.c [X86_64] (x86_64_regs): Make static.
30426
304272012-01-12  Denys Vlasenko  <dvlasenk@redhat.com>
30428
30429	Make ERESTARTxyz messages more descriptive.
30430	There is widespread confusion about exact meaning
30431	of ERESTARTxyz codes. Before this change, we were showing
30432	all four of them the same: as "(To be restarted)".
30433
30434	This change prints better explanations for these codes,
30435	and contains verbose comments which explain *why* we display
30436	codes that way - or else someone confused
30437	is bound to come later and mangle them again.
30438	New messages are:
30439
30440	ERESTARTSYS (To be restarted if SA_RESTART is set)
30441	ERESTARTNOINTR (To be restarted)
30442	ERESTARTNOHAND (Interrupted by signal)
30443	ERESTART_RESTARTBLOCK (Interrupted by signal)
30444
30445	* syscall.c (trace_syscall_exiting): Make ERESTARTxyz messages
30446	more descriptive.
30447
304482012-01-10  Denys Vlasenko  <dvlasenk@redhat.com>
30449
30450	Fix sigreturn arg count from 1 to 0 on all architectures.
30451	* linux/alpha/syscallent.h: Change [rt_]sigreturn's arg count to 0.
30452	* linux/arm/syscallent.h: Likewise.
30453	* linux/avr32/syscallent.h: Likewise.
30454	* linux/bfin/syscallent.h: Likewise.
30455	* linux/m68k/syscallent.h: Likewise.
30456	* linux/microblaze/syscallent.h: Likewise.
30457	* linux/mips/syscallent.h: Likewise.
30458	* linux/powerpc/syscallent.h: Likewise.
30459	* linux/sh/syscallent.h: Likewise.
30460	* linux/sh64/syscallent.h: Likewise.
30461	* linux/sparc/syscallent.h: Likewise.
30462	* linux/tile/syscallent.h: Likewise.
30463
304642012-01-10  Denys Vlasenko  <dvlasenk@redhat.com>
30465
30466	Display mask on enter to sigreturn, not on exit.
30467	sys_sigreturn() performs ugly manipulations in order to show
30468	signal mask which is restored by this syscall: on syscall entry,
30469	fetches it from the stack, saves it in tcp->u_arg[]
30470	(where it used to overflow this array - fixed sometime ago),
30471	then retrieves the mask and displays it on syscall exit.
30472
30473	Apparently, the motivation is to make it slightly more obvious
30474	to user that signal mask is restored only when this syscall returns.
30475	IMO, this hardly justifies the necessary hacks. It is much easier
30476	to display the mask at the point when we fetch it - on syscall entry.
30477
30478	While at it, I made it so that we do display returned value/errno.
30479	I see no point in hiding it and showing uninformative "= ?" instead.
30480
30481	Example of pause() being interrupted by ALRM which has installed handler
30482	which re-arms ALRM:
30483
30484	Before the patch:
30485
30486	rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
30487	--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
30488	alarm(1)                                = 0
30489	sigreturn()                             = ? (mask now [INT])
30490
30491	After:
30492
30493	rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
30494	--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
30495	alarm(1)                                = 0
30496	sigreturn() (mask [INT])                = -1 EINTR (Interrupted system call)
30497
30498	* defs.h: Declare struct pt_regs i386_regs and struct pt_regs x86_64_regs.
30499	* syscall.c: Remove "static" keywork from these structures' definitions.
30500	* signal.c (sys_sigreturn): Display mask on enter, not on exit.
30501
305022012-01-04  Denys Vlasenko  <dvlasenk@redhat.com>
30503
30504	Do not detach from tracee which experienced ptrace error.
30505	Before this patch, if a thread got nuked by exit in another thread
30506	and we happened to poke it at the same time, we print "????(" thingy
30507	and detach the thread. Since we removed "detach before death" logic,
30508	this no longer matches the behavior of other threads.
30509	Before patch:
30510	[pid  1780] exit_group(1)               = ?
30511	[pid  1778] ????( <unfinished ...>
30512	Process 1778 detached
30513	[pid  5860] +++ exited with 1 +++
30514	After:
30515	[pid 17765] exit_group(1)               = ?
30516	[pid 21680] ????( <unfinished ...>
30517	[pid 17791] +++ exited with 1 +++
30518	[pid 21680] +++ exited with 1 +++
30519
30520	* strace (trace): Do not detach from tracee which experienced ptrace error.
30521
305222012-01-04  Denys Vlasenko  <dvlasenk@redhat.com>
30523
30524	Remove sig parameter from detach()
30525	* strace.c (detach): Drop sig parameter - it is zero in all calls.
30526	(cleanup): Don't pass sig = 0 to detach() call.
30527	(detach): Ditto.
30528
305292011-12-26  Dmitry V. Levin  <ldv@altlinux.org>
30530
30531	Enhance decoding for personalities with small wordsize.
30532	* util.c (umoven, umovestr) [SUPPORTED_PERSONALITIES > 1]: If current
30533	personality's wordsize is less than sizeof(long), use only significant
30534	bits of the given address.
30535
305362011-12-23  Dmitry V. Levin  <ldv@altlinux.org>
30537
30538	Enhance personality switching.
30539	On syscall entry, save current personality in the tcb structure
30540	along with scno.
30541	On syscall exit, restore current personality from the tcb structure.
30542	* defs.h (struct tcb) [SUPPORTED_PERSONALITIES > 1]: Add currpers
30543	field.
30544	* strace.c (alloc_tcb) [SUPPORTED_PERSONALITIES > 1]: Initialize
30545	tcp->currpers.
30546	* syscall.c (update_personality) [SUPPORTED_PERSONALITIES > 1]: New
30547	function.
30548	(get_scno, trace_syscall_exiting): Use it.
30549
30550	Reported-by: Michael A Fetterman <mafetter@nvidia.com>
30551
305522011-12-01  Dmitry V. Levin  <ldv@altlinux.org>
30553
30554	* net.c (socktcpoptions): Add more TCP_* constants from linux/tcp.h.
30555	Reported-by: Rick Jones <rick.jones2@hp.com>
30556
305572011-12-01  Heiko Carstens  <heiko.carstens@de.ibm.com>
30558
30559	Fix sys_ipc/sys_semtimedop decoding on s390.
30560	The s390 kernel sys_ipc system call only takes five arguments instead of
30561	six arguments which the common code sys_ipc implementation takes.
30562	One of the arguments of the sys_semtimedop subcall is therefore passed in
30563	a different register than in the common code implementation.
30564	This leads to broken decoding of the timespec argument:
30565
30566	semtimedop(0, 0x3ffffb43832, 1, {...})  = -1 EAGAIN
30567
30568	Fixed it looks like this:
30569
30570	semtimedop(0, 0x3ffffc2c842, 1, {0, 10000000}) = -1 EINTR
30571
30572	* linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390.
30573
305742011-11-29  Dmitry V. Levin  <ldv@altlinux.org>
30575
30576	strace.c (trace): Fix compilation warning.
30577
305782011-11-28  Dmitry V. Levin  <ldv@altlinux.org>
30579
30580	linux/syscall.h: Remove redundant function declarations.
30581	Remove 51 function declarations aliased to other declarations in
30582	linux/dummy.h file.
30583
30584	linux/syscall.h: Sort function declarations.
30585
30586	linux/syscall.h: Place one function declaration per line.
30587
30588	Remove redundant parsers.
30589	* desc.c (sys_dup): Remove.
30590	* file.c (sys_pivotroot, sys_rmdir, sys_fchdir, sys_chroot, sys_fchroot,
30591	sys_unlink, sys_symlink, sys_rename): Remove.
30592	* linux/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_pivotroot,
30593	sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
30594	* linux/dummy.h: Add aliases for sys_chroot, sys_dup, sys_pivotroot,
30595	sys_rename, sys_rmdir, sys_symlink, sys_unlink.
30596	* pathtrace.c (pathtrace_match): Update.
30597	* sunos4/dummy.h: Add aliases for sys_chroot, sys_dup, sys_fchdir,
30598	sys_fchroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink.
30599	* svr4/dummy.h: Likewise.
30600	* sunos4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot,
30601	sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
30602	* svr4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot,
30603	sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
30604
30605	Reflect the fact that nfsservctl syscall was removed from linux kernels.
30606	linux/dummy.h: Move nfsservctl to "unimplemented" section.
30607
306082011-11-27  Dmitry V. Levin  <ldv@altlinux.org>
30609
30610	x86_64: add getcpu syscall entry.
30611	* linux/x86_64/syscallent.h: Add syscall entry for getcpu.
30612
306132011-11-26  Dmitry V. Levin  <ldv@altlinux.org>
30614
30615	Add syscall entries for new linux syscalls.
30616	* linux/dummy.h: Add printargs parsers for new syscalls.
30617	* linux/arm/syscallent.h: Add entries for sys_clock_adjtime,
30618	sys_name_to_handle_at, sys_open_by_handle_at, sys_sendmmsg, sys_setns
30619	and sys_syncfs.
30620	* linux/i386/syscallent.h: Likewise.
30621	* linux/ia64/syscallent.h: Likewise.
30622	* linux/mips/syscallent.h: Likewise.
30623	* linux/powerpc/syscallent.h: Likewise.
30624	* linux/sh/syscallent.h: Likewise.
30625	* linux/sh64/syscallent.h: Likewise.
30626	* linux/sparc/syscallent.h: Likewise.
30627	* linux/x86_64/syscallent.h: Likewise.
30628	* linux/alpha/syscallent.h: Add entries for sys_clock_adjtime,
30629	sys_name_to_handle_at, sys_open_by_handle_at, sys_setns and sys_syncfs.
30630	* linux/m68k/syscallent.h: Likewise.
30631	* linux/microblaze/syscallent.h: Likewise.
30632	* linux/s390/syscallent.h: Likewise.
30633	* linux/s390x/syscallent.h: Likewise.
30634	* linux/avr32/syscallent.h: Add entry for sys_setns.
30635	* linux/bfin/syscallent.h: Add entries for sys_sendmmsg and sys_setns.
30636	* linux/hppa/syscallent.h: Add entries for sys_clock_adjtime,
30637	fanotify_init, fanotify_mark, sys_name_to_handle_at,
30638	sys_open_by_handle_at, sys_sendmmsg, sys_setns and sys_syncfs.
30639
30640	Fix prctl syscall entries.
30641	* linux/mips/syscallent.h: Fix prctl handler.
30642	* linux/tile/syscallent.h: Likewise.
30643
30644	arm: fix io_* syscall entries.
30645	* linux/arm/syscallent.h: Fix handlers for io_setup, io_destroy,
30646	io_getevents, io_submit and io_cancel.
30647
30648	Fix mincore syscall entries.
30649	* linux/arm/syscallent.h: Fix mincore handler.
30650	* linux/avr32/syscallent.h: Likewise.
30651	* linux/mips/syscallent.h: Likewise.
30652	* linux/sh/syscallent.h: Likewise.
30653	* linux/sh64/syscallent.h: Likewise.
30654
306552011-11-25  Dmitry V. Levin  <ldv@altlinux.org>
30656
30657	Fix sendmsg syscall entries.
30658	* linux/arm/syscallent.h: Fix number of sendmsg arguments.
30659	* linux/avr32/syscallent.h: Likewise.
30660	* linux/bfin/syscallent.h: Likewise.
30661	* linux/hppa/syscallent.h: Likewise.
30662	* linux/i386/syscallent.h: Likewise.
30663	* linux/m68k/syscallent.h: Likewise.
30664	* linux/microblaze/syscallent.h: Likewise.
30665	* linux/powerpc/syscallent.h: Likewise.
30666	* linux/s390/syscallent.h: Likewise.
30667	* linux/s390x/syscallent.h: Likewise.
30668	* linux/sh/syscallent.h: Likewise.
30669	* linux/sh64/syscallent.h: Likewise.
30670	* linux/sparc/syscallent.h: Likewise.
30671	* linux/tile/syscallent.h: Likewise.
30672	* linux/x86_64/syscallent.h: Likewise.
30673
30674	Fix epoll_wait syscall entries.
30675	* linux/arm/syscallent.h: Fix epoll_wait flags and handler.
30676	* linux/m68k/syscallent.h: Fix epoll_wait flags.
30677	* linux/microblaze/syscallent.h: Fix number of epoll_wait arguments.
30678	* linux/sh/syscallent.h: Likewise.
30679	* linux/sh64/syscallent.h: Likewise.
30680	* linux/x86_64/syscallent.h: Likewise.
30681
30682	Fix epoll_ctl syscall entries.
30683	* linux/arm/syscallent.h: Fix epoll_ctl flags and handler.
30684	* linux/m68k/syscallent.h: Fix epoll_ctl flags.
30685	* linux/x86_64/syscallent.h: Fix number of epoll_ctl arguments.
30686
30687	arm: fix epoll_create syscall entry.
30688	* linux/arm/syscallent.h: Fix epoll_create handler.
30689
30690	Fix mlockall syscall entries.
30691	* linux/arm/syscallent.h: Fix number of mlockall arguments.
30692	* linux/avr32/syscallent.h: Likewise.
30693	* linux/bfin/syscallent.h: Likewise.
30694	* linux/i386/syscallent.h: Likewise.
30695	* linux/m68k/syscallent.h: Likewise.
30696	* linux/microblaze/syscallent.h: Likewise.
30697	* linux/s390/syscallent.h: Likewise.
30698	* linux/s390x/syscallent.h: Likewise.
30699	* linux/sh/syscallent.h: Likewise.
30700	* linux/sh64/syscallent.h: Likewise.
30701	* linux/sparc/syscallent.h: Likewise.
30702	* linux/tile/syscallent.h: Likewise.
30703	* linux/x86_64/syscallent.h: Likewise.
30704
30705	Fix epoll_pwait syscall entries.
30706	* linux/alpha/syscallent.h: Fix number of epoll_pwait arguments.
30707	* linux/arm/syscallent.h: Likewise.
30708	* linux/avr32/syscallent.h: Likewise.
30709	* linux/bfin/syscallent.h: Likewise.
30710	* linux/i386/syscallent.h: Likewise.
30711	* linux/ia64/syscallent.h: Likewise.
30712	* linux/m68k/syscallent.h: Likewise.
30713	* linux/microblaze/syscallent.h: Likewise.
30714	* linux/mips/syscallent.h: Likewise.
30715	* linux/powerpc/syscallent.h: Likewise.
30716	* linux/s390/syscallent.h: Likewise.
30717	* linux/s390x/syscallent.h: Likewise.
30718	* linux/sh/syscallent.h: Likewise.
30719	* linux/sh64/syscallent.h: Likewise.
30720	* linux/sparc/syscallent.h: Likewise.
30721	* linux/tile/syscallent.h: Likewise.
30722	* linux/x86_64/syscallent.h: Likewise.
30723
30724	Fix reboot syscall entries.
30725	* linux/alpha/syscallent.h: Fix number of reboot arguments.
30726	* linux/arm/syscallent.h: Likewise.
30727	* linux/avr32/syscallent.h: Likewise.
30728	* linux/bfin/syscallent.h: Likewise.
30729	* linux/hppa/syscallent.h: Likewise.
30730	* linux/i386/syscallent.h: Likewise.
30731	* linux/ia64/syscallent.h: Likewise.
30732	* linux/m68k/syscallent.h: Likewise.
30733	* linux/microblaze/syscallent.h: Likewise.
30734	* linux/mips/syscallent.h: Likewise.
30735	* linux/powerpc/syscallent.h: Likewise.
30736	* linux/s390/syscallent.h: Likewise.
30737	* linux/s390x/syscallent.h: Likewise.
30738	* linux/sh/syscallent.h: Likewise.
30739	* linux/sh64/syscallent.h: Likewise.
30740	* linux/sparc/syscallent.h: Likewise.
30741	* linux/tile/syscallent.h: Likewise.
30742	* linux/x86_64/syscallent.h: Likewise.
30743
30744	Fix swapon syscall entries.
30745	* linux/arm/syscallent.h: Fix number of swapon arguments.
30746	* linux/avr32/syscallent.h: Likewise.
30747	* linux/bfin/syscallent.h: Likewise.
30748	* linux/i386/syscallent.h: Likewise.
30749	* linux/m68k/syscallent.h: Likewise.
30750	* linux/microblaze/syscallent.h: Likewise.
30751	* linux/mips/syscallent.h: Likewise.
30752	* linux/powerpc/syscallent.h: Likewise.
30753	* linux/s390/syscallent.h: Likewise.
30754	* linux/s390x/syscallent.h: Likewise.
30755	* linux/sh/syscallent.h: Likewise.
30756	* linux/sh64/syscallent.h: Likewise.
30757	* linux/sparc/syscallent.h: Likewise.
30758	* linux/tile/syscallent.h: Likewise.
30759	* linux/x86_64/syscallent.h: Likewise.
30760	* linux/alpha/syscallent.h: Fix number of swapon arguments, add TF flag.
30761	* linux/hppa/syscallent.h: Likewise.
30762	* linux/ia64/syscallent.h: Likewise.
30763
30764	Fix sgetmask and ssetmask syscall entries.
30765	* linux/hppa/syscallent.h: Fix sgetmask and ssetmask entries.
30766	* linux/powerpc/syscallent.h: Likewise.
30767	* linux/sparc/syscallent.h: Likewise.
30768	* linux/tile/syscallent.h: Likewise.
30769
30770	Rename siggetmask to sgetmask and sigsetmask to ssetmask.
30771	* linux/arm/syscallent.h: Rename siggetmask to sgetmask and
30772	sigsetmask to ssetmask.
30773	* linux/bfin/syscallent.h: Likewise.
30774	* linux/i386/syscallent.h: Likewise.
30775	* linux/m68k/syscallent.h: Likewise.
30776	* linux/microblaze/syscallent.h: Likewise.
30777	* linux/mips/syscallent.h: Likewise.
30778	* linux/sh/syscallent.h: Likewise.
30779	* linux/sh64/syscallent.h: Likewise.
30780	* linux/ia64/syscallent.h: Rename sys_sgetmask to sys_siggetmask,
30781	sys_ssetmask to sys_sigsetmask.
30782
30783	Add TRACE_IPC flag to sys_ipc syscall entries.
30784	* linux/arm/syscallent.h: Add TI flag to sys_ipc entry.
30785	* linux/avr32/syscallent.h: Likewise.
30786	* linux/bfin/syscallent.h: Likewise.
30787	* linux/i386/syscallent.h: Likewise.
30788	* linux/m68k/syscallent.h: Likewise.
30789	* linux/microblaze/syscallent.h: Likewise.
30790	* linux/mips/syscallent.h: Likewise.
30791	* linux/powerpc/syscallent.h: Likewise.
30792	* linux/s390/syscallent.h: Likewise.
30793	* linux/s390x/syscallent.h: Likewise.
30794	* linux/sh/syscallent.h: Likewise.
30795	* linux/sh64/syscallent.h: Likewise.
30796	* linux/sparc/syscallent.h: Likewise.
30797
307982011-11-05  Dmitry V. Levin  <ldv@altlinux.org>
30799
30800	gitlog-to-changelog: update from gnulib.
30801	* gitlog-to-changelog: Update from gnulib.
30802	* Makefile.am: Add --append-dot to gitlog-to-changelog invocation.
30803
308042011-10-22  Denys Vlasenko  <dvlasenk@redhat.com>
30805
30806	Decode TIOCSCTTY's third parameter.
30807	* term.c (term_ioctl): Decode TIOCSCTTY's third parameter.
30808
308092011-10-14  Dmitry V. Levin  <ldv@altlinux.org>
30810
30811	Remove useless and obsolete "#if DONE" sections.  No code changes.
30812	* linux/dummy.h: Remove "#if DONE" section.
30813	* linux/sparc/dummy2.h: Likewise.
30814	* linux/sparc64/dummy2.h: Likewise.
30815	* sunos4/dummy.h: Likewise.
30816	* svr4/dummy.h: Likewise.
30817
30818	Add names for dummy parsers.  No code changes.
30819	* linux/dummy.h: Add aliases to printargs() for those of dummy parsers
30820	that had no own names before.
30821	* linux/*/syscallent.h: Use these new names instead of printargs.
30822
30823	Sort definitions of dummy parsers.  No code changes.
30824	* linux/dummy.h: Sort definitions of parsers implemented as aliases
30825	to printargs().
30826
308272011-10-14  Mike Frysinger  <vapier@gentoo.org>
30828
30829	sys_epoll_create1: decode flag arguments correctly.
30830	* desc.c (epollflags): Define.
30831	(sys_epoll_create1): Use epollflags to printflags. Change "O" to "EPOLL".
30832
30833	Reported-by: Марк Коренберг <socketpair@gmail.com>
30834
308352011-10-11  Dmitry V. Levin  <ldv@altlinux.org>
30836
30837	Implement decoding of splice, tee and vmsplice(2) syscalls.
30838	* io.c (print_loff_t): New function.
30839	(sys_sendfile64): Use it.
30840	(splice_flags): New xlat structure.
30841	(sys_tee, sys_splice, sys_vmsplice): New functions.
30842	* linux/syscall.h (sys_tee, sys_splice, sys_vmsplice): Declare them.
30843	* linux/*/syscallent.h: Use them.
30844
308452011-10-11  Dmitry V. Levin  <ldv@altlinux.org>
30846
30847	Fix epoll_wait and epoll_pwait decoding.
30848	* desc.c (epoll_wait_common): Print "maxevents" and "timeout" arguments
30849	as integers.
30850
30851	Reported-by: Марк Коренберг <socketpair@gmail.com>
30852
308532011-10-11  Dmitry V. Levin  <ldv@altlinux.org>
30854
30855	Decode EPOLLRDHUP.
30856	* desc.c (epollevents): Add EPOLLRDHUP.
30857
30858	Reported-by: Марк Коренберг <socketpair@gmail.com>
30859
308602011-10-11  Dmitry V. Levin  <ldv@altlinux.org>
30861
30862	Remove unreachable code in umoven() and umovestr().
30863	* util.c (umoven, umovestr): Remove unreachable code.
30864
30865	Reported-by: Weichuan Yan <wchyan@marvell.com>
30866
308672011-09-05  Denys Vlasenko  <dvlasenk@redhat.com>
30868
30869	Do post-attach initialization earlier; fix "we ignore SIGSTOP on NOMMU" bug
30870	We set ptrace options when we see post-attach SIGSTOP.
30871	This is wrong: it's better to set them right away on the very first
30872	stop (whichever it will be). It also will make adding SEIZE support easier,
30873	since SEIZE has no post-attach SIGSTOP.
30874
30875	We do it by adding a new bit, TCB_IGNORE_ONE_SIGSTOP, and treating
30876	TCB_STARTUP and TCB_IGNORE_ONE_SIGSTOP as two slightly different things.
30877
30878	* defs.h: Add a new flag bit, TCB_IGNORE_ONE_SIGSTOP.
30879	* process.c (internal_fork): Set TCB_IGNORE_ONE_SIGSTOP on a newly added child.
30880	* strace.c (startup_attach): Set TCB_IGNORE_ONE_SIGSTOP after attach.
30881	Fix a case when "strace -p PID" found PID dead but sone other of its threads
30882	still alive.
30883	(startup_child): Set TCB_IGNORE_ONE_SIGSTOP after attach, _if needed_.
30884	This fixes a bogus case where we can ignore a _real_ SIGSTOP on NOMMU.
30885	(detach): Perform anti-SIGSTOP dance only if TCB_IGNORE_ONE_SIGSTOP is set,
30886	not if TCB_STARTUP is set.
30887	(trace): Set TCB_IGNORE_ONE_SIGSTOP after attach.
30888	Clear TCB_STARTUP and initialize tracee on the very first tracee stop.
30889	Clear TCB_IGNORE_ONE_SIGSTOP when SIGSTOP is seen.
30890
308912011-09-05  Denys Vlasenko  <dvlasenk@redhat.com>
30892
30893	Get rid of TCB_ATTACH_DONE.
30894	* defs.h: Remove TCB_ATTACH_DONE constant.
30895	* strace.c (startup_attach): Use TCB_STARTUP instead of TCB_ATTACH_DONE
30896	to distinquish attached from not-yet-attached threads.
30897
308982011-09-05  Denys Vlasenko  <dvlasenk@redhat.com>
30899
30900	Set TCB_STARTUP only _after_ we attached.
30901	This fixes logic in detach() which thinks that TCB_STARTUP
30902	means that we are already attached, but did not see SIGSTOP yet.
30903	This also allows to get rid of TCB_ATTACH_DONE flag.
30904
30905	* process.c (internal_fork): Set TCB_STARTUP after attach.
30906	* strace.c (startup_attach): Likewise.
30907	(startup_child): Likewise.
30908	(alloc_tcb): Do not set TCB_STARTUP on tcb allocation - we are
30909	not attached yet.
30910	(trace): Set TCB_STARTUP when we detech an auto-attached child.
30911
309122011-09-02  Denys Vlasenko  <dvlasenk@redhat.com>
30913
30914	Simple optimizations in trace()
30915	* strace.c (trace): Calculate WSTOPSIG(status) once,
30916	unify code paths to ptrace(PTRACE_SYSCALL).
30917
30918	Trivial fixes on error paths.
30919	* strace.c (startup_attach): Emit message on fork() failure.
30920	(startup_child): Remove non-informative comment.
30921	* util.c (ptrace_restart): use perror_msg() on error instead of fprintf().
30922
309232011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>
30924
30925	Fix compile failure introduced by last commit.
30926	* desc.c (decode_select): Fix double definition of nfds.
30927
309282011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>
30929
30930	Roll back "die on malloc failure" behaviour a bit.
30931	After recent change, select(2^31-1, NULL, NULL, NULL)
30932	would make strace exit. This change caps fdsize so that
30933	it is always in [0, 1025*1024], IOW: we will try to allocate at most
30934	1 megabyte, which in practice will almost always work,
30935	unlike malloc(2Gig).
30936
30937	* desc.c (decode_select): Cap fdsize to 1024*1024.
30938	* pathtrace.c (pathtrace_match): Cap fdsize to 1024*1024.
30939	* file.c (sys_getdents): Cap len to 1024*1024.
30940	(sys_getdents64): Cap len to 1024*1024.
30941	* util.c (dumpiov): Refuse to process iov with more than 1024*1024
30942	elements. Don't die on malloc failure.
30943	(dumpstr): Don't die on malloc failure.
30944
309452011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>
30946
30947	Add stpcpy to autoconf machinery.
30948	* configure.ac: Add stpcpy to AC_CHECK_FUNCS.
30949	* defs.h: Frame stpcpy with "if !defined HAVE_STPCPY".
30950	* util.c: Likewise.
30951
30952	Simplify sprinttv()
30953	* time.c (sprinttv): Trivial simplifications.
30954
30955	* desc.c (decode_select): Set tcp->auxstr as late as possible.
30956
309572011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>
30958
30959	Reformat setuid-ing code in startup_child()
30960	New code does the same as old one, but is more readable (I hope).
30961
30962	* strace.c (startup_child): Reformat setuid-ing code.
30963
309642011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>
30965
30966	Minor tweaks in startup_child(). Logic isn't changed (but code is)
30967	* strace.c (startup_attach): Tweak comment.
30968	(startup_child): Move common code out of ifdef.
30969	Indent nested ifdefs. Tweak comments. Remove two
30970	unnecessary calls to getpid().
30971
30972	Use tprints with literal strings, it may be faster than tprintf.
30973	* bjm.c: Replace tprintf("str") with tprints("str").
30974	* block.c: Likewise.
30975	* desc.c: Likewise.
30976	* file.c: Likewise.
30977	* io.c: Likewise.
30978	* ipc.c: Likewise.
30979	* mem.c: Likewise.
30980	* net.c: Likewise.
30981	* proc.c: Likewise.
30982	* process.c: Likewise.
30983	* quota.c: Likewise.
30984	* resource.c: Likewise.
30985	* scsi.c: Likewise.
30986	* signal.c: Likewise.
30987	* sock.c: Likewise.
30988	* strace.c: Likewise.
30989	* stream.c: Likewise.
30990	* syscall.c: Likewise.
30991	* system.c: Likewise.
30992	* term.c: Likewise.
30993	* time.c: Likewise.
30994	* util.c: Likewise.
30995
30996	Fix "format not a string literal" warning caused by tprintf(str)
30997	* defs.h: Declare tprints().
30998	* strace.c: Define tprints().
30999	(tabto): Use tprints(str), since tprintf(str) was throwing a warning.
31000	* desc.c: Use tprints(str) instead of tprintf("%s", str).
31001	* file.c: Likewise.
31002	* io.c: Likewise.
31003	* net.c: Likewise.
31004	* process.c: Likewise.
31005	* signal.c: Likewise.
31006	* syscall.c: Likewise.
31007	* util.c: Likewise.
31008
310092011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>
31010
31011	Add README-linux-ptrace file.
31012	I tried to push this doc to Michael Kerrisk <mtk.manpages@gmail.com>,
31013	but got no reply. To avoid losing the document, let it live
31014	in strace tree for now.
31015
310162011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>
31017
31018	Make out-of-memory handling more uniform.
31019	This fixes one real bug in dumpstr().
31020
31021	* defs.h: Declare die_out_of_memory().
31022	* strace.c (die_out_of_memory): New function.
31023	(strace_popen): If allocation fails, call die_out_of_memory().
31024	(main): Likewise.
31025	(expand_tcbtab): Likewise.
31026	(rebuild_pollv): Likewise.
31027	* count.c (count_syscall): Likewise.
31028	(call_summary_pers): Likewise.
31029	* desc.c (decode_select): Likewise.
31030	* file.c (sys_getdents): Likewise.
31031	(sys_getdents64): Likewise.
31032	(sys_getdirentries): Likewise.
31033	* pathtrace.c (pathtrace_match): Likewise.
31034	* syscall.c (qualify): Likewise.
31035	* util.c (printstr): Likewise.
31036	(dumpiov): Likewise.
31037	(dumpstr): Likewise.
31038	(fixvfork): Likewise.
31039	* mem.c (sys_mincore): Don't check free() parameter for NULL.
31040
310412011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>
31042
31043	Optimization: eliminate all remaining usages of strcat()
31044	After this change, we don't use strcat() anywhere.
31045
31046	* defs.h: Change sprinttv() return type to char *.
31047	* time.c (sprinttv): Return pointer past last stored char.
31048	* desc.c (decode_select): Change printing logic in order to eliminate
31049	usage of strcat() - use stpcpy(), *outptr++ = ch, sprintf() instead.
31050	Also reduce usage of strlen().
31051	* stream.c (decode_poll): Likewise.
31052
310532011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>
31054
31055	Optimize string_quote() for speed.
31056	* util.c (string_quote): Speed up check for terminating NUL.
31057	Replace strintf() with open-coded binary to hex/oct conversions -
31058	we potentially do them for every single byte, need to be fast.
31059
31060	Optimization: eliminate some usages of strcat()
31061	* defs.h: Declare stpcpy().
31062	* util.c: Define stpcpy().
31063	* file.c: Remove static str_append().
31064	(sprint_open_modes): Use stpcpy() instead of str_append().
31065	(sprintflags): Use stpcpy() instead of strcat().
31066	(printpathn): Eliminate usage of strcat().
31067	(printstr): Eliminate usage of strcat().
31068
310692011-08-30  Denys Vlasenko  <dvlasenk@redhat.com>
31070
31071	Small optimization on AVR32.
31072	* syscall.c (syscall_enter): Optimize tcp->u_arg[i] setting
31073	from regs.FOO for AVR32.
31074
310752011-08-30  Denys Vlasenko  <dvlasenk@redhat.com>
31076
31077	On X86_64 and I386, use PTRACE_GETREGS to fetch all registers.
31078	Before this change, registers were read with PTRACE_PEEKUSER
31079	ptrace operation, one per register. This is slower than
31080	fetching them all in one ptrace operation.
31081
31082	* defs.h: include asm/ptrace.h on X86_64 and I386.
31083	* syscall.c: New static variables i386_regs and x86_64_regs.
31084	Remove static eax/rax variables.
31085	(get_scno): Fetch all registers with single PTRACE_GETREGS operation.
31086	(get_syscall_result): Likewise.
31087	(syscall_fixup_on_sysenter): Use PTRACE_GETREGS results in i386/x86_64_regs.
31088	(syscall_enter): Set tcp->u_arg[i] from PTRACE_GETREGS results.
31089	(get_error): Set tcp->u_rval, tcp->u_error from PTRACE_GETREGS results.
31090
310912011-08-30  Dmitry V. Levin  <ldv@altlinux.org>
31092
31093	Do not include <limits.h>
31094	* strace.c: Do not include <limits.h> explicitly, it is already included
31095	implicitly by <sys/param.h>.
31096
310972011-08-30  Dmitry V. Levin  <ldv@altlinux.org>
31098
31099	Include <sys/param.h> to get PATH_MAX definition.
31100	* pathtrace.c: Include <sys/param.h> instead of <limits.h> to get
31101	PATH_MAX definition.
31102
31103	Reported-by: Steve Bennett <steveb@workware.net.au>
31104
311052011-08-26  Denys Vlasenko  <dvlasenk@redhat.com>
31106
31107	Indent a large set of nested ifdefs/endifs. No code changes.
31108	* defs.h: Indent a large set of nested ifdefs/endifs
31109
31110	Rename syscall_fixup to syscall_fixup_on_sysenter.
31111	* defs.h: Tweak comment.
31112	* syscall.c: Rename syscall_fixup to syscall_fixup_on_sysenter.
31113	(trace_syscall_entering): Use new finction name.
31114
31115	Make syscall result reading more consistent among different arches.
31116	* syscall.c: Eliminate static flags variable for POWERPC.
31117	(syscall_fixup): Don't fetch syscall results. Affected arches:
31118	POWERPC, BFIN, HPPA.
31119	(syscall_fixup_on_sysexit): Move syscall results fetching code
31120	for this function to get_syscall_result. Affected arches:
31121	S390X, POWERPC, BFIN, M68K, HPPA, CRIS, MICROBLAZE.
31122	(get_syscall_result): Add syscall results fetching.
31123
311242011-08-25  Denys Vlasenko  <dvlasenk@redhat.com>
31125
31126	Simplify syscall_fixup[_on_sysexit]
31127	* syscall.c (syscall_fixup): Remove checks for entering(tcp).
31128	Remove code which executes if exiting(tcp).
31129	(syscall_fixup_on_sysexit): Remove code which executes
31130	if entering(tcp). Remove checks for exiting(tcp).
31131
31132	Split syscall_fixup into enter/exit pair of functions.
31133	* syscall.c: Create syscall_fixup_on_sysexit() which is a copy of
31134	syscall_fixup().
31135	(trace_syscall_exiting): Call syscall_fixup_on_sysexit() instead of
31136	syscall_fixup().
31137
31138	Remove stray commas in struct initializers. No code changes.
31139	* process.c: Remove stray commas in struct initializers.
31140
311412011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31142
31143	Optimize tabto()
31144	tabto is used in many lines of strace output.
31145	On glibc, tprintf("%*s", col - curcol, "") is noticeably slow
31146	compared to tprintf("                 "). Use the latter.
31147	Observed ~15% reduction of time spent in userspace.
31148
31149	* defs.h: Drop extern declaration of acolumn. Make tabto()
31150	take no parameters.
31151	* process.c (sys_exit): Call tabto() with no parameters.
31152	* syscall.c (trace_syscall_exiting): Call tabto() with no parameters.
31153	* strace.c: Make acolumn static, add static char *acolumn_spaces.
31154	(main): Allocate acolumn_spaces as a string of spaces.
31155	(printleader): Call tabto() with no parameters.
31156	(tabto): Use simpler method to print lots of spaces.
31157
311582011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31159
31160	* syscall.c (sys_indir): Use %ld for printing long, not %u.
31161
311622011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31163
31164	Opotimize "scno >= 0 && scno < nsyscalls" check.
31165	gcc can't figure out on its own that this check can be done with
31166	single compare, and does two compares. We can help it by casting
31167	scno to unsigned long: ((unsigned long)(scno) < nsyscalls)
31168
31169	* defs.h: New macro SCNO_IN_RANGE(long_var).
31170	* count.c (count_syscall): Use SCNO_IN_RANGE() instead of open-coded check.
31171	* syscall.c (getrval2): Use SCNO_IN_RANGE() instead of open-coded check.
31172	This fixes a bug: missing check for scno < 0 and scno > nsyscalls
31173	instead of scno >= nsyscalls.
31174	(get_scno): Use SCNO_IN_RANGE() instead of open-coded check.
31175	This fixes a bug: scno > nsyscalls instead of scno >= nsyscalls.
31176	(known_scno): Use SCNO_IN_RANGE() instead of open-coded check.
31177	(internal_syscall): Likewise.
31178	(syscall_enter): Likewise.
31179	(trace_syscall_entering): Likewise.
31180	(get_error): Likewise.
31181	(trace_syscall_exiting): Likewise.
31182
311832011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31184
31185	Remove scno_good logic in syscall exit.
31186	* syscall.c (trace_syscall_exiting): Remove scno_good logic,
31187	it can't trigger in syscall exit.
31188
31189	Remove redundant assignments.
31190	* syscall.c (get_error): Remove redundant "u_error = 0" and redundant
31191	and unclear comments.
31192
31193	Group int-sized fields together in struct tcb.
31194	* defs.h: Group int-sized fields together in struct tcb.
31195
311962011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31197
31198	Reorder functions in syscall.c. No code changes.
31199	Old order (basically "in no particular order"):
31200	    dumpio
31201	    decode_subcall
31202	    internal_syscall
31203	    get_scno
31204	    get_syscall_result
31205	    known_scno
31206	    syscall_fixup
31207	    is_negated_errno
31208	    get_error
31209	    syscall_enter
31210	    trace_syscall_entering
31211	    trace_syscall_exiting
31212	    trace_syscall
31213	    printargs
31214	    getrval2
31215	    sys_indir
31216	    is_restart_error
31217
31218	New order:
31219	various utility functions:
31220	    decode_subcall
31221	    printargs
31222	    getrval2
31223	    sys_indir
31224	    is_restart_error
31225	syscall enter handling functions:
31226	    get_scno
31227	    known_scno
31228	    syscall_fixup (also used in syscall exit code)
31229	    internal_syscall (also used in syscall exit code)
31230	    syscall_enter
31231	    trace_syscall_entering
31232	syscall exit handling functions:
31233	    get_syscall_result
31234	    is_negated_errno
31235	    get_error
31236	    dumpio
31237	    trace_syscall_exiting
31238	main syscall enter/exit function:
31239	    trace_syscall
31240
31241	* syscall.c: Reorder functions so that related ones are closer
31242	in the source.
31243
312442011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31245
31246	Rename some functions, delete unused one. No code changes.
31247	* defs.h: Rename get_scno_on_sysenter() to get_scno();
31248	delete force_result() declaration.
31249	* strace.c (proc_open): Rename get_scno_on_sysenter() to get_scno().
31250	* syscall.c: Rename get_scno_on_sysenter() to get_scno().
31251	Rename get_scno_on_sysexit() to get_syscall_result().
31252	Delete unused force_result().
31253
312542011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31255
31256	Unify per-architecture post-execve SIGTRAP check.
31257	Move post-execve SIGTRAP check from get_scno_on_sysenter
31258	(multitude of places on many architectures) to a single location
31259	in trace_syscall_entering. This loosens the logic for some arches,
31260	since many of them had additional checks such as scno == 0.
31261	However, on non-ancient Linux kernels we should never have post-execve
31262	SIGTRAP in the first place, by virtue of using PTRACE_O_TRACEEXEC.
31263
31264	* syscall.c (get_scno_on_sysenter): Remove tcp->flags & TCB_WAITEXECVE checks.
31265	(trace_syscall_entering): Do tcp->flags & TCB_WAITEXECVE check here.
31266	(get_scno_on_sysexit): Tweak comment.
31267	(syscall_fixup): Likewise.
31268	(trace_syscall_exiting): Likewise.
31269
312702011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31271
31272	Speed up x86 by avoiding EAX read on syscall entry.
31273	on x86, EAX read on syscall entry is not necessary if we know
31274	that post-execve SIGTRAP is disabled by PTRACE_O_TRACEEXEC ptrace option.
31275	This patch (a) moves EAX retrieval from syscall_fixup
31276	to get_scno_on_sysexit, and (b) perform EAX retrieval in syscall_fixup
31277	only if we are in syscall entry and PTRACE_O_TRACEEXEC option is not on.
31278
31279	* syscall.c (get_scno_on_sysexit): On I386 and X86_64, read eax/rax
31280	which contain syscall return value.
31281	(syscall_fixup): On I386 and X86_64, read eax/rax only on syscall enter
31282	and only if PTRACE_O_TRACEEXEC is not in effect.
31283
312842011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31285
31286	Do not read syscall no in get_scno_on_sysexit.
31287	* syscall.c (get_scno_on_sysexit): Remove scno retrieval code, since
31288	we don't save it anyway. This is the first real logic change
31289	which should make strace faster: for example, on x64 ORIG_EAX
31290	is no longer read in each syscall exit.
31291
31292	Simplify get_scno_on_sysenter/sysexit.
31293	* syscall.c (get_scno_on_sysenter): Remove "if (exiting(tcp))" code,
31294	make "if (entering(tcp))" code unconditional.
31295	(get_scno_on_sysexit): Remove "if (entering(tcp))" code,
31296	make "if (exiting(tcp))" code unconditional.
31297
312982011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>
31299
31300	get_scno is an unholy mess, make it less horrible.
31301	Currently, get_scno does *much* more than "get syscall no".
31302	It checks for post-execve SIGTRAP. It checks for changes
31303	in personality. It retrieves params on entry and registers on exit.
31304	Worse still, it is different in different architectures: for example,
31305	for AVR32 regs are fetched in get_scno(), while for e.g. I386
31306	it is done in syscall_enter().
31307
31308	Another problem is that get_scno() is called on both syscall entry and
31309	syscall exit, which is stupid: we don't need to know scno on syscall
31310	exit, it is already known from last syscall entry and stored in
31311	tcp->scno! In essence, get_scno() does two completely different things
31312	on syscall entry and on exit, they are just mixed into one bottle, like
31313	shampoo and conditioner.
31314
31315	The following patches will try to improve this situation.
31316
31317	This change duplicates get_scno into identical get_scno_on_sysenter,
31318	get_scno_on_sysexit functions. Call them in syscall enter and syscall
31319	exit, correspondingly.
31320
31321	* defs.h: Rename get_scno to get_scno_on_sysenter; declare it only
31322	if USE_PROCFS.
31323	* strace.c (proc_open): Call get_scno_on_sysenter instead of get_scno.
31324	* syscall.c (get_scno): Split into two (so far identical) functions
31325	get_scno_on_sysenter and get_scno_on_sysexit.
31326	(trace_syscall_entering): Call get_scno_on_sysenter instead of get_scno.
31327	(trace_syscall_exiting): Call get_scno_on_sysexit instead of get_scno.
31328
313292011-08-23  Dmitry V. Levin  <ldv@altlinux.org>
31330
31331	Reduce code redundancy in syscall_enter()
31332	* syscall.c [LINUX] (syscall_enter): Move tcp->u_nargs initialization
31333	from arch-specific ifdefs to common code.  Always cache tcp->u_nargs in
31334	a local variable and use it in for() loops.
31335	[IA64, AVR32] Rewrite tcp->u_arg[] initialization using a loop.
31336
313372011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31338
31339	Define MAX_ARGS to 6 for all Linux arches.
31340	* defs.h: Define MAX_ARGS to 6 for all Linux arches.
31341	* linux/ia64/syscallent.h: Change all 8-argument printargs
31342	to MA (MAX_ARGS).
31343	linux/mips/syscallent.h: Change all two 7-argument printargs
31344	to MA (MAX_ARGS).
31345
31346	Fix argument printing in sys_mmap64.
31347	* mem.c (sys_mmap64): Fix a bug where we used tcp->u_args[i]
31348	instead of argument values copied from memory.
31349
313502011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31351
31352	Cache tcp->u_nargs in a local variable for for() loops.
31353	Loops of the form "for (i = 0; i < tcp->u_nargs; i++) ..."
31354	need to fetch tcp->u_nargs from memory on every iteration
31355	if "..." part has a function call (gcc doesn't know that
31356	tcp->u_nargs won't change). This can be sped up
31357	by putting tcp->u_nargs in a local variable, which might
31358	go into a CPU register.
31359
31360	* syscall.c (decode_subcall): Cache tcp->u_nargs in a local variable
31361	as for() loop limit value.
31362	(syscall_enter): Likewise.
31363
313642011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31365
31366	Drop checks for sysent[i].nargs == -1.
31367	* defs.h: Declare nsyscalls, nerrnos, nioctlents, nsignals as unsigned.
31368	* syscall.c: Define nsyscalls, nerrnos, nioctlents, nsignals as unsigned.
31369	(decode_subcall): Drop checks for sysent[i].nargs == -1.
31370	(syscall_enter): Likewise.
31371
313722011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31373
31374	Stop using nargs == -1 in syscallent tables.
31375	Usage -1 as argument count in syscallent tables
31376	necessitates the check for it, a-la:
31377	if (sysent[tcp->scno].nargs != -1)
31378	    tcp->u_nargs = sysent[tcp->scno].nargs;
31379	else
31380	    tcp->u_nargs = MAX_ARGS;
31381	which is stupid: we waste cycles checking something which
31382	is constant and known at compile time.
31383
31384	* defs.h: Make struct sysent::nargs unsigned.
31385	* freebsd/i386/syscallent.h: Replace nargs of -1 with MA.
31386	* linux/s390/syscallent.h: Likewise.
31387	* linux/s390x/syscallent.h: Likewise.
31388	* svr4/syscallent.h: Likewise.
31389	* freebsd/syscalls.pl: Likewise in generator script.
31390	* syscallent.sh: Likewise in generator script.
31391	* syscall.c: Add define MA MAX_ARGS / undef MA around includes
31392	of syscallent[N].h.
31393
313942011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31395
31396	Move trace_syscall_exiting below trace_syscall_entering. No code changes.
31397	Syscall enter happens before syscall exit. Having functions
31398	in opposite order in the source is confusing.
31399
31400	* syscall.c: Move trace_syscall_exiting below trace_syscall_entering.
31401
314022011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31403
31404	Fix -z display.
31405	Before this patch, the following:
31406	    open("qwerty", O_RDONLY)    = -1 ENOENT
31407	    write(2, "wc: qwerty: No such file or dire"..., 38) = 38
31408	was shown totally wrongly with -z:
31409	    open("qwerty", O_RDONLY)    = 38
31410	(yes, that's right, write syscall is lost!)
31411	Now it is shown "less wrongly" as:
31412	    open("qwerty", O_RDONLY <unfinished ...>
31413	    write(2, "wc: qwerty: No such file or dire"..., 38) = 38
31414
31415	* syscall.c (trace_syscall_exiting): Use common TCB_INSYSCALL clearing
31416	via "goto ret". This fixes totally broken display of -z, but even now
31417	it is not working as intended. Add a comment about that.
31418	(trace_syscall_entering): Use common TCB_INSYSCALL setting
31419	via "goto ret".
31420
314212011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31422
31423	Straighten up confused comments/messages about post-execve SIGTRAP handling
31424	* defs.h: Explain TCB_INSYSCALL and TCB_WAITEXECVE bits in detail.
31425	* strace.c (choose_pfd): Use entering/exiting macros instead of direct check
31426	for TCB_INSYSCALL.
31427	* syscall.c (get_scno): Use entering/exiting macros instead of direct check
31428	for TCB_INSYSCALL. Fix comments about post-execve SIGTRAP.
31429	(syscall_fixup): Use entering/exiting instead of direct check
31430	for TCB_INSYSCALL. Add a comment what "not a syscall entry" message
31431	usually means. Change wrong "stray syscall exit" messages into
31432	"not a syscall entry" ones.
31433
31434	count_syscall() always returns 0, optimize it.
31435	* defs.h (count_syscall): Change return type from int to void.
31436	* count.c (count_syscall): Change return type from int to void.
31437	* syscall.c (trace_syscall_exiting): Change code around call
31438	to count_syscall accordingly.
31439
31440	Optimize out dummy PC printing on signal delivery.
31441	* strace.c (trace): Optimize out dummy PC printing on signal delivery.
31442	While at it, tweak comments.
31443
31444	Conditionally optimize out unused code.
31445	* syscall.c (internal_syscall): Call internal_exec only if
31446	SUNOS4 || (LINUX && TCB_WAITEXECVE).
31447	* process.c (internal_exec): Define this function only if
31448	SUNOS4 || (LINUX && TCB_WAITEXECVE).
31449	(printwaitn): Don't check wordsize if SUPPORTED_PERSONALITIES == 1.
31450	* signal.c (sys_kill): Likewise.
31451	* syscall.c (is_negated_errno): Likewise.
31452	(trace_syscall_exiting): Fold a tprintf into tprintfs which follow it.
31453
31454	Cosmetic improvement in ifdefs. No code changes.
31455	* strace.c (proc_open): Change ifdefs so that braces are properly paired.
31456
31457	Exclude tcp->pfd from non-procfs systems.
31458	* defs.h: Make struct tcb::pfd fields conditional on USE_PROCFS.
31459	* strace.c (alloc_tcb): Use tcp->pfd only if USE_PROCFS.
31460	(droptcb): Likewise.
31461
31462	Small optimizations related to memory allocation.
31463	* strace (expand_tcbtab): Shorten "out of memory" message.
31464	(rebuild_pollv): Remove unnecessary NULL check before free().
31465	* util.c (dumpstr): Add a comment about likely bug.
31466
31467	Improve code readability by avoiding assignments inside if()
31468	* desc.c (decode_select): Move assignment out of if() condition.
31469	* file.c (sprinttime): Likewise.
31470	(sys_getdirentries): Likewise.
31471	* io.c (sys_ioctl): Likewise.
31472	* strace.c (test_ptrace_setoptions_followfork): Likewise.
31473	(main): Likewise.
31474	(proc_open): Likewise.
31475	(detach): Likewise.
31476	(proc_poll): Likewise.
31477	(trace): Likewise.
31478	* syscall.c (qualify): Likewise.
31479	(sys_indir): Likewise.
31480	* test/procpollable.c (main): Likewise.
31481	* test/sfd.c (main): Likewise.
31482	* time.c (printtv_bitness): Likewise.
31483	(sprinttv): Likewise.
31484	(print_timespec): Likewise.
31485	(void sprint_timespec): Likewise.
31486	(printitv_bitness): Likewise.
31487	* util.c (dumpstr): Likewise.
31488	(umovestr): Likewise.
31489	(fixvfork): Likewise.
31490
31491	Convert ioctl_next_match() to new-style C function definition.
31492	* ioctl.c (ioctl_next_match): Convert to new-style C function definition.
31493
314942011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31495
31496	Small optimization in signal and ioctl tables.
31497	Trivial shuffling of data tables puts them all in one file,
31498	allowing gcc to see their sizes and eliminate variables
31499	which store these sizes.
31500
31501	Surprisingly, in C mode gcc does not optimize out static const int
31502	variables. Help it by using enums instead.
31503
31504	* defs.h: Stop exporting ioctlent{0,1,2}, nioctlents{0,1,2},
31505	signalent{0,1,2}, nsignals{0,1,2}.
31506	* ioctl.c: Remove definitions of ioctlent{,0,1,2} and nioctlents{,0,1,2}.
31507	* signal.c: Remove definitions of signalent{,0,1,2} and nsignals{,0,1,2}.
31508	* syscall.c: Move above definitions to this file. Make them static const
31509	or enums if suitable.
31510
315112011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31512
31513	Don't return int from set_personality(), no one checks it.
31514	* defs.h (set_personality): Change return type to void.
31515	* syscall.c (set_personality): Change return type to void.
31516
31517	Remove unused declaration.
31518	* defs.h: Remove unused declaration of handle_new_child().
31519
31520	Use natural-sized integer field for tcb::flags.
31521	* defs: Change struct tcb::flags type from short to int.
31522	This results in smaller code at least on x86.
31523
31524	Make needlessly static data local.
31525	* syscall.c (get_scno): For POWERPC64 and X86-64, variable currpers
31526	is declared static. But its old data is never used. Convert it
31527	to ordinary local variable.
31528
31529	Optimize get_scno function.
31530	* syscall.c (get_scno): Make gpr_offset[] array static const.
31531
31532	Optimize iocb_cmd_lookup.
31533	* desc.c (iocb_cmd_lookup): Make command table constant.
31534	Reduce size of static char buffer.
31535
31536	Correct sys_sendfile[64] type and nargs.
31537	* freebsd/i386/syscallent.h: Correct sys_sendfile nargs 7->8
31538	* linux/mips/syscallent.h: Correct sys_sendfile64 nargs 5->4
31539	* linux/sh/syscallent.h: Correct sys_sendfile64 nargs 5->4
31540	* linux/sh64/syscallent.h: Correct sys_sendfile64 nargs 5->4
31541	* linux/m68k/syscallent.h: Correct sys_sendfile64 type TF->TD|TN
31542	* linux/microblaze/syscallent.h: Correct sys_sendfile64 type TF->TD|TN
31543	* linux/tile/syscallent.h: Correct sys_sendfile and sys_sendfile64 type TD->TD|TN
31544
31545	Make addflags return void.
31546	* defs.h (addflags): Change return type from int to void.
31547	* util.c (addflags): Change return type from int to void.
31548
315492011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31550
31551	Set saner MAX_ARGS (6 or 8) for X86_64 and I386.
31552	I noticed that tcp->u_args[MAX_ARGS] array is way larger than
31553	I'd expect: for all arches except HPPA it has 32 (!) elements.
31554
31555	I looked at the code and so far I spotted only one abuser of
31556	this fact: sys_sigreturn. On several arches, it saves sigset_t
31557	into tcp->u_args[1...N] on entry and prints it on exit, a-la
31558
31559	memcpy(&tcp->u_arg[1], &sc.oldmask[0], sizeof(sigset_t))
31560
31561	The problem here is that in glibc sigset_t is insanely large:
31562	128 bytes, and using sizeof(sigset_t) in memcpy will overrun
31563	&tcp->u_args[1] even with MAX_ARGS == 32:
31564	On 32 bits, sizeof(tcp->u_args) == 32*4 == 128 bytes!
31565	We may already have a bug there!
31566
31567	This commit changes the code to save NSIG / 8 bytes only.
31568	NSIG can't ever be > 256, and in practice is <= 129,
31569	thus NSIG / 8 is <= 16 bytes == 4 32-bit words,
31570	and even MAX_ARGS == 5 should be enough for saving signal masks.
31571
31572	* defs.h: Reduce MAX_ARGS for X86_64 and I386 from 32 to 8
31573	for FreeBSD and to 6 for everyone else. Add comment about current
31574	state of needed MAX_ARGS.
31575	* signal.c: Add comment about size of sigset_t.
31576	(sprintsigmask): Reduce static string buffer from 8k to 2k.
31577	(sys_sigreturn): Fix sigset saving to save only NSIG / 8 bytes,
31578	not sizeof(sigset_t) bytes.
31579	* linux/mips/syscallent.h: Reduce nargs of printargs-type syscall to 7.
31580	* linux/arm/syscallent.h: Reduce nargs of printargs-type syscall to 6.
31581	* linux/i386/syscallent.h: Likewise.
31582	* linux/m68k/syscallent.h: Likewise.
31583	* linux/powerpc/syscallent.h: Likewise.
31584	* linux/s390/syscallent.h: Likewise.
31585	* linux/s390x/syscallent.h: Likewise.
31586	* linux/sh/syscallent.h: Likewise.
31587	* linux/sh64/syscallent.h: Likewise.
31588	* linux/sparc/syscallent.h: Likewise.
31589
315902011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31591
31592	Optimize sys_old_mmap.
31593	* mem.c (sys_old_mmap): For Ia64 and 32-bit personality of x86-64,
31594	copy narrow parameters from userspace by single umove, not by six
31595	separate ones; then assign them to long u_arg[i]. For SH[64],
31596	avoid copying of tcp->u_arg.
31597	(sys_mmap): Add FIXME comment - SH64 and i386 seem to be handled
31598	differently for no apparent reason.
31599	* test/mmap_offset_decode.c: New test program, illustrates FIXME.
31600
316012011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31602
31603	Untangle ifdef forest in sys_mmap64. No code changes.
31604	After careful analysis, it looks like !LINUX and ALPHA
31605	pass all seven parameters in registers; and in all other cases
31606	parameters are on stack (pointed to by tcp->u_arg[0]).
31607	In light of this, reorganize ifdefs, making them simpler,
31608	without changing any logic.
31609	After this, it's apparent we use tcp->u_arg[4,5,6] and possibly
31610	[7] without checking that it's valid to do so.
31611	So far, just add a comment about this.
31612
31613	* mem.c (sys_mmap64): Rewrite ifdefs in a much simpler way.
31614	Add comments about apparent bugs.
31615
316162011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>
31617
31618	Style and comment fixes, no code changes.
31619	* mem.c: Indent includes to show nesting better.
31620	  (addtileflags): Fix style of this function definition;
31621	  correct wrong endif comment, add another endif comment.
31622
31623	Use simpler rounding up to next multiple of 2.
31624	* util.c (printllval): simpler rounding up to next multiple of 2.
31625
31626	Cosmetic fixes, no code changes.
31627	* defs.h: Add/reformat comments.
31628	* signal.c: Remove wrong comment. Add warning directive
31629	when we detect that NSIG is undefined. Add comment about
31630	NSIG on ARM. Fix typo in comment.
31631	(signame): Reformat code a bit without changes to logic.
31632	Shorten static buffer.
31633	(sys_rt_sigprocmask): Remove stray empty line.
31634	* syscall.c: Add warning directive when we detect that
31635	NSIG is undefined. Add comment about NSIG on ARM.
31636
316372011-08-23  Dmitry V. Levin  <ldv@altlinux.org>
31638
31639	Fix PTRACE_SETOPTIONS tests.
31640	* strace.c [LINUX] (kill_save_errno): New function.
31641	(test_ptrace_setoptions_followfork): Change return type to void.
31642	Fix and harden error handling.  Use kill_save_errno() to avoid errno
31643	clobbering.  Treat EIO from ptrace() the same way as EINVAL.
31644	(test_ptrace_setoptions_for_all): Use kill_save_errno() to avoid errno
31645	clobbering.  Treat EIO from ptrace() the same way as EINVAL.
31646	(main): Update use of test_ptrace_setoptions_followfork().
31647
31648	Fix compilation on linux 2.4.x.
31649	* configure.ac: Check for BLKGETSIZE64.
31650	* block.c (block_ioctl): Check for HAVE_BLKGETSIZE64.
31651
316522011-08-17  Denys Vlasenko  <dvlasenk@redhat.com>
31653
31654	Remove tcp->parent and TCB_CLONE_THREAD.
31655	tcp->parent is used for only two things:
31656	(1) to send signal on detach via tgkill (need to know tgid).
31657	Solution: use tkill, it needs only tid.
31658	(2) to optimize out ptrace options setting for new tracees.
31659	Not a big deal if we drop this optimization: "set options" op is fast,
31660	doing it just one extra time once per each tracee is hardly measurable.
31661
31662	TCB_CLONE_THREAD is a misnomer. It used only to flag sibling we attached to
31663	in startup_attach. This is used to prevent infinite recursive rescanning
31664	of /proc/PID/task.
31665	Despite the name, there is no guarantee it is set only on non-leader:
31666	if one would run "strace -f -p THREAD_ID" and THREAD_ID is *not*
31667	a thread leader, strace will happily attach to it and all siblings
31668	and will think that THREAD_ID is the leader! Which is a bug, but
31669	since we no longer detach when we think tracee is going to die,
31670	this bug no longer matters, because we do not use the knowledge
31671	about thread group leaders for anything. (We used it to delay
31672	leader's exit).
31673
31674	IOW: after this patch strace has no need to know about threads, parents
31675	and children, and so on. Therefore it does not track that information.
31676	It treats all tracees as independent entities. Overall,
31677	this simplifies code a lot.
31678
31679	* defs.h: Add TCB_ATTACH_DONE flag, remove TCB_CLONE_THREAD flag
31680	and struct tcb::parent field.
31681	* process.c (internal_fork): Don't set tcpchild->parent.
31682	* strace.c (startup_attach): Use TCB_ATTACH_DONE flag instead of
31683	TCB_CLONE_THREAD to avoid attach attempts on already-attached threads.
31684	Unlike TCB_CLONE_THREAD, TCB_ATTACH_DONE bit is used only temporarily,
31685	and only in this function. We clear it on every tcb before we return.
31686	(detach): Use tkill instead of tgkill.
31687	(trace): Set ptrace options on new tracees unconditionally,
31688	not only when tcp->parent == NULL.
31689
316902011-08-17  Denys Vlasenko  <dvlasenk@redhat.com>
31691
31692	Remove TCB_SUSPENDED constant and related code.
31693	Since we no longer suspend waitpid'ing tracees, we have only one case when
31694	we suspend tracee: when we pick up a new tracee created by clone/fork/vfork.
31695
31696	Background: on some other OSes, attach to child is done this way:
31697	get fork's result (pid), loop ptrace(PTRACE_ATTACH) until you hook up
31698	new process/thread. This is ugly and not safe, but what matters for us
31699	is that it doesn't require suspending. Suspending is required
31700	on Linux only, because on Linux attach to child is done differently.
31701
31702	On Linux, we use two methods of catching new tracee:
31703	adding CLONE_THREAD bit to syscall (if needed, we change
31704	[v]fork into clone before that), or using ptrace options.
31705	In both cases, it may be so that new tracee appears before one which
31706	created it returns from syscall. In this case, current code
31707	suspends new tracee until its creator returns. Only then
31708	strace can determine who is its parent (it needs child's pid for this,
31709	which is visible in parent's [v]fork/clone result).
31710	This is inherently racy. For example, what if SIGKILL kills
31711	creator after it succeeded creating child, but before it returns?
31712	Looks like we will have child suspended forever.
31713
31714	But after previous commit, we DO NOT NEED parent<->child link for anything.
31715	Therefore we do not need suspending too. Bingo!
31716
31717	This patch removes suspending code. Now new tracees will be continued
31718	right away. Next patch will remove tcp->parent member.
31719
31720	* defs.h: Remove TCB_SUSPENDED constant
31721	* process.c (handle_new_child): Delete this function.
31722	  (internal_fork): Do not call handle_new_child on syscall exit.
31723	* strace.c (handle_ptrace_event): Delete this function.
31724	  (trace): Do not suspend new child; remove all handling
31725	  of now impossible TCB_SUSPENDED condition.
31726
317272011-08-17  Denys Vlasenko  <dvlasenk@redhat.com>
31728
31729	Do not detach when we think tracee is going to die.
31730	Current code plays some ungodly tricks, trying to not detach
31731	thread group leader until all threads exit.
31732
31733	Also, it detaches from a tracee when signal delivery is detected
31734	which will cause tracee to exit.
31735	This operation is racy (not to mention the determination
31736	whether signal is set to SIG_DFL is a horrible hack):
31737	after we determined that this signal is indeed fatal
31738	but before we detach and let process die,
31739	*other thread* may set a handler to this signal, and
31740	we will leak the process, falsely displaying it as killed!
31741
31742	I need to look in the past to figure out why we even do it.
31743	First guess is that it's a workaround for old kernel bugs:
31744	kernel used to deliver exit notifications to the tracer,
31745	not to real parent. These workarounds are ancient
31746	(internal_exit is from 1995).
31747
31748	The patch deletes the hacks. We no longer need tcp->nclone_threads,
31749	TCB_EXITING and TCB_GROUP_EXITING. We also lose a few rather
31750	ugly functions.
31751
31752	I also added a new message: "+++ exited with EXITCODE +++"
31753	which shows exact moment strace got exit notification.
31754	It is analogous to existing "+++ killed by SIG +++" message.
31755
31756	* defs.h: Delete struct tcb::nclone_threads field,
31757	  TCB_EXITING and TCB_GROUP_EXITING constants,
31758	  declarations of sigishandled() and internal_exit().
31759	* process.c (internal_exit): Delete this function.
31760	  (handle_new_child): Don't ++tcp->nclone_threads.
31761	* signal.c (parse_sigset_t): Delete this function.
31762	  (sigishandled): Delete this function.
31763	* strace.c (startup_attach): Don't tcbtab[tcbi]->nclone_threads++.
31764	  (droptcb): Don't delay dropping if tcp->nclone_threads > 0,
31765	  don't drop parent if its nclone_threads reached 0:
31766	  just drop (only) this tcb unconditionally.
31767	  (detach): don't drop parent.
31768	  (handle_group_exit): Delete this function.
31769	  (handle_ptrace_event): Instead of handle_group_exit, just drop tcb;
31770	  do not panic if we see WIFEXITED from an attached pid;
31771	  print "+++ exited with EXITCODE +++" for every WIFEXITED pid.
31772	* syscall.c (internal_syscall):	Do not treat sys_exit specially -
31773	  don't call internal_exit on it.
31774
317752011-08-16  Sergei Trofimovich  <slyfox@gentoo.org>
31776
31777	Declare printrusage32() on Alpha.
31778	* defs.h [ALPHA] (printrusage32): New declaration.
31779
317802011-08-15  Denys Vlasenko  <dvlasenk@redhat.com>
31781
31782	Slight optimization and cleanup in trace()
31783	* strace.c (trace): Do not recalculate "cflag ? &ru : NULL"
31784	again and again. Do not clear errno unnecessarily.
31785	Consistently check wait errors as pid < 0, not pid == -1.
31786	Indent ifdefs for better readability.
31787	Remove comments after endif if ifdef/endif block is really tiny.
31788
31789	Fix compilation on 2.4.20 kernel based system.
31790	* block.c (block_ioctl): add ifdef/endif around BLKGETSIZE64 usage
31791	* strace.c (trace): add ifdef/endif around WIFCONTINUED usage
31792
317932011-07-19  Dmitry V. Levin  <ldv@altlinux.org>
31794
31795	Check for additional PTRACE_* constants.
31796	* configure.ac (AC_CHECK_DECLS): Add PTRACE_O_TRACESYSGOOD,
31797	PTRACE_O_TRACEEXEC, PTRACE_O_TRACEEXIT, PTRACE_EVENT_EXEC,
31798	PTRACE_EVENT_VFORK_DONE and PTRACE_EVENT_EXIT.
31799	* defs.h [LINUX]: Define these PTRACE_* constants when they are not
31800	provided by <sys/ptrace.h>.
31801
31802	Reported-by: Douglas Mencken <dougmencken@gmail.com>
31803	Reported-by: Steve Bennett <steveb@workware.net.au>
31804
318052011-07-19  Denys Vlasenko  <dvlasenk@redhat.com>
31806
31807	Remove superfluous backslash-continuation in configure.ac.
31808	* configure.ac: remove superfluous backslash continuation
31809	in AC_CHECK_DECLS
31810
318112011-06-24  Denys Vlasenko  <dvlasenk@redhat.com>
31812
31813	Make IOCTL_WSTOP more readable.
31814	* defs.h: Make IOCTL_WSTOP more readable
31815
31816	Trivial cleanups.
31817	* strace.c (trace): Change ifdef LINUX to make a bit more sense,
31818	  remove wrong comment at its endif. Slightly optimize
31819	  "+++ killed by SIG +++" message for systems without WCOREDUMP macro.
31820
31821	Remove redundant include <stdarg.h>
31822	* strace.c: Remove redundant include <stdarg.h>
31823
31824	Clean up two old comments.
31825	* strace.c (startup_attach): Remove misplaced comment.
31826	  (trace) Remove incomplete part of a comment.
31827
31828	Make a few variables static.
31829	* defs.h: Remove tcbtab declaration.
31830	* strace.c: Make run_uid, run_gid, outf, tcbtab, progname
31831	  global variables static
31832
31833	Add debug output in initial attachment code.
31834	* strace.c (startup_attach): If -d, report pid and success/failure
31835	  of every attach attempt.
31836
31837	Better debug logging of allocations and waitpit results.
31838	* strace.c (alloc_tcb): Print number of allocated tcb's if -d.
31839	  (droptcb): Likewise.
31840	  (handle_ptrace_event): Remove PTRACE_EVENT_EXEC debug message.
31841	  (trace): Improve logging of waitpid: show WIFxxx, exitcode/signal,
31842	  ptrace event name, WCOREDUMP - all on one line.
31843
318442011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31845
31846	Optimize arrays of register indexes in syscall_enter.
31847	* syscall.c (syscall_enter) [BFIN]: Make register no array "static const".
31848	  [SH]: Make register no array "const", pre-multiply it by 4.
31849	  [SH64]: Make register no array "const".
31850	  [X86_64]: Make register no array "const", pre-multiply it by 8.
31851
318522011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31853
31854	Deindent syscall_enter by removing unnecessary braces. No code changes.
31855	syscall_enter has many long (>80 columns) lines.
31856	It is aggravated by the fact that it has a lot of {} blocks
31857	which are not necessary (the code is the same without them).
31858	This patch removes {}s and deindents affected lines.
31859	While at it, it indents ifdefs so that nesting is easier to track,
31860	and adds a few spaces in the expressions, such as
31861	"tcp->u_nargs*sizeof..." -> "tcp->u_nargs * sizeof...".
31862	There is no actual changes to the code here.
31863
31864	* syscall.c (syscall_enter): Remove unnecessary {} blocks.
31865
318662011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31867
31868	Remove dead "ifndef CLONE_PTRACE" branch.
31869	process.c defines CLONE_PTRACE for Linux, so it can't be undefined.
31870	Therefore ifndef CLONE_PTRACE code is dead (since at least 2004).
31871	This patch removes it.
31872
31873	* process.c (handle_new_child): Remove ifdef CLONE_PTRACE/endif (but not
31874	  the code inside) and entire ifndef CLONE_PTRACE/endif block.
31875
318762011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31877
31878	Add a comment about setbpt. No code changes.
31879	* defs.h: Add a comment about setbpt().
31880
31881	Untangle a particularly badly obfuscated bit of code. No logic changes.
31882	* util.c (setbpt): Calculate new arg0 in more readable way.
31883
318842011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31885
31886	Remove TCB_FOLLOWFORK.
31887	TCB_FOLLOWFORK flag seems to be unnecessary, because we either follow
31888	all [v]forks/clones or don't follow any, therefore global variable
31889	followfork is an already existing indicator of what we want to do.
31890	This patch drops all setting/clearing of TCB_FOLLOWFORK bit,
31891	and replaces checks for this bit by checks of followfork value.
31892	In internal_fork, check is moved to in front of if(), since
31893	the check is needed on both "entering" and "exiting" branch.
31894
31895	* defs.h: Remove TCB_FOLLOWFORK define.
31896	* process.c (internal_fork): Do not set/clear TCB_FOLLOWFORK,
31897	  test followfork instead of tcp->flags & TCB_FOLLOWFORK.
31898	  (handle_new_child): Likewise.
31899	* strace.c (startup_attach): Likewise.
31900
319012011-06-23  Dmitry V. Levin  <ldv@altlinux.org>
31902
31903	* system.c (sys_capget, sys_capset): Fix pointer arithmetics.
31904
319052011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31906
31907	Make initial tcb allocation more readable. No logic changes.
31908	* strace.c (main): Make initial tcb allocation more readable.
31909
319102011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31911
31912	Do not allocate tiny cap_user_header/data structures, place them on stack.
31913	This allows us to avoid having code to malloc them, and code to check
31914	for malloc failure. Resulting code decrease:
31915	   text	   data	    bss	    dec	    hex	filename
31916	  10175	      0	     16	  10191	   27cf	system.o.old
31917	   9797	      0	      0	   9797	   2645	system.o
31918
31919	* system.c (sys_capget): Put cap_user_header_t and cap_user_data_t
31920	  on stack, rather than allocating them in heap. These structures
31921	  are very small (a few integer fields), stack is a better place
31922	  for them.
31923	  (sys_capset): Likewise.
31924
319252011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>
31926
31927	Use [p]error_msg[_and_die] where appropriate. No logic changes.
31928	Resulting size changes:
31929	   text    data     bss     dec     hex filename
31930	  17445      16    8572   26033    65b1 strace.o.old
31931	  16850      16    8572   25438    635e strace.o
31932
31933	* strace.c: Replace fprintf[+cleanup]+exit with [p]error_msg_and_die,
31934	  fprintf("progname: ...") with [p]error_msg where appropriate.
31935
319362011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>
31937
31938	Whitespace cleanups. No code changes.
31939	* count.c: Place opening curly brace after if (),
31940	  not on the next line. Almost all strace code alredy
31941	  uses this style.
31942	* desc.c: Likewise.
31943	* file.c: Likewise.
31944	* net.c: Likewise.
31945	* pathtrace.c: Likewise.
31946	* process.c: Likewise.
31947	* quota.c: Likewise.
31948	* signal.c: Likewise.
31949	* strace.c: Likewise.
31950	* syscall.c: Likewise.
31951	* time.c: Likewise.
31952
319532011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>
31954
31955	Make strace_fopen abort on error.
31956	Error from strace_fopen in main results in call to exit(1).
31957	Error from strace_fopen in newoutf is propagated to newoutf
31958	callers: startup_attach (where it results in exit(1))
31959	and alloc_tcb (where error is ignored). In second case,
31960	the behavior doesn't seem to be right: it means with -ff
31961	on open error for new LOGFILE.PID the output will continue
31962	to go into *the same file as the previous process* - which
31963	would be confusing. Moreover, on droptcb outf may be closed
31964	and the output of other, still running process outputting
31965	to the same outf will be lost. I don't think this is sane.
31966	IOW: in all cases, error in strace_fopen should be fatal.
31967
31968	* strace.c (strace_fopen): Abort on error instead of returning NULL.
31969	  (newoutf): Change return type to void.
31970	  (startup_attach): Remove error check on newoutf return value.
31971	  (main): Remove error check on strace_fopen return value.
31972
319732011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>
31974
31975	Make set_cloexec_flag abort on error.
31976	set_cloexec_flag() may fail only if we pass it a bad fd,
31977	such as -1 or non-opened one. If we do, we have a bug
31978	in the caller. It makes no sense to try to continue
31979	running when we detect such a blatant bug in our own code.
31980
31981	* strace (set_cloexec_flag): Abort instead of returning error
31982	  indicator. Change function to return void.
31983	  (strace_fopen): Remove error check on set_cloexec_flag return value.
31984	  (proc_open): Likewise.
31985	  (proc_poll_open): Likewise.
31986
319872011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>
31988
31989	Make strace_popen abort on error.
31990	It makes no sense to postpone abort on strace_popen error
31991	unti it returns. Moreover, out-of-memory error was exiting
31992	without any message.
31993	While at it, use 0 as "none" for popen_pid, as optimization.
31994
31995	* strace: Initialize popen_pid to 0 - this puts it in bss.
31996	  (trace): Reset popen_pid to 0 instead of -1.
31997	  (strace_popen): Never return NULL as error indicator,
31998	  abort with good error message instead.
31999	  (main): Remove NULL check of strace_popen result.
32000
320012011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>
32002
32003	Delete fork_tcb()
32004	Get rid of fork_tcb() function. It used to do what the comment
32005	above it says, but now it doesn't do much:
32006	it only sets tcp->flags |= TCB_FOLLOWFORK and maybe calls
32007	expand_tcbtab(). The second operation is not necessary, since
32008	alloc_tcp() will do it itself when needed.
32009	This patch deletes fork_tcb(), open-coding tcp->flags |= TCB_FOLLOWFORK
32010	where it was formerly called. It also makes nprocs, tcbtabsize and
32011	expand_tcbtab() static. (While at it, I nuked redundant
32012	extern char **environ declaration: strace.c had *two* of them...)
32013
32014	* defs.h: Remove declarations of nprocs, tcbtabsize and
32015	  expand_tcbtab.
32016	* process.c (fork_tcb): Remove this function.
32017	  (internal_fork): Open-code fork_tcb.
32018	  (handle_new_child): Likewise.
32019	* strace.c: Remove redundant "extern char **environ". Declare
32020	  nprocs and tcbtabsize static.
32021	  (expand_tcbtab): Make it static.
32022
320232011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>
32024
32025	Simplify expand_tcbtab and alloc_tcb.
32026	Get rid of a few intermediate variables, simplifies a few expressions,
32027	and uses error_msg_and_die instead of more verbose
32028	fprintf+cleanup+exit sequence.
32029	In alloc_tcp, I use memset to clear entire new tcp.
32030	This not only saves a few bytes of code, but lowers the chances
32031	of future bugs where some data "leaks out" into new tcb's
32032	from old ones because we forgot to re-initialize it.
32033
32034	* strace.c (expand_tcbtab): Simplify this function. No logic changes.
32035	  (alloc_tcb): Likewise.
32036
320372011-06-21  Denys Vlasenko  <dvlasenk@redhat.com>
32038
32039	Trivial fixes.
32040	* process.c (internal_fork): Remove conditionals which make no difference
32041	  (we return 0 on both branches of these ifs).
32042	* util.c: Fix indentation of an ifdef.
32043
320442011-06-21  Dmitry V. Levin  <ldv@altlinux.org>
32045
32046	Fix build when libaio-devel is not available.
32047	* desc.c: Do not compile code that uses struct iocb unless
32048	HAVE_LIBAIO_H is set.
32049
32050	Reported-by: Denys Vlasenko <dvlasenk@redhat.com>
32051
320522011-06-21  Dmitry V. Levin  <ldv@altlinux.org>
32053
32054	tests: finish ptrace_setoptions_* merge.
32055	* tests/Makefile.am (TESTS): Merge ptrace_setoptions_*.
32056	* tests/ptrace_setoptions: Check for Linux kernel > 2.6.
32057
320582011-06-21  Denys Vlasenko  <dvlasenk@redhat.com>
32059
32060	Remove write-only nchildren member from struct tcb.
32061	* defs.h: Remove nchildren member from struct tcb.
32062	* process.c (handle_new_child): Remove inc/decrements of tcp->nchildren.
32063	  (internal_fork): Likewise.
32064	* strace.c (startup_attach): Likewise.
32065	  (droptcb): Likewise.
32066	  (alloc_tcb): Remove initialization of tcp->nchildren.
32067
32068	Fix tests/ptrace_setoptions_* to match last fix in ptrace options code.
32069
32070	Remove write-only nzombies member from struct tcb.
32071	* defs.h: Remove nzombies member from struct tcb.
32072	* strace.c (droptcb): Remove "tcp->parent->nzombies++".
32073	  (alloc_tcb): Remove "tcp->nzombies = 0".
32074
320752011-06-21  Denys Vlasenko  <dvlasenk@redhat.com>
32076
32077	Fix regression introduced by "Properly handle real SIGTRAPs" change.
32078	Commit 3454e4b463e6c22c7ea8c5461ef5a077f4650a54
32079	introduced a bug: sometimes, TRACECLONE/TRACE[V]FORK opts were not set.
32080	The check (tcp->parent == NULL) in old code was meant to check
32081	"if we are not a child created by auto-attach" - in this case,
32082	options need to be set on the child; otherwise they are inherited
32083	and do not need to be set.
32084	I misunderstood the check and if tcp->parent is not NULL, I was
32085	setting only ptrace_setoptions_for_all bits.
32086	This change fixes the problem. Since the fixed logic makes it
32087	unnecessary to keep two sets of options in separate variables,
32088	I merge them back into one variable, ptrace_setoptions.
32089
32090	* defs.h: Merge ptrace_setoptions_followfork and ptrace_setoptions_for_all
32091	  into one variable, ptrace_setoptions.
32092	* strace.c: Likewise.
32093	  (test_ptrace_setoptions_followfork): Use ptrace_setoptions variable.
32094	  (test_ptrace_setoptions_for_all): Likewise.
32095	  (main): Likewise.
32096	* process.c (internal_fork): Likewise.
32097	  (internal_exec): Likewise.
32098	* strace.c (trace): Fix the bug where different options were set
32099	  depending on "tcp->parent == NULL" condition. Add a comment
32100	  which makes it more clear why this condition is checked.
32101
321022011-06-18  Denys Vlasenko  <dvlasenk@redhat.com>
32103
32104	Do not suspend waitpid.
32105	strace used to suspend waitpid until there is a child
32106	for waitpid'ing process to collect status from.
32107	Apparently, it was done because in some very old kernels
32108	(circa 2002 or even earlier) there were ptrace bugs which
32109	were making waitpid in real parent to not see children.
32110	This kernel bug is fixed long ago. This change removes the workaround.
32111	test/wait_must_be_interruptible.c is a test program which
32112	illustrates why without this change strace changes
32113	programs's behavior.
32114
32115	* defs.h: Delete waitpid and nclone_waiting members from from struct tcb.
32116	  Remove declaration of internal_wait().
32117	* process.c (internal_wait): Remove this function.
32118	* strace.c (alloc_tcb): Do not set tcp->nclone_waiting.
32119	  (resume): Remove this function.
32120	  (resume_from_tcp): Remove this function.
32121	  (detach): Do not call resume_from_tcp().
32122	  (handle_group_exit): Do not call resume_from_tcp().
32123	* syscall.c (internal_syscall): Do not call internal_wait().
32124
321252011-06-13  Andi Kleen  <ak@linux.intel.com>
32126
32127	Enhance io_submit() decoding.
32128	strace didn't decode important fields in the iocb passed to io_submit.
32129	This patch changes the code to dump them all.  Also it prefixes the fields
32130	with names to make it easier to read.
32131
32132	* desc.c (iocb_cmd_lookup, print_common_flags): New functions.
32133	(sys_io_submit): New iocb decoder.
32134
321352011-06-13  Dmitry V. Levin  <ldv@altlinux.org>
32136
32137	Add argument to tprint_iov() specifying whether to decode each iovec.
32138	* defs.h (tprint_iov): Add decode_iov argument.
32139	* io.c (tprint_iov): Implement new decode_iov argument.
32140	(sys_readv, sys_writev, sys_sendfile, sys_preadv, sys_pwritev): Update
32141	tprint_iov calls.
32142	* net.c (do_msghdr): Likewise.
32143
32144	Introduce ARRAY_SIZE() macro.
32145	* defs.h (ARRAY_SIZE): New macro.
32146	* ioctl.c: Use it.
32147	* pathtrace.c (pathmatch, storepath): Likewise.
32148	* process.c (printpriv): Likewise.
32149	* signal.c: Likewise.
32150	* syscall.c: Likewise.
32151
321522011-06-13  Andi Kleen  <ak@linux.intel.com>
32153
32154	Fix decoding of timer id returned by timer_create.
32155	* time.c (sys_timer_create): The kernel returns a integer, not a
32156	pointer for the timer id in the memory pointed to by timer_id.
32157
321582011-06-09  Dmitry V. Levin  <ldv@altlinux.org>
32159
32160	Add test for PTRACE_O_TRACESYSGOOD.
32161	* tests/ptrace_setoptions_for_all: New file.
32162	* tests/Makefile.am (TESTS): Add ptrace_setoptions_for_all.
32163
32164	tests: update test for linux kernel version.
32165	* tests/ptrace_setoptions_followfork: Check for Linux kernel > 2.6.
32166
321672011-06-09  Dmitry V. Levin  <ldv@altlinux.org>
32168
32169	Update ptrace_setoptions test.
32170	The test have to be adjusted after commit v4.6-5-g3454e4b.
32171
32172	* ptrace_setoptions: Update grep pattern, rename to
32173	ptrace_setoptions_followfork.
32174	* tests/Makefile.am (TESTS): Rename ptrace_setoptions to
32175	ptrace_setoptions_followfork.
32176
321772011-06-09  Dmitry V. Levin  <ldv@altlinux.org>
32178
32179	* strace.c (verror_msg): Rewrite without use of heap memory allocation.
32180
321812011-06-09  Dmitry V. Levin  <ldv@altlinux.org>
32182
32183	Fix MIPS syscall entries.
32184	* linux/mips/syscallent.h: Remove duplicate entries for 4336, 4337,
32185	and 4338 syscall numbers.
32186
32187	Reported-by: Denys Vlasenko <dvlasenk@redhat.com>
32188
321892011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>
32190
32191	Don't display bogus parameter for sigreturn syscall.
32192	* linux/*/syscallent.h: For those arches which use sys_sigreturn,
32193	not printargs, to show [rt_]sigreturn syscall, change number of arguments
32194	from 1 to 0: sys_sigreturn function doesn't use syscall parameters.
32195	(I guess kernel doesn't actually _have_ any parameters for this syscall,
32196	at least on these architectures). Do the same change for I386 and x86-64
32197	even though they use printargs: I looked at kernel code and syscall
32198	definitely doesn't have any parameters on these arches.
32199	(I hesitate to change 1 to 0 params for arches I don't know -
32200	it is remotely possible some of them do have a parameter for this syscall).
32201
32202	Optimize sigreturn handling.
32203	* signal.c (sys_sigreturn): move stack pointer variables,
32204	and for SPARC and MIPS, stack pointer and sigmask reading code
32205	into "if (entering) ..." block, because it is only needed
32206	in this branch; load tcp->u_arg[1] into sigmask for display
32207	_after_ we know for sure u_arg[1] does contain valid sigmask
32208	(IOW: perform operation only when we know we will need the result)
32209
32210	Do not call umoven to fetch parameters if we have zero params.
32211	* syscall.c [I386] (syscall_enter): Do not call umoven
32212	to fetch zero bytes. This is just an optimization.
32213
32214	"Modernize" four old-style function parameter declarations.
32215	* signal.c (signame, long_to_sigset, printsigmask, printsignal):
32216	Convert old-style C function definitions to a "modern" form.
32217	This does not change any actual code.
32218
322192011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>
32220
32221	Fix sigreturn decoding on MIPS.
32222	The "return 0" line was accidentally deleted circa 2007,
32223	which made sigreturn on MIPS always display "= 0" return
32224	instead of more informative " = ? (mask now [MASK])".
32225
32226	* strace.c (sys_sigreturn): Add wrongly deleted "return 0" line
32227
322282011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>
32229
32230	Print at least one space between SYSCALL(ARGS) and = RESULT if tracee is killed
32231	We already do it in the normal case, but in rare code path where
32232	tracee is gone (SIGKILLed?) sometimes we were printing this:
32233	"SYSCALL(ARGS <unavailable>)= ? <unavailable>" - note jammed together ")=".
32234	test/sigkill_rain.c can be used to verify the fix.
32235
32236	* strace.c (printleader): add a space after ")" in " <unavailable>)"
32237
322382011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>
32239
32240	Add fflush after printf in test/sigkill_rain.c.
32241
32242	Update test/* directory, it seem to be a bit bit-rotted.
32243	Added README; modified sigkill_rain.c to be more understandable,
32244	made clone.c compile; added wait_must_be_interruptible.c test;
32245	updated Makefile and .gitignore.
32246
322472011-06-07  Denys Vlasenko  <dvlasenk@redhat.com>
32248
32249	Whitespace cleanups. no code changes.
32250	* bjm.c: Fix tabulation (such as extra spaces before tabs),
32251	convert punctuation where it deviates from prevalent form
32252	elsewhere in strace code, convert sizeof and offsetof where
32253	it deviates from from prevalent form, remove space between
32254	function/macro/array names and (parameters) or [index],
32255	add space between "if" and (condition), correct non-standard
32256	or wrong indentaion.
32257	* defs.h: Likewise
32258	* desc.c: Likewise
32259	* file.c: Likewise
32260	* ipc.c: Likewise
32261	* linux/arm/syscallent.h: Likewise
32262	* linux/avr32/syscallent.h: Likewise
32263	* linux/hppa/syscallent.h: Likewise
32264	* linux/i386/syscallent.h: Likewise
32265	* linux/ioctlsort.c: Likewise
32266	* linux/m68k/syscallent.h: Likewise
32267	* linux/microblaze/syscallent.h: Likewise
32268	* linux/powerpc/syscallent.h: Likewise
32269	* linux/s390/syscallent.h: Likewise
32270	* linux/s390x/syscallent.h: Likewise
32271	* linux/sh/syscallent.h: Likewise
32272	* linux/sh64/syscallent.h: Likewise
32273	* linux/tile/syscallent.h: Likewise
32274	* linux/x86_64/syscallent.h: Likewise
32275	* mem.c: Likewise
32276	* net.c: Likewise
32277	* pathtrace.c: Likewise
32278	* process.c: Likewise
32279	* signal.c: Likewise
32280	* sock.c: Likewise
32281	* strace.c: Likewise
32282	* stream.c: Likewise
32283	* sunos4/syscall.h: Likewise
32284	* sunos4/syscallent.h: Likewise
32285	* svr4/syscall.h: Likewise
32286	* svr4/syscallent.h: Likewise
32287	* syscall.c: Likewise
32288	* system.c: Likewise
32289	* test/childthread.c: Likewise
32290	* test/leaderkill.c: Likewise
32291	* test/skodic.c: Likewise
32292	* time.c: Likewise
32293	* util.c: Likewise
32294
322952011-05-30  Dmitry V. Levin  <ldv@altlinux.org>
32296
32297	ARM EABI: fix 64-bit syscall's arguments decoding.
32298	ARM OABI and ARM EABI have different function parameters passing rules.
32299	With EABI, 64-bit function parameters passed in registers are aligned to
32300	an even-numbered register instead of using the next available pair, see
32301	http://lkml.org/lkml/2006/1/12/175
32302	This rule also applies to syscall's arguments.
32303
32304	* linux/arm/syscallent.h (pread, pwrite, truncate64, ftruncate64,
32305	readahead, preadv, pwritev): Fix number of arguments.
32306	* util.c (printllval): Align 64bit argument to 64bit boundary on
32307	__ARM_EABI__.
32308
32309	Reported-by: Damir Shayhutdinov <damir@altlinux.org>
32310
323112011-05-30  Damir Shayhutdinov  <damir@altlinux.ru>
32312
32313	Linux: implement decoding of preadv and pwritev syscalls.
32314	* io.c [LINUX && HAVE_SYS_UIO_H] (sys_preadv, sys_pwritev): New functions.
32315	* linux/syscall.h (sys_preadv, sys_pwritev): Declare them.
32316	* linux/*/syscallent.h: Use them.
32317
323182011-05-30  Denys Vlasenko  <dvlasenk@redhat.com>
32319
32320	"Modernize" all old-style function parameter declarations.
32321	* bjm.c: Convert all remaining old-style C function definitions
32322	to a "modern" form. This does not change any actual code.
32323	* io.c: Likewise
32324	* ioctl.c: Likewise
32325	* net.c: Likewise
32326	* proc.c: Likewise
32327	* process.c: Likewise
32328	* signal.c: Likewise
32329	* sock.c: Likewise
32330	* strace.c: Likewise
32331	* stream.c: Likewise
32332	* syscall.c: Likewise
32333	* system.c: Likewise
32334	* time.c: Likewise
32335	* util.c: Likewise
32336
323372011-05-27  Denys Vlasenko  <dvlasenk@redhat.com>
32338
32339	Cleanups on top of "handle SIGTRAP properly" change, based on Dmitry's comments.
32340	* defs.h ([p]error_msg[_and_die]): Declare new functions.
32341	* strace.c (SYSCALLTRAP): Rename to syscall_trap_sig.
32342	([p]error_msg[_and_die]): Define new functions.
32343	(strace_tracer_pid): New variable, it controls which pid will
32344	do cleanup on exit via [p]error_msg_and_die.
32345	(main): Set strace_tracer_pid to our initial pid.
32346	(startup_attach): Change strace_tracer_pid if we are in -D mode.
32347	(test_ptrace_setoptions_for_all): Minor changes to logic,
32348	such as better diagnostic messages.
32349
323502011-05-25  Denys Vlasenko  <dvlasenk@redhat.com>
32351
32352	Identifier "errno" may be a macro, it's unsafe to use it.
32353	* strace.c (strerror): Rename parameter errno to err_no
32354
323552011-05-24  Denys Vlasenko  <dvlasenk@redhat.com>
32356
32357	Don't perform TCB_WAITEXECVE wait if not needed.
32358	* defs.h (ptrace_setoptions_for_all): Expose this variable.
32359	* strace.c (ptrace_setoptions_for_all): Remove "static".
32360	* process.c (internal_exec): Don't set TCB_WAITEXECVE bit
32361	if we know that post-execve SIGTRAP is not going to happen.
32362
323632011-05-23  Denys Vlasenko  <dvlasenk@redhat.com>
32364
32365	Properly handle real SIGTRAPs.
32366	* defs.h (ptrace_setoptions): Variable renamed to ptrace_setoptions_followfork.
32367	* process.c (internal_fork): Ditto.
32368	* strace.c (ptrace_setoptions_for_all): New variable.
32369	(SYSCALLTRAP): New variable.
32370	(error_msg_and_die): New function.
32371	(test_ptrace_setoptions_for_all): New function.
32372	(main): Call test_ptrace_setoptions_for_all() at init.
32373	(handle_ptrace_event): Handle PTRACE_EVENT_EXEC (by ignoring it).
32374	(trace): Check events and set ptrace options without -f too.
32375	Check WSTOPSIG(status) not for SIGTRAP, but for SYSCALLTRAP.
32376
323772011-04-24  Mike Frysinger  <vapier@gentoo.org>
32378
32379	Blackfin: update syscall list.
32380
32381	* linux/bfin/syscallent.h: Add name_to_handle_at, open_by_handle_at,
32382	clock_adjtime, and syncfs syscalls.
32383
323842011-04-24  Mike Frysinger  <vapier@gentoo.org>
32385
32386	linux: add new EHWPOISON errno.
32387
32388	* linux/errnoent.h: Change ERRNO_133 to EHWPOISON.
32389
323902011-04-08  Grant Edwards  <grant.b.edwards@gmail.com>
32391
32392	Add ability to print file descriptor paths and filter by those paths.
32393	* pathtrace.c: New file, implements matching syscall arguments to
32394	user-specified file paths.
32395	* Makefile.am (strace_SOURCES): Add pathtrace.c.
32396	* defs.h (TCB_FILTERED, filtered): New defines.
32397	(getfdpath, pathtrace_select, pathtrace_match, show_fd_path,
32398	tracing_paths): New declarations.
32399	* strace.c (show_fd_path, tracing_paths): New global variables.
32400	(usage, main): Implement handling of -y and -P options.
32401	* strace.1: Add descriptions of -y and -P options.
32402	* syscall.c (trace_syscall_entering): Add path matching logic to the
32403	print/noprint decision and set the TCB_FILTERED bit appropriately.
32404	(trace_syscall_exiting): Use filtered() macro that checks the
32405	TCB_FILTERED bit to determine print/noprint status.
32406	* util.c (printfd): Use getfdpath().
32407
324082011-04-07  Dmitry V. Levin  <ldv@altlinux.org>
32409
32410	Fix BLKTRACESTOP definition.
32411	* block.c: Fix typo in the check for BLKTRACESTOP.
32412	Reported by Gabor Z. Papp.
32413
324142011-03-15  Dmitry V. Levin  <ldv@altlinux.org>
32415
32416	Ensure that PTRACE_GETSIGINFO et al are always defined on Linux.
32417	* configure.ac (AC_CHECK_DECLS): Add PTRACE_* constants.
32418	* defs.h [LINUX]: Define those PTRACE_* constants that are not provided
32419	by <sys/ptrace.h>.
32420
32421	* CREDITS.in: Fix typo.
32422
324232011-03-14  Dmitry V. Levin  <ldv@altlinux.org>
32424
32425	Update PTRACE_* constants.
32426	* process.c (ptrace_cmds): Add PTRACE_GETREGSET and PTRACE_SETREGSET.
32427
32428	Prepare for 4.6 release.
32429	* NEWS: Update for 4.6 release.
32430	* configure.ac: Version 4.6.
32431	* debian/changelog: 4.6-1.
32432	* strace.spec: 4.6-1.
32433
324342011-03-14  Mike Frysinger  <vapier@gentoo.org>
32435
32436	linux/ioctlent: unify them all.
32437	This unifies all the ioctlent.h's in the linux subdir while still
32438	allowing each arch to maintain its own minor list.
32439
32440	The basic method is:
32441	- each arch has linux/<arch>/ioctlent.h.in which defines only the
32442	arch-specific ioctls;
32443	- linux/ioctlent.h.in which defines only the common ioctls;
32444	- at build time, these two headers are combined and sorted to produce
32445	the linux/ioctlent.h file.
32446
32447	This also requires a little tweaking of the include files since the
32448	common ioctlent.h is a built file.
32449
32450	* linux/ioctlent.h: Split into linux/ioctlent.h.in and
32451	linux/i386/ioctlent.h.in, remove asm entries from the former, remove
32452	non-asm entries from the latter.
32453	* linux/alpha/ioctlent.h: Rename to linux/alpha/ioctlent.h.in, remove
32454	non-asm entries.
32455	* linux/bfin/ioctlent.h: Rename to linux/bfin/ioctlent.h.in, remove
32456	non-asm entries.
32457	* linux/hppa/ioctlent.h: Rename to linux/hppa/ioctlent.h.in, remove
32458	non-asm entries.
32459	* linux/ia64/ioctlent.h: Rename to linux/ia64/ioctlent.h.in, remove
32460	non-asm entries.
32461	* linux/mips/ioctlent.h: Rename to linux/mips/ioctlent.h.in, remove
32462	non-asm entries.
32463	* linux/powerpc/ioctlent.h: Rename to linux/powerpc/ioctlent.h.in,
32464	remove non-asm entries.
32465	* linux/s390/ioctlent.h: Rename to linux/s390/ioctlent.h.in, remove
32466	non-asm entries.
32467	* linux/sh/ioctlent.h: Rename to linux/sh/ioctlent.h.in, remove
32468	non-asm entries.
32469	* linux/sparc/ioctlent.h: Rename to linux/sparc/ioctlent.h.in, remove
32470	non-asm entries.
32471	* linux/arm/ioctlent.h.in: New file.
32472	* linux/avr32/ioctlent.h.in: Likewise.
32473	* linux/i386/ioctlent.h.in: Likewise.
32474	* linux/m68k/ioctlent.h.in: Likewise.
32475	* linux/microblaze/ioctlent.h.in: Likewise.
32476	* linux/tile/ioctlent.h.in: Likewise.
32477	* linux/x86_64/ioctlent.h.in: Likewise.
32478	* linux/s390x/ioctlent.h.in: Include ioctlent.h.in instead of
32479	ioctlent.h.
32480	* linux/sh64/ioctlent.h.in: Likewise.
32481	* linux/sparc64/ioctlent.h.in: Likewise.
32482	* linux/arm/ioctlent1.h: Update ioctlent.h include.
32483	* linux/powerpc/ioctlent1.h: Likewise.
32484	* linux/sparc/ioctlent1.h: Likewise.
32485	* linux/sparc64/ioctlent1.h: Likewise.
32486	* linux/x86_64/ioctlent1.h: Likewise.
32487	* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS).
32488	(EXTRA_DIST): Update.
32489	[MAINTAINER_MODE && LINUX]: Convert from ioctlent_h to ioctlent_h_in.
32490	[LINUX]: Add $(builddir)/$(OS)/ioctlent.h generation rules.
32491	* .gitignore: Add linux/ioctlent.h.
32492
324932011-03-10  Dmitry V. Levin  <ldv@altlinux.org>
32494
32495	Show more details about signals received by traced processess.
32496	* strace.c [!USE_PROCFS] (trace): Differentiate output format depending
32497	on PTRACE_GETSIGINFO success or failure.  In the former case, use
32498	printsiginfo() to show more details about received signal.
32499
32500	Get rid of PT_GETSIGINFO.
32501	* strace.c [!USE_PROCFS] (trace): Assume that PTRACE_GETSIGINFO is
32502	available.  Replace PT_GETSIGINFO with PTRACE_GETSIGINFO.  Use
32503	PTRACE_GETSIGINFO for all signals.
32504
32505	Enhance decoding of kernel-generated signals.
32506	* signal.c (printsiginfo) [LINUX]: Do not print uninteresting
32507	zero-initialized fields.
32508
32509	Fix decoding of user-generated signals.
32510	* signal.c [LINUX] (SI_FROMUSER): Define.
32511	[LINUX || SVR4] (printsiginfo) [SI_FROMUSER]: Enhance decoding.
32512
32513	Recognize SI_KERNEL and SI_ASYNCNL.
32514	* signal.c [LINUX] (SI_KERNEL, SI_ASYNCNL): Define.
32515	[LINUX || SVR4] (siginfo_codes): Add entries for SI_KERNEL and
32516	SI_ASYNCNL, reorder entries.
32517
325182011-03-05  Sebastian Pipping  <sebastian@pipping.org>
32519
32520	Take all git branches into account for generation of CREDITS file.
32521	* Makefile.am: Make CREDITS target depend on all git branches.
32522
325232011-03-04  Dmitry V. Levin  <ldv@altlinux.org>
32524
32525	Fix decoding of file descriptors.
32526	* defs.h (printfd): New function prototype.
32527	* util.c (printfd): New function.
32528	* file.c (print_dirfd): Update prototype to use printfd().
32529	(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
32530	sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
32531	sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
32532	(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
32533	sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
32534	sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
32535	sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
32536	sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
32537	sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
32538	sys_fallocate): Use printfd() for decoding of file descriptors.
32539	* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
32540	decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
32541	decoding of file descriptors.
32542	* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
32543	sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
32544	sys_ioctl): Likewise.
32545	* mem.c (print_mmap, sys_mmap64): Likewise.
32546	* signal.c (do_signalfd): Likewise.
32547	* stream.c (decode_poll): Likewise.
32548	* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
32549	Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.
32550
325512011-03-03  Sebastian Pipping  <sebastian@pipping.org>
32552
32553	Print shutdown(2) modes as SHUT_* constants.
32554	* net.c (shutdown_modes): New xlat structure.
32555	(sys_shutdown): Use shutdown_modes to decode 2nd syscall argument.
32556
32557	Fix decoding of inotify_init1() flags.
32558	* file.c (inotify_init_flags): New xlat structure.
32559	(sys_inotify_init1): Use it instead of open_mode_flags.
32560
325612011-03-03  Dmitry V. Levin  <ldv@altlinux.org>
32562
32563	Fix struct xlat initialization bugs.
32564	* file.c (inotify_modes): Terminate with NULL entry.
32565	* net.c (sock_type_flags): Make this array static.
32566	(socketlayers): Add a comment that this array should remain not
32567	NULL-terminated.
32568
32569	tests: avoid SIGPIPE.
32570	* tests/ptrace_setoptions: Replace "grep -q" with "grep > /dev/null".
32571	The former may result to strace being killed by SIGPIPE, which in
32572	certain configuratons may lead to generation of a core file.
32573	Suggested by Mike Frysinger.
32574
325752011-03-01  Mike Frysinger  <vapier@gentoo.org>
32576
32577	tests: do not make missing /usr/bin/time a failure.
32578	* tests/init.sh (framework_skip_): New function.
32579	(check_prog): Use it instead of framework_failure_.
32580
325812011-02-27  Dmitry V. Levin  <ldv@altlinux.org>
32582
32583	Generate an xz tar archive of the distribution.
32584	* configure.ac (AM_INIT_AUTOMAKE): Replace dist-bzip2 with dist-xz.
32585	* Makefile.am: Update srpm target.
32586	* make-dist: Update for dist-xz.
32587	* strace.spec: Update Source tag.
32588	* debian/watch: Update regexp.
32589	* .gitignore: Add strace-*.tar.xz.
32590
32591	Use "make check" in debian/rules and strace.spec.
32592	* debian/control: Update Build-Depends.
32593	* debian/rules: Run "make check".
32594	* strace.spec: Update BuildRequires. Run "make check" in %check section.
32595
32596	Implement two basic "strace -f" tests.
32597	* Makefile.am (SUBDIRS): Add tests.
32598	* configure.ac (AC_CONFIG_FILES): Add tests/Makefile.
32599	* tests/.gitignore: New file.
32600	* tests/Makefile.am: Likewise.
32601	* tests/init.sh: Likewise.
32602	* tests/ptrace_setoptions: Likewise.
32603	* tests/strace-f: Likewise.
32604
326052011-02-26  Dmitry V. Levin  <ldv@altlinux.org>
32606
32607	ppc, s390, sparc: regenerate ioctlent.h files.
32608	* linux/powerpc/ioctlent.h: Regenerated using Fedora 15 kernel headers.
32609	* linux/s390/ioctlent.h: Likewise.
32610	* linux/sparc/ioctlent.h: Likewise.
32611
32612	Remove redundant ioctlent.h files.
32613	* linux/s390x/ioctlent.h: Replace old contents with include of
32614	s390/ioctlent.h file.
32615	* linux/sparc64/ioctlent.h: Replace old contents with include of
32616	sparc/ioctlent.h file.
32617
326182011-02-25  Dmitry V. Levin  <ldv@altlinux.org>
32619
32620	ioctlsort: sync with ioctl_lookup()
32621	* linux/ioctlsort.c (main): Use NR and TYPE bits only, to sync with
32622	ioctl_lookup() which looks at these bits only.
32623
32624	Remove obsolete .cvsignore files.
32625	* test/.cvsignore: Rename to test/.gitignore.
32626	* */.cvsignore, */*/.cvsignore: Removed.
32627
32628	Ignore generated intermediate header files.
32629	* .gitignore: Add ioctls.h and ioctldefs.h.
32630
326312011-02-24  Dmitry V. Levin  <ldv@altlinux.org>
32632
32633	Generate much of the CREDITS file from git log.
32634	* CREDITS.in: New file, derived from CREDITS, without names of
32635	those who are listed as git log 'Author:'s.
32636	* CREDITS: Remove file.
32637	* Makefile.am [MAINTAINER_MODE] (CREDITS): New rule.
32638	* .gitignore: Add CREDITS.
32639	* .mailmap: New file, required to map git author names and email
32640	addresses to canonical/preferred form.
32641
326422011-02-23  Dmitry V. Levin  <ldv@altlinux.org>
32643
32644	sparc: fix compilation warning.
32645	* file.c [!HAVE_LONG_LONG_OFF_T] (realprintstat): Cast st_size
32646	to unsigned long.
32647
32648	Update the list of files that must be distributed.
32649	* Makefile.am (EXTRA_DIST): Add debian/source/format, debian/watch,
32650	linux/ia64/signalent.h, linux/powerpc/ioctlent1.h,
32651	linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h,
32652	linux/powerpc/signalent1.h.
32653
32654	Fix compilation warning reported by gcc -Wunused-but-set-variable.
32655	* process.c (printwaitn) [!SUNOS4]: Do not define "exited" variable.
32656
326572011-02-22  Mike Frysinger  <vapier@gentoo.org>
32658
32659	ioctlsort: zero pad ioctl codes to 4 places.
32660	Zero padding the ioctl number will allow simple sorting via shell scripts.
32661
32662	* linux/ioctlsort.c (main): Output ioctl codes zero padded.
32663	* linux/ioctlent.h: Regenerated.
32664
326652011-02-22  Mike Frysinger  <vapier@gentoo.org>
32666
32667	Update mount flags to latest linux.
32668	* system.c (MS_RELATIME, MS_KERNMOUNT, MS_I_VERSION,
32669	MS_STRICTATIME, MS_BORN): Define.
32670	(mount_flags): Add MS_RELATIME, MS_KERNMOUNT, MS_I_VERSION,
32671	MS_STRICTATIME, MS_BORN.
32672
326732011-02-22  Dmitry V. Levin  <ldv@altlinux.org>
32674
32675	Sync debian/changelog and strace.spec with packages.
32676	* debian/changelog: Sync with 4.5.20-2.
32677	* strace.spec: Likewise.
32678
326792011-02-20  Dmitry V. Levin  <ldv@altlinux.org>
32680
32681	Add TRACE_DESC|TRACE_FILE flags to fanotify_* sysentries.
32682	* linux/*/syscallent.h: Add TD flag to fanotify_init.  Add TD|TF flags
32683	to fanotify_mark.
32684
32685	Fix flags of fallocate sysentries.
32686	* linux/*/syscallent.h: Fix sys_fallocate flags.
32687
32688	Add TRACE_DESC flag to epoll_create* sysentries.
32689	* linux/*/syscallent.h: Add TD flag to sys_epoll_create and
32690	sys_epoll_create1.
32691
32692	Add TRACE_DESC flag to fgetxattr, flistxattr, and fremovexattr sysentries
32693	* linux/*/syscallent.h: Add TD flag to sys_fgetxattr, sys_flistxattr,
32694	and fremovexattr.
32695
32696	Add TRACE_FILE flag to swapoff sysentries.
32697	* linux/*/syscallent.h: Add TF flag to sys_swapoff.
32698
32699	Add TRACE_DESC flag to fadvise64* sysentries.
32700	* linux/*/syscallent.h: Add TD flag to sys_fadvise64 and
32701	sys_fadvise64_64.
32702
32703	Add TRACE_DESC flag to mmap, mmap2, and old_mmap sysentries.
32704	* linux/*/syscallent.h: Add TD flag to sys_mmap and sys_old_mmap.
32705
32706	Do not initialize native_scno on platforms with only one personality.
32707	* linux/bfin/syscallent.h: Remove redundant native_scno initialization.
32708	* linux/m68k/syscallent.h: Likewise.
32709	* linux/microblaze/syscallent.h: Likewise.
32710
32711	Add LOOP_* ioctls defined in linux/loop.h.
32712	* linux/ioctlent.sh: Add LOOP_* ioctls (0x4C..) defined in linux/loop.h
32713	header file.
32714	* linux/ioctlent.h: Regenerated.
32715	Reported by Mike Frysinger.
32716
327172011-02-19  Dmitry V. Levin  <ldv@altlinux.org>
32718
32719	Fix PTRACE_GETEVENTMSG usage and enhance test_ptrace_setoptions()
32720	* strace.c (handle_ptrace_event): Fix PTRACE_GETEVENTMSG usage.
32721	(test_ptrace_setoptions): Test that PTRACE_GETEVENTMSG works properly.
32722
327232011-02-19  Mike Frysinger  <vapier@gentoo.org>
32724
32725	linux/sparc: move to common syscall.h.
32726	Rather than constantly deal with the sparc/syscall.h going stale, merge
32727	the few sparc-specific pieces into the linux/syscall.h header.
32728
32729	* linux/syscall.h: Add sparc-specific pieces from sparc/syscall.h.
32730	* Makefile.am (EXTRA_DIST): Remove linux/sparc/syscall.h and
32731	linux/sparc64/syscall.h.
32732	* linux/sparc/syscall.h, linux/sparc64/syscall.h: Deleted.
32733
327342011-02-19  Mike Frysinger  <vapier@gentoo.org>
32735
32736	sparc: add new funcs to syscall.h.
32737	Sync missing defs from the common syscall.h here.
32738
32739	* linux/sparc/syscall.h: Add sys_setfsuid, sys_pread64, and
32740	sys_pwrite64 prototypes.
32741
327422011-02-19  Mike Frysinger  <vapier@gentoo.org>
32743
32744	sparc: punt unused syscall.h.2.
32745	I can't find any mention of this header actually being used.
32746	Seems to be a really old copy of the common syscall.h.
32747
32748	* Makefile.am (EXTRA_DIST): Remove linux/sparc/syscall.h.2.
32749	* linux/sparc/syscall.h.2: Deleted.
32750
327512011-02-19  Dmitry V. Levin  <ldv@altlinux.org>
32752
32753	Fix raw exit_group(2) decoding.
32754	* syscall.c (trace_syscall_entering): Check for sys_exit instead of
32755	SYS_exit to handle exit_group(2) as well as _exit(2).
32756
327572011-02-18  Dmitry V. Levin  <ldv@altlinux.org>
32758
32759	Optimize known_scno()
32760	* syscall.c (known_scno): Do not check for native_scno field on
32761	platforms that support only one personality.
32762
32763	* process.c (internal_exit) [IA64]: Remove redundant check.
32764
327652011-02-09  Dmitry V. Levin  <ldv@altlinux.org>
32766
32767	Fix biarch support in IO dumping.
32768	* syscall.c (dumpio): Switch on tcp->sys_func instead of tcp->scno
32769	for more reliable results.
32770
32771	Simplify tprintf() declaration.
32772	* defs.h (tprintf): Simplify declaration.
32773
327742011-02-05  Dmitry V. Levin  <ldv@altlinux.org>
32775
32776	* defs.h (SYSCALL_NEVER_FAILS): Fix typo.
32777
327782011-01-19  Dmitry V. Levin  <ldv@altlinux.org>
32779
32780	Fix decoding of get[ug]id, gete[ug]id and setfs[ug]id return values.
32781	* defs.h (SYSCALL_NEVER_FAILS): New syscall flag.
32782	* linux/dummy.h: Change redirection for sys_get[ug]id, sys_gete[ug]id
32783	and setfs[ug]id.
32784	* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag for get[ug]id,
32785	gete[ug]id and setfs[ug]id syscalls.
32786	* process.c [LINUX] (sys_getuid, sys_setfsuid): New functions.
32787	* syscall.c (NF): New shorthand macro for use in syscallent.h files.
32788	(get_error): Check SYSCALL_NEVER_FAILS flag.
32789	Reported by Марк Коренберг <socketpair@gmail.com>.
32790
32791	* linux/*/syscallent.h: Fix typo in sys_newfstatat syscall flags.
32792
327932011-01-18  Mike Frysinger  <vapier@gentoo.org>
32794
32795	Blackfin: update ioctl list.
32796	* linux/bfin/ioctlent.h: Sync with latest kernel sources.
32797
327982011-01-17  Dmitry V. Levin  <ldv@altlinux.org>
32799
32800	Fix stat64 decoding on mips.
32801	* linux/mips/syscallent.h: Use sys_stat64() to decode stat64 syscall.
32802	This fixes Debian bug #599028.
32803
32804	Update linux/*/syscallent.h files to match Linux kernel v2.6.37.
32805	* linux/alpha/syscallent.h: Add hooks for fanotify_init, fanotify_mark,
32806	and prlimit64.
32807	* linux/i386/syscallent.h: Likewise.
32808	* linux/ia64/syscallent.h: Likewise.
32809	* linux/m68k/syscallent.h: Likewise.
32810	* linux/microblaze/syscallent.h: Likewise.
32811	* linux/mips/syscallent.h: Likewise.
32812	* linux/powerpc/syscallent.h: Likewise.
32813	* linux/s390/syscallent.h: Likewise.
32814	* linux/s390x/syscallent.h: Likewise.
32815	* linux/sh/syscallent.h: Likewise.
32816	* linux/sh64/syscallent.h: Likewise.
32817	* linux/sparc/syscallent.h: Likewise.
32818	* linux/x86_64/syscallent.h: Likewise.
32819	* linux/arm/syscallent.h: Add hooks for accept4, fanotify_init,
32820	fanotify_mark, and prlimit64.
32821	* linux/hppa/syscallent.h: Add hook for prlimit64.
32822
328232011-01-16  Dmitry V. Levin  <ldv@altlinux.org>
32824
32825	block.c: cleanup.
32826	* block.c: Include <inttypes.h>.
32827	(print_blkpg_req): Always decode struct blkpg_ioctl_arg.
32828	Robustify decoding of strings.
32829	(block_ioctl): Do not decode return values passed by pointers on exit
32830	from failed syscalls.
32831	Use format macros from inttypes.h to print values of type uint64_t.
32832
328332011-01-15  Dmitry V. Levin  <ldv@altlinux.org>
32834
32835	Add block ioctl support.
32836	* block.c: New file.
32837	* Makefile.am (strace_SOURCES): Add it.
32838	* defs.h [LINUX] (block_ioctl): New function.
32839	* ioctl.c (ioctl_decode) [LINUX]: Use it to decode HDIO_* and BLK*
32840	ioctls.
32841	Patch by Jeff Mahoney <jeffm@suse.com>
32842
328432011-01-14  Holger Hans Peter Freyther  <zecke@selfish.org>
32844
32845	Parse SOL_SCTP socket options.
32846	* configure.ac (AC_CHECK_HEADERS): Add netinet/sctp.h.
32847	* net.c [HAVE_NETINET_SCTP_H]: Include <netinet/sctp.h>.
32848	[SOL_SCTP] (socksctpoptions): New xlat structure.
32849	(sys_getsockopt, printsockopt): Parse SOL_SCTP options.
32850
32851	* net.c (socketlayers): Add more SOL_* constants from linux/socket.h.
32852
328532011-01-14  Dmitry V. Levin  <ldv@altlinux.org>
32854
32855	strace.1: fix misleading italics.
32856	* strace.1: Use bold instead of italics for "-e trace=" keywords.
32857	This fixes Debian bug #589323.
32858
32859	Update linux/ioctlent.h.
32860	* linux/ioctlent.h: Regenerate using linux v2.6.37 headers.
32861
32862	Add HDIO_* ioctls defined in linux/hdreg.h.
32863	* linux/ioctlent.sh: Add HDIO_* ioctls (0x03..) defined in
32864	linux/hdreg.h header file.
32865	This fixes Debian bug #450953.
32866
328672011-01-13  Dmitry V. Levin  <ldv@altlinux.org>
32868
32869	Test PTRACE_O_TRACECLONE and PTRACE_O_TRACEVFORK along with PTRACE_O_TRACEFORK
32870	* strace.c (test_ptrace_setoptions): Add PTRACE_O_TRACECLONE and
32871	PTRACE_O_TRACEVFORK to PTRACE_SETOPTIONS call, to test exactly
32872	the same set of options that is going to be used later in trace().
32873
328742011-01-10  Dmitry V. Levin  <ldv@altlinux.org>
32875
32876	* net.c (protocols): Add more IPPROTO_* constants defined in netinet/in.h
32877
328782011-01-10  Holger Hans Peter Freyther  <holger@freyther.de>
32879
32880	* net.c (protocols): Add IPPROTO_GRE, IPPROTO_SCTP and IPPROTO_UDPLITE.
32881
328822011-01-10  Carmelo AMOROSO  <carmelo.amoroso@st.com>
32883
32884	sh: Add entry for not-multiplexed accept4.
32885	* linux/sh/syscallent.h: Add specific entry for not-multiplexed accept4
32886	available in kernel mainline since v2.6.37-rc6, see
32887	http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21b6e4c7106b2d68a6710506d8706608272fd78b
32888
328892010-12-14  Carmelo AMOROSO  <carmelo.amoroso@st.com>
32890
32891	sh: Add entries for not-multiplexed socket calls.
32892	* linux/sh/syscallent.h: Add specific entries for not-multiplexed
32893	socket calls (available in kernel mainline since v2.6.37-rc1)
32894
32895	sh: Fix compilation warning in do_pipe due to missing prototype.
32896	* defs.h [SH]: Make getrval2 prototype visible to do_pipe
32897	and fix the following compiler warning:
32898	.../net.c: In function 'do_pipe':
32899	.../net.c:1632: warning: implicit declaration of function 'getrval2'
32900	.../net.c:1632: warning: format '%lu' expects type 'long unsigned int',
32901	but argument 3 has type 'int'
32902
329032010-12-14  Dmitry V. Levin  <ldv@altlinux.org>
32904
32905	Fix build on uClibc.
32906	* defs.h [LINUX]: Define PTRACE_GETEVENTMSG macro.
32907	Patch by Douglas Mencken <dougmencken@gmail.com>.
32908
329092010-12-07  Dmitry V. Levin  <ldv@altlinux.org>
32910
32911	Fix strace -f -o '|command' hangup.
32912	* strace.c (main): Call test_ptrace_setoptions() before parsing
32913	-o option, otherwise a forked command will cause a hangup inside
32914	test_ptrace_setoptions().
32915
329162010-12-03  Dmitry V. Levin  <ldv@altlinux.org>
32917
32918	Output diagnostics to stderr.
32919	* syscall.c (get_scno): Output information about changes in
32920	personality mode to stderr.  Reported by Pádraig Brady.
32921
32922	Recognize more clone flags.
32923	* process.c (CLONE_*): Define more flags from linux v2.6.25.
32924	(clone_flags): Add entries for them.
32925	Proposed by <zhangyanfei@cn.fujitsu.com>.
32926
32927	Decode struct ucred for getsockopt SO_PEERCRED.
32928	* net.c (sys_getsockopt): Decode SO_PEERCRED.
32929	Proposed by Arkadiusz Miśkiewicz <arekm@maven.pl>.
32930
329312010-12-03  Carmelo AMOROSO  <carmelo.amoroso@st.com>
32932
32933	sh: Add support for tracing sys_cacheflush system call.
32934	* linux/sh/syscallent.h: Update sys_cacheflush entry.
32935	* linux/syscall.h [SH] (sys_cacheflush): New function declaration.
32936	* system.c [SH] (cacheflush_flags): New xlat structure.
32937	[SH] (sys_cacheflush): New function.
32938
32939	Reviewed-by: Angelo Castello <angelo.castello@st.com>
32940
329412010-11-30  Dmitry V. Levin  <ldv@altlinux.org>
32942
32943	Cleanup test_ptrace_setoptions()
32944	* strace.c (test_ptrace_setoptions): Cleanup.
32945	(main): Fix test_ptrace_setoptions() error diagnostics message.
32946	Print ptrace_setoptions value in debug mode.
32947
329482010-11-30  Wang Chao  <wang.chao@cn.fujitsu.com>
32949
32950	Handle followfork using ptrace_setoptions if available.
32951	If PTRACE_O_TRACECLONE et al options are supported by kernel,
32952	use them to do followfork rather than the original setbpt
32953	method that changes registers ourselves.
32954
32955	* defs.h [LINUX] (handle_new_child): New function prototype.
32956	* process.c [LINUX] (handle_new_child): New function based on the
32957	code from internal_fork(), with a trivial change: do reparent only
32958	for sys_clone.
32959	[LINUX] (internal_fork): Use handle_new_child().  Do nothing if
32960	ptrace_setoptions is in effect.
32961	* strace.c [LINUX] (handle_ptrace_event): New function.
32962	[LINUX] (trace): If ptrace_setoptions is in effect, then
32963	call the new function to handle PTRACE_EVENT_* status, and
32964	set PTRACE_SETOPTIONS when we see the initial stop of tracee.
32965
329662010-11-30  Wang Chao  <wang.chao@cn.fujitsu.com>
32967
32968	Test how PTRACE_SETOPTIONS support works.
32969	Currently test fork related options only.  Fork a child that uses
32970	PTRACE_TRACEME at startup and then does a fork so strace can test
32971	how the PTRACE_SETOPTIONS support works before it handles any real
32972	tracee.  Since PTRACE_O_TRACECLONE/*FORK were introduced to kernel
32973	at the same time, this test seems to be enough for these 3 options.
32974
32975	* defs.h [LINUX]: Define PTRACE_O_TRACECLONE et al macros here.
32976	(ptrace_setoptions): New variable declaration.
32977	* strace.c [LINUX] (test_ptrace_setoptions): New function, tests
32978	whether kernel supports PTRACE_O_CLONE/*FORK, the result is stored
32979	in the new variable ptrace_setoptions for later use.
32980	(main): Call test_ptrace_setoptions() if followfork option is set.
32981
329822010-09-17  Dmitry V. Levin  <ldv@altlinux.org>
32983
32984	Enable support for less verbose build rules.
32985	* configure.ac (AM_INIT_AUTOMAKE): Add silent-rules.
32986
329872010-09-17  Wang Chao  <wang.chao@cn.fujitsu.com>
32988
32989	Do not trace children cloned with CLONE_UNTRACED flag.
32990	If clone is called with flag CLONE_UNTRACED, to be consistent with
32991	option PTRACE_O_TRACECLONE, we should not set CLONE_PTRACE flag on
32992	its arguments.
32993
32994	* process.c [LINUX] (internal_fork): Check the syscall and arguments.
32995
329962010-09-17  Dmitry V. Levin  <ldv@altlinux.org>
32997
32998	Update the list of CLOCK_* constants to match Linux kernel v2.6.32+
32999	* time.c (struct xlat clocknames[]): Add more RT clock IDs.
33000	Reported by Tommi Rantala.
33001
330022010-09-16  Dmitry V. Levin  <ldv@altlinux.org>
33003
33004	Update linux/hppa/syscallent.h to match Linux kernel v2.6.35.
33005	* linux/hppa/syscallent.h: Add hooks for recvmmsg and accept4.
33006
330072010-09-15  Dmitry V. Levin  <ldv@altlinux.org>
33008
33009	Pass less information to qualify_one and qual_*
33010	* syscall.c (qualify_one, qual_syscall, qual_signal, qual_fault,
33011	qual_desc): Take just a bitflag argument instead of pointer to the whole
33012	qual_options structure.
33013	(struct qual_options): Update prototype of "qualify" field.
33014	(qualify): Update use of qualify_one and qual_options->qualify.
33015
330162010-09-15  Wang Chao  <wang.chao@cn.fujitsu.com>
33017
33018	Fix -e option with only one value in qualifier statement.
33019	Fix regression introduced by commit v4.5.20-19-g30145dd:
33020	if -e option is used with only one value in qualifier statement,
33021	e.g. 'strace -e trace=open ls', syscall information would not be
33022	printed properly.
33023
33024	* syscall.c (qualify): Remove faulty optimization.
33025
330262010-09-15  Mike Frysinger  <vapier@gentoo.org>
33027
33028	Fix off_t/rlim_t size checks when cross-compiling.
33029	The current off_t/rlim_t size checks (wrt size of long long) use AC_RUN
33030	which obviously doesn't work when cross-compiling.  While we don't hit
33031	any configure errors, the fall back code is pretty dumb (which is to say
33032	there isn't any).  Considering the code in question though, we can use
33033	some fun compiler tricks with sizeof and array lengths to turn it into
33034	a pure build test and avoid the RUN issue completely.
33035
33036	* m4/long_long.m4 (AC_OFF_T_IS_LONG_LONG, AC_RLIM_T_IS_LONG_LONG):
33037	Convert from AC_RUN_IFELSE to AC_COMPILE_IFELSE.
33038
330392010-09-15  Mike Frysinger  <vapier@gentoo.org>
33040
33041	Fix long long little endian detection when cross-compiling.
33042	The long long endian detection code does an AC_TRY_RUN() and since that
33043	doesn't work when cross-compiling, it sets a fallback value.  However,
33044	rather than do any sort of default endian detection, the code simply
33045	sets it to "no".  This probably breaks most little endian systems out
33046	there when cross-compiling for them.  It certainly breaks Blackfin
33047	systems.  So use the common endian detection code provided by autoconf
33048	and key off of that when cross-compiling.
33049
33050	* configure.ac: Call AC_C_BIGENDIAN.
33051	* m4/long_long.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Set cross-compiling
33052	logic based on ac_cv_c_bigendian.
33053
330542010-09-15  Mike Frysinger  <vapier@gentoo.org>
33055
33056	Blackfin: decode new syscalls.
33057	* linux/bfin/syscallent.h: Add fanotify/prlimit/cacheflush syscalls.
33058	* linux/syscall.h: Add sys_cacheflush() decl.
33059	* system.c: Decode Blackfin's cacheflush syscall.
33060
33061	* linux/ioctlent.sh: Search a few non-exported paths.
33062
330632010-09-15  Roland McGrath  <roland@redhat.com>
33064
33065	Clean up pid2tcb usage.
33066	* strace.c (pid2tcb): Always match pid.  Fail for argument <= 0.
33067	[USE_PROCFS] (first_used_tcb): New function.
33068	[USE_PROCFS] (trace): Use that instead of pid2tcb(0).
33069
330702010-09-09  Dmitry V. Levin  <ldv@altlinux.org>
33071
33072	Turn on more compiler warnings.
33073	* configure.ac: Enable gcc -Wwrite-strings.
33074
33075	Import warnings.m4 from gnulib.
33076	* m4/warnings.m4: Replace with warnings.m4 from gnulib.
33077	* configure.ac: Use gl_WARN_ADD from new warnings.m4.
33078	* Makefile.am (AM_CFLAGS): Update for new warnings.m4.
33079
33080	Split acinclude.m4.
33081	* Makefile.am (ACLOCAL_AMFLAGS): Add "-I m4".
33082	* acinclude.m4: Remove.
33083	* m4/includedir.m4: New file, with definition of AC_INCLUDEDIR from
33084	acinclude.m4.
33085	* m4/long_long.m4: New file, with definitions of AC_OFF_T_IS_LONG_LONG,
33086	AC_RLIM_T_IS_LONG_LONG and AC_LITTLE_ENDIAN_LONG_LONG from acinclude.m4.
33087	* m4/procfs.m4: New file, with definitions of AC_MP_PROCFS,
33088	AC_POLLABLE_PROCFS and AC_STRUCT_PR_SYSCALL from acinclude.m4.
33089	* m4/stat.m4: New file, with definition of AC_STAT64 from acinclude.m4.
33090	* m4/statfs.m4: New file, with definition of AC_STATFS64 from
33091	acinclude.m4.
33092	* m4/warnings.m4: New file, with definition of AC_WARNFLAGS from
33093	acinclude.m4.
33094
33095	* process.c (sys_waitid): Remove unused variable.
33096
330972010-09-07  Dmitry V. Levin  <ldv@altlinux.org>
33098
33099	Fix const-correctness issues uncovered by gcc -Wwrite-strings.
33100	* defs.h (struct xlat): Add const qualifier to the field of
33101	type "char *".
33102	(set_sortby, qualify, printnum, printnum_int): Add const qualifier to
33103	arguments of type "char *".
33104	* count.c (set_sortby): Add const qualifier to the argument and
33105	automatic variable of type "char *".
33106	* desc.c (decode_select): Add const qualifier to automatic variables of
33107	type "char *".
33108	* ioctlsort.c (struct ioctlent): Add const qualifier to fields of
33109	type "char *".
33110	(main):  Add const qualifier to argv.
33111	* process.c (printargv): Add const qualifier to the argument and
33112	automatic variable of type "char *".
33113	(printargc) Add const qualifier to argument of type "char *".
33114	* signal.c (sprintsigmask, parse_sigset_t): Add const qualifier to
33115	arguments of type "char *".
33116	* strace.c (progname): Add const qualifier.
33117	(detach): Add const qualifier to automatic variable of type "char *".
33118	* stream.c (struct strbuf): Add const qualifier to the field of
33119	type "char *".
33120	* syscall.c (struct qual_options): Add const qualifier to fields of
33121	type "char *".
33122	(qual_syscall, qual_fault, qual_desc, lookup_class): Add const qualifier
33123	to arguments of type "char *".
33124	(qual_signal): Add const qualifier to the argument of type "char *",
33125	avoid modification of constant argument.
33126	(qualify): Likewise.
33127	* util.c (printflags): Add const qualifier to automatic variable of
33128	type "char *".
33129	(printnum, printnum_int): Add const qualifier to arguments of
33130	type "char *".
33131
331322010-09-04  Wang Chao  <wang.chao@cn.fujitsu.com>
33133
33134	Fix printing clone flags.
33135	When we trace clone() syscall with only exit signal as clone
33136	flags, strace would print an unnecessary OR operator.
33137
33138	* process.c (sys_clone): Fix this.
33139
331402010-08-28  Wang Chao  <wang.chao@cn.fujitsu.com>
33141
33142	Drop nclone_detached and related flags.
33143	Remove nclone_detached since CLONE_DETACHED flag was no-op for a very
33144	long time in kernel.
33145
33146	* defs.h (struct tcb): Remove nclone_detached field.
33147	Remove TCB_CLONE_DETACHED flag.
33148	* process.c: Remove CLONE_DETACHED flag.
33149	(clone_flags): Remove CLONE_DETACHED entry.
33150	(internal_fork, internal_wait): Remove code dealing with CLONE_DETACHED
33151	flag and nclone_detached.
33152	* strace.c (startup_attach, alloc_tcb, droptcb, handle_group_exit):
33153	Likewise.
33154
331552010-08-09  Neil Campbell  <lists@thebatcave.org.uk>
33156
33157	Correct get/set_robust_list syscall numbers for powerpc.
33158	* linux/powerpc/syscallent.h: Swap positions of get_ and set_robust_list.
33159
331602010-08-09  Wang Chao  <wang.chao@cn.fujitsu.com>
33161
33162	Handle CLONE_PARENT flag.
33163	* process.c (internal_fork): The parent of new cloned process is the
33164	same of the calling process when CLONE_PARENT is set.
33165
33166	Fix error when judging if process has children.
33167	* process.c (internal_wait): Processes counted in tcp->nclone_threads
33168	are tcp's threads, rather than tcp's children.
33169
331702010-08-09  Wang Chao  <wang.chao@cn.fujitsu.com>
33171
33172	Forbid using mutually exclusive options -D and -p together.
33173	If we use -D and -p option together to trace a multi-thread program, in
33174	addition to the main thread, other threads could not be traced even if we
33175	present -f option. Moreover, when executing 'strace -D -p <non-exist pid>',
33176	strace could not terminate normally.
33177
33178	* strace.c (main): Check it.
33179
331802010-08-05  David Daney  <ddaney@caviumnetworks.com>
33181
33182	Update Linux MIPS syscalls to match 2.6.35-rc6+
33183	* linux/mips/syscallent.h: Add and update 405 hooks.
33184
331852010-08-05  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
33186
33187	Add support for the MicroBlaze architecture.
33188	* configure.ac: Recognize MicroBlaze.
33189	* linux/microblaze/syscallent.h: New file.
33190	* Makefile.am (EXTRA_DIST): Add linux/microblaze/syscallent.h
33191	* process.c (change_syscall, struct_user_offsets): Add MicroBlaze
33192	support.
33193	* signal.c (sys_sigreturn): Likewise.
33194	* syscall.c (internal_syscall, get_scno, syscall_fixup, get_error,
33195	syscall_enter): Likewise.
33196
331972010-08-05  Frederik Schüler  <fs@debian.org>
33198
33199	linux/sparc: add missing syscall declarations.
33200	* linux/sparc/syscall.h: Sync with linux/syscall.h
33201
332022010-07-17  Andreas Schwab  <schwab@linux-m68k.org>
33203
33204	Handle biarch get/setrlimit.
33205	* resource.c (print_rlimit32) [POWERPC64 || X86_64]: Define.
33206	(sys_getrlimit, sys_setrlimit) [POWERPC64 || X86_64]: Use it.
33207
332082010-07-13  Andreas Schwab  <schwab@linux-m68k.org>
33209
33210	Add biarch support for powerpc64.
33211	* acinclude.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Use int instead of
33212	long.
33213	* configure.ac [$host_cpu = powerpc*]: Also define POWERPC64 if
33214	$host_cpu = powerpc64.
33215	* defs.h (SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE)
33216	(PERSONALITY1_WORDSIZE) [POWERPC64]: Define.
33217	* file.c: (struct stat_powerpc32, printstat_powerpc32) [POWERPC64]:
33218	Define.
33219	(printstat) [LINUX && POWERPC64]: Use printstat_powerpc32 in
33220	32-bit personality.
33221	(sys_newfstatat) [POWERPC64]: Handle personalities.
33222	* signal.c (sys_sigreturn) [POWERPC64]: Likewise.
33223	* util.c (printllval) [POWERPC64]: Likewise.
33224	(printcall) [POWERPC64]: Use wider format for IP prefix.
33225	* syscall.c (get_scno) [POWERPC64]: Check for 64/32 bit mode.
33226	* linux/powerpc/errnoent1.h: New file.
33227	* linux/powerpc/ioctlent1.h: New file.
33228	* linux/powerpc/signalent1.h: New file.
33229	* linux/powerpc/syscallent1.h: New file.
33230
332312010-07-09  Andreas Schwab  <schwab@redhat.com>
33232
33233	Balance braces.
33234	* strace.c (proc_open): Avoid unbalanced braces.
33235	(trace): Likewise.
33236
332372010-07-06  Andreas Schwab  <schwab@linux-m68k.org>
33238
33239	Remove extern declaration at file scope.
33240	* defs.h (force_result): Declare.
33241	* process.c (internal_wait): Don't declare force_result.
33242
332432010-06-24  Andreas Schwab  <schwab@redhat.com>
33244
33245	Document -C/-D.
33246	* strace.c (usage): Document -C.
33247	* strace.1: Document -D.
33248
332492010-06-13  Roland McGrath  <roland@redhat.com>
33250
33251	Fix sourceforge download URL.
33252
332532010-06-05  Andreas Schwab  <schwab@linux-m68k.org>
33254
33255	M68K: Fix fetching syscall arguments.
33256	* syscall.c (syscall_enter) [M68K]: Properly handle more than five
33257	syscall arguments.
33258
332592010-05-28  Andreas Schwab  <schwab@linux-m68k.org>
33260
33261	Decode TLS syscalls on m68k.
33262	* linux/m68k/syscallent.h: Add entries for get_thread_area,
33263	set_thread_area, atomic_comxchg_32, atomic_barrier.
33264	* linux/dummy.h (sys_get_thread_area, sys_set_thread_area) [M68K]:
33265	Don't redefine.
33266	* mem.c (sys_get_thread_area, sys_set_thread_area) [LINUX && M68K]: New.
33267
33268	Fix warning when compiling for m68k.
33269	* syscall.c (d0): Define as long.
33270
332712010-04-13  Dmitry V. Levin  <ldv@altlinux.org>
33272
33273	Prepare for 4.5.20 release.
33274	* NEWS: Update for 4.5.20 release.
33275	* configure.ac: Version 4.5.20.
33276	* debian/changelog: 4.5.20-1.
33277	* strace.spec: 4.5.20-1.
33278
332792010-04-13  Frederik Schüler  <fs@debian.org>
33280
33281	Update debian/* files for the upcoming release.
33282	* debian/control: update standards-version to 3.8.4.
33283	* debian/rules: allow parallel building.
33284	* debian/rules: comment out verbose build, only needed for debugging.
33285	* debian/rules: clean up clean: target, dh_clean does most of the work
33286	  already.
33287	* debian/rules: use *-stamp instead of stamp-*, so dh_clean can tidy
33288	  up for us.
33289
332902010-04-13  Heiko Carstens  <heiko.carstens@de.ibm.com>
33291
33292	Fix s390 system call table list.
33293	* linux/s390/syscallent.h: Add the missing entries for preadv and
33294	pwritev to the system call table list.
33295	* linux/s390x/syscallent.h: Likewise.
33296
332972010-04-07  Dmitry V. Levin  <ldv@altlinux.org>
33298
33299	Update linux/ioctlent.h.
33300	* linux/ioctlent.sh: Search in asm-generic directory as well.
33301	* linux/ioctlent.h: Regenerated.
33302
33303	Update linux/*/syscallent.h files to match Linux kernel v2.6.33.
33304	* linux/alpha/syscallent.h: Add 47 hooks.
33305	* linux/arm/syscallent.h: Update hooks for pselect6, ppoll,
33306	epoll_pwait.  Add 11 hooks.
33307	* linux/bfin/syscallent.h: Update hooks for prctl, fallocate,
33308	signalfd4, eventfd2, epoll_create1, dup3, pipe2, perf_event_open.
33309	Hook up recvmmsg.
33310	* linux/hppa/syscallent.h: Update hooks for signalfd4, eventfd2,
33311	epoll_create1, dup3, pipe2, perf_event_open.
33312	* linux/i386/syscallent.h: Fix syscall name for the kexec_load hook.
33313	Add 5 hooks.
33314	* linux/ia64/syscallent.h: Fix syscall name for the kexec_load hook.
33315	Add 4 hooks.
33316	* linux/m68k/syscallent.h: Add 50 hooks.
33317	* linux/powerpc/syscallent.h: Fix hook for timerfd_create.  Fix
33318	6 syscall names to match the kernel.  Use sys_semop to parse semop.
33319	Add 14 hooks.
33320	* linux/s390/syscallent.h: Fix syscall name for the kexec_load hook.
33321	Add 14 hooks.
33322	* linux/s390x/syscallent.h: Likewise.
33323	* linux/sh/syscallent.h: Add 13 hooks.
33324	* linux/sh64/syscallent.h: Add 15 hooks.
33325	* linux/sparc/syscallent.h: Add 22 hooks.
33326	* linux/x86_64/syscallent.h: Add 5 hooks.
33327
33328	Enhance recvmmsg parser.
33329	* net.c (sys_recvmmsg): Decode mmsghdr structure on exit from the
33330	syscall.  Decode timespec structure both on entrance and on exit.
33331
333322010-04-07  Andreas Schwab  <schwab@linux-m68k.org>
33333
33334	Decode recvmmsg syscall.
33335	* net.c (do_msghr): New function to print struct msghdr.
33336	(printmsghdr): Use it.
33337	(printmmsghdr, sys_recvmmsg): New.
33338	* linux/syscall.h: Declare sys_recvmmsg.
33339	(SYS_sub_recvmmsg): Define.
33340	(SYS_socket_nsubcalls): Bump.
33341	* linux/sparc/syscall.h: Likewise.
33342	* linux/arm/syscallent.h: Add sys_recvmmsg.
33343	* linux/bfin/syscallent.h: Likewise.
33344	* linux/i386/syscallent.h: Likewise.
33345	* linux/m68k/syscallent.h: Likewise.
33346	* linux/powerpc/syscallent.h: Likewise.
33347	* linux/s390/syscallent.h: Likewise.
33348	* linux/s390x/syscallent.h: Likewise.
33349	* linux/sh/syscallent.h: Likewise.
33350	* linux/sh64/syscallent.h: Likewise.
33351	* linux/sparc/syscallent.h: Likewise.
33352	* linux/ia64/syscallent.h: Adjust.
33353
333542010-04-07  Dmitry V. Levin  <ldv@altlinux.org>
33355
33356	* strace.1: Fix quoting of hyphens and formatting of strace options.
33357
33358	Split trace_syscall() for better readability.
33359	* syscall.c (trace_syscall): Split into trace_syscall_exiting() and
33360	trace_syscall_entering().
33361
33362	Implement -C option to combine regular and -c output.
33363	* defs.h (cflag_t): New enum.
33364	* strace.1: Document -C option.
33365	* strace.c (cflag): Update type.
33366	(main): Handle -C option.
33367	(trace): Update use of cflag.
33368	* count.c (count_syscall): Move clearing of TCB_INSYSCALL to ...
33369	* syscall.c (trace_syscall): ... here.  Update use of cflag.
33370	Based on patch by Adrien Kunysz.
33371
33372	Fix "make dist" regression introduced by commit v4.5.19-12-g5078770.
33373	* Makefile.am (EXTRA_DIST): Rename linux/syscallent.h to linux/i386/syscallent.h
33374
33375	* desc.c (sys_epoll_pwait): Fix output formatting bug.
33376
33377	* desc.c (decode_select): Fix potential stack buffer overflow.
33378
333792010-03-31  Dmitry V. Levin  <ldv@altlinux.org>
33380
33381	Fix msgsnd indirect ipccall decoding.
33382	This regression was introduced by commit v4.5.18-136-g783f5bc.
33383	* ipc.c (tprint_msgsnd): Add and use "flags" argument.
33384	(sys_msgsnd): Pass "flags" argument to tprint_msgsnd().
33385	Patch by Anton Blanchard.
33386
333872010-03-23  Mark Wielaard  <mjw@redhat.com>
33388
33389	Hook up inotify_init1 open mode flags printer.
33390	* file.c [LINUX] (sys_inotify_init1): New function.
33391	* linux/syscall.h: Declare new sys_inotify_init1 handler.
33392	* linux/bfin/syscallent.h: Hook up new handler.
33393	* linux/hppa/syscallent.h: Likewise.
33394	* linux/i386/syscallent.h: Likewise.
33395	* linux/x86_64/syscallent.h: Likewise.
33396
333972010-03-09  Andreas Schwab  <schwab@redhat.com>
33398
33399	Avoid spurious error when checking for linux/netlink.h.
33400	* configure.ac: Include <asm/types.h> when checking for
33401	linux/netlink.h.
33402
334032010-02-23  Andreas Schwab  <schwab@linux-m68k.org>
33404
33405	Fix reporting signal mask by sigreturn on powerpc.
33406	* signal.c (sys_sigreturn) [POWERPC]: Skip dummy stack frame when
33407	locating signal context.
33408
334092010-02-09  David Daney  <ddaney@caviumnetworks.com>
33410
33411	Fix MIPS N32/N64 compile error.
33412	* syscall.c [LINUX_MIPSN32 || LINUX_MIPSN64] (syscall_enter): Pass
33413	tcp->pid to ptrace().
33414
334152010-02-05  Chris Metcalf  <cmetcalf@tilera.com>
33416
33417	Add support for the TILE architecture.
33418	* configure.ac: Add TILE to the list of supported architectures.
33419	* defs.h: Define TCB_WAITEXECVE for TILE.
33420	* linux/tile/syscallent.h: New file.
33421	* Makefile.am (EXTRA_DIST): Add linux/tile/syscallent.h
33422	* process.c (change_syscall, struct_user_offsets): Add TILE support.
33423	* syscall.c (get_scno, get_error, syscall_enter): Likewise.
33424	* mem.c (mmap_flags, print_mmap): Add MAP_CACHE_xxx TILE extensions
33425	support.
33426	* signal.c (sigact_flags): Add SA_NOPTRACE.
33427	(sys_sigreturn): Add TILE support.
33428
334292010-02-04  Dmitry V. Levin  <ldv@altlinux.org>
33430
33431	Remove dead code.
33432	* defs.h (tv_tv): Remove.
33433	* net.c (sys_xsetsockaddr): Remove commented out dead code.
33434	* process.c (setarg, sys_execv, sys_execve, struct_user_offsets):
33435	Likewise.
33436	* signal.c (sys_sigsuspend): Likewise.
33437	* strace.c (reaper, trace): Likewise.
33438	* stream.c (internal_stream_ioctl): Likewise.
33439	* syscall.c (trace_syscall): Likewise.
33440	* term.c (term_ioctl): Likewise.
33441	* util.c (tv_tv, umoven, uload, getpc, fixvfork, setbpt, clearbpt):
33442	Likewise.
33443
33444	Merge Linux internal_clone() into internal_fork()
33445	* defs.h (internal_clone): Remove.
33446	* process.c (internal_clone): Merge into internal_fork().
33447	(internal_fork) [!LINUX]: Remove dead code.
33448	* syscall.c (internal_syscall): Replace internal_clone() with
33449	internal_fork().
33450
33451	* Makefile.am (INCLUDES): Remove redundant search directories.
33452
334532010-02-04  Frederik Schüler  <fs@debian.org>
33454
33455	Update debian/* files.
33456	* debian/control: add sparc64 to the architectures list.
33457	This closes Debian bug #560062
33458	* Backport commit f0df31e71a58c6e79ba77c1a9d84b2f38d44bec7 to fix FTBFS.
33459	This closes Debian bug #560516
33460	* debian/control: Update standards-version to 3.8.3.
33461	* debian/control: Lower package priority to optional, matching
33462	the archive override.
33463	* debian/control: add ${misc:Depends} to Depends: lines where
33464	appropriate.
33465	* debian/watch: new file, allows automatic tracking of new
33466	upstream versions.
33467	* debian/source/format: new file, adapt to debian source format "quilt"
33468	* debian/rules: indentation cleanups; use dh_testroot and dh_prep
33469	in clean target.
33470
334712010-01-25  Andreas Schwab  <schwab@redhat.com>
33472
33473	Fix spurious failure of AC_STAT64 test.
33474	* acinclude.m4 (AC_STAT64): Include <sys/types.h> first.
33475
334762010-01-12  Andreas Schwab  <schwab@redhat.com>
33477
33478	Don't kill the process when detaching.
33479	* strace.c (detach): Call clearbpt when TCB_BPTSET is set.
33480
334812009-12-25  Dmitry V. Levin  <ldv@altlinux.org>
33482
33483	Decode fifth argument of mremap syscall.
33484	* mem.c (sys_mremap): Decode fifth argument.
33485	* linux/*/syscallent.h: Update the number of mremap syscall arguments.
33486
334872009-12-24  Chris Metcalf  <cmetcalf@tilera.com>
33488
33489	* mem.c (sys_mbind): Display first argument in hex.
33490
33491	* mem.c (mremap_flags): Add MREMAP_FIXED.
33492
334932009-11-16  Mike Frysinger  <vapier@gentoo.org>
33494
33495	Move i386-specific files out of common linux dir.
33496	* linux/syscallent.h: Moved to ...
33497	* linux/i386/syscallent.h: ... here.
33498	* linux/ia64/syscallent.h: Update i386 syscallent.h include.
33499	* linux/sparc/gen.pl: Likewise.
33500	* linux/x86_64/syscallent1.h: Likewise.
33501
335022009-11-16  Andreas Schwab  <schwab@redhat.com>
33503
33504	Remove support for pre-C89.
33505	* defs.h: Remove references to __STDC__ and P macros.
33506	* strace.c: Likewise.
33507
335082009-11-13  Dmitry V. Levin  <ldv@altlinux.org>
33509
33510	Decode more SOL_PACKET socket options.
33511	* net.c (sockpacketoptions): Add more PACKET_* entries.
33512	(sys_getsockopt): Decode PACKET_STATISTICS.
33513	(printsockopt): Decode PACKET_RX_RING and PACKET_TX_RING.
33514	Patch by Gabor Gombas.
33515
335162009-11-11  Andreas Schwab  <schwab@redhat.com>
33517
33518	Ignore errors if a thread is killed.
33519	* util.c (clearbpt): Ignore ESRCH error.
33520
335212009-11-06  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>
33522
33523	Fix handling of Linux systems without struct statfs64.
33524	* acinclude.m4 (AC_STATFS64): New macro to check for struct statfs64.
33525	* configure.ac: Call AC_STATFS64.
33526	* file.c (printstatfs64, sys_statfs64, sys_fstatfs64): Compile only
33527	  if struct statfs64 is available.
33528
335292009-11-06  Dmitry V. Levin  <ldv@altlinux.org>
33530
33531	Fix getsockopt decoding on architectures where sizeof(long) > sizeof(int)
33532	* net.c (sys_getsockopt): Optimize output a bit.
33533	Decode integer argument using printnum_int(), patch by Gabor Gombas.
33534
33535	Check umove() return code.
33536	* bjm.c (sys_query_module): Print input parameters when entering
33537	syscall.  Fix handling of syscall error.  Handle unlikely umove()
33538	failures.
33539	* ipc.c (tprint_msgrcv): New function.  Move part of msgrcv parser code
33540	here, add check umove() return code.
33541	(sys_msgsnd): Print msqid parameter as int instead of long.
33542	(sys_msgrcv): Likewise.  Use tprint_msgrcv().
33543	* process.c (print_affinitylist): Check umove() return code.
33544	* sock.c (sock_ioctl): Handle unlikely umove() failure in the
33545	SIOCGIFCONF parser.
33546
33547	Fix check for linux/netlink.h on Linux 2.6.32-rc5+
33548	* configure.ac (AC_CHECK_HEADERS): In check for linux/netlink.h, include
33549	sys/socket.h instead of linux/socket.h beforehand.
33550
335512009-11-04  Andreas Schwab  <schwab@redhat.com>
33552
33553	Decode fallocate on PowerPC.
33554	* linux/powerpc/syscallent.h: Decode fallocate.
33555
33556	Factor out printing of 64bit syscall argument.
33557	* defs.h (ALIGN64): Remove.
33558	(printllval): Declare.
33559	* util.c (printllval): Define.
33560	* file.c (sys_readahead): Use printllval.
33561	(sys_lseek64): Likewise.
33562	(sys_truncate64): Likewise.
33563	(sys_ftruncate64): Likewise.
33564	(sys_fadvise64): Likewise.
33565	(sys_fadvise64_64): Likewise.
33566	(sys_fallocate): Likewise.
33567	* io.c (sys_pread): Likewise.
33568	(sys_pwrite): Likewise.
33569	(sys_pread64): Likewise.
33570	(sys_pwrite64): Likewise.
33571	* mem.c (sys_mmap64): Likewise.
33572
335732009-11-03  Andreas Schwab  <schwab@redhat.com>
33574
33575	Correct decoding of readahead and fadvice64(_64) on PowerPC.
33576	* file.c (sys_readahead): Align 64bit argument.  Handle PowerPC64
33577	like other 64bit architectures.
33578	(sys_fadvise64): Likewise.
33579	(sys_fadvise64_64): Handle PowerPC like ARM.
33580	* linux/powerpc/syscallent.h (sys_readahead): Account for 64bit
33581	argument alignment on PowerPC32.
33582
335832009-10-27  Andreas Schwab  <schwab@redhat.com>
33584
33585	Maintain separate print column for each process.
33586	* defs.h (struct tcp): Add curcol.
33587	* strace.c: (alloc_tcb): Initialize it.
33588	(trace): Use curcol from current process and save it before
33589	continuing.
33590	(tprintf): Don't modify curcol on output error.
33591
335922009-10-21  Roland McGrath  <roland@redhat.com>
33593
33594	* strace.spec: 4.5.19-1 release.
33595
335962009-10-21  Dmitry V. Levin  <ldv@altlinux.org>
33597
33598	* file.c (printstat64): Cleanup trailing whitespace.
33599
336002009-10-16  Andreas Schwab  <schwab@redhat.com>
33601
33602	Fix decoding of newfstatat syscall on x86-64.
33603	* file.c (printstat64) [LINUX && X68_64]: If tracing a 64-bit
33604	process redirect to printstat.
33605	Fixes RH#529316 "Field values shown for "newfstatat" system
33606	call are incorrect"
33607
336082009-10-12  Dmitry V. Levin  <ldv@altlinux.org>
33609
33610	* configure.ac (AC_CHECK_HEADERS): Remove asm/reg.h.
33611
336122009-10-12  Mike Frysinger  <vapier@gentoo.org>
33613
33614	sparc/linux: Rewrite to use asm/ptrace.h.
33615	The current sparc/linux code uses asm/reg.h, but recent Linux kernels
33616	dropped that header completely.  So switch over to the ptrace headers
33617	as those should stick around indefinitely as part of the ABI.
33618
33619	* defs.h [LINUXSPARC] (U_REG_G1, U_REG_O0, U_REG_O1): Define.
33620	* process.c: Drop asm/regs.h include.
33621	[SPARC || SPARC64] (change_syscall): Change struct regs to struct pt_regs.
33622	* signal.c: Drop asm/regs.h include.
33623	(m_siginfo_t): Unify [SPARC || SPARC64] and [MIPS].
33624	[SPARC || SPARC64] (sys_sigreturn): Change struct regs to struct pt_regs.
33625	* syscall.c: Drop asm/regs.h include.
33626	[SPARC || SPARC64] (internal_syscall, get_scno, get_error, force_result,
33627	syscall_enter): Change struct regs to struct pt_regs.
33628	* util.c: Drop asm/regs.h include.
33629	(_hack_syscall5, _ptrace): Delete.
33630	[SPARC || SPARC64] (getpc, printcall, arg_setup_state): Change
33631	struct regs to struct pt_regs.
33632
336332009-10-11  Roland McGrath  <roland@redhat.com>
33634
33635	* make-dist: Clean up.
33636
33637	* configure.ac: Use AC_CONFIG_AUX_DIR([.]).
33638
336392009-10-09  Dmitry V. Levin  <ldv@altlinux.org>
33640
33641	* make-dist: New script for preparing release tarballs.
33642
33643	* git-set-file-times: Import from rsync.
33644
33645	* Makefile.am [MAINTAINER_MODE]: Define and export TAR_OPTIONS.
33646
336472009-10-08  Dmitry V. Levin  <ldv@altlinux.org>
33648
33649	Enhance msgsnd() parser.
33650	* ipc.c (tprint_msgsnd): New function.  Move msgsnd parser code here,
33651	add check for umove() return code.
33652	(sys_msgsnd): Use tprint_msgsnd().
33653
33654	* NEWS: Update for 4.5.19 release.
33655
33656	Enhance semop()/semtimedop() sembuf parser.
33657	* ipc.c (tprint_sembuf): New function. Move sembuf parser code here,
33658	add abbrev() support.
33659	(sys_semop, sys_semtimedop): Use tprint_sembuf().
33660
336612009-10-08  Jakub Bogusz  <qboosh@pld-linux.org>
33662
33663	Add pretty printing of sembuf argument to semop() and semtimedop()
33664	* ipc.c (semop_flags): New xlat structure.
33665	(sys_semop, sys_semtimedop): Add pretty printing of sembuf argument.
33666
336672009-10-08  Mike Frysinger  <vapier@gentoo.org>
33668
33669	Add support for Linux/no-mmu with vfork.
33670	* configure.ac (AC_CHECK_FUNCS): Add fork.
33671	* strace.c (strace_vforked): Define.
33672	(startup_child): Do not raise SIGSTOP if vforked.
33673	(trace): Skip first exec when starting up after vforked.
33674	* syscall.c [BFIN] (get_scno): Drop waitexec checks.
33675
33676	Avoid malloc(0) in getdents parsers.
33677	On end of directory, getdents returns 0.  This return value is used to
33678	then try and do malloc(0), but on some systems this will always return
33679	NULL.  Since the code won't read the pointer in question if len is 0,
33680	then don't bother calling malloc(0) and set the pointer to NULL ourself.
33681	* file.c (sys_getdents, sys_getdents64): Avoid malloc(0) call.
33682
336832009-10-07  Mike Frysinger  <vapier@gentoo.org>
33684
33685	Add sys_nanosleep() prototype for sparc.
33686	* linux/sparc/syscall.h (sys_nanosleep): New prototype.
33687	Reported by Frederik Schüler.
33688
33689	Silence compiler warnings about implicit cast from pointer to integer.
33690	* util.c (do_ptrace): Cast ptrace() 4th arg to long.
33691	(ptrace_restart): Drop void* cast on ptrace() 4th arg.
33692
33693	Ignore .gdb files from FLAT toolchains.
33694	* .gitignore: Add /*.gdb.
33695
33696	* configure.ac (AC_CHECK_FUNCS): Sort and expand.
33697
33698	Blackfin: Update ioctl/syscall lists.
33699	* linux/bfin/ioctlent.h: Sync list with latest kernel sources.
33700	* linux/bfin/syscallent.h: Likewise.
33701
33702	ioctlsort: Check ppc hosts too.
33703	* linux/ioctlsort.c: Check for __powerpc__.
33704
337052009-10-07  Andreas Schwab  <schwab@redhat.com>
33706
33707	Fix build on ia64.
33708	* linux/ia64/syscallent.h: Update for addition of accept4 syscall
33709	in ../syscallent.h.
33710
337112009-10-07  Roland McGrath  <roland@redhat.com>
33712
33713	* strace.spec (%doc): Add ChangeLog-CVS.
33714
33715	* Makefile.am (srpm): New phony target.
33716
33717	* Makefile.am (EXTRA_DIST): Add ChangeLog.
33718	($(srcdir)/ChangeLog): New target, replaces gen-changelog phony target.
33719	Put it inside [MAINTAINER_MODE].
33720
337212009-10-06  Dmitry V. Levin  <ldv@altlinux.org>
33722
33723	* NEWS: Update for 4.5.19 release.
33724
337252009-10-05  Frederik Schüler  <fs@debian.org>
33726
33727	Prepare debian/* files for release.
33728	* debian/rules: Do not ship ChangeLog anymore.
33729	* debian/control: Update to Debian standards version 3.8.1, and remove
33730	Roland from the Maintainers list.  This closes Debian bug #521458.
33731	* debian/changelog: Document changes and prepare for release.
33732
337332009-10-05  Dmitry V. Levin  <ldv@altlinux.org>
33734
33735	* defs.h [HPPA]: Lower MAX_ARGS from 32 to 6.
33736
33737	* ipc.c [LINUX] (sys_shmat): HPPA does not use an IPC multiplexer.
33738	Based on patch from Carlos O'Donell.
33739
337402009-10-05  Carlos O'Donell  <carlos@systemhalted.org>
33741
33742	* linux/hppa/syscallent.h: Update syscalls.
33743	Based on work by Kyle McMartin and Helge Deller.
33744
33745	Fix SA_HANDLER function pointer comparisons for hppa.
33746	* signal.c (sys_sigaction): Cast SA_HANDLER function pointers to long.
33747	(sys_rt_sigaction): Likewise.
33748
337492009-10-05  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
33750
33751	CRIS: Correct first argument to upeek()
33752	This complements commit ea0e6e80260d2b1b7ad40282012b0e47869bcddf.
33753	* syscall.c [CRISV10 || CRISV32] (syscall_fixup, syscall_enter): Pass
33754	tcp pointer instead of pid to upeek().
33755	* util.c [CRISV10 || CRISV32] (printcall): Likewise.
33756
337572009-10-05  Dmitry V. Levin  <ldv@altlinux.org>
33758
33759	* signal.c (do_signalfd): Fix typo in output format.
33760
337612009-09-21  Dmitry V. Levin  <ldv@altlinux.org>
33762
33763	* Makefile.am (gen_changelog_start_date): Fix date.
33764
337652009-09-19  Dmitry V. Levin  <ldv@altlinux.org>
33766
33767	Prepare for 4.5.19 release.
33768	* NEWS: Update for 4.5.19 release.
33769	* configure.ac: Version 4.5.19.
33770	* debian/changelog: 4.5.19-1.
33771	* strace.spec: 4.5.19-1.
33772
33773	Update debian/* to 4.5.18-1.
33774	* debian/changelog: Update to 4.5.18-1.
33775	* debian/compat: Set compatibility level to 7.
33776	* debian/control (Build-Depends): Update debhelper requirement.
33777	(strace, strace64): Add Section and Priority tags.
33778
337792009-09-19  Kirill A. Shutemov  <kirill@shutemov.name>
33780
33781	Fix fadvise64 decoding on ARM.
33782	* file.c (sys_fadvise64_64) [ARM]: Fix argument ordering.
33783
337842009-09-18  Dmitry V. Levin  <ldv@altlinux.org>
33785
33786	Fix follow fork/vfork on Linux ARM OABI.
33787	__NR_SYSCALL_BASE eis 0 for EABI and is 0x900000 for OABI.
33788	* process (change_syscall) [LINUX && ARM]: Mask off the high order bits
33789	when changing syscall.
33790
33791	Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>
33792
337932009-09-18  Mike Frysinger  <vapier@gentoo.org>
33794
33795	Mark shell scripts as executable.
33796
33797	Ignore ioctlsort helper program.
33798	* .gitignore: Add ioctlsort.
33799
33800	linux/errno: Add ERFKILL.
33801	* linux/errnoent.h: Change ERRNO_132 to ERFKILL according to errno 132
33802	definition introduced in Linux 2.6.31.
33803
338042009-09-01  Paolo Bonzini  <pbonzini@redhat.com>
33805
33806	Add accept4 socketcall.
33807	This second patch in the series adds support for accept4 as a socketcall
33808	sub-call.  Besides the need to renumber all system calls, this poses
33809	no problem.
33810	Tested on i686.
33811
33812	* linux/arm/syscallent.h: Add accept4 socketcall.
33813	* linux/m68k/syscallent.h: Likewise.
33814	* linux/powerpc/syscallent.h: Likewise.
33815	* linux/s390/syscallent.h: Likewise.
33816	* linux/s390x/syscallent.h: Likewise.
33817	* linux/sh/syscallent.h: Likewise.
33818	* linux/sh64/syscallent.h: Likewise.
33819	* linux/sparc/syscallent.h: Likewise.
33820	* linux/syscallent.h: Likewise.
33821
33822	* linux/sparc/syscall.h (SYS_sub_accept4): Declare.
33823	(SYS_socket_nsubcalls): Update.
33824	* linux/syscall.h: Likewise.
33825
338262009-09-01  Paolo Bonzini  <pbonzini@redhat.com>
33827
33828	Replace x86-64 paccept with accept4.
33829	This patch changes the paccept syscall to accept4 for x86-64, since
33830	the former was dropped in Linux kernel commit v2.6.27-rc7-14-g2d4c826.
33831	At the same time, it adds support for pretty printing its arguments.
33832
33833	* linux/x86_64/syscallent.h: Replace paccept with accept4,
33834	hook in sys_accept4.
33835	* net.c (sys_accept): Leave a small stub calling the new...
33836	(do_accept): ... function, which also adds a flags_arg argument.
33837	(sys_accept4): New.
33838
338392009-08-28  Andreas Schwab  <schwab@redhat.com>
33840
33841	Zero-extend 32-bit addresses when printing argv array.
33842	(printargv): Zero-extend 32-bit addresses.
33843	Fixes RH#519480 "64-bit strace is lazy on execve of 32-bit
33844	process".
33845
338462009-08-12  Andreas Schwab  <schwab@redhat.com>
33847
33848	Add more futex decoding.
33849	* process.c (FUTEX_WAIT_REQUEUE_PI, FUTEX_CMP_REQUEUE_PI)
33850	(FUTEX_PRIVATE_FLAG, FUTEX_CLOCK_REALTIME): Define.
33851	(futexops): Add entries for them.
33852	(sys_futex): Decode FUTEX_CMP_REQUEUE_PI and
33853	FUTEX_WAIT_REQUEUE_PI.
33854
338552009-07-08  Dmitry V. Levin  <ldv@altlinux.org>
33856
33857	Generate ChangeLog from git log.
33858	* .gitignore: Add ChangeLog
33859	* ChangeLog: Rename to ChangeLog-CVS.
33860	* Makefile.am (gen-changelog): New rule.
33861	(dist-hook): Depend on it.
33862	(EXTRA_DIST): Add ChangeLog-CVS.
33863	* README-hacking: Describe changes.
33864	* gitlog-to-changelog: Import from gnulib.
33865
33866
33867See ChangeLog-CVS for older changes.
33868