pkgsrc-Changes archive

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

CVS commit: pkgsrc/emulators/qemu



Module Name:    pkgsrc
Committed By:   yhardy
Date:           Sun Sep 19 13:49:12 UTC 2021

Modified Files:
        pkgsrc/emulators/qemu: Makefile distinfo
Added Files:
        pkgsrc/emulators/qemu/patches: patch-slirp_src_tcp__subr.c

Log Message:
emulators/qemu: fix crash in slirp:tcp_subr.c

Reported upstream to the qemu and slirp projects (thanks to Marc), fixed in

 https://gitlab.freedesktop.org/slirp/libslirp/-/commit/23db43abdb5740287bbb7cbf5cc99eb22e121298

This adds the corresponding patch for qemu-6.1.0.


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 pkgsrc/emulators/qemu/Makefile
cvs rdiff -u -r1.185 -r1.186 pkgsrc/emulators/qemu/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/emulators/qemu/patches/patch-slirp_src_tcp__subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/emulators/qemu/Makefile
diff -u pkgsrc/emulators/qemu/Makefile:1.287 pkgsrc/emulators/qemu/Makefile:1.288
--- pkgsrc/emulators/qemu/Makefile:1.287        Fri Sep 10 13:10:58 2021
+++ pkgsrc/emulators/qemu/Makefile      Sun Sep 19 13:49:12 2021
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.287 2021/09/10 13:10:58 nia Exp $
+# $NetBSD: Makefile,v 1.288 2021/09/19 13:49:12 yhardy Exp $
 
 DISTNAME=      qemu-6.1.0
 PKGNAME=       ${DISTNAME:S/-rc/rc/}
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    emulators
 MASTER_SITES=  https://download.qemu.org/
 EXTRACT_SUFX=  .tar.xz

Index: pkgsrc/emulators/qemu/distinfo
diff -u pkgsrc/emulators/qemu/distinfo:1.185 pkgsrc/emulators/qemu/distinfo:1.186
--- pkgsrc/emulators/qemu/distinfo:1.185        Fri Sep 10 19:44:37 2021
+++ pkgsrc/emulators/qemu/distinfo      Sun Sep 19 13:49:12 2021
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.185 2021/09/10 19:44:37 nia Exp $
+$NetBSD: distinfo,v 1.186 2021/09/19 13:49:12 yhardy Exp $
 
 SHA1 (palcode-clipper-qemu-5.2.0nb8) = ddbf1dffb7c2b2157e0bbe9fb7db7e57105130b1
 RMD160 (palcode-clipper-qemu-5.2.0nb8) = 3f9fe19a40f7ca72ecfe047d1449e55b63cba3ee
@@ -25,5 +25,6 @@ SHA1 (patch-include_sysemu_nvmm.h) = 2cf
 SHA1 (patch-meson.build) = 35f4d563e99dcc014a011bb4c7cddefac852d4cf
 SHA1 (patch-net_tap-solaris.c) = cc953c9a624dd55ace4e130d0b31bbfb956c17d5
 SHA1 (patch-roms_u-boot-sam460ex_Makefile) = 3a1bbf19b1422c10ebdd819eb0b711fafc78e2f2
+SHA1 (patch-slirp_src_tcp__subr.c) = bd6d80ecf3baeaf6f8458b2361bcb92298d41f7e
 SHA1 (patch-target_i386_nvmm_nvmm-all.c) = 8f4b51a6460090d7826af1ae02840a208767345b
 SHA1 (patch-target_sparc_translate.c) = 7ec2add2fd808facb48b9a66ccc345599251bf76

Added files:

Index: pkgsrc/emulators/qemu/patches/patch-slirp_src_tcp__subr.c
diff -u /dev/null pkgsrc/emulators/qemu/patches/patch-slirp_src_tcp__subr.c:1.1
--- /dev/null   Sun Sep 19 13:49:12 2021
+++ pkgsrc/emulators/qemu/patches/patch-slirp_src_tcp__subr.c   Sun Sep 19 13:49:12 2021
@@ -0,0 +1,57 @@
+$NetBSD: patch-slirp_src_tcp__subr.c,v 1.1 2021/09/19 13:49:12 yhardy Exp $
+
+Issues:
+
+ QEMU crashes when receiving network connection on NetBSD
+ https://gitlab.com/qemu-project/qemu/-/issues/605
+
+ Use the exact sockaddr size in getnameinfo call
+ https://gitlab.freedesktop.org/slirp/libslirp/-/issues/52
+ Fixed in commit: 23db43ab
+
+--- slirp/src/tcp_subr.c.orig  2021-09-18 20:05:43.313555017 +0000
++++ slirp/src/tcp_subr.c
+@@ -464,7 +464,7 @@ void tcp_connect(struct socket *inso)
+     Slirp *slirp = inso->slirp;
+     struct socket *so;
+     struct sockaddr_storage addr;
+-    socklen_t addrlen = sizeof(struct sockaddr_storage);
++    socklen_t addrlen;
+     struct tcpcb *tp;
+     int s, opt, ret;
+     /* AF_INET6 addresses are bigger than AF_INET, so this is big enough. */
+@@ -473,7 +473,17 @@ void tcp_connect(struct socket *inso)
+ 
+     DEBUG_CALL("tcp_connect");
+     DEBUG_ARG("inso = %p", inso);
+-    ret = getnameinfo((const struct sockaddr *) &inso->lhost.ss, sizeof(inso->lhost.ss), addrstr, sizeof(addrstr), portstr, sizeof(portstr), NI_NUMERICHOST|NI_NUMERICSERV);
++    switch (inso->lhost.ss.ss_family) {
++    case AF_INET:
++        addrlen = sizeof(struct sockaddr_in);
++        break;
++    case AF_INET6:
++        addrlen = sizeof(struct sockaddr_in6);
++        break;
++    default:
++        g_assert_not_reached();
++    }
++    ret = getnameinfo((const struct sockaddr *) &inso->lhost.ss, addrlen, addrstr, sizeof(addrstr), portstr, sizeof(portstr), NI_NUMERICHOST|NI_NUMERICSERV);
+     g_assert(ret == 0);
+     DEBUG_ARG("ip = [%s]:%s", addrstr, portstr);
+     DEBUG_ARG("so_state = 0x%x", inso->so_state);
+@@ -494,6 +504,7 @@ void tcp_connect(struct socket *inso)
+              * us again until the guest address is available.
+              */
+             DEBUG_MISC(" guest address not available yet");
++            addrlen = sizeof(addr);
+             s = accept(inso->s, (struct sockaddr *)&addr, &addrlen);
+             if (s >= 0) {
+                 close(s);
+@@ -518,6 +529,7 @@ void tcp_connect(struct socket *inso)
+ 
+     tcp_mss(sototcpcb(so), 0);
+ 
++    addrlen = sizeof(addr);
+     s = accept(inso->s, (struct sockaddr *)&addr, &addrlen);
+     if (s < 0) {
+         tcp_close(sototcpcb(so)); /* This will sofree() as well */



Home | Main Index | Thread Index | Old Index