[PATCH] Move SH-specific argument number calculation to getllval

2016-08-20 Thread Eugene Syromyatnikov
This change prevents scattering of ll-related hacks and simplifies pread/pwrite syscalls parsers' logic a bit. * util.c (getllval): Add fixup for arg_no for SuperH when argument number is equal to 3 (see comment). * io.c (PREAD_OFFSET_ARG): Macro removed. (SYS_FUNC(pread)): Always use argument

[PATCH 0/2] Minor bug in timerfd_settime parser

2016-08-22 Thread Eugene Syromyatnikov
e updates tests and second one fixes the aforementioned problem. Eugene Syromyatnikov (2): Fill old_value argument in timer{,fd}_xettime tests Fix old_value argument retrieval in timerfd_settime parser tests/timer_xettime.c |4 tests/timerfd_xettime.c |4 time.c

[PATCH 1/2] Fill old_value argument in timer{,fd}_xettime test

2016-08-22 Thread Eugene Syromyatnikov
It is needed in order to differentiate it from the value returned by the call. As a consequence, it enables revealing possible bugs in syscall parsers, for example, when the value read on syscall entering and not on syscall exiting (as it is the case with timerfd_settime parser). * tests/timer_xet

[PATCH 2/2] Fix old_value argument retrieval in timerfd_settime parser

