]> git.hungrycats.org Git - linux/commitdiff
security/seclvl.c: fix time wrap (CVE-2005-4352)
authorAdrian Bunk <bunk@stusta.de>
Fri, 17 Nov 2006 16:42:43 +0000 (17:42 +0100)
committerAdrian Bunk <bunk@stusta.de>
Fri, 17 Nov 2006 16:42:43 +0000 (17:42 +0100)
initlvl=2 in seclvl gives the guarantee
"Cannot decrement the system time".

But it was possible to set the time to the maximum unixtime value
(19 Jan 2038) resulting in a wrap to the minimum value.

This patch fixes this by disallowing setting the time to any date
after 2030 with initlvl=2.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
security/seclvl.c

index 8529ea6f7aa83437174727478988702d4e9db89b..8ebe647b587da5dff818441ea9d3f7efe5f96320 100644 (file)
@@ -381,6 +381,8 @@ static int seclvl_settime(struct timespec *tv, struct timezone *tz)
                                      current->group_leader->pid);
                        return -EPERM;
                }               /* if attempt to decrement time */
+               if (tv->tv_sec > 1924988400)    /* disallow dates after 2030) */
+                       return -EPERM;          /* CVE-2005-4352 */
        }                       /* if seclvl > 1 */
        return 0;
 }