qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] db0754: file-posix: Use error API properly


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] db0754: file-posix: Use error API properly
Date: Tue, 13 Nov 2018 02:14:04 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: db0754df88e3ca4797539c1edbde596d871b64b6
      
https://github.com/qemu/qemu/commit/db0754df88e3ca4797539c1edbde596d871b64b6
  Author: Fam Zheng <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  file-posix: Use error API properly

Use error_report for situations that affect user operation (i.e.  we're
actually returning error), and warn_report/warn_report_err when some
less critical error happened but the user operation can still carry on.

For raw_normalize_devicepath, add Error parameter to propagate to
its callers.

Suggested-by: Markus Armbruster <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 63d5341f8553ff78ae99407ff8ad5a6648b95a30
      
https://github.com/qemu/qemu/commit/63d5341f8553ff78ae99407ff8ad5a6648b95a30
  Author: zhenwei pi <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M blockdev.c

  Log Message:
  -----------
  blockdev: handle error on block latency histogram set error

Function block_latency_histogram_set may return error, but qapi ignore this.
This can be reproduced easily by qmp command:
virsh qemu-monitor-command INSTANCE '{"execute":"x-block-latency-histogram-set",
"arguments":{"device":"drive-virtio-disk1","boundaries":[10,200,40]}}'
In fact this command does not work, but we still get success result.

qmp_x_block_latency_histogram_set is a batch setting API, report error ASAP.

Signed-off-by: zhenwei pi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: d52e1a0e967a532867149c2d95c2dd664ca22fe8
      
https://github.com/qemu/qemu/commit/d52e1a0e967a532867149c2d95c2dd664ca22fe8
  Author: Peter Maydell <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M blockdev.c

  Log Message:
  -----------
  blockdev: Consistently use snapshot_node_name in external_snapshot_prepare()

In the function external_snapshot_prepare() we have a
BlockdevSnapshotSync struct, which has the usual combination
of has_snapshot_node_name and snapshot_node_name fields for an
optional field. We set up a local variable
  const char *snapshot_node_name =
      s->has_snapshot_node_name ? s->snapshot_node_name : NULL;

and then mostly use "if (!snapshot_node_name)" for checking
whether we have a snapshot node name. The exception is that in
one place we check s->has_snapshot_node_name instead. This
confuses Coverity (CID 1396473), which thinks it might be
possible to get here with s->has_snapshot_node_name true but
snapshot_node_name NULL, and warns that the call to
qdict_put_str() will segfault in that case.

Make the code consistent and unconfuse Coverity by using
the same check for this conditional that we do in the rest
of the surrounding code.

Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 20faf0f5f8aba33405a6206cd26f0d2b49ac174a
      
https://github.com/qemu/qemu/commit/20faf0f5f8aba33405a6206cd26f0d2b49ac174a
  Author: Li Qiang <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M hw/block/nvme.c

  Log Message:
  -----------
  nvme: don't unref ctrl_mem when device unrealized

Currently, when hotplug/unhotplug nvme device, it will cause an
assert in object.c. Following is the backtrack:

ERROR:qom/object.c:981:object_unref: assertion failed: (obj->ref > 0)

Thread 2 "qemu-system-x86" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffcbd32700 (LWP 18844)]
0x00007fffdb9e4fff in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
/lib/x86_64-linux-gnu/libglib-2.0.so.0
/lib/x86_64-linux-gnu/libglib-2.0.so.0
qom/object.c:981
/home/liqiang02/qemu-upstream/qemu/memory.c:1732
/home/liqiang02/qemu-upstream/qemu/memory.c:285
util/qemu-thread-posix.c:504
/lib/x86_64-linux-gnu/libpthread.so.0

This is caused by memory_region_unref in nvme_exit.

Remove it to make the PCIdevice refcount correct.

Signed-off-by: Li Qiang <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: a883d6a0bcbff889c932015179a25a1b5ea8e096
      
https://github.com/qemu/qemu/commit/a883d6a0bcbff889c932015179a25a1b5ea8e096
  Author: Li Qiang <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M hw/block/nvme.c

  Log Message:
  -----------
  nvme: free cmbuf in nvme_exit

This avoid a memory leak in unhotplug nvme device.

Signed-off-by: Li Qiang <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 2996ffad3acabe890fbb4f84a069cdc325a68108
      
https://github.com/qemu/qemu/commit/2996ffad3acabe890fbb4f84a069cdc325a68108
  Author: Fam Zheng <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  file-posix: Skip effectiveless OFD lock operations

If we know we've already locked the bytes, don't do it again; similarly
don't unlock a byte if we haven't locked it. This doesn't change the
behavior, but fixes a corner case explained below.

