* [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value
@ 2014-08-20 8:46 Jan Stancek
2014-08-20 8:57 ` Wanlong Gao
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Stancek @ 2014-08-20 8:46 UTC (permalink / raw)
To: ltp-list
Before kernel validates that fd is valid, it checks itimerspec struct
with timespec_valid(). This struct is currently not initialised in test,
which can cause failures, for example:
timerfd_settime01 1 TFAIL : timerfd_settime01.c:121: timerfd_settime()
failed unexpectedly; expected: 9 - Bad file
descriptor: TEST_ERRNO=EINVAL(22): Invalid argument
timerfd_settime01 2 TFAIL : timerfd_settime01.c:121: timerfd_settime()
failed unexpectedly; expected: 14 - Bad address:
TEST_ERRNO=EINVAL(22): Invalid argument
Fix this by giving fields in this struct some deterministic values
(zero in this patch).
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../kernel/syscalls/timerfd/timerfd_settime01.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
index d12e40a..a1b04a5 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
@@ -58,6 +58,7 @@ static void setup(void);
static void timerfd_settime_verify(const struct test_case_t *);
static void cleanup(void);
static int exp_enos[] = { EBADF, EFAULT, EINVAL, 0 };
+static struct itimerspec new_value;
int main(int argc, char *argv[])
{
@@ -103,7 +104,6 @@ static void setup(void)
static void timerfd_settime_verify(const struct test_case_t *test)
{
- struct itimerspec new_value;
TEST(timerfd_settime(*test->fd, test->flags, &new_value,
test->old_value));
--
1.7.1
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value
2014-08-20 8:46 [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value Jan Stancek
@ 2014-08-20 8:57 ` Wanlong Gao
2014-08-20 10:22 ` Zeng Linggang
2014-08-20 14:04 ` chrubis
2 siblings, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2014-08-20 8:57 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On 08/20/2014 04:46 PM, Jan Stancek wrote:
> Before kernel validates that fd is valid, it checks itimerspec struct
> with timespec_valid(). This struct is currently not initialised in test,
> which can cause failures, for example:
>
> timerfd_settime01 1 TFAIL : timerfd_settime01.c:121: timerfd_settime()
> failed unexpectedly; expected: 9 - Bad file
> descriptor: TEST_ERRNO=EINVAL(22): Invalid argument
> timerfd_settime01 2 TFAIL : timerfd_settime01.c:121: timerfd_settime()
> failed unexpectedly; expected: 14 - Bad address:
> TEST_ERRNO=EINVAL(22): Invalid argument
>
> Fix this by giving fields in this struct some deterministic values
> (zero in this patch).
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
> .../kernel/syscalls/timerfd/timerfd_settime01.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> index d12e40a..a1b04a5 100644
> --- a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> +++ b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> @@ -58,6 +58,7 @@ static void setup(void);
> static void timerfd_settime_verify(const struct test_case_t *);
> static void cleanup(void);
> static int exp_enos[] = { EBADF, EFAULT, EINVAL, 0 };
> +static struct itimerspec new_value;
>
> int main(int argc, char *argv[])
> {
> @@ -103,7 +104,6 @@ static void setup(void)
>
> static void timerfd_settime_verify(const struct test_case_t *test)
> {
> - struct itimerspec new_value;
> TEST(timerfd_settime(*test->fd, test->flags, &new_value,
> test->old_value));
>
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value
2014-08-20 8:46 [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value Jan Stancek
2014-08-20 8:57 ` Wanlong Gao
@ 2014-08-20 10:22 ` Zeng Linggang
2014-08-20 14:04 ` chrubis
2 siblings, 0 replies; 4+ messages in thread
From: Zeng Linggang @ 2014-08-20 10:22 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
On Wed, 2014-08-20 at 10:46 +0200, Jan Stancek wrote:
> Before kernel validates that fd is valid, it checks itimerspec struct
> with timespec_valid(). This struct is currently not initialised in test,
> which can cause failures, for example:
Thank you for pointing out this.
Best regards,
Zeng
>
> timerfd_settime01 1 TFAIL : timerfd_settime01.c:121: timerfd_settime()
> failed unexpectedly; expected: 9 - Bad file
> descriptor: TEST_ERRNO=EINVAL(22): Invalid argument
> timerfd_settime01 2 TFAIL : timerfd_settime01.c:121: timerfd_settime()
> failed unexpectedly; expected: 14 - Bad address:
> TEST_ERRNO=EINVAL(22): Invalid argument
>
> Fix this by giving fields in this struct some deterministic values
> (zero in this patch).
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> .../kernel/syscalls/timerfd/timerfd_settime01.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> index d12e40a..a1b04a5 100644
> --- a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> +++ b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> @@ -58,6 +58,7 @@ static void setup(void);
> static void timerfd_settime_verify(const struct test_case_t *);
> static void cleanup(void);
> static int exp_enos[] = { EBADF, EFAULT, EINVAL, 0 };
> +static struct itimerspec new_value;
>
> int main(int argc, char *argv[])
> {
> @@ -103,7 +104,6 @@ static void setup(void)
>
> static void timerfd_settime_verify(const struct test_case_t *test)
> {
> - struct itimerspec new_value;
> TEST(timerfd_settime(*test->fd, test->flags, &new_value,
> test->old_value));
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value
2014-08-20 8:46 [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value Jan Stancek
2014-08-20 8:57 ` Wanlong Gao
2014-08-20 10:22 ` Zeng Linggang
@ 2014-08-20 14:04 ` chrubis
2 siblings, 0 replies; 4+ messages in thread
From: chrubis @ 2014-08-20 14:04 UTC (permalink / raw)
To: Jan Stancek; +Cc: ltp-list
Hi!
> Before kernel validates that fd is valid, it checks itimerspec struct
> with timespec_valid(). This struct is currently not initialised in test,
> which can cause failures, for example:
>
> timerfd_settime01 1 TFAIL : timerfd_settime01.c:121: timerfd_settime()
> failed unexpectedly; expected: 9 - Bad file
> descriptor: TEST_ERRNO=EINVAL(22): Invalid argument
> timerfd_settime01 2 TFAIL : timerfd_settime01.c:121: timerfd_settime()
> failed unexpectedly; expected: 14 - Bad address:
> TEST_ERRNO=EINVAL(22): Invalid argument
>
> Fix this by giving fields in this struct some deterministic values
> (zero in this patch).
I've reproduced the failure and tested the fix.
Tested and acked.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-20 14:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 8:46 [LTP] [PATCH] timerfd_settime01: initialise itimerspec new_value Jan Stancek
2014-08-20 8:57 ` Wanlong Gao
2014-08-20 10:22 ` Zeng Linggang
2014-08-20 14:04 ` chrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.