[PATCH] um: time-travel: fix time going backwards

Vincent Whitchurch Vincent.Whitchurch at axis.com
Wed Oct 25 04:55:02 PDT 2023


On Mon, 2023-10-23 at 09:33 +0200, Johannes Berg wrote:
> Do you have a specific workload that tends to reproduce this?

I've been seeing it when running roadtest, but it's easily reproducible
without that by using the attached config and the following program as
init.

  cp repro.config .config
  make ARCH=um olddefconfig all
  gcc -Wall -static -o repro repro.c
  ./linux time-travel init=$PWD/repro rootfstype=hostfs

With the above commands I usually see the panic in a few seconds.  This
is on an unmodified v6.6-rc7.

----8<-------
#include <time.h>
#include <pthread.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

int main(void)
{
        if (fork() == 0) {
                while (1) {
                        nanosleep(&(struct timespec){.tv_nsec = 330 * 1000}, NULL);
                }
                return 0;
        }
        
        while (1) {
                struct timespec ts;
                clock_gettime(CLOCK_MONOTONIC, &ts);
                nanosleep(&(struct timespec){.tv_nsec = 22 * 1000}, NULL);
        }
        
        return 0;
}       
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: repro.config
URL: <http://lists.infradead.org/pipermail/linux-um/attachments/20231025/cb7d7e0f/attachment-0001.ksh>


More information about the linux-um mailing list