Libvirt had an error handling bug that an image can get its (ownership,
file mode, SELinux) permissions changed (RHBZ 1584982) by mistake behind
QEMU. Specifically, an image in use by Libvirt VM has:

    $ ls -lhZ b.img
    -rw-r--r--. qemu qemu system_u:object_r:svirt_image_t:s0:c600,c690 b.img

Trying to attach it a second time won't work because of image locking.
And after the error, it becomes:

    $ ls -lhZ b.img
    -rw-r--r--. root root system_u:object_r:virt_image_t:s0 b.img

Then, we won't be able to do OFD lock operations with the existing fd.
In other words, the code such as in blk_detach_dev:

    blk_set_perm(blk, 0, BLK_PERM_ALL, &error_abort);

can abort() QEMU, out of environmental changes.

This patch is an easy fix to this and the change is regardlessly
reasonable, so do it.

Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: f2e3af29b70624659a50903bd075e1663b64c9da
      
https://github.com/qemu/qemu/commit/f2e3af29b70624659a50903bd075e1663b64c9da
  Author: Fam Zheng <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/file-posix.c

  Log Message:
  -----------
  file-posix: Drop s->lock_fd

The lock_fd field is not strictly necessary because transferring locked
bytes from old fd to the new one shouldn't fail anyway. This spares the
user one fd per image.

Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: aef96d7d4f0b6746e329bfa7a1ea38e1611237e3
      
https://github.com/qemu/qemu/commit/aef96d7d4f0b6746e329bfa7a1ea38e1611237e3
  Author: Fam Zheng <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M tests/Makefile.include
    A tests/test-image-locking.c

  Log Message:
  -----------
  tests: Add unit tests for image locking

Signed-off-by: Fam Zheng <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 2f74013655e562cb97271e2ed75144ea15f0d670
      
https://github.com/qemu/qemu/commit/2f74013655e562cb97271e2ed75144ea15f0d670
  Author: Jeff Cody <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/Makefile.objs
    M configure

  Log Message:
  -----------
  block: Make more block drivers compile-time configurable

This adds configure options to control the following block drivers:

* Bochs
* Cloop
* Dmg
* Qcow (V1)
* Vdi
* Vvfat
* qed
* parallels
* sheepdog

Each of these defaults to being enabled.

Signed-off-by: Jeff Cody <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>


  Commit: c2032289b0c46597a4da7017a7869f2b41f8be16
      
https://github.com/qemu/qemu/commit/c2032289b0c46597a4da7017a7869f2b41f8be16
  Author: Liam Merwick <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M job.c

  Log Message:
  -----------
  job: Fix off-by-one assert checks for JobSTT and JobVerbTable

In the assert checking the array dereference of JobVerbTable[verb]
in job_apply_verb() the check of the index, verb, allows an overrun
because an index equal to the array size is permitted.

Similarly, in the assert check of JobSTT[s0][s1] with index s1
in job_state_transition(), an off-by-one overrun is not flagged
either.

This is not a run-time issue as there are no callers actually
passing in the max value.

Signed-off-by: Liam Merwick <address@hidden>
Reviewed-by: Darren Kenny <address@hidden>
Reviewed-by: Mark Kanda <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>


  Commit: 602414d1232723d92836babe8d7014b57b93e4d9
      
https://github.com/qemu/qemu/commit/602414d1232723d92836babe8d7014b57b93e4d9
  Author: Liam Merwick <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/block-backend.c

  Log Message:
  -----------
  block: Null pointer dereference in blk_root_get_parent_desc()

The dev_id returned by the call to blk_get_attached_dev_id() in
blk_root_get_parent_desc() can be NULL (an internal call to
object_get_canonical_path may have returned NULL).

Instead of just checking this case before before dereferencing,
adjust blk_get_attached_dev_id() to return the empty string if no
object path can be found (similar to the case when blk->dev is NULL
and an empty string is returned).

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>


  Commit: 2e2db260093d44130a8a2974aed3cc8149c0a08d
      
https://github.com/qemu/qemu/commit/2e2db260093d44130a8a2974aed3cc8149c0a08d
  Author: Liam Merwick <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M qemu-img.c

  Log Message:
  -----------
  qemu-img: assert block_job_get() does not return NULL in img_commit()

Although the function block_job_get() can return NULL, it would be a
serious bug if it did so (because the job yields before executing anything
(if it started successfully); but otherwise, commit_active_start() would
have returned an error).  However, as a precaution, before dereferencing
the 'job' pointer in img_commit() assert it is not NULL.

Signed-off-by: Liam Merwick <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>


  Commit: 8d9401c2791ee2d2805b741b1ee3006041edcd3e
      
https://github.com/qemu/qemu/commit/8d9401c2791ee2d2805b741b1ee3006041edcd3e
  Author: Liam Merwick <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/vvfat.c

  Log Message:
  -----------
  block: Fix potential Null pointer dereferences in vvfat.c

