[oe-commits] Richard Purdie : qemu: add smc asserts to debug segfault

git at git.openembedded.org git at git.openembedded.org
Fri Sep 4 16:43:37 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 044d26f57f958d1ed60b0bf855e8eeb2b511797f
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=044d26f57f958d1ed60b0bf855e8eeb2b511797f

Author: Richard Purdie <richard.purdie at linuxfoundation.org>
Date:   Fri Sep  4 11:35:45 2015 +0000

qemu: add smc asserts to debug segfault

Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/recipes-devtools/qemu/qemu/smcassert.patch | 42 +++++++++++++++++++++++++
 meta/recipes-devtools/qemu/qemu_2.4.0.bb        |  1 +
 2 files changed, 43 insertions(+)

diff --git a/meta/recipes-devtools/qemu/qemu/smcassert.patch b/meta/recipes-devtools/qemu/qemu/smcassert.patch
new file mode 100644
index 0000000..1ffb32f
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu/smcassert.patch
@@ -0,0 +1,42 @@
+Add some debugging to try and get more info about a segfault we're seeing
+through some asserts.
+
+Upstream-Status: Inappropriate [debug for segfault]
+
+Index: qemu-2.4.0/hw/net/smc91c111.c
+===================================================================
+--- qemu-2.4.0.orig/hw/net/smc91c111.c
++++ qemu-2.4.0/hw/net/smc91c111.c
+@@ -157,6 +157,7 @@ static void smc91c111_pop_rx_fifo(smc91c
+     int i;
+ 
+     s->rx_fifo_len--;
++    assert(s->rx_fifo_len < NUM_PACKETS);
+     if (s->rx_fifo_len) {
+         for (i = 0; i < s->rx_fifo_len; i++)
+             s->rx_fifo[i] = s->rx_fifo[i + 1];
+@@ -174,6 +175,7 @@ static void smc91c111_pop_tx_fifo_done(s
+ 
+     if (s->tx_fifo_done_len == 0)
+         return;
++    assert(s->tx_fifo_done_len <= NUM_PACKETS);
+     s->tx_fifo_done_len--;
+     for (i = 0; i < s->tx_fifo_done_len; i++)
+         s->tx_fifo_done[i] = s->tx_fifo_done[i + 1];
+@@ -201,6 +203,7 @@ static void smc91c111_do_tx(smc91c111_st
+         return;
+     if (s->tx_fifo_len == 0)
+         return;
++    assert(s->tx_fifo_len <= NUM_PACKETS);
+     for (i = 0; i < s->tx_fifo_len; i++) {
+         packetnum = s->tx_fifo[i];
+         p = &s->data[packetnum][0];
+@@ -674,6 +677,8 @@ static ssize_t smc91c111_receive(NetClie
+     packetnum = smc91c111_allocate_packet(s);
+     if (packetnum == 0x80)
+         return -1;
++
++    assert(s->rx_fifo_len < NUM_PACKETS);
+     s->rx_fifo[s->rx_fifo_len++] = packetnum;
+ 
+     p = &s->data[packetnum][0];
diff --git a/meta/recipes-devtools/qemu/qemu_2.4.0.bb b/meta/recipes-devtools/qemu/qemu_2.4.0.bb
index 5e5f786..4d550e0 100644
--- a/meta/recipes-devtools/qemu/qemu_2.4.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_2.4.0.bb
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
 SRC_URI += "file://configure-fix-Darwin-target-detection.patch \
             file://qemu-enlarge-env-entry-size.patch \
             file://Qemu-Arm-versatilepb-Add-memory-size-checking.patch \
+            file://smcassert.patch \
            "
 SRC_URI_prepend = "http://wiki.qemu-project.org/download/${BP}.tar.bz2"
 SRC_URI[md5sum] = "186ee8194140a484a455f8e3c74589f4"



More information about the Openembedded-commits mailing list