Commit Graph

2166 Commits

Author SHA1 Message Date
Mike Frysinger
6c19136aca Rename COPYRIGHT to COPYING
The standard name people have adopted is "COPYING" rather than
"COPYRIGHT".  Use that as a lot of license scanning tools look for it.

* COPYRIGHT: Rename to ...
* COPYING: ... this.
* Makefile.am (EXTRA_DIST): Rename COPYRIGHT to COPYING.
* README: Likewise.
* strace.spec (%files): Likewise.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-17 23:18:55 +00:00
0eb7165588 Sync strace.spec and debian/ with packages
* debian/changelog: Sync with 4.7-1.
* debian/strace.docs: Likewise.
* strace.spec: Sync with 4.7-3.
2013-05-17 23:16:39 +00:00
f782201adf Update PTRACE_O_* constants
* process.c (ptrace_setoptions_flags): Sync with Linux 3.9.
2013-05-17 22:22:19 +00:00
ea0d2a60b1 Update AF_*, PF_*, MSG_*, and TCP_* constants
* net.c (domains, addrfams, protocols, socktcpoptions): Sync with
Linux 3.9.
2013-05-17 22:20:02 +00:00
1d2435b20b NOMMU: do not hide startup syscalls unless in -D mode
On NOMMU systems in "strace PROG" case, we have no way to attach to
the tracee before it calls execve unless in -D mode.  That is, the
first execve call is very likely to be missed, and setting
hide_log_until_execve just results to empty log.

* strace.c (init) [NOMMU_SYSTEM]: Do not set hide_log_until_execve
unless in -D mode.
2013-05-14 22:50:11 +00:00
882478a072 Make -D mode work when the Yama LSM is enabled
* strace.c [HAVE_PRCTL]: Include sys/prctl.h.
(startup_child) [HAVE_PRCTL && PR_SET_PTRACER && PR_SET_PTRACER_ANY]:
In -D mode, allow tracing the process that is going to become the
tracee.
2013-05-14 22:29:18 +00:00
7a0fb38386 Update PR_* constants
* process.c (prctl_options): Add PR_SET_PTRACER.
2013-05-14 21:20:58 +00:00
Denys Vlasenko
2a3d27552f Hide startup syscalls.
Tested with "./strace [-D] [-q] [-bexecve] env true",
all cases seem to work.

* defs.h: Declare new variable: bool hide_log_until_execve.
* strace.c: Define hide_log_until_execve.
Rename skip_startup_execve to skip_one_b_execve.
(startup_child): Do not set skip_one_b_execve = 1 here.
(init): If "strace PROG" case (as opposed to "strace -pPID"),
set skip_one_b_execve and hide_log_until_execve to 1.
(trace): Don't print signal messages if hide_log_until_execve == 1.
* syscall.c (trace_syscall_entering):
Skip syscall printing if hide_log_until_execve == 1.
Reset hide_log_until_execve if we enter execve syscall.
(trace_syscall_exiting): Skip syscall printing if hide_log_until_execve == 1.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-05-14 16:10:42 +02:00
Daniel P. Berrange
01997cf32d Allow -q to be repeated for very quiet output
Even with the -q flag specified, tracing output is still mixed
with messages about signals and process exit status, which is
often irrelevant.  Allow the -q option to be repeated to force
the suppression of signals / exit status info too.

