qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Jason Wang (jasowang@redhat.com)" <jasowang@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V15 00/12] Introduce COLO-Proxy
Date: Fri, 30 Sep 2016 16:04:03 +0200	[thread overview]
Message-ID: <609665e9-a108-2d4d-31d8-845fc69d028b@redhat.com> (raw)
In-Reply-To: <1474942956-27182-1-git-send-email-zhangchen.fnst@cn.fujitsu.com>



On 27/09/2016 04:22, Zhang Chen wrote:
> COLO-proxy is a part of COLO project. COLO project is
> composed of COLO-frame, COLO-proxy and block-replication.
> It is used to compare the network package to help COLO
> decide whether to do checkpoint. With COLO-proxy's help,
> COLO greatly improves the performance.
> 
> The filter-redirector, filter-mirror, colo-compare
> and filter-rewriter compose the COLO-proxy.
> 
> COLO-compare
> It is used to compare the network package to help COLO decide
> whether to do checkpoint. 
> 
> Filter-rewriter
> It will rewrite some of secondary packet to make
> secondary guest's connection established successfully.
> In this module we will rewrite tcp packet's ack to the secondary
> from primary,and rewrite tcp packet's seq to the primary from
> secondary.

Hi, please fix the following issues reported by Coverity:



** CID 1363368:    (RESOURCE_LEAK)
/net/filter-rewriter.c: 197 in colo_rewriter_receive_iov()
/net/filter-rewriter.c: 210 in colo_rewriter_receive_iov()
/net/filter-rewriter.c: 217 in colo_rewriter_receive_iov()
________________________________________________________________________________________________________
*** CID 1363368:    (RESOURCE_LEAK)
191                     packet_destroy(pkt, NULL);
192                     pkt = NULL;
193                     /*
194                      * We block the packet here,after rewrite pkt
195                      * and will send it
196                      */
>>>     CID 1363368:    (RESOURCE_LEAK)
>>>     Variable "buf" going out of scope leaks the storage it points to.
197                     return 1;
198                 }
199             } else {
200                 /* NET_FILTER_DIRECTION_RX */
201                 if (!handle_secondary_tcp_pkt(nf, conn, pkt)) {
202                     qemu_net_queue_send(s->incoming_queue, sender, 0,

204                     packet_destroy(pkt, NULL);
205                     pkt = NULL;
206                     /*
207                      * We block the packet here,after rewrite pkt
208                      * and will send it
209                      */
>>>     CID 1363368:    (RESOURCE_LEAK)
>>>     Variable "buf" going out of scope leaks the storage it points to.
210                     return 1;
211                 }
212             }
213         }
214     
215         packet_destroy(pkt, NULL);
/net/filter-rewriter.c: 217 in colo_rewriter_receive_iov()
216         pkt = NULL;
>>>     CID 1363368:    (RESOURCE_LEAK)
>>>     Variable "buf" going out of scope leaks the storage it points to.
217         return 0;
218     }
219     
220     static void colo_rewriter_cleanup(NetFilterState *nf)
221     {
222         RewriterState *s = FILTER_COLO_REWRITER(nf);





** CID 1363359:  API usage errors  (ALLOC_FREE_MISMATCH)
/net/filter-rewriter.c: 78 in handle_primary_tcp_pkt()
/net/filter-rewriter.c: 79 in handle_primary_tcp_pkt()
________________________________________________________________________________________________________
72             sdebug = strdup(inet_ntoa(pkt->ip->ip_src));
73             ddebug = strdup(inet_ntoa(pkt->ip->ip_dst));
74             trace_colo_filter_rewriter_pkt_info(__func__, sdebug, ddebug,
75                         ntohl(tcp_pkt->th_seq), ntohl(tcp_pkt->th_ack),
76                         tcp_pkt->th_flags);
77             trace_colo_filter_rewriter_conn_offset(conn->offset);
>>>     CID 1363359:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>     Calling "g_free" frees "sdebug" using "g_free" but it should have been freed using "free".
78             g_free(sdebug);
>>>     CID 1363359:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>     Calling "g_free" frees "ddebug" using "g_free" but it should have been freed using "free".
79             g_free(ddebug);
80         }
81     
82         if (((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == TH_SYN)) {
83             /*





** CID 1363358:  API usage errors  (ALLOC_FREE_MISMATCH)
/net/filter-rewriter.c: 126 in handle_secondary_tcp_pkt()
/net/filter-rewriter.c: 127 in handle_secondary_tcp_pkt()
________________________________________________________________________________________________________
120             sdebug = strdup(inet_ntoa(pkt->ip->ip_src));
121             ddebug = strdup(inet_ntoa(pkt->ip->ip_dst));
122             trace_colo_filter_rewriter_pkt_info(__func__, sdebug, ddebug,
123                         ntohl(tcp_pkt->th_seq), ntohl(tcp_pkt->th_ack),
124                         tcp_pkt->th_flags);
125             trace_colo_filter_rewriter_conn_offset(conn->offset);
>>>     CID 1363358:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>     Calling "g_free" frees "sdebug" using "g_free", it should have been allocated using "g_strdup".
126             g_free(sdebug);
>>>     CID 1363358:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>     Calling "g_free" frees "ddebug" using "g_free", it should have been allocated using "g_strdup".
127             g_free(ddebug);
128         }
129     
130         if (((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == (TH_ACK | TH_SYN))) {
131             /*





** CID 1363357:  API usage errors  (ALLOC_FREE_MISMATCH)
/net/colo-compare.c: 238 in colo_packet_compare_tcp()
/net/colo-compare.c: 239 in colo_packet_compare_tcp()
________________________________________________________________________________________________________
233             fprintf(stderr, "Primary len = %d\n", ppkt->size);
234             qemu_hexdump((char *)ppkt->data, stderr, "colo-compare", ppkt->size);
235             fprintf(stderr, "Secondary len = %d\n", spkt->size);
236             qemu_hexdump((char *)spkt->data, stderr, "colo-compare", spkt->size);
237     
>>>     CID 1363356:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>     Calling "g_free" frees "sdebug" using "g_free", it should have been allocated using "g_strdup".
238             g_free(sdebug);
>>>     CID 1363357:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>     Calling "g_free" frees "ddebug" using "g_free", it should have been allocated using "g_strdup".
239             g_free(ddebug);
240         }
241     
242         return res;
243     }
244     

      parent reply	other threads:[~2016-09-30 14:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27  2:22 [Qemu-devel] [PATCH V15 00/12] Introduce COLO-Proxy Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 01/12] qemu-char: Add qemu_chr_add_handlers_full() for GMaincontext Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 02/12] colo-compare: introduce colo compare initialization Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 03/12] net/colo.c: add colo.c to define and handle packet Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 04/12] Jhash: add linux kernel jhashtable in qemu Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 05/12] colo-compare: track connection and enqueue packet Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 06/12] colo-compare: introduce packet comparison thread Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 07/12] colo-compare: add TCP, UDP, ICMP packet comparison Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 08/12] filter-rewriter: introduce filter-rewriter initialization Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 09/12] filter-rewriter: track connection and parse packet Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 10/12] filter-rewriter: rewrite tcp packet to keep secondary connection Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 11/12] MAINTAINERS: add maintainer for COLO-proxy Zhang Chen
2016-09-27  2:22 ` [Qemu-devel] [PATCH V15 12/12] docs: Add documentation " Zhang Chen
2016-09-27  8:38 ` [Qemu-devel] [PATCH V15 00/12] Introduce COLO-Proxy Jason Wang
2016-09-27  8:45   ` Zhang Chen
2016-09-30 14:04 ` Paolo Bonzini [this message]

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=609665e9-a108-2d4d-31d8-845fc69d028b@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhangchen.fnst@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).