The calls to find_mapping_for_cluster() may return NULL but it
isn't always checked for before dereferencing the value returned.
Additionally, add some asserts to cover cases where NULL can't
be returned but which might not be obvious at first glance.

Signed-off-by: Liam Merwick <address@hidden>
Message-id: address@hidden
[mreitz: Dropped superfluous check of "mapping" following an assertion
   that it is not NULL, and fixed some indentation]
Signed-off-by: Max Reitz <address@hidden>


  Commit: 7cb6d3c9be2cbda05d2b14e7897e74839e48fbb2
      
https://github.com/qemu/qemu/commit/7cb6d3c9be2cbda05d2b14e7897e74839e48fbb2
  Author: Liam Merwick <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/qcow2-refcount.c

  Log Message:
  -----------
  qcow2: Read outside array bounds in qcow2_pre_write_overlap_check()

The commit for 0e4e4318eaa5 increments QCOW2_OL_MAX_BITNR but does not
add an array entry for QCOW2_OL_BITMAP_DIRECTORY_BITNR to metadata_ol_names[].
As a result, an array dereference of metadata_ol_names[8] in
qcow2_pre_write_overlap_check() could result in a read outside of the array 
bounds.

Fixes: 0e4e4318eaa5 ('qcow2: add overlap check for bitmap directory')

Cc: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Liam Merwick <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>


  Commit: 1a42e5d8298d1b0f90d2254e7d559391dd3a45ca
      
https://github.com/qemu/qemu/commit/1a42e5d8298d1b0f90d2254e7d559391dd3a45ca
  Author: Kevin Wolf <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/Makefile.objs
    M block/block-backend.c
    M block/qcow2-refcount.c
    M block/vvfat.c
    M configure
    M job.c
    M qemu-img.c

  Log Message:
  -----------
  Merge remote-tracking branch 'mreitz/tags/pull-block-2018-11-12' into 
queue-block

Block patches:
- Added NULL checks found by static analysis
- Allow more block drivers to not be included in the qemu build

# gpg: Signature made Mon Nov 12 17:51:18 2018 CET
# gpg:                using RSA key F407DB0061D5CF40
# gpg: Good signature from "Max Reitz <address@hidden>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2018-11-12:
  qcow2: Read outside array bounds in qcow2_pre_write_overlap_check()
  block: Fix potential Null pointer dereferences in vvfat.c
  qemu-img: assert block_job_get() does not return NULL in img_commit()
  block: Null pointer dereference in blk_root_get_parent_desc()
  job: Fix off-by-one assert checks for JobSTT and JobVerbTable
  block: Make more block drivers compile-time configurable

Signed-off-by: Kevin Wolf <address@hidden>


  Commit: 6db87aae61bc6ac0a8cd9bc2e05d7ebfbcfd3657
      
https://github.com/qemu/qemu/commit/6db87aae61bc6ac0a8cd9bc2e05d7ebfbcfd3657
  Author: Peter Maydell <address@hidden>
  Date:   2018-11-12 (Mon, 12 Nov 2018)

  Changed paths:
    M block/Makefile.objs
    M block/block-backend.c
    M block/file-posix.c
    M block/qcow2-refcount.c
    M block/vvfat.c
    M blockdev.c
    M configure
    M hw/block/nvme.c
    M job.c
    M qemu-img.c
    M tests/Makefile.include
    A tests/test-image-locking.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- file-posix: Don't waste a file descriptor for locking, don't lock the
  same bit multiple times
- nvme: Fix double free and memory leak
- Misc error handling fixes
- Added NULL checks found by static analysis
- Allow more block drivers to not be included in the qemu build

# gpg: Signature made Mon 12 Nov 2018 17:05:00 GMT
# gpg:                using RSA key 7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <address@hidden>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  qcow2: Read outside array bounds in qcow2_pre_write_overlap_check()
  block: Fix potential Null pointer dereferences in vvfat.c
  qemu-img: assert block_job_get() does not return NULL in img_commit()
  block: Null pointer dereference in blk_root_get_parent_desc()
  job: Fix off-by-one assert checks for JobSTT and JobVerbTable
  block: Make more block drivers compile-time configurable
  tests: Add unit tests for image locking
  file-posix: Drop s->lock_fd
  file-posix: Skip effectiveless OFD lock operations
  nvme: free cmbuf in nvme_exit
  nvme: don't unref ctrl_mem when device unrealized
  blockdev: Consistently use snapshot_node_name in external_snapshot_prepare()
  blockdev: handle error on block latency histogram set error
  file-posix: Use error API properly

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/5704c36d25ee...6db87aae61bc
      **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]