Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1314624 > unrolled thread
| Started by | John Stultz <john.stultz@linaro.org> |
|---|---|
| First post | 2016-01-22 00:10 +0100 |
| Last post | 2016-01-22 16:00 +0100 |
| Articles | 9 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] Fix for ADJ_SETOFFSET w/ ADJ_NANO John Stultz <john.stultz@linaro.org> - 2016-01-22 00:10 +0100
[PATCH 1/2] ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO John Stultz <john.stultz@linaro.org> - 2016-01-22 00:10 +0100
[tip:timers/urgent] ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO tip-bot for John Stultz <tipbot@zytor.com> - 2016-01-22 12:10 +0100
Re: [PATCH 1/2] ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO David Herrmann <dh.herrmann@gmail.com> - 2016-01-22 12:10 +0100
[PATCH 2/2] kselftests: timers: Add adjtimex SETOFFSET validity tests John Stultz <john.stultz@linaro.org> - 2016-01-22 00:10 +0100
[tip:timers/urgent] kselftests: timers: Add adjtimex SETOFFSET validity tests tip-bot for John Stultz <tipbot@zytor.com> - 2016-01-26 16:50 +0100
Re: [PATCH 0/2] Fix for ADJ_SETOFFSET w/ ADJ_NANO Shuah Khan <shuahkh@osg.samsung.com> - 2016-01-22 00:20 +0100
Re: [PATCH 0/2] Fix for ADJ_SETOFFSET w/ ADJ_NANO Thomas Gleixner <tglx@linutronix.de> - 2016-01-22 09:00 +0100
Re: [PATCH 0/2] Fix for ADJ_SETOFFSET w/ ADJ_NANO Shuah Khan <shuahkh@osg.samsung.com> - 2016-01-22 16:00 +0100
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2016-01-22 00:10 +0100 |
| Subject | [PATCH 0/2] Fix for ADJ_SETOFFSET w/ ADJ_NANO |
| Message-ID | <qTwwz-3Hx-37@gated-at.bofh.it> |
David Herrmann mailed me pointing out that one of the changes that landed in 4.5-rc broke users of ADJ_SETOFFSET when used with ADJ_NANO. I've implemented a fix to this issue and also introduced more unit tests to validate these going forward. Thomas: Can you queue the first patch for tip/timers/urgent? Shuah: The kselftests patch can wait to the next merge window if you'd prefer. Let me know if you have any thoughts or objections! thanks -john Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Harald Hoyer <harald@redhat.com> Cc: Kay Sievers <kay@vrfy.org> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> John Stultz (2): ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO kselftests: timers: Add adjtimex SETOFFSET validity tests kernel/time/ntp.c | 14 ++- tools/testing/selftests/timers/valid-adjtimex.c | 139 +++++++++++++++++++++++- 2 files changed, 150 insertions(+), 3 deletions(-) -- 1.9.1
[toc] | [next] | [standalone]
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2016-01-22 00:10 +0100 |
| Subject | [PATCH 1/2] ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO |
| Message-ID | <qTwwz-3Hx-43@gated-at.bofh.it> |
| In reply to | #1314624 |
Recently, in commit 37cf4dc3370f
("time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow")
I forgot to check if the timeval being passed was actually a
timespec (as is signaled with ADJ_NANO).
This resulted in that patch breaking ADJ_SETOFFSET users who set
ADJ_NANO, by rejecting valid timespecs that were compared with
valid timeval ranges.
This patch addresses this by checking for the ADJ_NANO flag and
using the timepsec check instead in that case.
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
Cc: Kay Sievers <kay@vrfy.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Reported-by: Harald Hoyer <harald@redhat.com>
Reported-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
kernel/time/ntp.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 36f2ca0..6df8927 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -685,8 +685,18 @@ int ntp_validate_timex(struct timex *txc)
if (!capable(CAP_SYS_TIME))
return -EPERM;
- if (!timeval_inject_offset_valid(&txc->time))
- return -EINVAL;
+ if (txc->modes & ADJ_NANO) {
+ struct timespec ts;
+
+ ts.tv_sec = txc->time.tv_sec;
+ ts.tv_nsec = txc->time.tv_usec;
+ if (!timespec_inject_offset_valid(&ts))
+ return -EINVAL;
+
+ } else {
+ if (!timeval_inject_offset_valid(&txc->time))
+ return -EINVAL;
+ }
}
/*
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for John Stultz <tipbot@zytor.com> |
|---|---|
| Date | 2016-01-22 12:10 +0100 |
| Subject | [tip:timers/urgent] ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO |
| Message-ID | <qTHLk-3dT-31@gated-at.bofh.it> |
| In reply to | #1314625 |
Commit-ID: dd4e17ab704269bce71402285f5e8b9ac24b1eff
Gitweb: http://git.kernel.org/tip/dd4e17ab704269bce71402285f5e8b9ac24b1eff
Author: John Stultz <john.stultz@linaro.org>
AuthorDate: Thu, 21 Jan 2016 15:03:34 -0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 22 Jan 2016 12:01:42 +0100
ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO
Recently, in commit 37cf4dc3370f I forgot to check if the timeval being passed
was actually a timespec (as is signaled with ADJ_NANO).
This resulted in that patch breaking ADJ_SETOFFSET users who set
ADJ_NANO, by rejecting valid timespecs that were compared with
valid timeval ranges.
This patch addresses this by checking for the ADJ_NANO flag and
using the timepsec check instead in that case.
Reported-by: Harald Hoyer <harald@redhat.com>
Reported-by: Kay Sievers <kay@vrfy.org>
Fixes: 37cf4dc3370f "time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow"
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Link: http://lkml.kernel.org/r/1453417415-19110-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/time/ntp.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 36f2ca0..6df8927 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -685,8 +685,18 @@ int ntp_validate_timex(struct timex *txc)
if (!capable(CAP_SYS_TIME))
return -EPERM;
- if (!timeval_inject_offset_valid(&txc->time))
- return -EINVAL;
+ if (txc->modes & ADJ_NANO) {
+ struct timespec ts;
+
+ ts.tv_sec = txc->time.tv_sec;
+ ts.tv_nsec = txc->time.tv_usec;
+ if (!timespec_inject_offset_valid(&ts))
+ return -EINVAL;
+
+ } else {
+ if (!timeval_inject_offset_valid(&txc->time))
+ return -EINVAL;
+ }
}
/*
[toc] | [prev] | [next] | [standalone]
| From | David Herrmann <dh.herrmann@gmail.com> |
|---|---|
| Date | 2016-01-22 12:10 +0100 |
| Subject | Re: [PATCH 1/2] ntp: Fix ADJ_SETOFFSET being used w/ ADJ_NANO |
| Message-ID | <qTHLl-3dT-39@gated-at.bofh.it> |
| In reply to | #1314625 |
Hi
On Fri, Jan 22, 2016 at 12:03 AM, John Stultz <john.stultz@linaro.org> wrote:
> Recently, in commit 37cf4dc3370f
> ("time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow")
> I forgot to check if the timeval being passed was actually a
> timespec (as is signaled with ADJ_NANO).
>
> This resulted in that patch breaking ADJ_SETOFFSET users who set
> ADJ_NANO, by rejecting valid timespecs that were compared with
> valid timeval ranges.
>
> This patch addresses this by checking for the ADJ_NANO flag and
> using the timepsec check instead in that case.
>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Prarit Bhargava <prarit@redhat.com>
> Cc: Harald Hoyer <harald@redhat.com>
> Cc: Kay Sievers <kay@vrfy.org>
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Reported-by: Harald Hoyer <harald@redhat.com>
> Reported-by: Kay Sievers <kay@vrfy.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
Thanks for picking this up. Looks good to me:
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Thanks
David
> ---
> kernel/time/ntp.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
> index 36f2ca0..6df8927 100644
> --- a/kernel/time/ntp.c
> +++ b/kernel/time/ntp.c
> @@ -685,8 +685,18 @@ int ntp_validate_timex(struct timex *txc)
> if (!capable(CAP_SYS_TIME))
> return -EPERM;
>
> - if (!timeval_inject_offset_valid(&txc->time))
> - return -EINVAL;
> + if (txc->modes & ADJ_NANO) {
> + struct timespec ts;
> +
> + ts.tv_sec = txc->time.tv_sec;
> + ts.tv_nsec = txc->time.tv_usec;
> + if (!timespec_inject_offset_valid(&ts))
> + return -EINVAL;
> +
> + } else {
> + if (!timeval_inject_offset_valid(&txc->time))
> + return -EINVAL;
> + }
> }
>
> /*
> --
> 1.9.1
>
[toc] | [prev] | [next] | [standalone]
| From | John Stultz <john.stultz@linaro.org> |
|---|---|
| Date | 2016-01-22 00:10 +0100 |
| Subject | [PATCH 2/2] kselftests: timers: Add adjtimex SETOFFSET validity tests |
| Message-ID | <qTwwA-3Hx-49@gated-at.bofh.it> |
| In reply to | #1314624 |
Add some simple tests to check both valid and invalid
offsets when using adjtimex's ADJ_SETOFFSET method.
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
Cc: Kay Sievers <kay@vrfy.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
tools/testing/selftests/timers/valid-adjtimex.c | 139 +++++++++++++++++++++++-
1 file changed, 138 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
index e86d937..60fe3c5 100644
--- a/tools/testing/selftests/timers/valid-adjtimex.c
+++ b/tools/testing/selftests/timers/valid-adjtimex.c
@@ -45,7 +45,17 @@ static inline int ksft_exit_fail(void)
}
#endif
-#define NSEC_PER_SEC 1000000000L
+#define NSEC_PER_SEC 1000000000LL
+#define USEC_PER_SEC 1000000LL
+
+#define ADJ_SETOFFSET 0x0100
+
+#include <sys/syscall.h>
+static int clock_adjtime(clockid_t id, struct timex *tx)
+{
+ return syscall(__NR_clock_adjtime, id, tx);
+}
+
/* clear NTP time_status & time_state */
int clear_time_state(void)
@@ -193,10 +203,137 @@ out:
}
+int set_offset(long long offset, int use_nano)
+{
+ struct timex tmx = {};
+ int ret;
+
+ tmx.modes = ADJ_SETOFFSET;
+ if (use_nano) {
+ tmx.modes |= ADJ_NANO;
+
+ tmx.time.tv_sec = offset / NSEC_PER_SEC;
+ tmx.time.tv_usec = offset % NSEC_PER_SEC;
+
+ if (offset < 0 && tmx.time.tv_usec) {
+ tmx.time.tv_sec -= 1;
+ tmx.time.tv_usec += NSEC_PER_SEC;
+ }
+ } else {
+ tmx.time.tv_sec = offset / USEC_PER_SEC;
+ tmx.time.tv_usec = offset % USEC_PER_SEC;
+
+ if (offset < 0 && tmx.time.tv_usec) {
+ tmx.time.tv_sec -= 1;
+ tmx.time.tv_usec += USEC_PER_SEC;
+ }
+ }
+
+ ret = clock_adjtime(CLOCK_REALTIME, &tmx);
+ if (ret < 0) {
+ printf("(sec: %ld usec: %ld) ", tmx.time.tv_sec, tmx.time.tv_usec);
+ printf("[FAIL]\n");
+ return -1;
+ }
+ return 0;
+}
+
+int set_bad_offset(long sec, long usec, int use_nano)
+{
+ struct timex tmx = {};
+ int ret;
+
+ tmx.modes = ADJ_SETOFFSET;
+ if (use_nano)
+ tmx.modes |= ADJ_NANO;
+
+ tmx.time.tv_sec = sec;
+ tmx.time.tv_usec = usec;
+ ret = clock_adjtime(CLOCK_REALTIME, &tmx);
+ if (ret >= 0) {
+ printf("Invalid (sec: %ld usec: %ld) did not fail! ", tmx.time.tv_sec, tmx.time.tv_usec);
+ printf("[FAIL]\n");
+ return -1;
+ }
+ return 0;
+}
+
+int validate_set_offset(void)
+{
+ printf("Testing ADJ_SETOFFSET... ");
+
+ /* Test valid values */
+ if (set_offset(NSEC_PER_SEC - 1, 1))
+ return -1;
+
+ if (set_offset(-NSEC_PER_SEC + 1, 1))
+ return -1;
+
+ if (set_offset(-NSEC_PER_SEC - 1, 1))
+ return -1;
+
+ if (set_offset(5 * NSEC_PER_SEC, 1))
+ return -1;
+
+ if (set_offset(-5 * NSEC_PER_SEC, 1))
+ return -1;
+
+ if (set_offset(5 * NSEC_PER_SEC + NSEC_PER_SEC / 2, 1))
+ return -1;
+
+ if (set_offset(-5 * NSEC_PER_SEC - NSEC_PER_SEC / 2, 1))
+ return -1;
+
+ if (set_offset(USEC_PER_SEC - 1, 0))
+ return -1;
+
+ if (set_offset(-USEC_PER_SEC + 1, 0))
+ return -1;
+
+ if (set_offset(-USEC_PER_SEC - 1, 0))
+ return -1;
+
+ if (set_offset(5 * USEC_PER_SEC, 0))
+ return -1;
+
+ if (set_offset(-5 * USEC_PER_SEC, 0))
+ return -1;
+
+ if (set_offset(5 * USEC_PER_SEC + USEC_PER_SEC / 2, 0))
+ return -1;
+
+ if (set_offset(-5 * USEC_PER_SEC - USEC_PER_SEC / 2, 0))
+ return -1;
+
+ /* Test invalid values */
+ if (set_bad_offset(0, -1, 1))
+ return -1;
+ if (set_bad_offset(0, -1, 0))
+ return -1;
+ if (set_bad_offset(0, 2 * NSEC_PER_SEC, 1))
+ return -1;
+ if (set_bad_offset(0, 2 * USEC_PER_SEC, 0))
+ return -1;
+ if (set_bad_offset(0, NSEC_PER_SEC, 1))
+ return -1;
+ if (set_bad_offset(0, USEC_PER_SEC, 0))
+ return -1;
+ if (set_bad_offset(0, -NSEC_PER_SEC, 1))
+ return -1;
+ if (set_bad_offset(0, -USEC_PER_SEC, 0))
+ return -1;
+
+ printf("[OK]\n");
+ return 0;
+}
+
int main(int argc, char **argv)
{
if (validate_freq())
return ksft_exit_fail();
+ if (validate_set_offset())
+ return ksft_exit_fail();
+
return ksft_exit_pass();
}
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for John Stultz <tipbot@zytor.com> |
|---|---|
| Date | 2016-01-26 16:50 +0100 |
| Subject | [tip:timers/urgent] kselftests: timers: Add adjtimex SETOFFSET validity tests |
| Message-ID | <qVe2t-67x-7@gated-at.bofh.it> |
| In reply to | #1314626 |
Commit-ID: e03a58c320e1103ebe97bda8ebdfcc5c9829c53f
Gitweb: http://git.kernel.org/tip/e03a58c320e1103ebe97bda8ebdfcc5c9829c53f
Author: John Stultz <john.stultz@linaro.org>
AuthorDate: Thu, 21 Jan 2016 15:03:35 -0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 26 Jan 2016 16:26:06 +0100
kselftests: timers: Add adjtimex SETOFFSET validity tests
Add some simple tests to check both valid and invalid
offsets when using adjtimex's ADJ_SETOFFSET method.
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
Cc: Kay Sievers <kay@vrfy.org>
Cc: David Herrmann <dh.herrmann@gmail.com>
Link: http://lkml.kernel.org/r/1453417415-19110-3-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
tools/testing/selftests/timers/valid-adjtimex.c | 139 +++++++++++++++++++++++-
1 file changed, 138 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
index e86d937..60fe3c5 100644
--- a/tools/testing/selftests/timers/valid-adjtimex.c
+++ b/tools/testing/selftests/timers/valid-adjtimex.c
@@ -45,7 +45,17 @@ static inline int ksft_exit_fail(void)
}
#endif
-#define NSEC_PER_SEC 1000000000L
+#define NSEC_PER_SEC 1000000000LL
+#define USEC_PER_SEC 1000000LL
+
+#define ADJ_SETOFFSET 0x0100
+
+#include <sys/syscall.h>
+static int clock_adjtime(clockid_t id, struct timex *tx)
+{
+ return syscall(__NR_clock_adjtime, id, tx);
+}
+
/* clear NTP time_status & time_state */
int clear_time_state(void)
@@ -193,10 +203,137 @@ out:
}
+int set_offset(long long offset, int use_nano)
+{
+ struct timex tmx = {};
+ int ret;
+
+ tmx.modes = ADJ_SETOFFSET;
+ if (use_nano) {
+ tmx.modes |= ADJ_NANO;
+
+ tmx.time.tv_sec = offset / NSEC_PER_SEC;
+ tmx.time.tv_usec = offset % NSEC_PER_SEC;
+
+ if (offset < 0 && tmx.time.tv_usec) {
+ tmx.time.tv_sec -= 1;
+ tmx.time.tv_usec += NSEC_PER_SEC;
+ }
+ } else {
+ tmx.time.tv_sec = offset / USEC_PER_SEC;
+ tmx.time.tv_usec = offset % USEC_PER_SEC;
+
+ if (offset < 0 && tmx.time.tv_usec) {
+ tmx.time.tv_sec -= 1;
+ tmx.time.tv_usec += USEC_PER_SEC;
+ }
+ }
+
+ ret = clock_adjtime(CLOCK_REALTIME, &tmx);
+ if (ret < 0) {
+ printf("(sec: %ld usec: %ld) ", tmx.time.tv_sec, tmx.time.tv_usec);
+ printf("[FAIL]\n");
+ return -1;
+ }
+ return 0;
+}
+
+int set_bad_offset(long sec, long usec, int use_nano)
+{
+ struct timex tmx = {};
+ int ret;
+
+ tmx.modes = ADJ_SETOFFSET;
+ if (use_nano)
+ tmx.modes |= ADJ_NANO;
+
+ tmx.time.tv_sec = sec;
+ tmx.time.tv_usec = usec;
+ ret = clock_adjtime(CLOCK_REALTIME, &tmx);
+ if (ret >= 0) {
+ printf("Invalid (sec: %ld usec: %ld) did not fail! ", tmx.time.tv_sec, tmx.time.tv_usec);
+ printf("[FAIL]\n");
+ return -1;
+ }
+ return 0;
+}
+
+int validate_set_offset(void)
+{
+ printf("Testing ADJ_SETOFFSET... ");
+
+ /* Test valid values */
+ if (set_offset(NSEC_PER_SEC - 1, 1))
+ return -1;
+
+ if (set_offset(-NSEC_PER_SEC + 1, 1))
+ return -1;
+
+ if (set_offset(-NSEC_PER_SEC - 1, 1))
+ return -1;
+
+ if (set_offset(5 * NSEC_PER_SEC, 1))
+ return -1;
+
+ if (set_offset(-5 * NSEC_PER_SEC, 1))
+ return -1;
+
+ if (set_offset(5 * NSEC_PER_SEC + NSEC_PER_SEC / 2, 1))
+ return -1;
+
+ if (set_offset(-5 * NSEC_PER_SEC - NSEC_PER_SEC / 2, 1))
+ return -1;
+
+ if (set_offset(USEC_PER_SEC - 1, 0))
+ return -1;
+
+ if (set_offset(-USEC_PER_SEC + 1, 0))
+ return -1;
+
+ if (set_offset(-USEC_PER_SEC - 1, 0))
+ return -1;
+
+ if (set_offset(5 * USEC_PER_SEC, 0))
+ return -1;
+
+ if (set_offset(-5 * USEC_PER_SEC, 0))
+ return -1;
+
+ if (set_offset(5 * USEC_PER_SEC + USEC_PER_SEC / 2, 0))
+ return -1;
+
+ if (set_offset(-5 * USEC_PER_SEC - USEC_PER_SEC / 2, 0))
+ return -1;
+
+ /* Test invalid values */
+ if (set_bad_offset(0, -1, 1))
+ return -1;
+ if (set_bad_offset(0, -1, 0))
+ return -1;
+ if (set_bad_offset(0, 2 * NSEC_PER_SEC, 1))
+ return -1;
+ if (set_bad_offset(0, 2 * USEC_PER_SEC, 0))
+ return -1;
+ if (set_bad_offset(0, NSEC_PER_SEC, 1))
+ return -1;
+ if (set_bad_offset(0, USEC_PER_SEC, 0))
+ return -1;
+ if (set_bad_offset(0, -NSEC_PER_SEC, 1))
+ return -1;
+ if (set_bad_offset(0, -USEC_PER_SEC, 0))
+ return -1;
+
+ printf("[OK]\n");
+ return 0;
+}
+
int main(int argc, char **argv)
{
if (validate_freq())
return ksft_exit_fail();
+ if (validate_set_offset())
+ return ksft_exit_fail();
+
return ksft_exit_pass();
}
[toc] | [prev] | [next] | [standalone]
| From | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| Date | 2016-01-22 00:20 +0100 |
| Message-ID | <qTwGe-3KM-13@gated-at.bofh.it> |
| In reply to | #1314624 |
On 01/21/2016 04:03 PM, John Stultz wrote: > David Herrmann mailed me pointing out that one of the > changes that landed in 4.5-rc broke users of ADJ_SETOFFSET > when used with ADJ_NANO. > > I've implemented a fix to this issue and also introduced > more unit tests to validate these going forward. > > Thomas: Can you queue the first patch for tip/timers/urgent? > > Shuah: The kselftests patch can wait to the next merge window > if you'd prefer. Yeah. Probably it has to wait until the next merge window as this is a new test. I can pull this into linux-kselftest next after merge window closes. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shuahkh@osg.samsung.com | (970) 217-8978
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2016-01-22 09:00 +0100 |
| Message-ID | <qTENr-Wu-5@gated-at.bofh.it> |
| In reply to | #1314635 |
On Thu, 21 Jan 2016, Shuah Khan wrote: > On 01/21/2016 04:03 PM, John Stultz wrote: > > David Herrmann mailed me pointing out that one of the > > changes that landed in 4.5-rc broke users of ADJ_SETOFFSET > > when used with ADJ_NANO. > > > > I've implemented a fix to this issue and also introduced > > more unit tests to validate these going forward. > > > > Thomas: Can you queue the first patch for tip/timers/urgent? > > > > Shuah: The kselftests patch can wait to the next merge window > > if you'd prefer. > > Yeah. Probably it has to wait until the next merge window as > this is a new test. I can pull this into linux-kselftest next > after merge window closes. We really should not delay selftests, especially if they have been written along with a fix for a recently detected problem. Thanks, tglx
[toc] | [prev] | [next] | [standalone]
| From | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| Date | 2016-01-22 16:00 +0100 |
| Message-ID | <qTLlV-5r6-21@gated-at.bofh.it> |
| In reply to | #1314808 |
On 01/22/2016 12:54 AM, Thomas Gleixner wrote: > On Thu, 21 Jan 2016, Shuah Khan wrote: >> On 01/21/2016 04:03 PM, John Stultz wrote: >>> David Herrmann mailed me pointing out that one of the >>> changes that landed in 4.5-rc broke users of ADJ_SETOFFSET >>> when used with ADJ_NANO. >>> >>> I've implemented a fix to this issue and also introduced >>> more unit tests to validate these going forward. >>> >>> Thomas: Can you queue the first patch for tip/timers/urgent? >>> >>> Shuah: The kselftests patch can wait to the next merge window >>> if you'd prefer. >> >> Yeah. Probably it has to wait until the next merge window as >> this is a new test. I can pull this into linux-kselftest next >> after merge window closes. > > We really should not delay selftests, especially if they have been written > along with a fix for a recently detected problem. > Thomas, Yes. That is why I have "probably" in my response. Could you please fold this test in with your urgent fix, so they can go in together. Acked-by: Shuah Khan <shuahkh@osg.samsung.com> thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shuahkh@osg.samsung.com | (970) 217-8978
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web