Monitor-related fixes
cover Monitor-related fixes
Hi,
the first patch fixes an issue with HMP monitors, which was exposed with v2.1.0 (commits cdaa86a and 812c10). The second one fixes a typo in a helper C program used in qemu-iotests.
We think that they should be cherry-picked for the next stable release.
Thanks,
Stratos
Stratos Psomadakis (2):
monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
iotests: Send the correct fd in socket_scm_helper
monitor.c | 1 + tests/qemu-iotests/socket_scm_helper.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.10.4
PATCH 1/2 monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Commit cdaa86a54 ("Add G_IO_HUP handler for socket chardev") exposed a bug in the way the HMP monitor handles its input. When a client closes the connection to the monitor, tcp_chr_read() will catch the HUP 'signal' and call tcp_chr_disconnect() to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for each tcp_chr_read()), the monitor readline state / buffers can be left in an inconsistent state (i.e. a half-finished command). Thus, without calling readline_restart() on mon->rs upon CHR_EVENT_CLOSED, future HMP commands will fail.
--- monitor.c | 1 + 1 file changed, 1 insertion(+)
monitor.c +1 -0
@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 5 lines · Stratos Psomadakis
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its input. When a client closes the connection to the monitor,tcp_chr_read()will catch the HUP 'signal' and calltcp_chr_disconnect()to close the server-side connection too.
Your wording suggests SIGUP, but that's misleading. Suggest "tcp_chr_read() will detect the G_IO_HUP condition, and call".
Quoted 3 lines
Due to the fact that monitor reads 1 byte at a time (for
eachtcp_chr_read()), the monitor readline state / buffers can be left in an inconsistent state (i.e. a half-finished command).
The state is not really inconsistent, there's just junk left in rs->cmd_buf[].
Quoted 3 lines
Thus, without
callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.
To make sure I understand you correctly: when you connect again, any leftover junk is prepended to your input, which messes up your first command. Correct?
Quoted 11 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +0
-0
monitor.c static void monitor_event(void *opaque, int event) · line 5258
Quoted 7 lines
monitor.c +1
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Patch looks good to me.
Re: [Qemu-devel] [synnefo-devel] Re: [PATCH 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 9 lines · Markus Armbruster
Quoted 5 lines · Stratos Psomadakis
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its input. When a client closes the connection to the monitor,tcp_chr_read()will catch the HUP 'signal' and calltcp_chr_disconnect()to close the server-side connection too.Your wording suggests SIGUP, but that's misleading. Suggest "
tcp_chr_read()will detect theG_IO_HUPcondition, and call".
ack
Quoted 6 lines
Quoted 4 lines
Due to the fact that monitor reads 1 byte at a time (for
eachtcp_chr_read()), the monitor readline state / buffers can be left in an inconsistent state (i.e. a half-finished command).The state is not really inconsistent, there's just junk left in rs->cmd_buf[].
ack
Quoted 6 lines
Quoted 3 lines
Thus, without
callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.To make sure I understand you correctly: when you connect again, any leftover junk is prepended to your input, which messes up your first command. Correct?
Yeap.
Quoted 13 lines
Quoted 13 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +0
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;
Quoted 6 lines
monitor.c static void monitor_event(void *opaque, int event) · line 5258
Quoted 5 lines
monitor.c +1
-0case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;Patch looks good to me.
ok, I'll edit the commit msg and resend the patch.
Thanks,
Stratos
Quoted 1 line
Signature · 2 lines
Stratos Psomadakis <[email protected]>
PATCH RESEND 1/2 monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
In reply to Markus ArmbrusterCommit cdaa86a54 ("Add G_IO_HUP handler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor, tcp_chr_read() will detect the G_IO_HUP condition and call tcp_chr_disconnect() to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for each tcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without calling readline_restart() on mon->rs upon CHR_EVENT_CLOSED, future HMP commands will fail.
--- monitor.c | 1 + 1 file changed, 1 insertion(+)
monitor.c +1 -0
@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH resend 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 8 lines · On Fri, 12 Sep 2014 17:07:32 +0300 Stratos Psomadakis <[email protected]> wrote:
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor,tcp_chr_read()will detect theG_IO_HUPcondition and calltcp_chr_disconnect()to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for eachtcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.
What's your reproducer? Are you using the mux feature? We also reset it in CHR_EVENT_OPENED if the mux feature is not used, why isn't that good enough?
Quoted 19 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +1
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Re: [Qemu-devel] [synnefo-devel] Re: [PATCH resend 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 11 lines · Luiz Capitulino
Quoted 8 lines · On Fri, 12 Sep 2014 17:07:32 +0300 Stratos Psomadakis <[email protected]> wrote:
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor,tcp_chr_read()will detect theG_IO_HUPcondition and calltcp_chr_disconnect()to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for eachtcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.
Quoted 1 line
What's your reproducer?
We have a script that opens a connection to the HMP socket and starts sending 'info version' commands to the monitor in a loop. If we kill the script (in the middle of the loop) and re-run it, we get "unknown command" errors from the HMP ("unknown command: 'infinfo'" for example).
Quoted 1 line
Are you using the mux feature?
Nope (on the cli we use '-monitor unix:<path>.mon,server,nowait' for the HMP).
Quoted 3 lines
We also reset it
inCHR_EVENT_OPENEDif the mux feature is not used, why isn't that good enough?
I checked the code and on CHR_EVENT_OPENED the monitor calls readline_show_prompt (when not using mux). This resets the last_cmd_index/size readline variables, but the cmd_buf_index/size remains intact. I think that readline_restart() is necessary in order to cleanup the readline cmd buf (either in CHR_EVENT_OPENED or in CHR_EVENT_CLOSED).
Thanks,
Stratos
Quoted 19 lines
Quoted 19 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +1
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Signature · 2 lines
Stratos Psomadakis <[email protected]>
Re: [Qemu-devel] [synnefo-devel] Re: [PATCH resend 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 28 lines · On Fri, 12 Sep 2014 20:01:04 +0300 Stratos Psomadakis <[email protected]> wrote:
Quoted 11 lines · Luiz Capitulino
Quoted 8 lines · On Fri, 12 Sep 2014 17:07:32 +0300 Stratos Psomadakis <[email protected]> wrote:
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor,tcp_chr_read()will detect theG_IO_HUPcondition and calltcp_chr_disconnect()to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for eachtcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.Quoted 1 line
What's your reproducer?
We have a script that opens a connection to the HMP socket and starts sending 'info version' commands to the monitor in a loop. If we kill the script (in the middle of the loop) and re-run it, we get "unknown command" errors from the HMP ("unknown command: 'infinfo'" for example).
Quoted 1 line
Are you using the mux feature?
Nope (on the cli we use '-monitor unix:<path>.mon,server,nowait' for the HMP).
Quoted 3 lines
We also reset it
inCHR_EVENT_OPENEDif the mux feature is not used, why isn't that good enough?
Quoted 6 lines
I checked the code and on
CHR_EVENT_OPENEDthe monitor callsreadline_show_prompt(when not using mux). This resets the last_cmd_index/size readline variables, but the cmd_buf_index/size remains intact. I think thatreadline_restart()is necessary in order to cleanup the readline cmd buf (either inCHR_EVENT_OPENEDor inCHR_EVENT_CLOSED).
I'm wondering if calling readline_restart() in the CHR_EVENT_CLOSED can break mux support. But I won't have time to check it today. Maybe moving the readline_restart() call to right before the readline_show_prompt() call in the OPENED event is the best thing to do?
Quoted 25 lines
Thanks,
StratosQuoted 19 lines
Quoted 19 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +1
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Re: [Qemu-devel] [synnefo-devel] Re: [PATCH resend 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 34 lines · Luiz Capitulino
Quoted 25 lines · On Fri, 12 Sep 2014 20:01:04 +0300 Stratos Psomadakis <[email protected]> wrote:
Quoted 11 lines · Luiz Capitulino
Quoted 8 lines · On Fri, 12 Sep 2014 17:07:32 +0300 Stratos Psomadakis <[email protected]> wrote:
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor,tcp_chr_read()will detect theG_IO_HUPcondition and calltcp_chr_disconnect()to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for eachtcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.Quoted 1 line
What's your reproducer?
We have a script that opens a connection to the HMP socket and starts sending 'info version' commands to the monitor in a loop. If we kill the script (in the middle of the loop) and re-run it, we get "unknown command" errors from the HMP ("unknown command: 'infinfo'" for example).
Quoted 1 line
Are you using the mux feature?
Nope (on the cli we use '-monitor unix:<path>.mon,server,nowait' for the HMP).
Quoted 3 lines
We also reset it
inCHR_EVENT_OPENEDif the mux feature is not used, why isn't that good enough?Quoted 6 lines
I checked the code and on
CHR_EVENT_OPENEDthe monitor callsreadline_show_prompt(when not using mux). This resets the last_cmd_index/size readline variables, but the cmd_buf_index/size remains intact. I think thatreadline_restart()is necessary in order to cleanup the readline cmd buf (either inCHR_EVENT_OPENEDor inCHR_EVENT_CLOSED).
Quoted 4 lines
I'm wondering if calling
readline_restart()in theCHR_EVENT_CLOSEDcan break mux support. But I won't have time to check it today. Maybe moving thereadline_restart()call to right before thereadline_show_prompt()call in the OPENED event is the best thing to do?
I did some quick tests with a mux chardev (I tried two mux'ed HMP monitors and a serial and an HMP). Calling readline_restart() in CHR_EVENT_CLOSED didn't seem to affect mux support (as far as I could tell). However, calling readline_restart() in CHR_EVENT_OPENED, just before readline_show_prompt(), resolves the issue too, and I think it makes more sense to be called at that point. If you agree, I can resend the modified patch.
Quoted 23 lines
Quoted 23 lines
Thanks,
StratosQuoted 18 lines
Quoted 18 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +1
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
Signature · 2 lines
Stratos Psomadakis <[email protected]>
Re: [Qemu-devel] [synnefo-devel] Re: [PATCH resend 1/2] monitor: Reset HMP mon->rs on CHR_EVENT_CLOSED
Quoted 40 lines · On Sat, 13 Sep 2014 19:27:46 +0300 Stratos Psomadakis <[email protected]> wrote:
Quoted 34 lines · Luiz Capitulino
Quoted 25 lines · On Fri, 12 Sep 2014 20:01:04 +0300 Stratos Psomadakis <[email protected]> wrote:
Quoted 11 lines · Luiz Capitulino
Quoted 8 lines · On Fri, 12 Sep 2014 17:07:32 +0300 Stratos Psomadakis <[email protected]> wrote:
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor,tcp_chr_read()will detect theG_IO_HUPcondition and calltcp_chr_disconnect()to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for eachtcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without callingreadline_restart()onmon->rsuponCHR_EVENT_CLOSED, future HMP commands will fail.Quoted 1 line
What's your reproducer?
We have a script that opens a connection to the HMP socket and starts sending 'info version' commands to the monitor in a loop. If we kill the script (in the middle of the loop) and re-run it, we get "unknown command" errors from the HMP ("unknown command: 'infinfo'" for example).
Quoted 1 line
Are you using the mux feature?
Nope (on the cli we use '-monitor unix:<path>.mon,server,nowait' for the HMP).
Quoted 3 lines
We also reset it
inCHR_EVENT_OPENEDif the mux feature is not used, why isn't that good enough?Quoted 6 lines
I checked the code and on
CHR_EVENT_OPENEDthe monitor callsreadline_show_prompt(when not using mux). This resets the last_cmd_index/size readline variables, but the cmd_buf_index/size remains intact. I think thatreadline_restart()is necessary in order to cleanup the readline cmd buf (either inCHR_EVENT_OPENEDor inCHR_EVENT_CLOSED).Quoted 4 lines
I'm wondering if calling
readline_restart()in theCHR_EVENT_CLOSEDcan break mux support. But I won't have time to check it today. Maybe moving thereadline_restart()call to right before thereadline_show_prompt()call in the OPENED event is the best thing to do?
Quoted 7 lines
I did some quick tests with a mux chardev (I tried two mux'ed HMP monitors and a serial and an HMP). Calling
readline_restart()inCHR_EVENT_CLOSEDdidn't seem to affect mux support (as far as I could tell). However, callingreadline_restart()inCHR_EVENT_OPENED, just beforereadline_show_prompt(), resolves the issue too, and I think it makes more sense to be called at that point. If you agree, I can resend the modified patch.
Yes, I think that's the best. I'll just apply your respin.
Quoted 26 lines
Quoted 24 lines
Quoted 24 lines
Thanks,
StratosQuoted 18 lines
Quoted 18 lines
Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +1
-0@@ -5252,6 +5252,7 @@ static void monitor_event(void *opaque, int event)break ;case CHR_EVENT_CLOSED : +readline_restart (mon->rs); mon_refcount--;monitor_fdsets_cleanup ();break ;
PATCH RESEND v2 1/2 monitor: Reset HMP mon->rs in CHR_EVENT_OPEN
Commit cdaa86a54 ("Add G_IO_HUP handler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor, tcp_chr_read() will detect the G_IO_HUP condition and call tcp_chr_disconnect() to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for each tcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without calling readline_restart() on mon->rs in CHR_EVENT_OPEN, future HMP commands will fail.
--- monitor.c | 1 + 1 file changed, 1 insertion(+)
monitor.c +1 -0
@@ -5245,6 +5245,7 @@ static void monitor_event(void *opaque, int event)monitor_printf (mon,"QEMU %s monitor - type 'help' for more " "information\n" ,QEMU_VERSION );if (!mon->mux_out) { +readline_restart (mon->rs);readline_show_prompt (mon->rs); } mon->reset_seen =1 ;
Signature · 1 line
1.7.10.4
Luiz Capitulino
AppliedRe: [Qemu-devel] [PATCH resend v2 1/2] monitor: Reset HMP mon->rs in CHR_EVENT_OPEN
Quoted 11 lines · On Mon, 15 Sep 2014 15:34:57 +0300 Stratos Psomadakis <[email protected]> wrote:
Commit
cdaa86a54("AddG_IO_HUPhandler for socket chardev") exposed a bug in the way the HMP monitor handles its command buffer. When a client closes the connection to the monitor,tcp_chr_read()will detect theG_IO_HUPcondition and calltcp_chr_disconnect()to close the server-side connection too. Due to the fact that monitor reads 1 byte at a time (for eachtcp_chr_read()), the monitor readline state / buffers might contain junk (i.e. a half-finished command). Thus, without callingreadline_restart()onmon->rsinCHR_EVENT_OPEN, future HMP commands will fail.Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>
Applied to the qmp branch, thanks.
Quoted 16 lines
--- monitor.c | 1 + 1 file changed, 1 insertion(+)monitor.c +1
-0@@ -5245,6 +5245,7 @@ static void monitor_event(void *opaque, int event)monitor_printf (mon,"QEMU %s monitor - type 'help' for more " "information\n" ,QEMU_VERSION );if (!mon->mux_out) { +readline_restart (mon->rs);readline_show_prompt (mon->rs); } mon->reset_seen =1 ;
PATCH 2/2 iotests: Send the correct fd in socket_scm_helper
In reply to Stratos PsomadakisMake sure to pass the correct fd via SCM_RIGHTS in socket_scm_helper.c (i.e. fd_to_send, not socket-fd).
--- tests/qemu-iotests/socket_scm_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/socket_scm_helper.c +1 -1
@@ -52,7 +52,7 @@ static int send_fd(int fd, int fd_to_send) cmsg->cmsg_len =CMSG_LEN (sizeof (int )); cmsg->cmsg_level =SOL_SOCKET ; cmsg->cmsg_type =SCM_RIGHTS ; -memcpy (CMSG_DATA (cmsg), &fd,sizeof (int )); +memcpy (CMSG_DATA (cmsg), &fd_to_send,sizeof (int )); do { ret = sendmsg(fd, &msg, 0);
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 2/2] iotests: Send the correct fd in socket_scm_helper
Quoted 14 lines · Stratos Psomadakis
Make sure to pass the correct fd via
SCM_RIGHTSinsocket_scm_helper.c(i.e.fd_to_send, not socket-fd).Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>--- tests/qemu-iotests/socket_scm_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qemu-iotests/socket_scm_helper.c +0
-0
tests/qemu-iotests/socket_scm_helper.c static int send_fd(int fd, int fd_to_send) · line 58
Quoted 8 lines
tests/qemu-iotests/socket_scm_helper.c +1
-1@@ -52,7 +52,7 @@ static int send_fd(int fd, int fd_to_send) cmsg->cmsg_len =CMSG_LEN (sizeof (int )); cmsg->cmsg_level =SOL_SOCKET ; cmsg->cmsg_type =SCM_RIGHTS ; -memcpy (CMSG_DATA (cmsg), &fd,sizeof (int )); +memcpy (CMSG_DATA (cmsg), &fd_to_send,sizeof (int )); do { ret = sendmsg(fd, &msg, 0);
Ouch. Do you have an idea what's broken without this fix?
Kevin Wolf
AppliedRe: [Qemu-devel] [PATCH 2/2] iotests: Send the correct fd in socket_scm_helper
Am 12.09.2014 um 09:04 hat Markus Armbruster geschrieben:
Quoted 7 lines
Quoted 5 lines · Stratos Psomadakis
Make sure to pass the correct fd via
SCM_RIGHTSinsocket_scm_helper.c(i.e.fd_to_send, not socket-fd).Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>
Thanks, applied to the block branch.
(Also thanks to Markus for copying me, would have missed the patch otherwise.)
Quoted 14 lines
Quoted 14 lines
tests/qemu-iotests/socket_scm_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qemu-iotests/socket_scm_helper.c +1
-1@@ -52,7 +52,7 @@ static int send_fd(int fd, int fd_to_send) cmsg->cmsg_len =CMSG_LEN (sizeof (int )); cmsg->cmsg_level =SOL_SOCKET ; cmsg->cmsg_type =SCM_RIGHTS ; -memcpy (CMSG_DATA (cmsg), &fd,sizeof (int )); +memcpy (CMSG_DATA (cmsg), &fd_to_send,sizeof (int ));
Quoted 4 lines
tests/qemu-iotests/socket_scm_helper.c static int send_fd(int fd, int fd_to_send) · line 58
Quoted 2 lines
tests/qemu-iotests/socket_scm_helper.c +0
-0do { ret = sendmsg(fd, &msg, 0);Ouch. Do you have an idea what's broken without this fix?
As far as I can tell, nothing. Test case 045 will send a different file descriptor than it intended to, but the file descriptors aren't used other than checking whether qemu correctly reports their existence, so it doesn't matter.
I'm not adding qemu-stable therefore. Please correct me if I'm missing something.
Kevin
Re: [Qemu-devel] [PATCH 2/2] iotests: Send the correct fd in socket_scm_helper
Quoted 30 lines · Kevin Wolf
Am 12.09.2014 um 09:04 hat Markus Armbruster geschrieben:
Quoted 7 lines
Quoted 5 lines · Stratos Psomadakis
Make sure to pass the correct fd via
SCM_RIGHTSinsocket_scm_helper.c(i.e.fd_to_send, not socket-fd).Signed-off-by Stratos Psomadakis <[email protected]>Signed-off-by Dimitris Aragiorgis <[email protected]>Thanks, applied to the block branch.
(Also thanks to Markus for copying me, would have missed the patch otherwise.)
Quoted 14 lines
Quoted 14 lines
tests/qemu-iotests/socket_scm_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/qemu-iotests/socket_scm_helper.c +1
-1@@ -52,7 +52,7 @@ static int send_fd(int fd, int fd_to_send) cmsg->cmsg_len =CMSG_LEN (sizeof (int )); cmsg->cmsg_level =SOL_SOCKET ; cmsg->cmsg_type =SCM_RIGHTS ; -memcpy (CMSG_DATA (cmsg), &fd,sizeof (int )); +memcpy (CMSG_DATA (cmsg), &fd_to_send,sizeof (int ));Quoted 3 lines
tests/qemu-iotests/socket_scm_helper.c static int send_fd(int fd, int fd_to_send) · line 58
Quoted 2 lines
tests/qemu-iotests/socket_scm_helper.c +0
-0do { ret = sendmsg(fd, &msg, 0);Ouch. Do you have an idea what's broken without this fix?
Quoted 7 lines
As far as I can tell, nothing. Test case 045 will send a different file descriptor than it intended to, but the file descriptors aren't used other than checking whether qemu correctly reports their existence, so it doesn't matter.
I'm not adding qemu-stable therefore. Please correct me if I'm missing something.
Right. I mentioned qemu-stable mainly for the first patch.
Thanks,
Stratos
Quoted 2 lines
Kevin
Signature · 2 lines
Stratos Psomadakis <[email protected]>
You neglected to cc maintainers.
Quoted 4 lines · Stratos Psomadakis
Hi,
the first patch fixes an issue with HMP monitors, which was exposed with v2.1.0 (commits cdaa86a and 812c10).
Copying Luiz.
Quoted 2 lines
The second one fixes a typo in a helper C program used in qemu-iotests.
Copying Kevin and Stefan.
Quoted 1 line
We think that they should be cherry-picked for the next stable release.
Copying [email protected].