* defs.h: Change 'qflag' from 'bool' to 'unsigned int'.
* strace.1: Document ability to repeat '-q' option.
* strace.c: Allow '-q' to be repeated to quieten process
exit status and signal messages.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 14:11:31 +00:00
8190912d2e mips o32: fix syscall table
* linux/mips/syscallent-o32.h: Add entries for getpmsg, putpmsg,
get_mempolicy, set_mempolicy and vserver.  Fix names for umount,
umount2, mmap, mmap2, pread64, pwrite64, sigaltstack and fstatat64
syscalls.
2013-05-11 21:57:28 +00:00
b1e7cb1777 mips n64: fix syscall table
* linux/mips/syscallent-n64.h: Add entries for get_mempolicy,
set_mempolicy and timerfd syscalls.  Fix entry for socket syscall.
Fix names for pread64, pwrite64, shmat, rt_sigsuspend, sigaltstack
and umount2 syscalls.
2013-05-10 22:56:35 +00:00
26ff3f2af4 mips n32: fix syscall table
* linux/mips/syscallent-n32.h: Add entries for mbind, get_mempolicy,
set_mempolicy and timerfd syscalls.  Fix entry for socket syscall.
Fix handlers for truncate, ftruncate and getdents64 syscalls.
Fix names for pread64, pwrite64, shmat, rt_sigsuspend, sigaltstack,
umount2, and getdents64 syscalls.
2013-05-10 22:55:29 +00:00
f9236e6d76 sync_file_range: fix number of syscall arguments
* linux/avr32/syscallent.h: Set the number of sync_file_range arguments
to 6.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Change sync_file_range to
sync_file_range2, set the number of sync_file_range2 arguments to 6.
* linux/tile/syscallent.h: Change sync_file_range to sync_file_range2,
set the number of sync_file_range2 arguments to 4.
* linux/tile/syscallent1.h: Change sync_file_range to sync_file_range2.
update handler.
* linux/xtensa/syscallent.h: Likewise.
2013-05-08 17:03:24 +00:00
cbd4e922ac Add syscall entries for new linux syscalls
* linux/dummy.h: Add printargs aliases for sys_finit_module, sys_kcmp
and sys_sync_file_range2.
* linux/alpha/syscallent.h: Add entries for process_vm_readv
and process_vm_writev.
* linux/bfin/syscallent.h: Likewise.
* linux/arm/syscallent.h: Add entries for sync_file_range2, kcmp
and finit_module.
* linux/hppa/syscallent.h: Add entries for process_vm_readv,
process_vm_writev, kcmp and finit_module.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
* linux/ia64/syscallent.h: Add entry for finit_module.
* linux/i386/syscallent.h: Add entries for kcmp and finit_module.
* linux/m68k/syscallent.h: Likewise.
* linux/metag/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/s390/syscallent.h: Add entries for s390_runtime_instr, kcmp
and finit_module.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Add entries for kern_features, kcmp
and finit_module.
2013-05-08 16:57:53 +00:00
56ef5ef90f tests/net: fix portability issues
* tests/net-accept-connect.c: Fix address length passed to bind()
and connect().
* tests/net: Update regexps.
2013-05-08 14:03:38 +00:00
47b0dcca2b tests: add a test for basic network syscalls
* tests/.gitignore: Add net-accept-connect, *.o and *.log.*.
* tests/Makefile.am (AM_CFLAGS): New variable.
(check_PROGRAMS): Add net-accept-connect.
(TESTS): Add net.
* tests/net-accept-connect.c: New file.
* tests/net: New file.
2013-05-08 02:06:39 +00:00
56fb81c696 tests: do not skip tests when timeout utility is not available
* tests/init.sh (check_timeout): New function.
* tests/ptrace_setoptions: Use it.
* tests/qual_syscall: Likewise.
* tests/stat: Likewise.
* tests/strace-f: Likewise.
2013-05-08 01:54:32 +00:00
de462cf99b Move subcall decoding configuration out of the common code
* Makefile.am (EXTRA_DIST): Add linux/subcall.h.
* linux/syscall.h (SYS_socket_subcall): Remove.
(SYS_socket_nsubcalls, SYS_ipc_subcall, SYS_ipc_nsubcalls): Move to ...
* linux/subcall.h: ... new file.
* linux/arm/syscallent.h: Define SYS_socket_subcall, include subcall.h.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.

Suggested by Mike Frysinger and Chris Metcalf.
2013-05-07 16:06:58 +00:00
ebe3d3a640 sparc: remove some unused declarations and macros
* linux/syscall.h [SPARC || SPARC64] (sys_msgsys, sys_semsys,
sys_shmsys): Remove declarations.
[SPARC || SPARC64] (SYS_semsys_subcall, SYS_semsys_nsubcalls,
SYS_msgsys_subcall, SYS_msgsys_nsubcalls, SYS_shmsys_subcall,
SYS_shmsys_nsubcalls): Remove macros.
2013-05-07 19:03:26 +04:00
Mike Frysinger
3883ab8438 mips: fix build regression
The recent commit (2690fadc8b) shuffled
the mips headers around causing it to check the ABI defines before it
included the header which set those up.  Now all mips builds fail with:
	In file included from count.c:36:0:
	defs.h:48:4: error: #error Unsupported _MIPS_SIM

