Skip to contentSkip to conversation

qemu-img: crash on check of an image with large value in the 'size' header field

Qemu-devel Maria Kustova 5 participants 14 messages Jun 19, 2014 – Jan 31, 2018

lore
Share & tools
lore
#0 lore raw

Public bug reported:

The qemu-img crashes on the next command:

qemu-img check test_image

'test_image' can be found in the attachment. It's a fuzzed test image with the qcow2 image header only. Suppositional cause of the failure is the value of 'size' header field set to maximum uint_64 value.

System information:

qemu.git: 6baa963f4dcc2118
Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64 GNU/Linux

** Affects: qemu
Importance: Undecided
Status: New

** Attachment added: "Core dumb, backtrace and test image"
https://bugs.launchpad.net/bugs/1332297/+attachment/4135094/+files/core.n.image.tar.gz

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1332297

Title:
  qemu-img: crash on check of an image with large value in the 'size'
  header field

Status in QEMU:
  New

Bug description:
  The qemu-img crashes on the next command:

  qemu-img check test_image

  'test_image' can be found in the attachment. It's a fuzzed test image
  with the qcow2 image header only. Suppositional cause of the failure
  is the value of 'size' header field set to maximum uint_64 value.

  System information:

  qemu.git: 6baa963f4dcc2118
  Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64  GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1332297/+subscriptions
#1 lore raw

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1332297

Title:
  qemu-img: crash on check of an image with large value in the 'size'
  header field

Status in QEMU:
  New

Bug description:
  The qemu-img crashes on the next command:

  qemu-img check test_image

  'test_image' can be found in the attachment. It's a fuzzed test image
  with the qcow2 image header only. Suppositional cause of the failure
  is the value of 'size' header field set to maximum uint_64 value.

  System information:

  qemu.git: 6baa963f4dcc2118
  Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64  GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1332297/+subscriptions
#2 lore raw
Quoted 4 lines · Maria Kustova

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

Stefan

#3 lore raw
Quoted 6 lines · Stefan Hajnoczi
Quoted 4 lines · Maria Kustova

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Quoted 6 lines

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

These patches are conflicting with current master. So I can't test them as they are.

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

Quoted 2 lines

Stefan

#4 lore raw

Am 24.06.2014 um 15:19 hat M.Kustova geschrieben:

Quoted 11 lines · Stefan Hajnoczi
Quoted 10 lines · Maria Kustova
Quoted 4 lines

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Quoted 8 lines
Quoted 2 lines

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

These patches are conflicting with current master. So I can't test them as they are.

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

I'm just about to send a new version, I'll keep you CCed there.

Kevin

#5 lore raw
Quoted 15 lines · Kevin Wolf

Am 24.06.2014 um 15:19 hat M.Kustova geschrieben:

Quoted 14 lines · Stefan Hajnoczi
Quoted 12 lines · Maria Kustova
Quoted 4 lines

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

Quoted 7 lines
Quoted 5 lines

These patches are conflicting with current master. So I can't test them as they are.

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

I'm just about to send a new version, I'll keep you CCed there.

"[PATCH v4 21/21] qcow2: Return useful error code in refcount_init()" is still broken for the current master.

Quoted 2 lines

Kevin

Maria.

#6 lore raw

Am 25.06.2014 um 11:32 hat M.Kustova geschrieben:

Quoted 19 lines · Kevin Wolf
Quoted 18 lines

Am 24.06.2014 um 15:19 hat M.Kustova geschrieben:

Quoted 17 lines · Stefan Hajnoczi
Quoted 6 lines · Maria Kustova
Quoted 4 lines

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Quoted 6 lines

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

These patches are conflicting with current master. So I can't test them as they are.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

I'm just about to send a new version, I'll keep you CCed there.

"[PATCH v4 21/21] qcow2: Return useful error code in refcount_init()" is still broken for the current master.

In which way? I can cleanly apply the whole patch series on master (even tried applying the emails from my inbox to be sure).

Kevin

#7 lore raw
Quoted 23 lines · Kevin Wolf

Am 25.06.2014 um 11:32 hat M.Kustova geschrieben:

Quoted 22 lines · Kevin Wolf
Quoted 21 lines

Am 24.06.2014 um 15:19 hat M.Kustova geschrieben:

Quoted 19 lines · Stefan Hajnoczi
Quoted 6 lines · Maria Kustova
Quoted 4 lines

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Quoted 6 lines

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

These patches are conflicting with current master. So I can't test them as they are.

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'm just about to send a new version, I'll keep you CCed there.

"[PATCH v4 21/21] qcow2: Return useful error code in refcount_init()" is still broken for the current master.

In which way? I can cleanly apply the whole patch series on master (even tried applying the emails from my inbox to be sure).

