timer_migration interface accepts any number as input in 2.6.30-git9
Subsystems (3)
Hi
Timer migration interface /proc/sys/kernel/timer_migration in 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 > /proc/sys/kernel/timer_migration
2. cat /proc/sys/kernel/timer_migration
-6666666
1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration
2. cat /proc/sys/kernel/timer_migration
-1357789412
Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
Regards
Poornima
Quoted 13 lines · poornima nayak
Hi
Timer migration interface
/proc/sys/kernel/timer_migrationin 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 >/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-66666661. echo 44444444444444444444444444444444444444444444444444444444444 >
/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-1357789412
Quoted 6 lines
Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
Regards
Poornima
Hi Poornima,
Thanks for reporting the bug.
Hope this patch removes the bug.
The patch is based against the latest -tip/master.
--arun
--- kernel/sysctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/sysctl.c +4 -1
@@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, },#endif {
Amerigo Wang
Reviewed-byQuoted 24 lines · Arun R Bharadwaj
Quoted 13 lines · poornima nayak
Hi
Timer migration interface
/proc/sys/kernel/timer_migrationin 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 >/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-66666661. echo 44444444444444444444444444444444444444444444444444444444444 >
/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-1357789412Quoted 6 lines
Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
Regards
PoornimaHi Poornima,
Quoted 8 lines
Thanks for reporting the bug.
Hope this patch removes the bug.
The patch is based against the latest -tip/master.--arun
Signed-off-by Arun R Bharadwaj <[email protected]>
My fix goes further, the further part of it is shown below. :) Mind to have a look?
Not tested yet.
-----
kernel/sysctl.c +2 -1
@@ -2331,7 +2331,8 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,if (*p <'0' || *p >'9' )break ; - lval =simple_strtoul (p, &p,0 ); +if (strict_strtoul (p,0 , &lval)) +return -EINVAL ; len = p-buf;if ((len < left) && *p && !isspace (*p))
lib/vsprintf.c +3 -0
@@ -163,11 +163,14 @@ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)char *tail;unsigned long val;size_t len; +char tmp[32 ]; *res =0 ; len =strlen (cp);if (len ==0 )return -EINVAL ; +if (len >snprintf (tmp,"%ld" ,ULONG_MAX )) +return -EINVAL ; val =simple_strtoul (cp, &tail, base);if (tail == cp)
Quoted 9 lines · poornima nayak
Hi
Timer migration interface
/proc/sys/kernel/timer_migrationin 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 >/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-6666666
Quoted 7 lines
1. echo 44444444444444444444444444444444444444444444444444444444444 >
/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-1357789412Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
Is this patch fix your problem:
[PATCH] kernel/sysctl: fix timer migration interface
Timer migration interface /proc/sys/kernel/timer_migration in 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 > /proc/sys/kernel/timer_migration
2. cat /proc/sys/kernel/timer_migration
-6666666
1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration
2. cat /proc/sys/kernel/timer_migration
-1357789412
Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
--- kernel/sysctl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
kernel/sysctl.c +4 -1
@@ -334,7 +334,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, },#endif {
Signature · 1 line
1.6.0.6
Hi Arun,
Patch given by you fixes the reported bug.
Regds
Poornima
Quoted 57 lines · Arun R Bharadwaj
Quoted 13 lines · poornima nayak
Hi
Timer migration interface
/proc/sys/kernel/timer_migrationin 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 >/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-66666661. echo 44444444444444444444444444444444444444444444444444444444444 >
/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-1357789412Quoted 6 lines
Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
Regards
PoornimaHi Poornima,
Thanks for reporting the bug.
Hope this patch removes the bug.
The patch is based against the latest -tip/master.--arun
Signed-off-by Arun R Bharadwaj <[email protected]>--- kernel/sysctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Index:
linux.trees.git/kernel/sysctl.c
===================================================================kernel/sysctl.c +4
-2@@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, },#endif { --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Arun R Bharadwaj
Tested-by Poornima NayakQuoted 6 lines · poornima nayak
Hi Arun,
Patch given by you fixes the reported bug.
Regds
Poornima
Hi Ingo,
Can you please include this minor interface bug fix for timer migration?
thanks,
--- kernel/sysctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/sysctl.c +4 -1
@@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, },#endif {
Quoted 59 lines · Arun R Bharadwaj
Quoted 57 lines · poornima nayak
Quoted 14 lines
Hi
Timer migration interface
/proc/sys/kernel/timer_migrationin 2.6.30-git9 accepts any numerical value as input. Steps to reproduce
1. echo -6666666 >/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-66666661. echo 44444444444444444444444444444444444444444444444444444444444 >
/proc/sys/kernel/timer_migration
2. cat/proc/sys/kernel/timer_migration
-1357789412Quoted 6 lines
Expected behavior: Should 'echo: write error: Invalid argument' while setting any value other then 0 & 1
Regards
PoornimaHi Poornima,
Thanks for reporting the bug.
Hope this patch removes the bug.
The patch is based against the latest -tip/master.--arun
Signed-off-by Arun R Bharadwaj <[email protected]>--- kernel/sysctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)Index:
linux.trees.git/kernel/sysctl.c
===================================================================kernel/sysctl.c +4
-2@@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, },#endif { --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[tip:timers/urgent] timers: Fix timer_migration interface which accepts any number as input
Commit-ID: bfdb4d9f0f611687d71cf6a460efc9e755f4a462 Gitweb: http://git.kernel.org/tip/bfdb4d9f0f611687d71cf6a460efc9e755f4a462 Author: Arun R Bharadwaj <[email protected]> AuthorDate: Tue, 23 Jun 2009 10:00:58 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 23 Jun 2009 10:49:33 +0200
timers: Fix timer_migration interface which accepts any number as input
Poornima Nayek reported:
| Timer migration interface /proc/sys/kernel/timer_migration in | 2.6.30-git9 accepts any numerical value as input. | | Steps to reproduce: | 1. echo -6666666 > /proc/sys/kernel/timer_migration | 2. cat /proc/sys/kernel/timer_migration | -6666666 | | 1. echo 44444444444444444444444444444444444444444444444444444444444 > /proc/sys/kernel/timer_migration | 2. cat /proc/sys/kernel/timer_migration | -1357789412 | | Expected behavior: Should 'echo: write error: Invalid argument' while | setting any value other then 0 & 1
Restrict valid values to 0 and 1.
LKML-Reference: <[email protected]>
--- kernel/sysctl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
kernel/sysctl.c +4 -1
@@ -335,7 +335,10 @@ static struct ctl_table kern_table[] = { .data = &sysctl_timer_migration, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = &proc_dointvec, + .proc_handler = &proc_dointvec_minmax, + .strategy = &sysctl_intvec, + .extra1 = &zero, + .extra2 = &one, },#endif {