The migration status during the race condition is
not 'active' (which is expected to have RAM info, but didn't)
but 'setup' (which is not, thus no issues).
(qemu) info migrate
-updates:
...
Migration status: active
total time: 0 ms
-proposed:
...
Migration status: setup
total time: 0 ms
(gdb) b migrate_set_state
...
Breakpoint 1 at 0x47ed10: migrate_set_state. (2 locations)
(gdb) b migration/migration.c:1103
...
Breakpoint 2 at 0x47dba0: file ../../migration/migration.c, line 1103.
(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333,server,wait=off
Terminal 3)
nc 127.0.0.1 3333
(qemu) migrate -d tcp:127.0.0.1:4444
Terminal 2)
Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x555556779618, old_state=0, new_state=1) at ../../migration/migration.c:1763
(gdb) p (MigrationStatus) 0
$1 = MIGRATION_STATUS_NONE
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_STATUS_SETUP
(gdb) c
Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state=0x555556779618, old_state=1, new_state=4) at ../../migration/migration.c:1763
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_STATUS_SETUP
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_STATUS_ACTIVE
Terminal 3)
(qemu) info migrate
Terminal 2)
Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1103
(gdb) p (MigrationStatus) s.state
$6 = MIGRATION_STATUS_SETUP
(gdb) p info.status
$7 = MIGRATION_STATUS_NONE
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7ffff6c32340 (LWP 2368) "qemu-system-x86" fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1103
2 Thread 0x7ffff65ff6c0 (LWP 2369) "qemu-system-x86" (running)
3 Thread 0x7ffff5d7c6c0 (LWP 2370) "qemu-system-x86" (running)
5 Thread 0x7ffff49ff6c0 (LWP 2373) "qemu-system-x86" migrate_set_state (state=0x555556779618, old_state=1, new_state=4) at ../../migration/migration.c:1763
(gdb) thread 5
(gdb) continue &
(gdb) info threads
Id Target Id Frame
1 Thread 0x7ffff6c32340 (LWP 2368) "qemu-system-x86" fill_source_migration_info (info=0x555556dc6c60) at ../../migration/migration.c:1103
2 Thread 0x7ffff65ff6c0 (LWP 2369) "qemu-system-x86" (running)
3 Thread 0x7ffff5d7c6c0 (LWP 2370) "qemu-system-x86" (running)
* 5 Thread 0x7ffff49ff6c0 (LWP 2373) "qemu-system-x86" (running)
(gdb) thread 1
(gdb) p (MigrationStatus) s.state
$8 = MIGRATION_STATUS_ACTIVE
(gdb) c
Terminal 3)
...
Migration status: active
total time: 0 ms
(qemu)
Migration status is active, without any RAM statistics.
(qemu) quit
(gdb) quit
Terminal 1)
Ctrl-C
...
Packages from -proposed: PASS
-----------------------
$ sudo add-apt-repository -yp proposed
$ sudo add-apt-repository -ys # didn't work for proposed
$ echo 'deb-src http://archive.ubuntu.com/ubuntu kinetic-proposed main' | sudo tee -a /etc/apt/sources.list
(gdb) b migrate_set_state
...
Breakpoint 1 at 0x47ed20: migrate_set_state. (2 locations)
(gdb) b migration/migration.c:1104
...
Breakpoint 2 at 0x47dbc3: file ../../migration/migration.c, line 1104.
Verification done on kinetic-proposed.
The migration status during the race condition is
not 'active' (which is expected to have RAM info, but didn't)
but 'setup' (which is not, thus no issues).
(qemu) info migrate
-updates:
...
Migration status: active
total time: 0 ms
-proposed:
...
Migration status: setup
total time: 0 ms
Detailed steps:
==============
$ lxc launch ubuntu:kinetic qemu-k
$ lxc exec qemu-k -- su - ubuntu
Packages from -updates: FAIL ------- ------- -
-------
$ sudo apt install --yes --no-install- recommends qemu-system-x86 gdb dpkg-dev
$ dpkg -s qemu-system-x86 | grep Version: 7ubuntu2. 1
Version: 1:7.0+dfsg-
...
Source: get line number for breakpoint.
$ sudo add-apt-repository -ys
$ apt source qemu
$ head -n1 qemu-*/ debian/ changelog dfsg-7ubuntu2. 1) kinetic-security; urgency=medium
qemu (1:7.0+
$ vim qemu-*/ migration/ migration. c
1073 static void fill_source_ migration_ info(MigrationI nfo *info) STATUS_ SETUP:
1074 {
...
1100 case MIGRATION_
...
1103 break;
...
...
Terminal 1)
$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444
Terminal 2)
gdb \ /debuginfod. ubuntu. com' \ system- x86_64
-ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' \
-iex 'set debuginfod enabled on' -iex 'set debuginfod urls https:/
qemu-
(gdb) b migrate_set_state migration. c:1103 /migration. c, line 1103.
...
Breakpoint 1 at 0x47ed10: migrate_set_state. (2 locations)
(gdb) b migration/
...
Breakpoint 2 at 0x47dba0: file ../../migration
(gdb) run -nodefaults -nographic -S -monitor tcp:0:3333, server, wait=off
Terminal 3)
nc 127.0.0.1 3333
(qemu) migrate -d tcp:127.0.0.1:4444
Terminal 2)
Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state= 0x555556779618, old_state=0, new_state=1) at ../../migration /migration. c:1763
(gdb) p (MigrationStatus) 0 STATUS_ NONE STATUS_ SETUP
$1 = MIGRATION_
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_
(gdb) c
Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state= 0x555556779618, old_state=1, new_state=4) at ../../migration /migration. c:1763
(gdb) p (MigrationStatus) 1 STATUS_ SETUP STATUS_ ACTIVE
$3 = MIGRATION_
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_
Terminal 3)
(qemu) info migrate
Terminal 2)
Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_ migration_ info (info=0x555556d c6c60) at ../../migration /migration. c:1103
(gdb) p (MigrationStatus) s.state STATUS_ SETUP STATUS_ NONE
$6 = MIGRATION_
(gdb) p info.status
$7 = MIGRATION_
(gdb) info threads migration_ info (info=0x555556d c6c60) at ../../migration /migration. c:1103 0x555556779618, old_state=1, new_state=4) at ../../migration /migration. c:1763
Id Target Id Frame
* 1 Thread 0x7ffff6c32340 (LWP 2368) "qemu-system-x86" fill_source_
2 Thread 0x7ffff65ff6c0 (LWP 2369) "qemu-system-x86" (running)
3 Thread 0x7ffff5d7c6c0 (LWP 2370) "qemu-system-x86" (running)
5 Thread 0x7ffff49ff6c0 (LWP 2373) "qemu-system-x86" migrate_set_state (state=
(gdb) thread 5
(gdb) continue &
(gdb) info threads migration_ info (info=0x555556d c6c60) at ../../migration /migration. c:1103
Id Target Id Frame
1 Thread 0x7ffff6c32340 (LWP 2368) "qemu-system-x86" fill_source_
2 Thread 0x7ffff65ff6c0 (LWP 2369) "qemu-system-x86" (running)
3 Thread 0x7ffff5d7c6c0 (LWP 2370) "qemu-system-x86" (running)
* 5 Thread 0x7ffff49ff6c0 (LWP 2373) "qemu-system-x86" (running)
(gdb) thread 1
(gdb) p (MigrationStatus) s.state STATUS_ ACTIVE
$8 = MIGRATION_
(gdb) c
Terminal 3)
...
Migration status: active
total time: 0 ms
(qemu)
Migration status is active, without any RAM statistics.
(qemu) quit
(gdb) quit
Terminal 1)
Ctrl-C
...
Packages from -proposed: PASS ------- ------- --
-------
$ sudo add-apt-repository -yp proposed archive. ubuntu. com/ubuntu kinetic-proposed main' | sudo tee -a /etc/apt/ sources. list
$ sudo add-apt-repository -ys # didn't work for proposed
$ echo 'deb-src http://
$ sudo apt install --yes --no-install- recommends qemu-system-x86
$ dpkg -s qemu-system-x86 | grep Version: 7ubuntu2. 2
Version: 1:7.0+dfsg-
$ rm -rf qemu-*
a$ apt source qemu
$ head -n1 qemu-*/ debian/ changelog dfsg-7ubuntu2. 2) kinetic; urgency=medium
qemu (1:7.0+
$ vim qemu-*/ migration/ migration. c
1073 static void fill_source_ migration_ info(MigrationI nfo *info) read(&s- >state) ; STATUS_ SETUP:
1074 {
...
1076 int state = qatomic_
...
1101 case MIGRATION_
...
1104 break;
Terminal 1)
$ qemu-system-x86_64 -nodefaults -nographic -S -incoming tcp:0:4444
Terminal 2)
$ gdb -ex 'set non-stop on' -ex 'set pagination off' -ex 'set confirm off' -iex 'set debuginfod enabled on' -iex 'set debuginfod urls https:/ /debuginfod. ubuntu. com' qemu-system-x86_64
(gdb) b migrate_set_state migration. c:1104 /migration. c, line 1104.
...
Breakpoint 1 at 0x47ed20: migrate_set_state. (2 locations)
(gdb) b migration/
...
Breakpoint 2 at 0x47dbc3: file ../../migration
Terminal 3)
$ nc 127.0.0.1 3333
(qemu) migrate -d tcp:127.0.0.1:4444
Terminal 2)
Thread 1 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state= 0x555556779618, old_state=0, new_state=1) at ../../migration /migration. c:1764
(gdb) p (MigrationStatus) 0 STATUS_ NONE STATUS_ SETUP
$1 = MIGRATION_
(gdb) p (MigrationStatus) 1
$2 = MIGRATION_
(gdb) c
Thread 5 "qemu-system-x86" hit Breakpoint 1, migrate_set_state (state= 0x555556779618, old_state=1, new_state=4) at ../../migration /migration. c:1764 /migration. c STATUS_ SETUP STATUS_ ACTIVE
1764 in ../../migration
(gdb) p (MigrationStatus) 1
$3 = MIGRATION_
(gdb) p (MigrationStatus) 4
$4 = MIGRATION_
(qemu) info migrate
Terminal 2)
Thread 1 "qemu-system-x86" hit Breakpoint 2, fill_source_ migration_ info (info=0x555556d c6c60) at ../../migration /migration. c:1141
(gdb) p (MigrationStatus) s.state STATUS_ SETUP STATUS_ NONE
$6 = MIGRATION_
(gdb) p info.status
$7 = MIGRATION_
(gdb) info threads migration_ info (info=0x555556d c6c60) at ../../migration /migration. c:1141 0x555556779618, old_state=1, new_state=4) at ../../migration /migration. c:1764
Id Target Id Frame
* 1 Thread 0x7ffff6c32340 (LWP 7562) "qemu-system-x86" fill_source_
2 Thread 0x7ffff65ff6c0 (LWP 7565) "qemu-system-x86" (running)
3 Thread 0x7ffff5d7c6c0 (LWP 7566) "qemu-system-x86" (running)
5 Thread 0x7fffa7dff6c0 (LWP 7569) "qemu-system-x86" migrate_set_state (state=
(gdb) thread 5
(gdb) continue &
(gdb) info threads migration_ info (info=0x555556d c6c60) at ../../migration /migration. c:1141
Id Target Id Frame
1 Thread 0x7ffff6c32340 (LWP 7562) "qemu-system-x86" fill_source_
2 Thread 0x7ffff65ff6c0 (LWP 7565) "qemu-system-x86" (running)
3 Thread 0x7ffff5d7c6c0 (LWP 7566) "qemu-system-x86" (running)
* 5 Thread 0x7fffa7dff6c0 (LWP 7569) "qemu-system-x86" (running)
(gdb) thread 1 STATUS_ ACTIVE
(gdb) p (MigrationStatus) s.state
$8 = MIGRATION_
(gdb) c
Terminal 3)
Status is now still 'SETUP' (which is not expected to have RAM statistics), not 'ACTIVE' (which is, and caused the issue).
...
Migration status: setup
total time: 0 ms