qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 90a6d1: chardev: avoid crash if no associated


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 90a6d1: chardev: avoid crash if no associated address
Date: Fri, 05 Oct 2018 04:24:35 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 90a6d17bed2ea1571ee74aff294e4584168a8e9f
      
https://github.com/qemu/qemu/commit/90a6d17bed2ea1571ee74aff294e4584168a8e9f
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M chardev/char-socket.c

  Log Message:
  -----------
  chardev: avoid crash if no associated address

A socket chardev may not have associated address (when adding client
fd manually for example). But on disconnect, updating socket filename
expects an address and may lead to this crash:

  Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
  0x0000555555d8c70c in SocketAddress_to_str (prefix=0x555556043062 
"disconnected:", addr=0x0, is_listen=false, is_telnet=false) at 
/home/elmarco/src/qq/chardev/char-socket.c:388
  388       switch (addr->type) {
  (gdb) bt
  #0  0x0000555555d8c70c in SocketAddress_to_str (prefix=0x555556043062 
"disconnected:", addr=0x0, is_listen=false, is_telnet=false) at 
/home/elmarco/src/qq/chardev/char-socket.c:388
  #1  0x0000555555d8c8aa in update_disconnected_filename (s=0x555556b1ed00) at 
/home/elmarco/src/qq/chardev/char-socket.c:419
  #2  0x0000555555d8c959 in tcp_chr_disconnect (chr=0x555556b1ed00) at 
/home/elmarco/src/qq/chardev/char-socket.c:438
  #3  0x0000555555d8cba1 in tcp_chr_hup (channel=0x555556b75690, cond=G_IO_HUP, 
opaque=0x555556b1ed00) at /home/elmarco/src/qq/chardev/char-socket.c:482
  #4  0x0000555555da596e in qio_channel_fd_source_dispatch 
(source=0x555556bb68b0, callback=0x555555d8cb58 <tcp_chr_hup>, 
user_data=0x555556b1ed00) at /home/elmarco/src/qq/io/channel-watch.c:84

Replace filename with a generic "disconnected:socket" in this case.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>


  Commit: 43182856c5a576f5db5f40768972a19f187a789e
      
https://github.com/qemu/qemu/commit/43182856c5a576f5db5f40768972a19f187a789e
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M chardev/char-fe.c

  Log Message:
  -----------
  chardev: remove qemu_chr_fe_read_all() counter

There is no obvious reason to have a loop counter. This limits from
reading several megabytes large buffers in one go, since socket
read/write usually have a limit.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>


  Commit: 425d8a4e70f3946ac649925c4e3211906371ca6d
      
https://github.com/qemu/qemu/commit/425d8a4e70f3946ac649925c4e3211906371ca6d
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M chardev/char-fe.c

  Log Message:
  -----------
  chardev: unref if underlying chardev has no parent

It's possible to write code creating a chardev backend that is not
registered. When it is not user-created, it makes sense to keep it
hidden. Let the associated frontend destroy it also in this case.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>


  Commit: 5662576ad020c8eabdc1a84e9ee1f9ce85578bbb
      
https://github.com/qemu/qemu/commit/5662576ad020c8eabdc1a84e9ee1f9ce85578bbb
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M include/chardev/char-fe.h
    M include/chardev/char.h

  Log Message:
  -----------
  char.h: fix gtk-doc comment style

Fix up conformance to GTK-Doc function comment style, as documented in
https://developer.gnome.org/gtk-doc-manual/stable/documenting_symbols.html.en

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>


  Commit: 95e30b2a131ed1f94ab7a64326243943317aa18a
      
https://github.com/qemu/qemu/commit/95e30b2a131ed1f94ab7a64326243943317aa18a
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M chardev/char.c
    M gdbstub.c
    M hw/char/xen_console.c
    M include/chardev/char.h
    M net/slirp.c
    M vl.c

  Log Message:
  -----------
  chardev: mark the calls that allow an implicit mux monitor

This is mostly for readability of the code. Let's make it clear which
callers can create an implicit monitor when the chardev is muxed.

This will also enforce a safer behaviour, as we don't really support
creating monitor anywhere/anytime at the moment. Add an assert() to
make sure the programmer explicitely wanted that behaviour.

There are documented cases, such as: -serial/-parallel/-virtioconsole
and to less extent -debugcon.

Less obvious and questionable ones are -gdb, SLIRP -guestfwd and Xen
console. Add a FIXME note for those, but keep the support for now.

Other qemu_chr_new() callers either have a fixed parameter/filename
string or do not need it, such as -qtest:

* qtest.c: qtest_init()
  Afaik, only used by tests/libqtest.c, without mux. I don't think we
  support it outside of qemu testing: drop support for implicit mux
  monitor (qemu_chr_new() call: no implicit mux now).

* hw/
  All with literal @filename argument that doesn't enable mux monitor.

* tests/
  All with @filename argument that doesn't enable mux monitor.

On a related note, the list of monitor creation places:

- the chardev creators listed above: all from command line (except
  perhaps Xen console?)

- -gdb & hmp gdbserver will create a "GDB monitor command" chardev
  that is wired to an HMP monitor.

- -mon command line option

>From this short study, I would like to think that a monitor may only
be created in the main thread today, though I remain skeptical :)

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>


  Commit: a7077b8e354d90fec26c2921aa2dea85b90dff90
      
https://github.com/qemu/qemu/commit/a7077b8e354d90fec26c2921aa2dea85b90dff90
  Author: Marc-André Lureau <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M chardev/char-io.c

  Log Message:
  -----------
  chardev: use a child source for qio input source

GLib child source were added with version 2.28. We can use them now
that we bumped our requirement to 2.40.

Signed-off-by: Marc-André Lureau <address@hidden>
Reviewed-by: Daniel P. Berrangé <address@hidden>


  Commit: b8e5671a8cd196e7262802ca895bf87d50416989
      
https://github.com/qemu/qemu/commit/b8e5671a8cd196e7262802ca895bf87d50416989
  Author: Peter Maydell <address@hidden>
  Date:   2018-10-03 (Wed, 03 Oct 2018)

  Changed paths:
    M chardev/char-fe.c
    M chardev/char-io.c
    M chardev/char-socket.c
    M chardev/char.c
    M gdbstub.c
    M hw/char/xen_console.c
    M include/chardev/char-fe.h
    M include/chardev/char.h
    M net/slirp.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/elmarco/tags/chardev-pull-request' into 
staging

chardev patches

# gpg: Signature made Wed 03 Oct 2018 11:57:34 BST
# gpg:                using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <address@hidden>"
# gpg:                 aka "Marc-André Lureau <address@hidden>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* remotes/elmarco/tags/chardev-pull-request:
  chardev: use a child source for qio input source
  chardev: mark the calls that allow an implicit mux monitor
  char.h: fix gtk-doc comment style
  chardev: unref if underlying chardev has no parent
  chardev: remove qemu_chr_fe_read_all() counter
  chardev: avoid crash if no associated address

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


Compare: https://github.com/qemu/qemu/compare/dafd95053611...b8e5671a8cd1
      **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]