Beginning from line #49 in master:

    if (s->refcount_table_size > 0) {
        BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD);
        ret = bdrv_pread(bs->file, s->refcount_table_offset,

The patch:

if (s->refcount_table_size > 0) {^M

         if (s->refcount_table == NULL) {^M
+            ret = -ENOMEM;^M
             goto fail;^M
         }^M
         BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD);^M
         ret = bdrv_pread(bs->file, s->refcount_table_offset,^M

At least master version doesn't have this condition.

Quoted 2 lines

Kevin

Maria

#8 lore raw

Am 25.06.2014 um 11:54 hat M.Kustova geschrieben:

Quoted 48 lines · Kevin Wolf
Quoted 23 lines

Am 25.06.2014 um 11:32 hat M.Kustova geschrieben:

Quoted 22 lines · Kevin Wolf
Quoted 21 lines

Am 24.06.2014 um 15:19 hat M.Kustova geschrieben:

Quoted 19 lines · Stefan Hajnoczi
Quoted 6 lines · Maria Kustova
Quoted 4 lines

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Quoted 6 lines

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

These patches are conflicting with current master. So I can't test them as they are.

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'm just about to send a new version, I'll keep you CCed there.

"[PATCH v4 21/21] qcow2: Return useful error code in refcount_init()" is still broken for the current master.

In which way? I can cleanly apply the whole patch series on master (even tried applying the emails from my inbox to be sure).

Beginning from line #49 in master:

    if (s->refcount_table_size > 0) {
        BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD);
        ret = bdrv_pread(bs->file, s->refcount_table_offset,

The patch:

   if (s->refcount_table_size > 0) {^M
         if (s->refcount_table == NULL) {^M
+            ret = -ENOMEM;^M
             goto fail;^M
         }^M
         BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD);^M
         ret = bdrv_pread(bs->file, s->refcount_table_offset,^M
Quoted 1 line

At least master version doesn't have this condition.

It is code added in patch 11 of the same series.

Kevin

#9 lore raw
Quoted 49 lines · Kevin Wolf

Am 25.06.2014 um 11:54 hat M.Kustova geschrieben:

Quoted 48 lines · Kevin Wolf
Quoted 23 lines

Am 25.06.2014 um 11:32 hat M.Kustova geschrieben:

Quoted 22 lines · Kevin Wolf
Quoted 21 lines

Am 24.06.2014 um 15:19 hat M.Kustova geschrieben:

Quoted 19 lines · Stefan Hajnoczi
Quoted 6 lines · Maria Kustova
Quoted 4 lines

The bug description missed qemu-img error:

(process:12283): GLib-ERROR **: gmem.c:110: failed to allocate 18446744059294601304 bytes

Quoted 6 lines

Thanks, there has been recent work by Kevin Wolf to handle memory allocation failures gracefully without terminating QEMU. This sounds like a candidate for g_try_malloc() and friends.

Does the following patch series solve the problem?
https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01275.html

These patches are conflicting with current master. So I can't test them as they are.

Do you have a developer repository or branch containing these patches, so I could test it on the pre-release base?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'm just about to send a new version, I'll keep you CCed there.

"[PATCH v4 21/21] qcow2: Return useful error code in refcount_init()" is still broken for the current master.

In which way? I can cleanly apply the whole patch series on master (even tried applying the emails from my inbox to be sure).

Beginning from line #49 in master:

    if (s->refcount_table_size > 0) {
        BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD);
        ret = bdrv_pread(bs->file, s->refcount_table_offset,

The patch:

   if (s->refcount_table_size > 0) {^M
         if (s->refcount_table == NULL) {^M
+            ret = -ENOMEM;^M
             goto fail;^M
         }^M
         BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_LOAD);^M
         ret = bdrv_pread(bs->file, s->refcount_table_offset,^M
Quoted 3 lines
Quoted 1 line

At least master version doesn't have this condition.

It is code added in patch 11 of the same series.

My apologies for the false alarm.

Quoted 2 lines

Kevin

Maria

#10 lore raw
In reply to Maria Kustova

The series fixed the crash, but qemu-img started to produce the confusing output:

$ qemu-img check test_image

ERROR: I/O error in check_refcounts_l1
No errors were found on the image.

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1332297

Title:
  qemu-img: crash on check of an image with large value in the 'size'
  header field

Status in QEMU:
  New

Bug description:
  The qemu-img crashes on the next command:

  qemu-img check test_image

  'test_image' can be found in the attachment. It's a fuzzed test image
  with the qcow2 image header only. Suppositional cause of the failure
  is the value of 'size' header field set to maximum uint_64 value.

  System information:

  qemu.git: 6baa963f4dcc2118
  Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64  GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1332297/+subscriptions
#11 lore raw
In reply to Maria Kustova

QEMU nowadays seems to report "Check failed: Cannot allocate memory" ... so I assume that is OK and we can now close this bug?

** Changed in: qemu
Status: New => Incomplete

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1332297

Title:
  qemu-img: crash on check of an image with large value in the 'size'
  header field

Status in QEMU:
  Incomplete

Bug description:
  The qemu-img crashes on the next command:

  qemu-img check test_image

  'test_image' can be found in the attachment. It's a fuzzed test image
  with the qcow2 image header only. Suppositional cause of the failure
  is the value of 'size' header field set to maximum uint_64 value.

  System information:

  qemu.git: 6baa963f4dcc2118
  Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64  GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1332297/+subscriptions
#12 lore raw
In reply to Maria Kustova

[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
Status: Incomplete => Expired

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1332297

Title:
  qemu-img: crash on check of an image with large value in the 'size'
  header field

Status in QEMU:
  Expired

Bug description:
  The qemu-img crashes on the next command:

  qemu-img check test_image

  'test_image' can be found in the attachment. It's a fuzzed test image
  with the qcow2 image header only. Suppositional cause of the failure
  is the value of 'size' header field set to maximum uint_64 value.

  System information:

  qemu.git: 6baa963f4dcc2118
  Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64  GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1332297/+subscriptions
#13 lore raw
In reply to Maria Kustova

Have the same proble: qemu-img: Check failed: Cannot allocate memory

Signature · 27 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1332297

Title:
  qemu-img: crash on check of an image with large value in the 'size'
  header field

Status in QEMU:
  Expired

Bug description:
  The qemu-img crashes on the next command:

  qemu-img check test_image

  'test_image' can be found in the attachment. It's a fuzzed test image
  with the qcow2 image header only. Suppositional cause of the failure
  is the value of 'size' header field set to maximum uint_64 value.

  System information:

  qemu.git: 6baa963f4dcc2118
  Host: Linux 3.14.7-200.fc20.x86_64 #1 SMP Wed Jun 11 22:38:05 UTC 2014 x86_64  GNU/Linux

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1332297/+subscriptions