Skip to contentSkip to conversation

the scheduled -EINVAL for invalid timevals in setitimer

PATCH In review Adrian Bunk 3 participants 5 messages Apr 6, 2007 – Apr 21, 2007 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 the scheduled -EINVAL for invalid timevals in setitimer

As scheduled, do_setitimer() now returns -EINVAL for invalid timeval.

---

 Documentation/feature-removal-schedule.txt |   12 ----
 kernel/itimer.c                            |   58 ---------------------
 2 files changed, 2 insertions(+), 68 deletions(-)
Documentation/feature-removal-schedule.txt renamed from Documentation/feature-removal-schedule.txt.old +0 -12
@@ -104,18 +104,6 @@ Who:    Adrian Bunk <[email protected]>
 
 ---------------------------
 
-What:	Usage of invalid timevals in setitimer
-When:	March 2007
-Why:	POSIX requires to validate timevals in the setitimer call. This
-	was never done by Linux. The invalid (e.g. negative timevals) were
-	silently converted to more or less random timeouts and intervals.
-	Until the removal a per boot limited number of warnings is printed
-	and the timevals are sanitized.
-
-Who:	Thomas Gleixner <[email protected]>
-
----------------------------
-
 What:	Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports
 	(temporary transition config option provided until then)
 	The transition config option will also be removed at the same time.
kernel/itimer.c renamed from kernel/itimer.c.old +2 -56

76 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · Adrian Bunk

As scheduled, do_setitimer() now returns -EINVAL for invalid timeval.

Ha, you beat me by a minute :)

kernel/itimer.c int do_setitimer(int which, struct itime · line 157

Quoted 4 lines
kernel/itimer.c renamed from kernel/itimer.c.old +2 -1
-	check_itimerval(value);
+	if (unlikely(!timeval_valid(&value->it_value) || !timeval_valid(&value->it_interval)))
+		return -EINVAL;

Please make this:

+ if (!timeval_valid(&value->it_value) ||
+ !timeval_valid(&value->it_interval))
+ return -EINVAL;

tglx

#2 lore raw

PATCH 1/1 the scheduled -EINVAL for invalid timevals in setitimer

Quoted 14 lines · Thomas Gleixner
Quoted 3 lines · Adrian Bunk

As scheduled, do_setitimer() now returns -EINVAL for invalid timeval.

Ha, you beat me by a minute :)

Review

Quoted 4 lines
(quoted diff) +2 -1
-	check_itimerval(value);
+	if (unlikely(!timeval_valid(&value->it_value) || !timeval_valid(&value->it_interval)))
+		return -EINVAL;

Please make this:

Review

Quoted 3 lines
(quoted diff) +3 -0
+       if (!timeval_valid(&value->it_value) ||
+           !timeval_valid(&value->it_interval))
+               return -EINVAL;

Updated patch below.

Quoted 1 line

tglx

cu
Adrian

<-- snip -->

As scheduled, do_setitimer() now returns -EINVAL for invalid timeval.

---

 Documentation/feature-removal-schedule.txt |   12 ----
 kernel/itimer.c                            |   59 +--------------------
 2 files changed, 3 insertions(+), 68 deletions(-)

As scheduled, do_setitimer() now returns -EINVAL for invalid timeval.

---

 Documentation/feature-removal-schedule.txt |   12 ----
 kernel/itimer.c                            |   58 ---------------------
 2 files changed, 2 insertions(+), 68 deletions(-)
Documentation/feature-removal-schedule.txt renamed from Documentation/feature-removal-schedule.txt.old +0 -12
@@ -104,18 +104,6 @@ Who:    Adrian Bunk <[email protected]>
 
 ---------------------------
 
-What:	Usage of invalid timevals in setitimer
-When:	March 2007
-Why:	POSIX requires to validate timevals in the setitimer call. This
-	was never done by Linux. The invalid (e.g. negative timevals) were
-	silently converted to more or less random timeouts and intervals.
-	Until the removal a per boot limited number of warnings is printed
-	and the timevals are sanitized.
-
-Who:	Thomas Gleixner <[email protected]>
-
----------------------------
-
 What:	Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports
 	(temporary transition config option provided until then)
 	The transition config option will also be removed at the same time.
kernel/itimer.c renamed from kernel/itimer.c.old +3 -56

77 lines not on this page · raw message