* defs.h [MIPS]: Move sgidefs.h above _MIPS_SIM check.
2013-05-07 14:59:44 +00:00
James Hogan
f6c246f224 metag: rename llseek syscall to _llseek
The raw llseek syscall is called _llseek from userland, so fix the
naming of it for metag to allow the stat test to pass.

* linux/metag/syscallent.h: Rename llseek syscall to _llseek.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2013-05-07 13:12:41 +00:00
James Hogan
28927cd868 metag: disable socket and ipc subcall support
The metag architecture also uses dedicated syscalls and doesn't need to
multiplex ipc and socket subcalls.

* linux/syscall.h [METAG]: Do not define SYS_socket_subcall and
SYS_ipc_subcall.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2013-05-07 13:11:03 +00:00
5273cb7d60 pread, pwrite: fix number of syscall arguments
The number of pread and pwrite arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4, for unaligned
32bit it equals to 5, and for aligned 32bit it equals to 6.

* linux/aarch64/syscallent1.h: Change the number of pread and pwrite
arguments to 4.
* linux/alpha/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Change the number of pread and pwrite
arguments to 5.
2013-05-07 09:43:55 +00:00
ea5a079684 preadv, pwritev: fix number of syscall arguments
The number of preadv and pwritev arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4, for unaligned 32bit
it equals to 5, and for aligned 32bit it equals to 6.

* linux/aarch64/syscallent1.h: Change the number of preadv and pwritev
arguments to 4.
* linux/alpha/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Change the number of preadv and pwritev
arguments to 6.
* linux/sh/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2013-05-07 09:43:54 +00:00
54aee7a38c ftruncate64, truncate64: fix number of syscall arguments
The number of ftruncate64/truncate64 arguments depends on architecture
and personality.  For 64bit and ilp32 it equals to 2, for unaligned
32bit it equals to 3, and for aligned 32bit it equals to 4.

* linux/or1k/syscallent.h: Change the number of ftruncate64 and
truncate64 arguments to 3.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Change ftruncate64 and truncate64 handlers.
* linux/sparc/syscallent.h: Change ftruncate64 handler, change the
number of its arguments to 3.
* linux/xtensa/syscallent.h: Change the number of ftruncate64 and
truncate64 arguments to 4.
2013-05-07 09:43:53 +00:00
eb1cc1568c fallocate: fix number of syscall arguments
The number of fallocate arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4,
for 32bit it equals to 6.

* linux/aarch64/syscallent1.h: Change the number of fallocate arguments
to 4.
* linux/alpha/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Set fallocate handler and flags.
2013-05-07 09:43:52 +00:00
3f4a41a55d fadvise64, fadvise64_64: fix handlers and number of syscall arguments
The number of fadvise64 arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4, for unaligned
32bit it equals to 5, and for aligned 32bit it equals to 6.

The number of fadvise64_64 arguments is 4 for 64bit and ilp32, for
unaligned 32bit and most of aligned 32bit it equals to 6, and for
mips o32 it equals to 7.

* linux/alpha/syscallent.h: Set fadvise64 handler.
* linux/s390/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Set fadvise64_64 handler, change the number
of syscall arguments to 6.
* linux/ia64/syscallent.h: Change the number of fadvise64 arguments
to 4.
* linux/mips/syscallent-n32.h: Likewise.
* linux/tile/syscallent1.h: Change the number of fadvise64 arguments
to 5.
* linux/mips/syscallent-o32.h: Change the number of fadvise64_64
arguments to 7.
* linux/s390x/syscallent.h: Change fadvise64_64 handler.  Set fadvise64
handler.  Change numbers of fadvise64 and fadvise64_64 arguments to 4.
* linux/sh64/syscallent.h: Change fadvise64_64 handler.
Change numbers of fadvise64 and fadvise64_64 arguments to 4.
* linux/sparc/syscallent.h: Set fadvise64 and fadvise64_64 handlers,
change numbers of their arguments to 5 and 6.
* linux/x86_64/syscallent.h: Change fadvise64 handler.
2013-05-07 09:43:51 +00:00
2690fadc8b mips o32: raise the max number of syscall arguments to 7
On mips o32, fadvise64_64 takes 7 arguments.