2016-08-22 Thread Eugene Syromyatnikov
This is done similar to timer_settime syscall parser. * time.c (SYS_FUNC(timerfd_settime)): retrieve old_value argument on exiting and not on entering. Return 0 instead of RVAL_DECODED (since call hasn't been decoded in full on entering). --- time.c | 20 +++- 1 file changed

[PATCH 0/8] Some futex parser tweaks and futex test

2016-08-29 Thread Eugene Syromyatnikov
Hello. This patchset contains some initial proposal for the futex syscall test along with some syscall parser formatting tweaks that appeared sensible to me during the test's realisation. Eugene Syromyatnikov (8): Fix FUTEX_WAKE_OP compare function mask futex: Add handling of FUT

[PATCH 1/8] Fix FUTEX_WAKE_OP compare function mask

2016-08-29 Thread Eugene Syromyatnikov
* futex.c (SYS_FUNC(futex)) : compare function does not have FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits from bit 24 to bit 27, as per both initial and current (v4.7) kernel implementations, so bring futex parser in accordance with this. --- futex.c |4 +--- 1 file changed, 1 insertion

[PATCH 2/8] futex: Add handling of FUTEX_FD command

2016-08-29 Thread Eugene Syromyatnikov
Since FUTEX_FD is known (and most likely reserved for the future use), albeit obsolete, it has some expected argument format, so it's probably wise to employ it. * futex.c (SYS_FUNC(futex)): add handling of FUTEX_FD command. --- futex.c |1 + 1 file changed, 1 insertion(+) diff --git a/futex

[PATCH 3/8] futex: Some refinement to unknown command argument formatting

2016-08-29 Thread Eugene Syromyatnikov
Several changes have been performed: * alternate form is used for timeout value since it is pointer half of the time. And half of the time it is not, which can be confusing without number base prefix. * uaddr is pointer across all existing operations, so it's rather expected that it woul

[PATCH 4/8] Add xlat values for FUTEX_WAIT commands with FUTEX_CLOCK_REALTIME bit set

2016-08-29 Thread Eugene Syromyatnikov
The support for these has been added in commit g337f130, before Linux 4.5. * xlat/futexops.in: add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME records. --- xlat/futexops.in |2 ++ 1 file changed, 2 insertions(+) diff --git a/xlat/futexops.in b/xlat/futexops.

[PATCH 5/8] futex: Use alternate form for val3 presented in hex

2016-08-29 Thread Eugene Syromyatnikov
In order to distinguish it from the cases where it is printed in decimal. * futex.c (SYS_FUNC(futex)) : use alternate form for the val3 argument. --- futex.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/futex.c b/futex.c index 6bd739f..1418c89 100644 --- a/futex.c

[PATCH 6/8] futex: Avoid printing val2 when it is not used by the command

2016-08-29 Thread Eugene Syromyatnikov
Analogous to timeout argument omitting in FUTEX_WAKE_BITSET command. * futex.c (SYS_FUNC(futex)) : Remove val2 argument printing. --- futex.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/futex.c b/futex.c index 1418c89..a49677a 100644 --- a/futex.c +++ b/futex.c @@ -

[PATCH 7/8] futex: Avoid printing val when it is not used by the command

2016-08-29 Thread Eugene Syromyatnikov
Analogous to timeout argument omitting in FUTEX_WAKE_BITSET command. * futex.c (SYS_FUNC(futex)): Remove common val argument print call, add it into specific command cases (all except FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, FUTEX_TRYLOCK_PI). --- futex.c | 14 +- 1 file changed, 13 inse

[PATCH 8/8] tests: Add test for the futex syscall

2016-08-29 Thread Eugene Syromyatnikov
* tests/futex.c: New file. * tests/futex.test: Likewise. * tests/Makefile.am (check_PROGRAMS): Add futex binary to the auxiliary programs list. (DECODER_TESTS): Add futex.test to the tests list. --- tests/Makefile.am |2 + tests/futex.c | 655 ++

Re: [PATCH 1/8] Fix FUTEX_WAKE_OP compare function mask

2016-08-29 Thread Eugene Syromyatnikov
On Mon, Aug 29, 2016 at 5:21 PM, Dmitry V. Levin wrote: > futex_atomic_op_inuser Can you please refer to the specific file where it is used for cmp operation? I've checked include/asm-generic/futex.h and arch/x86/include/asm/futex.h and haven't found any notion of usage of this flag for cmp operat

Re: [PATCH 4/8] Add xlat values for FUTEX_WAIT commands with FUTEX_CLOCK_REALTIME bit set

2016-08-29 Thread Eugene Syromyatnikov
On Mon, Aug 29, 2016 at 5:45 PM, Dmitry V. Levin wrote: > On Mon, Aug 29, 2016 at 06:12:55PM +0300, Eugene Syromyatnikov wrote: >> The support for these has been added in commit g337f130, before Linux 4.5. > > commit g337f130? Is it a septendecimal number? Sorry, I've overloo

[PATCH v2 0/7] Some futex parser tweaks and futex test

2016-08-29 Thread Eugene Syromyatnikov
on used in comments. * Futex test: instances of direct usage of magic constants replaced with appropriate macro usage (VAL/VAL_PR) * Futex test: some typo fixes, etc. * Other patches haven't been changed. Eugene Syromyatnikov (7): Fix FUTEX_WAKE_OP compare function mask futex: Add handl

[PATCH v2 1/7] Fix FUTEX_WAKE_OP compare function mask

2016-08-29 Thread Eugene Syromyatnikov
* futex.c (SYS_FUNC(futex)) : compare function does not have FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits from bit 24 to bit 27, as per both initial and current (v4.7) kernel implementations, so bring futex parser in accordance with this. --- futex.c |4 +--- 1 file changed, 1 insertion

[PATCH v2 2/7] futex: Add handling of FUTEX_FD command

2016-08-29 Thread Eugene Syromyatnikov
Since FUTEX_FD is known (and most likely reserved for the future use), albeit obsolete, it has some expected argument format, so it's probably wise to employ it. * futex.c (SYS_FUNC(futex)): add handling of FUTEX_FD command. --- futex.c |1 + 1 file changed, 1 insertion(+) diff --git a/futex

[PATCH v2 3/7] futex: Some refinement to unknown command argument formatting

2016-08-29 Thread Eugene Syromyatnikov
Several changes have been performed: * alternate form is used for timeout value since it is pointer half of the time. And half of the time it is not, which can be confusing without number base prefix. * uaddr is pointer across all existing operations, so it's rather expected that it woul

[PATCH v2 4/7] Add xlat values for FUTEX_WAIT commands with FUTEX_CLOCK_REALTIME bit set

2016-08-29 Thread Eugene Syromyatnikov
The support for these has been added in commit 337f130, before Linux 4.5. * xlat/futexops.in: add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME records. --- xlat/futexops.in |2 ++ 1 file changed, 2 insertions(+) diff --git a/xlat/futexops.in b/xlat/futexops.i

[PATCH v2 5/7] futex: Use alternate form for val3 presented in hex

2016-08-29 Thread Eugene Syromyatnikov
In order to distinguish it from the cases where it is printed in decimal. * futex.c (SYS_FUNC(futex)) : use alternate form for the val3 argument. --- futex.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/futex.c b/futex.c index 6bd739f..1418c89 100644 --- a/futex.c

[PATCH v2 6/7] futex: Avoid printing val when it is not used by the command

2016-08-29 Thread Eugene Syromyatnikov
Analogous to timeout argument omitting in FUTEX_WAKE_BITSET command. * futex.c (SYS_FUNC(futex)): Remove common val argument print call, add it into specific command cases (all except FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, FUTEX_TRYLOCK_PI). --- futex.c | 14 +- 1 file changed, 13 inse

[PATCH v2 7/7] tests: Add test for the futex syscall

2016-08-29 Thread Eugene Syromyatnikov
* tests/futex.c: New file. * tests/futex.test: Likewise. * tests/Makefile.am (check_PROGRAMS): Add futex binary to the auxiliary programs list. (DECODER_TESTS): Add futex.test to the decoder tests list. --- tests/Makefile.am |2 + tests/futex.c | 663 ++

[PATCH] futex: Remove inclusion which is not used

2016-08-30 Thread Eugene Syromyatnikov
configure script doesn't perform check for linux/futex.h presence, so HAVE_LINUX_FUTEX_H is always undefined and inclusion of system header is never performed. Moreover, this header had an incorrect definition of FUTEX_WAIT_BITSET_PRIVATE/FUTEX_WAKE_BITSET_PRIVATE in the past: from commit v2.6.24-6

[PATCH v3] tests: Add test for the futex syscall

2016-08-30 Thread Eugene Syromyatnikov
* tests/futex.c: New file. * tests/futex.test: Likewise. * tests/Makefile.am (check_PROGRAMS): Add futex. (DECODER_TESTS): Add futex.test. --- Changes since v2: * Commands not available on the old kernels (2.6.18 onwards) are wrapped in CHECK_FUTEX_ENOSYS which prevents failure in case errno

[PATCH] Refactor common sa_handler printing code

2016-08-31 Thread Eugene Syromyatnikov
* xlat/sa_handler_values.in: New file. * signal.c: Include "xlat/sa_handler_values.h". (get_sa_handler_str, print_sa_handler): New functions. (SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them. --- signal.c | 64 -

[PATCH 0/2] Test and minor printf format fix for the readahead syscall

2016-08-31 Thread Eugene Syromyatnikov
Hello. There is some initial implementation of readahead syscall decoder test. While it is implemented, it has been noticed that incorrect format is used for printing "count" argument. Eugene Syromyatnikov (2): readahead: Fix print format for the "count" argument test

[PATCH 1/2] readahead: Fix print format for the "count" argument

2016-08-31 Thread Eugene Syromyatnikov
It is size_t (according to documentation and syscalls.h), so "%lu" should be used instead of "%ld". * readahead.c (SYS_FUNC(readahead)): fix conversion specifier for the "count" argument. --- readahead.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readahead.c b/readah

[PATCH 2/2] tests: check decoding of readahead syscall

2016-08-31 Thread Eugene Syromyatnikov
* tests/readahead.c: New file. * tests/readahead.test: New test. * tests/.gitignore: Add readahead. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add readahead.test. --- Simple test for simple decoder. tests/.gitignore |1 + tests/Makefile.am|2 ++ tests/reada

[PATCH] Makefile.am: use readlink as a fallback for realpath

2016-08-31 Thread Eugene Syromyatnikov
Since realpath utility is fairly new in GNU coreutils, there could be possibility that it is not present in the system. Instead of checking its presence in configure script it probably makes sense to resort to calling readlink since it is (probably) more widespread. --- Makefile.am |3 ++- 1 f

Re: [PATCH] Makefile.am: use readlink as a fallback for realpath

2016-09-01 Thread Eugene Syromyatnikov
On Thu, Sep 1, 2016 at 9:35 AM, Dmitry V. Levin wrote: > On Thu, Sep 01, 2016 at 02:47:34AM +0300, Eugene Syromyatnikov wrote: >> Since realpath utility is fairly new in GNU coreutils, there could be >> possibility that it is not present in the system. Instead of checking >

Re: [PATCH 2/2] tests: check decoding of readahead syscall

2016-09-01 Thread Eugene Syromyatnikov
On Thu, Sep 1, 2016 at 9:39 AM, Dmitry V. Levin wrote: > On Thu, Sep 01, 2016 at 02:43:30AM +0300, Eugene Syromyatnikov wrote: >> * tests/readahead.c: New file. >> * tests/readahead.test: New test. >> * tests/.gitignore: Add readahead. >> * tests/Makefile.am

[PATCH 0/5] tests: Refactor of retstr from futex.c into a library function and updated readahead test

2016-09-01 Thread Eugene Syromyatnikov
pe of this patch set, since looks like it is fine as is. Eugene Syromyatnikov (5): tests/futex: Rename retstr to sprintrc tests/futex: Increase static sprintrc buffer size tests/futex: Add support for return codes other than 0 and -1 to sprintrc tests: Move return code printing into a sep

[PATCH 2/5] tests/futex: Increase static sprintrc buffer size

2016-09-01 Thread Eugene Syromyatnikov
* tests/futex.c (sprintrc) : Value increased from 256 to 4095. --- tests/futex.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/futex.c b/tests/futex.c index dca191e..edb5c9d 100644 --- a/tests/futex.c +++ b/tests/futex.c @@ -145,7 +145,7 @@ void invalid_op(int *val

[PATCH 1/5] tests/futex: Rename retstr to sprintrc

2016-09-01 Thread Eugene Syromyatnikov
* tests/futex.c (retstr): Rename to sprintrc, (main): Update all retstr calls to sprintrc. --- tests/futex.c | 88 + 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/tests/futex.c b/tests/futex.c index dfdf68d..dca191e 1006

[PATCH 3/5] tests/futex: Add support for return codes other than 0 and -1 to sprintrc

2016-09-01 Thread Eugene Syromyatnikov
* tests/futex.c (sprintrc): Print the actual return code provided, not just "0". --- tests/futex.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/futex.c b/tests/futex.c index edb5c9d..fb7833c 100644 --- a/tests/futex.c +++ b/tests/futex.c @@ -147,11 +1

[PATCH 4/5] tests: Move return code printing into a separate file

2016-09-01 Thread Eugene Syromyatnikov
* tests/tests.h: Add sprintrc declaration. * tests/futex.c (sprintrc): Remove. * tests/sprintrc.c: New file. * tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c. --- tests/Makefile.am |1 + tests/futex.c | 24 tests/sprintrc.c | 36 +++

[PATCH 5/5] tests: check decoding of readahead syscall

2016-09-01 Thread Eugene Syromyatnikov
* tests/readahead.c: New file. * tests/readahead.test: New test. * tests/.gitignore: Add readahead. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add readahead.test. --- tests/.gitignore |1 + tests/Makefile.am|2 ++ tests/readahead.c| 62

[PATCH v2 0/5] tests: Refactor of retstr from futex.c into a library function and updated readahead test

2016-09-02 Thread Eugene Syromyatnikov
Hello. Changes from v1: * sprintrc now takes long as rc argument since syscalls return long. * Changes in various rc values support as suggested by Dmitry. Eugene Syromyatnikov (5): tests/futex: Rename retstr to sprintrc tests/futex: Increase static sprintrc buffer size tests/futex: Add

[PATCH v2 1/5] tests/futex: Rename retstr to sprintrc

2016-09-02 Thread Eugene Syromyatnikov
* tests/futex.c (retstr): Rename to sprintstr, (main): Convert all retstr calls to sprintrc. --- tests/futex.c | 88 + 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/tests/futex.c b/tests/futex.c index dfdf68d..fe3741a 10

[PATCH v2 2/5] tests/futex: Increase static sprintrc buffer size

2016-09-02 Thread Eugene Syromyatnikov
* tests/futex.c (sprintrc) : Value increased from 256 to 4096. --- tests/futex.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/futex.c b/tests/futex.c index fe3741a..28d9df8 100644 --- a/tests/futex.c +++ b/tests/futex.c @@ -145,8 +145,7 @@ void invalid_op(int *v

[PATCH v2 3/5] tests/futex: Add support for return codes other than 0 and -1 to sprintrc

2016-09-02 Thread Eugene Syromyatnikov
* tests/futex.c (sprintrc): Print the actual return code provided, not just "0"; checks for snprintf return code added. --- tests/futex.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/futex.c b/tests/futex.c index 28d9df8..09a6c25 100644 --- a/tests/futex.

[PATCH v2 5/5] tests: check decoding of readahead syscall

2016-09-02 Thread Eugene Syromyatnikov
* tests/readahead.c: New file. * tests/readahead.test: New test. * tests/.gitignore: Add readahead. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add readahead.test. --- tests/.gitignore |1 + tests/Makefile.am|2 ++ tests/readahead.c| 62

[PATCH v2 4/5] tests: Move return code printing into a separate file

2016-09-02 Thread Eugene Syromyatnikov
* tests/tests.h: Add sprintrc declaration. * tests/futex.c (sprintrc): Remove. * tests/sprintrc.c: New file. * tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c. --- tests/Makefile.am |1 + tests/futex.c | 20 tests/sprintrc.c | 33 +++

[PATCH v3] tests: check decoding of readahead syscall

2016-09-04 Thread Eugene Syromyatnikov
* tests/readahead.c: New file. * tests/readahead.test: New test. * tests/.gitignore: Add readahead. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add readahead.test. --- Changes since v2: * Added workaround for an old glibc bug (https://sourceware.org/bugzilla/show_bug.cgi?

[PATCH v3.1] tests: check decoding of readahead syscall

2016-09-04 Thread Eugene Syromyatnikov
* tests/readahead.c: New file. * tests/readahead.test: New test. * tests/.gitignore: Add readahead. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add readahead.test. --- Changes from v3: * Scraping incorrect attempt to work around glibc bug, now just skipping the test. te

[PATCH 0/9] Minor decoder fixes and various tests amendments

2016-09-04 Thread Eugene Syromyatnikov
Hello. This is quite inconsistent collection of patches for various decoder test in attempt to make them more thorough. Eugene Syromyatnikov (9): tests: check decoding of perf_event_open syscall tests: Use sprintrc for return code output in sched_xetscheduler test tests: Additional decoder

[PATCH 1/9] tests: check decoding of perf_event_open syscall

2016-09-04 Thread Eugene Syromyatnikov
* tests/perf_event_open.c: New file. * tests/perf_event_open.test: New test. * tests/.gitignore: Add perf_event_open. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add perf_event_open.test. --- tests/.gitignore |1 + tests/Makefile.am |2 ++ tests/pe

[PATCH 3/9] tests: Additional decoder tests in sched_xetscheduler

2016-09-04 Thread Eugene Syromyatnikov
Some additional syscall parser tests: * Incorrect (negative) PID in sched_getscheduler, sched_setscheduler * Incorrect address of sched_param structure. * Incorrect policy value. * tests/sched_xetscheduler.c: additional tests. --- tests/sched_xetscheduler.c | 19 +++ 1 file c

[PATCH 4/9] tests: Use sprintrc for return code output in sched_rr_get_interval test

2016-09-04 Thread Eugene Syromyatnikov
* tests/sched_rr_get_interval.c: Use sprintrc for return code output. --- tests/sched_rr_get_interval.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/sched_rr_get_interval.c b/tests/sched_rr_get_interval.c index 8501346..73e2d39 100644 --- a/tests/sched_rr_get_inte

[PATCH 5/9] tests: Additional decoder tests in sched_rr_get_interval

2016-09-04 Thread Eugene Syromyatnikov
Some additional syscall parser tests: * Incorrect timespec pointer. * Successful call. * tests/sched_rr_get_interval.c: Additional tests. --- tests/sched_rr_get_interval.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/sched_rr_get_interval.c

[PATCH 6/9] aio: Use printfd for fd printing

2016-09-04 Thread Eugene Syromyatnikov
struct iocb contains two fields with fd semantics: aio_fildes and aio_resfd. It is quite reasonable to use appropriate function for printing them (apart from just "%d"). * aio.c (print_common_flags): Add struct tcb pointer to parameter list; use printfd for printing aio_resfd field. (print_ioc

[PATCH 9/9] tests: Some additional aio checks

2016-09-04 Thread Eugene Syromyatnikov
* aio.c: Additional checks added. --- tests/aio.c | 108 +++ 1 file changed, 108 insertions(+) diff --git a/tests/aio.c b/tests/aio.c index 8c5bfa7..00de5ae 100644 --- a/tests/aio.c +++ b/tests/aio.c @@ -111,6 +111,33 @@ main(void)

[PATCH 7/9] tests: Use sprintrc for return code output in aio test

2016-09-04 Thread Eugene Syromyatnikov
* tests/aio.c: Use sprintrc for return code output. --- tests/aio.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/aio.c b/tests/aio.c index a6a3b9c..5a023cf 100644 --- a/tests/aio.c +++ b/tests/aio.c @@ -147,8 +147,8 @@ main(void) printf("io_setup(%u,

[PATCH 2/9] tests: Use sprintrc for return code output in sched_xetscheduler test

2016-09-04 Thread Eugene Syromyatnikov
* tests/sched_xetscheduler.c: Use sprintrc for return code output. --- tests/sched_xetscheduler.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sched_xetscheduler.c b/tests/sched_xetscheduler.c index d3b7759..ffb3307 100644 --- a/tests/sched_xetscheduler.c +++ b/

[PATCH 8/9] tests: min_nr and nr arguments in io_getevents should be long

2016-09-04 Thread Eugene Syromyatnikov
* aio.c (main): change output format for min_nr and nr arguments in io_getevents check to %ld, cast arguments to long. --- tests/aio.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/aio.c b/tests/aio.c index 5a023cf..8c5bfa7 100644 --- a/tests/aio.c +++ b/tests/

[PATCH v2] Makefile.am: use dirname as a fallback for realpath

2016-09-05 Thread Eugene Syromyatnikov
Since realpath utility is fairly new in GNU coreutils, there could be possibility that it is not present in the system. Instead of checking its presence in configure script it probably makes sense to fall back to dirname call since it is more widespread. Initial implementation utilized readlink in

[PATCH v2] tests: check decoding of perf_event_open syscall

2016-09-05 Thread Eugene Syromyatnikov
* tests/perf_event_open.c: New file. * tests/perf_event_open.test: New test. * tests/.gitignore: Add perf_event_open. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add perf_event_open.test. --- Changes since v1: * HAVE_LINUX_PERF_EVENT_H check added for strange cases where

[PATCH v2] tests: Some additional aio checks

2016-09-05 Thread Eugene Syromyatnikov
* aio.c: Additional checks added. --- Changes since v1: * All io_submit checks now use long as second argument, last io_submit check now always passes positive nr value. * Additional decoder checks reworked a bit in order to increase coverage. tests/aio.c | 137 ++

[PATCH 3/7] tests: Add sprintrc_grep function

2016-09-05 Thread Eugene Syromyatnikov
sprintrc_grep function is sprintrc function equivalent suitable for tests where grep-base pattern matching is employed. * tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration. (sprintrc_ex): New function, renamed from sprintrc with updates regarding support of different format

[PATCH 1/7] tests: Split long lines in sched_xetattr test

2016-09-05 Thread Eugene Syromyatnikov
--- tests/sched_xetattr.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/sched_xetattr.c b/tests/sched_xetattr.c index b437b04..b982cca 100644 --- a/tests/sched_xetattr.c +++ b/tests/sched_xetattr.c @@ -54,7 +54,10 @@ main(void) if (syscall(__NR_sche

[PATCH 2/7] tests: Perform more strict structure allocation in sched_xetattr test

2016-09-05 Thread Eugene Syromyatnikov
tail_alloc with precise size of the structure is used now. * tests/sched_xetattr.c: Eliminate usage of anonymous union type; rename sched to sched_attr; change type of sched_attr to struct pointer; use tail_alloc for sched_attr allocation; update printf statements accrodingly. --- tests/sch

[PATCH 0/7] Minor tests tweaks pt. 2

2016-09-05 Thread Eugene Syromyatnikov
Hello. This time, mostly sched_xetattr tweaks. Another notable changes are new sprintrc_grep function and additional shmget check. Eugene Syromyatnikov (7): tests: Split long lines in sched_xetattr test tests: Perform more strict structure allocation in sched_xetattr test tests: Add

[PATCH 4/7] tests: Additional shmget decoder checks

2016-09-05 Thread Eugene Syromyatnikov
* tests/ipc_shm.c: Additional checks for shmget syscall decoding. --- tests/ipc_shm.c | 20 1 file changed, 20 insertions(+) diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c index 54723e2..80a8f0f 100644 --- a/tests/ipc_shm.c +++ b/tests/ipc_shm.c @@ -27,11 +27,15 @@ */

[PATCH 7/7] tests: Additional sched_getattr/sched_setattr decoder checks

2016-09-05 Thread Eugene Syromyatnikov
* tests/sched_xetattr.c: Additional checs for sched_getattr and sched_setattr decoding. --- tests/sched_xetattr.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/tests/sched_xetattr.c b/tests/sched_xetattr.c index 9ff8c72..ce5c417 100644 --- a/t

[PATCH 6/7] tests: Print size argument of sched_setattr as unsigned

2016-09-05 Thread Eugene Syromyatnikov
Since it is how it is declared. * tests/sched_xetattr.c: Cast size of struct sched_attr to unsigned, update format specifier accordingly. --- tests/sched_xetattr.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sched_xetattr.c b/tests/sched_xetattr.c index 2e0c

[PATCH 5/7] tests: Change type of sched_nice field to signed in sched_xetattr test

2016-09-05 Thread Eugene Syromyatnikov
Kernel headers declare this field as s32, and strace prints it with %d specifier. * tests/sched_xetattr.c: Change type of sched_nice field of struct sched_attr to int32_t, update format specifiers accordingly. --- tests/sched_xetattr.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions

[PATCH 0/2] Additional checks for IPC tests

2016-09-07 Thread Eugene Syromyatnikov
Hello. I've noticed that IPC tests do not check first parameter (IPC ID) enough which allowed incorrect format specifier usage. These patches augment tests with regard to aforementioned issue and correct illicit behaviour. Eugene Syromyatnikov (2): tests: Additional IPC checks Change ty

[PATCH 1/2] tests: Additional IPC checks

2016-09-07 Thread Eugene Syromyatnikov
* tests/ipc_msg.c: Additional msgget (parameter format), msgctl (parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT commands) checks. * tests/ipc_sem.c: Additional semget, semctl checks. * tests/ipc_shm.c: Additional shmctl checks. * tests/semop.c: Additional semop checks. Added

[PATCH 2/2] Change type of the format specifier from "%lu" to "%d" for IPC ID

2016-09-07 Thread Eugene Syromyatnikov
* ipc_msgctl.c (SYS_FUNC(msgctl)): Convert format specifier of the first argument from "%lu" to "%d", cast argument to int. * ipc_sem.c (SYS_FUNC(semop)): Likewise. (SYS_FUNC(semtimedop)): Likewise. (SYS_FUNC(semget)): Likewise. * ipc_shm.c (SYS_FUNC(shmat)): Likewise. * ipc_shmctl.c (SYS_FUN

[PATCH v2 1/9] Change type of the format specifier from "%lu" to "%d" for IPC ID

2016-09-08 Thread Eugene Syromyatnikov
* ipc_msgctl.c (SYS_FUNC(msgctl)): Convert format specifier of the first argument from "%lu" to "%d", cast argument to int. * ipc_sem.c (SYS_FUNC(semop)): Likewise. (SYS_FUNC(semtimedop)): Likewise. (SYS_FUNC(semget)): Likewise. * ipc_shm.c (SYS_FUNC(shmat)): Likewise. * ipc_shmctl.c (SYS_FUN

[PATCH v2 2/9] Fix key_t argument printing in IPC *get calls

2016-09-08 Thread Eugene Syromyatnikov
key_t is actually int. * ipc_msg.c (SYS_FUNC(msgget)): Change format specifier of the first argument to "%#x". * ipc_sem.c (SYS_FUNC(semget)): Likewise. * ipc_shm (SYS_FUNC(shmget)): Likewise. --- ipc_msg.c |5 +++-- ipc_sem.c |5 +++-- ipc_shm.c |5 +++-- 3 files changed, 9 inserti

[PATCH v2 0/9] Minor tests tweaks pt. 2 + Additional checks for IPC tests

2016-09-08 Thread Eugene Syromyatnikov
f decoding checks. * Invalid addresses are now made more invalid in order to avoid accidental decoding. Eugene Syromyatnikov (9): Change type of the format specifier from "%lu" to "%d" for IPC ID Fix key_t argument printing in IPC *get calls tests: Split long lines in

[PATCH v2 5/9] tests: Add sprintrc_grep function

2016-09-08 Thread Eugene Syromyatnikov
sprintrc_grep function is sprintrc function equivalent suitable for tests where grep-base pattern matching is employed. * tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration. (sprintrc_ex): New function, renamed from sprintrc with updates regarding support of different format

[PATCH v2 7/9] tests: Print size argument of sched_setattr as unsigned

2016-09-08 Thread Eugene Syromyatnikov
Since it is how it is declared. * tests/sched_xetattr.c: Cast size of struct sched_attr to unsigned, update format specifier accordingly. --- tests/sched_xetattr.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sched_xetattr.c b/tests/sched_xetattr.c index 2e0c

[PATCH v2 4/9] tests: Perform more strict structure allocation in sched_xetattr test

2016-09-08 Thread Eugene Syromyatnikov
tail_alloc with precise size of the structure is used now. * tests/sched_xetattr.c: Eliminate usage of anonymous union type; rename sched to sched_attr; change type of sched_attr to struct pointer; use tail_alloc for sched_attr allocation; update printf statements accrodingly. --- tests/sch

[PATCH v2 3/9] tests: Split long lines in sched_xetattr test

2016-09-08 Thread Eugene Syromyatnikov
--- tests/sched_xetattr.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/sched_xetattr.c b/tests/sched_xetattr.c index b437b04..b982cca 100644 --- a/tests/sched_xetattr.c +++ b/tests/sched_xetattr.c @@ -54,7 +54,10 @@ main(void) if (syscall(__NR_sche

[PATCH v2 6/9] tests: Change type of sched_nice field to signed in sched_xetattr test

2016-09-08 Thread Eugene Syromyatnikov
Kernel headers declare this field as s32, and strace prints it with %d specifier. * tests/sched_xetattr.c: Change type of sched_nice field of struct sched_attr to int32_t, update format specifiers accordingly. --- tests/sched_xetattr.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions

[PATCH v2 8/9] tests: Additional sched_getattr/sched_setattr decoder checks

2016-09-08 Thread Eugene Syromyatnikov
* tests/sched_xetattr.c: Additional checs for sched_getattr and sched_setattr decoding. --- tests/sched_xetattr.c | 43 +++ 1 file changed, 43 insertions(+) diff --git a/tests/sched_xetattr.c b/tests/sched_xetattr.c index 9ff8c72..ce5c417 100644 --- a/t

[PATCH v2 9/9] tests: Additional IPC checks

2016-09-08 Thread Eugene Syromyatnikov
* tests/ipc_msg.c: Additional msgget (parameter format), msgctl (parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT commands) checks. * tests/ipc_sem.c: Additional semget, semctl checks. * tests/ipc_shm.c: Additional shmget, shmctl checks. * tests/semop.c: Additional semop checks

[PATCH v3 0/2] Aditional checks for IPC tests

2016-09-12 Thread Eugene Syromyatnikov
Changes since v2: * Workaround for musl which sets size argument in shmget call to SIZE_MAX if it is greater than PTRDIFF_MAX. * Fix pattern for indirect semctl call. * Added workaround for broken msgctl call with faulty pointer in third argument on PPC64. Eugene Syromyatnikov (2

[PATCH v3 1/2] tests: Additional IPC checks

2016-09-12 Thread Eugene Syromyatnikov
* tests/ipc_msg.c: Additional msgget (parameter format), msgctl (parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT commands) checks. * tests/ipc_sem.c: Additional semget, semctl checks. * tests/ipc_shm.c: Additional shmget, shmctl checks. * tests/semop.c: Additional semop checks

[PATCH v3 2/2] tests: Workaroud for buggy glibc in ipc_msg test on ppc64

2016-09-12 Thread Eugene Syromyatnikov
glibc before 2.23 (glibc-2.22-122-gbe48165? to be more precise) tried to access data pointed by third argument of msgctl call on 64-bit PowerPC which led to segmentataion fault (instead of EFAULT from kernel). * tests/ipc_msg.c (BROKEN_GLIBC): new macro. (main): test for incorrect third argument

Re: [PATCH v3 2/2] tests: Workaroud for buggy glibc in ipc_msg test on ppc64

2016-09-13 Thread Eugene Syromyatnikov
On Tue, Sep 13, 2016 at 7:32 AM, Andreas Schwab wrote: > On Sep 13 2016, Eugene Syromyatnikov > wrote: > >> glibc before 2.23 (glibc-2.22-122-gbe48165? to be more precise) tried to >> access >> data pointed by third argument of msgctl call on 64-bit PowerPC which le

[PATCH v4] tests: Additional IPC checks

2016-09-13 Thread Eugene Syromyatnikov
* tests/ipc_msg.c: Additional msgget (parameter format), msgctl (parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT commands) checks. * tests/ipc_sem.c: Additional semget, semctl checks. * tests/ipc_shm.c: Additional shmget, shmctl checks. * tests/semop.c: Additional semop checks

[PATCH 00/12] quotactl decoder tests and minor fixes

2016-09-20 Thread Eugene Syromyatnikov
exiting and it isn't possible to reliably enforce syscall to return success (file system with quota enabled and CAP_SYS_ADMIN are among requirements for this to work). Eugene Syromyatnikov (12): quota: Display quota command as a macro quota: Use printuid for id parameter printing quota:

[PATCH 01/12] quota: Display quota command as a macro

2016-09-20 Thread Eugene Syromyatnikov
* quota.c (SYS_FUNC(quotactl)): Replace disjunction of two xlat values (which also lacks shift of left part) with a macro call. --- quota.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quota.c b/quota.c index 0a388b2..9f18c0d 100644 --- a/quota.c +++ b/quota.c @@ -

[PATCH 04/12] quota: Remove additional indentation inside command dispatching switch statement

2016-09-20 Thread Eugene Syromyatnikov
--- quota.c | 638 +++ 1 file changed, 319 insertions(+), 319 deletions(-) diff --git a/quota.c b/quota.c index 495bd5f..68f8a79 100644 --- a/quota.c +++ b/quota.c @@ -215,380 +215,380 @@ static int decode_cmd_data(struct tcb *tcp, uin

[PATCH 02/12] quota: Use printuid for id parameter printing

2016-09-20 Thread Eugene Syromyatnikov
* quota.c (SYS_FUNC(quotactl)): since id call argument is used for user/group/project ID which all have special semantics for -1, it looks reasonable to print it the same way as UIDs are printed. --- quota.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quota.c b/quo

[PATCH 03/12] quota: Avoid printing id for the commands which are known to ignore it

2016-09-20 Thread Eugene Syromyatnikov
id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO, Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF, Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, Q_V2_GETSTATS subcommands, so it makes sense to avoid printing it. * quota.c (decode_cmd_data):

[PATCH 06/12] quota: Add dispatch of SYNC subcommands

2016-09-20 Thread Eugene Syromyatnikov
Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway. * quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand dispatch switch since id/addr arguments for these subcommands are known to be ignored. --- quota.c |2 ++ 1 file changed, 2 insertions(+) diff -

[PATCH 05/12] quota: Add missing prefixes to struct field names

2016-09-20 Thread Eugene Syromyatnikov
* quota.c (decode_cmd_data): Print field names in accordance with their definition. --- quota.c | 191 --- 1 file changed, 98 insertions(+), 93 deletions(-) diff --git a/quota.c b/quota.c index 68f8a79..1e1597f 100644 --- a/quota.c ++

[PATCH 09/12] quota: Remove legacy command decoding support code

2016-09-20 Thread Eugene Syromyatnikov
Support for these commands has been dropped long ago (before 2.6.12 and around 2.4.22 as stated by related man page), so it is decided to drop it in order to minimize amount of code which should be subjected to testing and structured conversion. * quota.c: Drop support for decoding of obsolete Q_V

[PATCH 08/12] quota: Add packed attribute to struct if_dqblk definition

2016-09-20 Thread Eugene Syromyatnikov
Since the only difference between 32-bit and 64-bit environments regarding this structure is its padding, it has been decided to just add packed attribute to it instead of going full mpers. * quota.c: Add ATTRIBUTE_PACKED to struct if_dqblk definition. --- quota.c |6 +- 1 file changed, 5

[PATCH 07/12] quota: Add decoding for Q_XQUOTARM subcommand

2016-09-20 Thread Eugene Syromyatnikov
* quota.c (decode_cmd_data): Add Q_XQUOTARM handling to subcommand switch. --- quota.c | 13 + 1 file changed, 13 insertions(+) diff --git a/quota.c b/quota.c index 53730d1..905fece 100644 --- a/quota.c +++ b/quota.c @@ -591,6 +591,19 @@ decode_cmd_data(struct tcb *tcp, uint32_t i

[PATCH 11/12] tests: Add support for providing program arguments

2016-09-20 Thread Eugene Syromyatnikov
* tests/init.sh (run_strace_match_diff): Add support for providing arguments to program via the PROG_ARGS environment variable. --- tests/init.sh |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/init.sh b/tests/init.sh index 46a08f9..e37fb20 100644 --- a/tests/init

[PATCH 10/12] quota: Add realtime block limits fields to XFS disk quota printing code

2016-09-20 Thread Eugene Syromyatnikov
* quota.c (decode_cmd_data): Add printing of d_rtb_hardlimit and d_rtb_softlimit fields to struct xfs_dqblk printing code. --- quota.c |4 1 file changed, 4 insertions(+) diff --git a/quota.c b/quota.c index bc55638..24370d4 100644 --- a/quota.c +++ b/quota.c @@ -269,6 +269,10 @@ decod

[PATCH 12/12] tests: Add tests for the quotactl syscall

2016-09-20 Thread Eugene Syromyatnikov
* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, sys/quota.h. * tests/.gitignore: Add quotactl, quotactl-xfs * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add quotactl.test, quotactl-v.test, quotactl-xfs.test, quotactl-xfs-v.test. (EXTRA_DIST): quotactl.h * quotact

[PATCH 02/11] tests: Avoid filling with the same values in ioctl_block test

2016-09-21 Thread Eugene Syromyatnikov
* tests/ioctl.block (init_magic): Add iterator value to fill magic value in order to enable detection of possible 4-byte aligned shifts. --- tests/ioctl_block.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ioctl_block.c b/tests/ioctl_block.c index 3dc030d..bac9f68

[PATCH 01/11] tests: Additional getcwd checks

2016-09-21 Thread Eugene Syromyatnikov
* tests/getcwd.c: Additional checks for getcwd arguments decoding. --- tests/getcwd.c |8 1 file changed, 8 insertions(+) diff --git a/tests/getcwd.c b/tests/getcwd.c index 704a315..e4a791f 100644 --- a/tests/getcwd.c +++ b/tests/getcwd.c @@ -13,6 +13,14 @@ main(void) { long

  1   2   3   4   >