From: Stefan Weil <sw@weilnetz.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 05/39] fdsets: use weak aliases instead of qemu-tool.c/qemu-user.c
Date: Thu, 15 Nov 2012 19:01:56 +0100 [thread overview]
Message-ID: <50A52E14.2070106@weilnetz.de> (raw)
In-Reply-To: <1351697456-16107-6-git-send-email-pbonzini@redhat.com>
Am 31.10.2012 16:30, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
> cutils.c | 5 -----
> osdep.c | 30 ++++++++++++++++++++++++++++++
> qemu-common.h | 1 -
> qemu-tool.c | 20 --------------------
> qemu-user.c | 20 --------------------
> 5 file modificati, 30 inserzioni(+), 46 rimozioni(-)
>
> diff --git a/cutils.c b/cutils.c
> index 6f9f799..4f0692f 100644
> --- a/cutils.c
> +++ b/cutils.c
> @@ -280,11 +280,6 @@ int qemu_parse_fd(const char *param)
> return fd;
> }
>
> -int qemu_parse_fdset(const char *param)
> -{
> - return qemu_parse_fd(param);
> -}
> -
> /* round down to the nearest power of 2*/
> int64_t pow2floor(int64_t value)
> {
> diff --git a/osdep.c b/osdep.c
> index 3b25297..0061f74 100644
> --- a/osdep.c
> +++ b/osdep.c
> @@ -144,6 +144,11 @@ fail:
> errno = serrno;
> return -1;
> }
> +
> +static int qemu_parse_fdset(const char *param)
> +{
> + return qemu_parse_fd(param);
> +}
> #endif
>
> /*
> @@ -404,3 +409,28 @@ bool fips_get_state(void)
> {
> return fips_enabled;
> }
> +
> +
> +static int default_fdset_get_fd(int64_t fdset_id, int flags)
> +{
> + return -1;
> +}
> +QEMU_WEAK_ALIAS(monitor_fdset_get_fd, default_fdset_get_fd);
> +
> +static int default_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
> +{
> + return -1;
> +}
> +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_add, default_fdset_dup_fd_add);
> +
> +static int default_fdset_dup_fd_remove(int dup_fd)
> +{
> + return -1;
> +}
> +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_remove, default_fdset_dup_fd_remove);
> +
> +static int default_fdset_dup_fd_find(int dup_fd)
> +{
> + return -1;
> +}
> +QEMU_WEAK_ALIAS(monitor_fdset_dup_fd_find, default_fdset_dup_fd_find);
> diff --git a/qemu-common.h b/qemu-common.h
> index b54612b..36ce522 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -167,7 +167,6 @@ int qemu_fls(int i);
> int qemu_fdatasync(int fd);
> int fcntl_setfl(int fd, int flag);
> int qemu_parse_fd(const char *param);
> -int qemu_parse_fdset(const char *param);
>
> /*
> * strtosz() suffixes used to specify the default treatment of an
> diff --git a/qemu-tool.c b/qemu-tool.c
> index f2f9813..84273ae 100644
> --- a/qemu-tool.c
> +++ b/qemu-tool.c
> @@ -68,26 +68,6 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
> {
> }
>
> -int monitor_fdset_get_fd(int64_t fdset_id, int flags)
> -{
> - return -1;
> -}
> -
> -int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
> -{
> - return -1;
> -}
> -
> -int monitor_fdset_dup_fd_remove(int dup_fd)
> -{
> - return -1;
> -}
> -
> -int monitor_fdset_dup_fd_find(int dup_fd)
> -{
> - return -1;
> -}
> -
> int64_t cpu_get_clock(void)
> {
> return qemu_get_clock_ns(rt_clock);
> diff --git a/qemu-user.c b/qemu-user.c
> index 13fb9ae..08ccb0f 100644
> --- a/qemu-user.c
> +++ b/qemu-user.c
> @@ -35,23 +35,3 @@ void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
> void monitor_set_error(Monitor *mon, QError *qerror)
> {
> }
> -
> -int monitor_fdset_get_fd(int64_t fdset_id, int flags)
> -{
> - return -1;
> -}
> -
> -int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
> -{
> - return -1;
> -}
> -
> -int monitor_fdset_dup_fd_remove(int dup_fd)
> -{
> - return -1;
> -}
> -
> -int monitor_fdset_dup_fd_find(int dup_fd)
> -{
> - return -1;
> -}
Hi Paolo,
this patch breaks QEMU on 32 and 64 bit hosts, native and with Wine.
It's easy to reproduce the SIGSEGV crash: just add a -snapshot option.
Obviously the critical code is executed only when this option was used.
Here is a simple command line using Wine:
wine i386-softmmu/qemu-system-i386 -L pc-bios -snapshot Makefile
The disk image does not matter, so I just selected QEMU's Makefile.
It looks like weak symbols are not really working with MinGW
(Blue Swirl previously pointed out that only ELF and a.out are
officially supported).
I can see in the debugger that QEMU wants to call monitor_fdset_dup_fd_find
from qemu_close.
In previous versions, this was just a dummy function returning 0.
Now, it is the function in monitor.c, but the address does not match
exactly, so the code addresses lines near the beginning of
monitor_fdset_dup_fd_find which does not work of course.
A trivial workaround is calling default_fdset_dup_fd_find which
restores the old behaviour. I expect that all other weak functions
would show the same problem if they were used.
Regards,
Stefan
next prev parent reply other threads:[~2012-11-15 18:02 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 15:30 [Qemu-devel] [PULL v2 00/39] AioContext, thread pool, Win32 AIO Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 01/39] janitor: move iovector functions out of cutils.c Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 02/39] build: move cutils.o and qemu-timer-common.o to oslib-obj-y Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 03/39] compiler: use weak aliases to provide default definitions Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 04/39] sockets: use weak aliases instead of qemu-tool.c Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 05/39] fdsets: use weak aliases instead of qemu-tool.c/qemu-user.c Paolo Bonzini
2012-11-15 18:01 ` Stefan Weil [this message]
2012-11-15 20:52 ` Paolo Bonzini
2012-11-15 22:18 ` Stefan Weil
2012-11-16 9:35 ` Paolo Bonzini
2012-11-16 17:15 ` Stefan Weil
2012-11-16 17:39 ` Paolo Bonzini
2012-11-16 17:52 ` Peter Maydell
2012-11-16 17:55 ` Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 06/39] iohandler: add weak alias in qemu-sockets.c, for qemu-ga Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 07/39] win32: add weak version of qemu_fd_register Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 08/39] qemu-timer: make initialization functions idempotent Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 09/39] main-loop: unify qemu_init_main_loop between QEMU and tools Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 10/39] qemu-tool: do not depend on qemu-timer.c Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 11/39] build: opts-visitor is not really part of QAPI Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 12/39] build: do not include main loop where it is not actually used Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 13/39] event_notifier: add Win32 implementation Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 14/39] event_notifier: enable it to use pipes Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 15/39] vl: init main loop earlier Paolo Bonzini
2012-11-02 7:26 ` Jan Kiszka
2012-11-02 9:55 ` Paolo Bonzini
2012-11-02 10:32 ` Jan Kiszka
2012-11-02 11:04 ` Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 16/39] aio: change qemu_aio_set_fd_handler to return void Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 17/39] aio: provide platform-independent API Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 18/39] aio: introduce AioContext, move bottom halves there Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 19/39] aio: add I/O handlers to the AioContext interface Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 20/39] aio: test node->deleted before calling io_flush Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 21/39] aio: add non-blocking variant of aio_wait Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 22/39] aio: prepare for introducing GSource-based dispatch Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 23/39] aio: add Win32 implementation Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 24/39] aio: make AioContexts GSources Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 25/39] aio: add aio_notify Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 26/39] aio: call aio_notify after setting I/O handlers Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 27/39] main-loop: use GSource to poll AIO file descriptors Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 28/39] main-loop: use aio_notify for qemu_notify_event Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 29/39] aio: clean up now-unused functions Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 30/39] linux-aio: use event notifiers Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 31/39] qemu-thread: add QemuSemaphore Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 32/39] aio: add generic thread-pool facility Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 33/39] threadpool: do not take lock in event_notifier_ready Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 34/39] block: switch posix-aio-compat to threadpool Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 35/39] raw: merge posix-aio-compat.c into block/raw-posix.c Paolo Bonzini
2012-11-02 15:00 ` Peter Maydell
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 36/39] raw-posix: rename raw-posix-aio.h, hide unavailable prototypes Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 37/39] raw-win32: add emulated AIO support Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 38/39] raw-posix: move linux-aio.c to block/ Paolo Bonzini
2012-10-31 15:30 ` [Qemu-devel] [PATCH v2 39/39] raw-win32: implement native asynchronous I/O Paolo Bonzini
2012-11-21 13:20 ` Jan Kiszka
2012-11-21 13:25 ` Paolo Bonzini
2012-11-21 13:27 ` Jan Kiszka
2012-11-21 13:33 ` Paolo Bonzini
2012-11-21 13:38 ` Jan Kiszka
2012-11-22 13:34 ` Jan Kiszka
2012-11-22 15:16 ` Paolo Bonzini
2012-11-22 15:53 ` Jan Kiszka
2012-11-01 19:33 ` [Qemu-devel] [PULL v2 00/39] AioContext, thread pool, Win32 AIO Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50A52E14.2070106@weilnetz.de \
--to=sw@weilnetz.de \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.