* defs.h [LINUX_MIPSO32]: Raise MAX_ARGS to 7.
2013-05-07 09:43:50 +00:00
34c445b5c6 mips: split syscallent.h
linux/mips/syscallent.h consisted of several parts that had little in
common.  Split them into separate files to ease maintenance.

* linux/mips/syscallent-compat.h: New file.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/mips/syscallent.h: Include them.
* Makefile.am (EXTRA_DIST): Add them.
2013-05-07 09:43:04 +00:00
4996b3a352 readahead: fix number of syscall arguments
The number of readahead arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 3, for unaligned 32bit it
equals to 4, and for aligned 32bit it equals to 5.

* linux/aarch64/syscallent1.h: Set number of readahead arguments to 3.
* linux/alpha/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Set number of readahead arguments to 4.
* linux/sh/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Set number of readahead arguments to 5.
2013-05-07 01:56:09 +00:00
828bbd846e linux/syscall.h: make subcall decoding configuration more readable
* linux/syscall.h: Inverse and sort the subcall ifdef,
add a comment why subcall decoding support is not enabled
on some architectures.
2013-05-06 23:39:04 +00:00
Chris Zankel
2f6519a9c1 xtensa: disable socket and ipc subcall support
The Xtensa architecture also uses dedicated syscalls and doesn't
need to multiplex ipc and socket subcalls.

* linux/syscall.h [XTENSA]: Do not define SYS_socket_subcall and
SYS_ipc_subcall.

