lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a75c40636be267163dc30b5a6a2442089628e57.camel@axis.com>
Date:   Mon, 23 Oct 2023 07:08:58 +0000
From:   Vincent Whitchurch <Vincent.Whitchurch@...s.com>
To:     "johannes@...solutions.net" <johannes@...solutions.net>,
        Vincent Whitchurch <Vincent.Whitchurch@...s.com>,
        "anton.ivanov@...bridgegreys.com" <anton.ivanov@...bridgegreys.com>,
        "richard@....at" <richard@....at>
CC:     "linux-um@...ts.infradead.org" <linux-um@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        kernel <kernel@...s.com>
Subject: Re: [PATCH] um: time-travel: fix time going backwards

On Fri, 2023-10-20 at 16:47 +0200, Vincent Whitchurch wrote:
> In basic time travel mode, I sometimes see "time goes backwards" panics
> like the one below:
> 
>  Kernel panic: time-travel: time goes backwards 161689340000492 -> 161689339869814
>  Call Trace:
>   panic+0x1a1/0x3d7
>   time_travel_update_time.cold+0xe9/0x133
>   timer_read+0xc1/0x100
>   ktime_get+0x10c/0x200
>   copy_process+0x1899/0x2230
>   kernel_clone+0x57/0x7a0
>   kernel_thread+0x4a/0x50
>   kthreadd+0x116/0x190
> 
> The problem is a race between time_travel_handle_real_alarm() and
> timer_read().  time_travel_handle_real_alarm() changes the time after
> time_read() reads the current time but before time_travel_update_time()
> has had a chance to add the end event.
> 
> Fix this by doing the time read and event add atomically with respect to
> time_travel_handle_real_alarm().

Further testing resulted in hitting the BUG_ON(time_travel_time !=
e->time) so looks like this needs some more work.  

 BUG: failure at arch/um/kernel/time.c:409/time_travel_update_to_event()!
 Kernel panic - not syncing: BUG!
 CPU: 0 PID: 1 Comm: swapper Not tainted 6.5.0+ #13
 Stack:
  624db908 60a06c60 41b58ab3 60ae2398
  6003fb90 10000c1e577c 41b58ab3 60b419ae
  607f0dc0 00000000 00000000 6005b270
 Call Trace:
  [<607fad5d>] show_stack.cold+0xc0/0x149
  [<60841364>] dump_stack_lvl+0x75/0x94
  [<6084139d>] dump_stack+0x1a/0x1c
  [<607fca1d>] panic+0x27e/0x490
  [<607fb093>] time_travel_update_to_event.cold+0x89/0x18b
  [<60041317>] time_travel_forward_time.constprop.0+0xf7/0x160
  [<600414f1>] timer_read+0x171/0x1b0
  [<60140652>] random_get_entropy_fallback+0x42/0x60
  [<60545943>] add_device_randomness+0x73/0xf0
  [<6003a685>] do_one_initcall+0x145/0x3b0
  [<60002598>] 0x60002598
  [<60843ac5>] kernel_init+0x4a/0x195
  [<6003d111>] new_thread_handler+0x141/0x1a0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