qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] d23292: ui/egl: fix framebuffer reads


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] d23292: ui/egl: fix framebuffer reads
Date: Thu, 19 Sep 2019 10:09:59 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d2329237af197429492ec27d22a4ba4f121dbc10
      
https://github.com/qemu/qemu/commit/d2329237af197429492ec27d22a4ba4f121dbc10
  Author: Gerd Hoffmann <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M include/ui/egl-helpers.h
    M ui/egl-headless.c
    M ui/egl-helpers.c

  Log Message:
  -----------
  ui/egl: fix framebuffer reads

Fix egl_fb_read() to use the (destination) surface size instead of the
(source) framebuffer source for glReadPixels.  Pass the DisplaySurface
instead of the pixeldata pointer to egl_fb_read() to make this possible.

With that in place framebuffer reads work fine even if the surface and
framebuffer sizes don't match, so we can remove the guest-triggerable
asserts in egl_scanout_flush().

Buglink: https://bugzilla.redhat.com//show_bug.cgi?id=1749659
Signed-off-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-id: address@hidden


  Commit: e1b3d47751a420835cb0560fd029c39fea961a79
      
https://github.com/qemu/qemu/commit/e1b3d47751a420835cb0560fd029c39fea961a79
  Author: Gerd Hoffmann <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M ui/vnc.c

  Log Message:
  -----------
  vnc: fix websocket field in events

Just need to fill VncClientInfo.websocket in vnc_client_cache_addr().

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1748175
Signed-off-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden


  Commit: 6105683da35babad9ae168a72d1e89e63e9d6974
      
https://github.com/qemu/qemu/commit/6105683da35babad9ae168a72d1e89e63e9d6974
  Author: Laurent Vivier <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    A docs/barrier.txt
    M ui/Makefile.objs
    A ui/input-barrier.c
    A ui/input-barrier.h

  Log Message:
  -----------
  ui: add an embedded Barrier client

This allows to receive mouse and keyboard events from
a Barrier server.

This is enabled by adding the following parameter on the
command line

    ... -object input-barrier,id=$id,name=$name ...

Where $name is the name declared in the screens section of barrier.conf

The barrier server (barriers) must be configured and must run on the
local host.

For instance:

  section: screens
      localhost:
          ...
      VM-1:
          ...
      end

  section: links
      localhost:
          right = VM-1
      VM-1:
          left = localhost
  end

Then on the QEMU command line:

    ... -object input-barrier,id=barrie0,name=VM-1 ...

When the mouse will move out of the screen of the local host on
the right, the mouse and the keyboard will be grabbed and all
related events will be send to the guest OS.

This is usefull when qemu is configured without emulated graphic card
but with a VFIO attached graphic card.

More information about Barrier can be found at:

  https://github.com/debauchee/barrier

This avoids to install the Barrier server in the guest OS,
for instance when it is not supported or during the installation.

Signed-off-by: Laurent Vivier <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 6bf21f3d83e95bcc4ba35a7a07cc6655e8b010b0
      
https://github.com/qemu/qemu/commit/6bf21f3d83e95bcc4ba35a7a07cc6655e8b010b0
  Author: Li Qiang <address@hidden>
  Date:   2019-09-17 (Tue, 17 Sep 2019)

  Changed paths:
    M ui/vnc-enc-tight.c
    M ui/vnc-enc-zlib.c
    M ui/vnc-enc-zrle.c
    M ui/vnc-enc-zrle.inc.c
    M ui/vnc.c
    M ui/vnc.h

  Log Message:
  -----------
  vnc: fix memory leak when vnc disconnect