Signed-off-by: Chris Zankel <chris@zankel.net>
2013-05-06 23:18:28 +00:00
6b03c9b5ce Fix syscall flags
* linux/aarch64/syscallent1.h: Fix syscall flags for send.
* linux/alpha/syscallent.h: Fix syscall flags for fchdir, getcwd,
oldumount, sigaltstack, umount, uselib, and utimes.
* linux/arm/syscallent.h: Fix syscall flags for close, creat, dup, dup2,
fchdir, fchmod, fchown, fchown32, fcntl, fcntl64, fdatasync, flock,
fsetxattr, fsync, getdents, getdents64, ioctl, oldfstat, oldselect,
open, pipe, poll, pread, pwrite, read, readahead, readdir, readv,
select, socketcall, write, and writev.
* linux/avr32/syscallent.h: Fix syscall flags for inotify_init and
unshare.
* linux/bfin/syscallent.h: Fix syscall flags for pread64 and pwrite64.
* linux/hppa/syscallent.h: Fix syscall flags for fchdir, flistxattr,
getcwd, pause, signal, umount2, uselib, utime, and vfork.
* linux/ia64/syscallent.h: Fix syscall flags for creat, fchdir,
lstat, umount, uselib, and utimes.  Fix syscall handlers for
fgetxattr, flistxattr, fremovexattr, and fsetxattr.
* linux/m68k/syscallent.h: Fix syscall flags for close, creat, dup,
dup2, fchdir, fchmod, fchown, fchown32, fcntl, fcntl64, fdatasync,
flock, fsetxattr, getdents, ioctl, oldfstat, oldselect, open, pipe,
poll, pread64, pwrite64, read, readahead, readdir, readv, select,
socketcall, write, and writev.
* linux/metag/syscallent.h: Fix syscall flags for fanotify_init,
prlimit64, process_vm_readv, process_vm_writev, and quotactl.
* linux/microblaze/syscallent.h: Fix syscall flags for close, creat,
dup, dup2, fchdir, fchmod, fchown, fchown32, fcntl, fcntl64,
fdatasync, flock, fsetxattr, getdents, ioctl, oldfstat, oldselect,
open, perf_event_open, pipe, poll, pread64, pwrite64, read, readahead,
readdir, readv, select, socketcall, write, and writev.
* linux/mips/syscallent.h: Fix syscall flags for close, creat, dup,
dup2, fchdir, fchmod, fchown, fcntl, fcntl64, fdatasync, flock,
fsetxattr, getdents, getdents64, getxattr, ioctl, lgetxattr,
listxattr, llistxattr, lremovexattr, lsetxattr, oldfstat, open, pipe,
pivot_root, poll, pread, pwrite, read, readahead, readv, removexattr,
select, setxattr, socketcall, statfs, write, and writev.
* linux/or1k/syscallent.h: Fix syscall flags for fchdir and quotactl.
* linux/powerpc/syscallent.h: Fix syscall flags for fchdir.
* linux/sh/syscallent.h: Fix syscall flags for getcwd.
* linux/sparc/syscallent.h: Fix syscall flags for getresgid, getresuid,
setresgid, setresgid32, and setresuid.
* linux/xtensa/syscallent.h: Fix syscall flags for close, creat, dup,
dup2, fallocate, fchdir, fchmod, fchown, fcntl, fcntl64, fdatasync,
flock, fsetxattr, fstatfs, fstatfs64, fsync, getdents, getdents64,
ioctl, open, pipe, pivot_root, poll, pread64, pwrite64, read,
readahead, readv, rt_sigreturn, select, setfsgid, setfsuid, setuid,
swapoff, times, utime, write, and writev.
2013-05-06 20:43:35 +00:00
53f6795d75 tests/stat: enhance regexps
* tests/stat: Enhance regexps that check tracing of stat/stat64 and
fstatat/fstatat64 syscalls.
2013-05-06 19:15:09 +00:00
Chris Metcalf
6f11acd360 tests/stat: support fstatat syscall for stat()
Newer Linux architectures don't support the stat/stat64 syscalls.
Instead they use fstatat() with AT_FDCWD and an extra flags argument.
Support seeing this output in the 'strace -efile' test.

As part of this change, use "grep -E -x" syntax consistently for
all stat tests, since the number of \(foo\)\? expressions was becoming
pretty unwieldy.

* tests/stat: Update stat/stat64 check regexp to handle architectures
that use fstatat instead.  Use "grep -E -x" syntax consistently.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2013-05-06 18:47:50 +00:00
8e096c4ec5 ARM OABI: fix 64-bit arguments decoding
ARM OABI and ARM EABI have different function parameters passing rules,
see commit v4.6-11-g7a5b08f for details.

* util.c (printllval): Do not align argument number in case of ARM OABI.
* file.c (sys_fadvise64_64): Likewise.
2013-05-06 18:23:01 +00:00
Mike Frysinger
a32b683704 printllval: fix 64bit unpacking on mips/o32 and xtensa
The mips/o32 ABI and xtensa arch also do 64bit aligning, so add it to the
printllval list for this.

Normally for sys_fadvise64_64 we'd handle the same list of arches, but
mips/o32 ABI is funky and doesn't shift -- it has 7 args.  So just add
xtensa to it.

* file.c (sys_fadvise64_64): Add XTENSA to the shifted list.
* util.c (printllval): Add LINUX_MIPSO32 and XTENSA to the shifted list.
2013-05-06 18:13:34 +00:00
Chris Metcalf
c7b2f0c74e tile: disable socket and ipc subcall support
The tile arch just has the dedicated syscalls, so disable
the logic for parsing subcalls.

* linux/syscall.h [TILE]: Do not define SYS_socket_subcall and
SYS_ipc_subcall.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2013-05-06 18:09:36 +00:00
Mike Frysinger
6b572cfd2b Blackfin: disable socketcall and ipc subcall support
The Blackfin arch does not have a socketcall or ipc subcall
(it has dedicated syscalls broken out), so disable the logic for it.

