All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] slirp updates
@ 2017-05-27 21:46 Samuel Thibault
  2017-05-27 21:46 ` [Qemu-devel] [PULL 1/3] slirp: Fix wrong mss bug Samuel Thibault
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Samuel Thibault @ 2017-05-27 21:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Samuel Thibault, stefanha, jan.kiszka

The following changes since commit 9964e96dc9999cf7f7c936ee854a795415d19b60:

  Merge remote-tracking branch 'jasowang/tags/net-pull-request' into staging (2017-05-23 15:01:31 +0100)

are available in the git repository at:

  http://people.debian.org/~sthibault/qemu.git tags/samuel-thibault

for you to fetch changes up to 2e30230aa95a2d6cfaadac015bd96c3db19c45e4:

  Fix total IP header length in forwarded TCP packets (2017-05-27 23:35:00 +0200)

----------------------------------------------------------------
slirp updates

----------------------------------------------------------------
Marc-André Lureau (1):
      slirp: fix leak

Sjors Gielen (1):
      Fix total IP header length in forwarded TCP packets

Tao Wu (1):
      slirp: Fix wrong mss bug.

 slirp/socket.c    | 3 +++
 slirp/tcp_input.c | 4 ++--
 slirp/tcp_subr.c  | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 1/3] slirp: Fix wrong mss bug.
  2017-05-27 21:46 [Qemu-devel] [PULL 0/3] slirp updates Samuel Thibault
@ 2017-05-27 21:46 ` Samuel Thibault
  2017-05-27 21:46 ` [Qemu-devel] [PULL 2/3] slirp: fix leak Samuel Thibault
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2017-05-27 21:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Tao Wu, stefanha, jan.kiszka, Tao Wu

From: Tao Wu <ytht.net@gmail.com>

This bug was introduced by https://github.com/qemu/qemu/commit/98c6305

Signed-off-by: Tao Wu <lepton@google.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-bu: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/tcp_input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c
index edb98f06f3..07bcbdb2dd 100644
--- a/slirp/tcp_input.c
+++ b/slirp/tcp_input.c
@@ -1587,11 +1587,11 @@ tcp_mss(struct tcpcb *tp, u_int offer)
 	switch (so->so_ffamily) {
 	case AF_INET:
             mss = MIN(IF_MTU, IF_MRU) - sizeof(struct tcphdr)
-	                              + sizeof(struct ip);
+	                              - sizeof(struct ip);
 	    break;
 	case AF_INET6:
             mss = MIN(IF_MTU, IF_MRU) - sizeof(struct tcphdr)
-	                              + sizeof(struct ip6);
+	                              - sizeof(struct ip6);
 	    break;
 	default:
 	    g_assert_not_reached();
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 2/3] slirp: fix leak
  2017-05-27 21:46 [Qemu-devel] [PULL 0/3] slirp updates Samuel Thibault
  2017-05-27 21:46 ` [Qemu-devel] [PULL 1/3] slirp: Fix wrong mss bug Samuel Thibault
@ 2017-05-27 21:46 ` Samuel Thibault
  2017-05-27 21:46 ` [Qemu-devel] [PULL 3/3] Fix total IP header length in forwarded TCP packets Samuel Thibault
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2017-05-27 21:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, stefanha, jan.kiszka, Samuel Thibault

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Spotted by ASAN:

/x86_64/hmp/pc-0.12:
=================================================================
==22538==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 224 byte(s) in 1 object(s) allocated from:
    #0 0x7f0f63cdee60 in malloc (/lib64/libasan.so.3+0xc6e60)
    #1 0x556f11ff32d7 in tcp_newtcpcb /home/elmarco/src/qemu/slirp/tcp_subr.c:250
    #2 0x556f11fdb1d1 in tcp_listen /home/elmarco/src/qemu/slirp/socket.c:688
    #3 0x556f11fca9d5 in slirp_add_hostfwd /home/elmarco/src/qemu/slirp/slirp.c:1052
    #4 0x556f11f8db41 in slirp_hostfwd /home/elmarco/src/qemu/net/slirp.c:506
    #5 0x556f11f8dd83 in hmp_hostfwd_add /home/elmarco/src/qemu/net/slirp.c:535

There might be a better way to fix this, but calling slirp tcp_close()
doesn't work.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/socket.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/slirp/socket.c b/slirp/socket.c
index 86927722e1..3b49a69a93 100644
--- a/slirp/socket.c
+++ b/slirp/socket.c
@@ -100,6 +100,9 @@ sofree(struct socket *so)
   if(so->so_next && so->so_prev)
     remque(so);  /* crashes if so is not in a queue */
 
+  if (so->so_tcpcb) {
+      free(so->so_tcpcb);
+  }
   free(so);
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Qemu-devel] [PULL 3/3] Fix total IP header length in forwarded TCP packets
  2017-05-27 21:46 [Qemu-devel] [PULL 0/3] slirp updates Samuel Thibault
  2017-05-27 21:46 ` [Qemu-devel] [PULL 1/3] slirp: Fix wrong mss bug Samuel Thibault
  2017-05-27 21:46 ` [Qemu-devel] [PULL 2/3] slirp: fix leak Samuel Thibault