Currently when qemu receives a vnc connect, it creates a 'VncState' to
represent this connection. In 'vnc_worker_thread_loop' it creates a
local 'VncState'. The connection 'VcnState' and local 'VncState' exchange
data in 'vnc_async_encoding_start' and 'vnc_async_encoding_end'.
In 'zrle_compress_data' it calls 'deflateInit2' to allocate the libz library
opaque data. The 'VncState' used in 'zrle_compress_data' is the local
'VncState'. In 'vnc_zrle_clear' it calls 'deflateEnd' to free the libz
library opaque data. The 'VncState' used in 'vnc_zrle_clear' is the connection
'VncState'. In currently implementation there will be a memory leak when the
vnc disconnect. Following is the asan output backtrack:

Direct leak of 29760 byte(s) in 5 object(s) allocated from:
    0 0xffffa67ef3c3 in __interceptor_calloc (/lib64/libasan.so.4+0xd33c3)
    1 0xffffa65071cb in g_malloc0 (/lib64/libglib-2.0.so.0+0x571cb)
    2 0xffffa5e968f7 in deflateInit2_ (/lib64/libz.so.1+0x78f7)
    3 0xaaaacec58613 in zrle_compress_data ui/vnc-enc-zrle.c:87
    4 0xaaaacec58613 in zrle_send_framebuffer_update ui/vnc-enc-zrle.c:344
    5 0xaaaacec34e77 in vnc_send_framebuffer_update ui/vnc.c:919
    6 0xaaaacec5e023 in vnc_worker_thread_loop ui/vnc-jobs.c:271
    7 0xaaaacec5e5e7 in vnc_worker_thread ui/vnc-jobs.c:340
    8 0xaaaacee4d3c3 in qemu_thread_start util/qemu-thread-posix.c:502
    9 0xffffa544e8bb in start_thread (/lib64/libpthread.so.0+0x78bb)
    10 0xffffa53965cb in thread_start (/lib64/libc.so.6+0xd55cb)

This is because the opaque allocated in 'deflateInit2' is not freed in
'deflateEnd'. The reason is that the 'deflateEnd' calls 'deflateStateCheck'
and in the latter will check whether 's->strm != strm'(libz's data structure).
This check will be true so in 'deflateEnd' it just return 'Z_STREAM_ERROR' and
not free the data allocated in 'deflateInit2'.

The reason this happens is that the 'VncState' contains the whole 'VncZrle',
so when calling 'deflateInit2', the 's->strm' will be the local address.
So 's->strm != strm' will be true.

To fix this issue, we need to make 'zrle' of 'VncState' to be a pointer.
Then the connection 'VncState' and local 'VncState' exchange mechanism will
work as expection. The 'tight' of 'VncState' has the same issue, let's also turn
it to a pointer.

Reported-by: Ying Fang <address@hidden>
Signed-off-by: Li Qiang <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: a77d20bafcd4cb7684168a9b4c6dc2a321aaeb50
      
https://github.com/qemu/qemu/commit/a77d20bafcd4cb7684168a9b4c6dc2a321aaeb50
  Author: Peter Maydell <address@hidden>
  Date:   2019-09-19 (Thu, 19 Sep 2019)

  Changed paths:
    A docs/barrier.txt
    M include/ui/egl-helpers.h
    M ui/Makefile.objs
    M ui/egl-headless.c
    M ui/egl-helpers.c
    A ui/input-barrier.c
    A ui/input-barrier.h
    M ui/vnc-enc-tight.c
    M ui/vnc-enc-zlib.c
    M ui/vnc-enc-zrle.c
    M ui/vnc-enc-zrle.inc.c
    M ui/vnc.c
    M ui/vnc.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190919-pull-request' 
into staging

ui: add barrier client.
ui: bugfixes for vnc & egl.

# gpg: Signature made Thu 19 Sep 2019 08:09:05 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann <address@hidden>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/ui-20190919-pull-request:
  vnc: fix memory leak when vnc disconnect
  ui: add an embedded Barrier client
  vnc: fix websocket field in events
  ui/egl: fix framebuffer reads

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


Compare: https://github.com/qemu/qemu/compare/084f67c9d98d...a77d20bafcd4



reply via email to

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