* linux/syscall.h [BFIN]: Do not define SYS_socket_subcall and
SYS_ipc_subcall.
2013-05-06 18:08:39 +00:00
Mike Frysinger
554c8beaab s390: fix # of args truncate64/ftruncate64 takes
* linux/s390/syscallent.h: Change nargs to 3 for truncate64/ftruncate64.
2013-05-05 21:19:23 +00:00
Mike Frysinger
2f99788e8f mtd: clamp ubi name strings
Since the length fields with the ubi volnames are signed 16bit values,
make sure we clamp that number to the size of the buffer we've allocated
on the stack to prevent buffer overflows.

* mtd.c (ubi_ioctl): Clamp length to string_quote to 0/UBI_MAX_VOLUME_NAME.
Check the return of string_quote and tweak the output accordingly.
2013-05-05 08:15:24 +00:00
7a498be266 printxval: support more architectures
* configure.ac: Define SIZEOF_LONG_LONG.
* util.c (printllval): Handle all architectures with sizeof(long) > 4
and sizeof(long) == sizeof(long long).
2013-05-04 19:51:57 +00:00
Mike Frysinger
80acf62207 Fix building for sparc64 targets
* util.c (printllval): Handle SPARC64 define.
2013-05-04 19:11:04 +00:00
Mike Frysinger
921744d5e7 Fix building for mips n64 targets
* util.c (printllval): Handle LINUX_MIPSN64 define.
2013-05-04 15:58:45 +00:00
8d5f11585c hppa: fix stat64 and fstat64 decoding
* file.c [HPPA]: Do not redefine stat64 to hpux_stat64.
2013-05-03 23:47:17 +00:00
a55b6b193c arm, aarch64, ppc: fix printllval-based decoders
* util.c (printllval) [ARM || POWERPC]: Align argument number.
[AARCH64]: Align argument number in 32bit mode.
* file.c (sys_fadvise64_64) [ARM || POWERPC]: Remove no longer needed
printllval workaround.
[AARCH64]: Fix printing POSIX_FADV_* constants in 32bit mode.
2013-05-03 23:45:54 +00:00
Mike Frysinger
d648f29cc3 Decode mtd/ubi ioctls
Been playing with UBI of late and it'd help if I could see what it was
doing.  Not entirely sure about the decoding of UBI_IOCVOLUP -- it takes
a pointer to a 64bit value, not a strict.

* util.c (MAX, MIN): Move to ...
* defs.h (MAX, MIN): ... here.
(CLAMP): Define.
(ubi_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call ubi_ioctl when code is 'o' or 'O'.
* mtd.c: Include ubi user API header.
(ubi_volume_types): New enum decode.
(ubi_volume_props): Likewise.
(ubi_ioctl): Define.
* linux/ubi-user.h: Import from linux 3.8.
2013-05-02 22:50:55 +00:00
Mike Frysinger
48d3159d67 test: add mtd/ubi test helpers
I used these to develop the mtd/ubi ioctl decoders.

* test/.gitignore: Add mtd/ubi.
* test/Makefile: Declare all tests in a PROGS var.
Declare build targets .PHONY.
(all): Depend on $(PROGS) instead of hardcoded list.
(clean): Remove $(PROGS) instead of hardcoded list.
* test/mtd.c: New file.
* test/ubi.c: Likewise.
2013-05-02 22:43:47 +00:00
Mike Frysinger
b51ce62454 test: include headers for used funcs
These funcs use things like wait/write/read/strcmp but sometimes
don't include the right header for them.

* test/Makefile: Add -Wall to CFLAGS.
* test/clone.c: Include unistd.h.
* test/fork.c: Include sys/wait.h.
* test/sig.c: Include unistd.h.
* test/sigkill_rain.c: Include sys/wait.h.
* test/vfork.c: Include sys/wait.h.
* test/wait_must_be_interruptible.c: Include string.h
2013-05-02 22:41:50 +00:00
8582f881ee ia64: fix compilation warnings introduced by commit v4.7-174-g44f0ed1
* linux/ia64/syscallent.h: Undefine sys_oldlstat, sys_lstat and
sys_lstat64 before redefining them to printargs.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2013-05-02 22:14:21 +00:00