@ 2017-05-27 21:46 ` Samuel Thibault
  2017-05-27 21:52 ` [Qemu-devel] [PULL 0/3] slirp updates no-reply
  2017-05-30  9:29 ` Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2017-05-27 21:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sjors Gielen, stefanha, jan.kiszka, Samuel Thibault

From: Sjors Gielen <sjors@sjorsgielen.nl>

When forwarding TCP packets, the internal tcpiphdr struct length was wrongly
used inside the IP header. This commit changes the behaviour to what is used
by tcp_output.c, using the correct full IP header + payload length.

Signed-off-by: Sjors Gielen <sjors@sjorsgielen.nl>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 slirp/tcp_subr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index ed16e1807f..dc8b4bbb50 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -204,7 +204,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
 	    m->m_len  -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr)
 	                                         - sizeof(struct ip);
 	    ip = mtod(m, struct ip *);
-	    ip->ip_len = tlen;
+	    ip->ip_len = m->m_len;
 	    ip->ip_dst = tcpiph_save.ti_dst;
 	    ip->ip_src = tcpiph_save.ti_src;
 	    ip->ip_p = tcpiph_save.ti_pr;
@@ -224,7 +224,7 @@ tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m,
 	    m->m_len  -= sizeof(struct tcpiphdr) - sizeof(struct tcphdr)
 	                                         - sizeof(struct ip6);
 	    ip6 = mtod(m, struct ip6 *);
-	    ip6->ip_pl = tlen;
+	    ip6->ip_pl = tcpiph_save.ti_len;
 	    ip6->ip_dst = tcpiph_save.ti_dst6;
 	    ip6->ip_src = tcpiph_save.ti_src6;
 	    ip6->ip_nh = tcpiph_save.ti_nh6;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL 0/3] slirp updates
  2017-05-27 21:46 [Qemu-devel] [PULL 0/3] slirp updates Samuel Thibault
                   ` (2 preceding siblings ...)
  2017-05-27 21:46 ` [Qemu-devel] [PULL 3/3] Fix total IP header length in forwarded TCP packets Samuel Thibault
@ 2017-05-27 21:52 ` no-reply
  2017-05-30  9:29 ` Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: no-reply @ 2017-05-27 21:52 UTC (permalink / raw)
  To: samuel.thibault; +Cc: famz, qemu-devel, stefanha, jan.kiszka

Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PULL 0/3] slirp updates
Message-id: 20170527214618.32626-1-samuel.thibault@ens-lyon.org
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20170527214618.32626-1-samuel.thibault@ens-lyon.org -> patchew/20170527214618.32626-1-samuel.thibault@ens-lyon.org
Switched to a new branch 'test'
489f78a Fix total IP header length in forwarded TCP packets
c0516eb slirp: fix leak
faedb70 slirp: Fix wrong mss bug.

=== OUTPUT BEGIN ===
Checking PATCH 1/3: slirp: Fix wrong mss bug....
ERROR: code indent should never use tabs
#25: FILE: slirp/tcp_input.c:1590:
+^I                              - sizeof(struct ip);$

ERROR: code indent should never use tabs
#30: FILE: slirp/tcp_input.c:1594:
+^I                              - sizeof(struct ip6);$

total: 2 errors, 0 warnings, 13 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/3: slirp: fix leak...
ERROR: suspect code indent for conditional statements (2, 6)
#38: FILE: slirp/socket.c:103:
+  if (so->so_tcpcb) {
+      free(so->so_tcpcb);

total: 1 errors, 0 warnings, 9 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 3/3: Fix total IP header length in forwarded TCP packets...
ERROR: code indent should never use tabs
#23: FILE: slirp/tcp_subr.c:207:
+^I    ip->ip_len = m->m_len;$

ERROR: code indent should never use tabs
#32: FILE: slirp/tcp_subr.c:227:
+^I    ip6->ip_pl = tcpiph_save.ti_len;$

total: 2 errors, 0 warnings, 16 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PULL 0/3] slirp updates
  2017-05-27 21:46 [Qemu-devel] [PULL 0/3] slirp updates Samuel Thibault
                   ` (3 preceding siblings ...)
  2017-05-27 21:52 ` [Qemu-devel] [PULL 0/3] slirp updates no-reply
@ 2017-05-30  9:29 ` Stefan Hajnoczi
  4 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2017-05-30  9:29 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: qemu-devel, stefanha, jan.kiszka

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

On Sat, May 27, 2017 at 11:46:15PM +0200, Samuel Thibault wrote:
> The following changes since commit 9964e96dc9999cf7f7c936ee854a795415d19b60:
> 
>   Merge remote-tracking branch 'jasowang/tags/net-pull-request' into staging (2017-05-23 15:01:31 +0100)
> 
> are available in the git repository at:
> 
>   http://people.debian.org/~sthibault/qemu.git tags/samuel-thibault
> 
> for you to fetch changes up to 2e30230aa95a2d6cfaadac015bd96c3db19c45e4:
> 
>   Fix total IP header length in forwarded TCP packets (2017-05-27 23:35:00 +0200)
> 
> ----------------------------------------------------------------
> slirp updates
> 
> ----------------------------------------------------------------
> Marc-André Lureau (1):
>       slirp: fix leak
> 
> Sjors Gielen (1):
>       Fix total IP header length in forwarded TCP packets
> 
> Tao Wu (1):
>       slirp: Fix wrong mss bug.
> 
>  slirp/socket.c    | 3 +++
>  slirp/tcp_input.c | 4 ++--
>  slirp/tcp_subr.c  | 4 ++--
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 

Thanks, applied to my staging tree:
https://github.com/stefanha/qemu/commits/staging

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-30  9:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-27 21:46 [Qemu-devel] [PULL 0/3] slirp updates Samuel Thibault
2017-05-27 21:46 ` [Qemu-devel] [PULL 1/3] slirp: Fix wrong mss bug Samuel Thibault
2017-05-27 21:46 ` [Qemu-devel] [PULL 2/3] slirp: fix leak Samuel Thibault
2017-05-27 21:46 ` [Qemu-devel] [PULL 3/3] Fix total IP header length in forwarded TCP packets Samuel Thibault
2017-05-27 21:52 ` [Qemu-devel] [PULL 0/3] slirp updates no-reply
2017-05-30  9:29 ` Stefan Hajnoczi

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.