|
Message-ID: <003901ce208c$17367c00$45a37400$@yahoo.com> Date: Thu, 14 Mar 2013 09:15:27 +0100 From: "Costin Enache" <e_costin@...oo.com> To: <john-dev@...ts.openwall.com> Subject: clock err in timers (alarm, status ...) and fix HI, John uses for the alarm, status, save and probably other timers the sysconf(_SC_CLK_TCK) value, which, at least on Linux, is hard coded to a value of 100. This means that the timers do not really work. On my system, an abort timer set at 10 sec will abort after approx. 8 seconds. It is ok to use the clock ticks value for timer polling (puts no additional stress on the system), but the ticks cannot be used as seconds. I suggest the follwing mods against the bleeding or similar, to fix the abort and status timers (for me works fine): john.c @@ -815,10 +821,11 @@ static void john_done(void) { + unsigned int time = status_get_time(); if ((options.flags & (FLG_CRACKING_CHK | FLG_STDOUT)) == FLG_CRACKING_CHK) { if (event_abort) - log_event(timer_abort ? + log_event((time < timer_abort) ? "Session aborted" : "Session stopped (max run-time reached)"); signals.c @@ -49,6 +49,7 @@ #include "config.h" #include "options.h" #include "bench.h" +#include "status.h" volatile int event_pending = 0; volatile int event_abort = 0, event_save = 0, event_status = 0; @@ -154,11 +155,12 @@ void check_abort(int be_async_signal_safe) { if (!event_abort) return; + unsigned int time = status_get_time(); tty_done(); if (be_async_signal_safe) { - if (timer_abort) + if (time < timer_abort) write_loop(2, "Session aborted\n", 16); else write_loop(2, "Session stopped (max run-time reached)\n", 39); @@ -171,7 +173,7 @@ _exit(1); } - fprintf(stderr, "Session %s\n", timer_abort ? + fprintf(stderr, "Session %s\n", (time < timer_abort) ? "aborted" : "stopped (max run-time reached)"); error(); } @@ -273,6 +275,7 @@ static void sig_handle_timer(int signum) { + unsigned int time = status_get_time(); int saved_errno = errno; if (!--timer_save_value) { @@ -281,13 +284,13 @@ event_save = event_pending = 1; } - if (!--timer_abort) + if(time >= timer_abort) event_abort = event_pending = 1; #ifndef BENCH_BUILD - if (!--timer_status) { + if(time >= timer_status) { event_status = event_pending = 1; - timer_status = options.status_interval; + timer_status += options.status_interval; } #endif Costin Content of type "text/html" skipped Download attachment "smime.p7s" of type "application/pkcs7-signature" (6579 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.