Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian GCC (http://www.linux-archive.org/debian-gcc/)
-   -   Bug#670578: More information needed (http://www.linux-archive.org/debian-gcc/660717-bug-670578-more-information-needed.html)

Jurij Smakov 04-28-2012 04:02 PM

Bug#670578: More information needed
 
Hello,

Is there an upstream bug for that? If there is, can you please provide
a reference?

Can you post a stack trace, preferrably obtained with the latest
Debian binaries (gnunet version 0.8.1b-8), if possible?

Thanks.
--
Jurij Smakov jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120428160206.GB4505@wooyd.org">http://lists.debian.org/20120428160206.GB4505@wooyd.org

Christian Grothoff 05-01-2012 05:36 PM

Bug#670578: More information needed
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I get this:

# gdb --args gnunet-service-mesh -c test_gnunet_vpn.conf
GNU gdb (GDB) 7.0.1-debian
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "sparc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/gnbuild/bin/gnunet-service-mesh...done.
(gdb) r
Starting program: /tmp/gnbuild/bin/gnunet-service-mesh -c
test_gnunet_vpn.conf

Program received signal SIGBUS, Bus error.
0xf7f28b24 in idx_of (m=0x34a98, key=0xfffed46a) at
container_multihashmap.c:136
136 return (*(unsigned int *) key) % m->map_length;
(gdb) ba
#0 0xf7f28b24 in idx_of (m=0x34a98, key=0xfffed46a) at
container_multihashmap.c:136
#1 0xf7f29460 in GNUNET_CONTAINER_multihashmap_put (map=0x34a98,
key=0xfffed46a, value=0x33638,
opt=GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE) at
container_multihashmap.c:425
#2 0x0002278c in handle_local_new_client (cls=0x0, client=0x34bc8,
message=0xfffed7c0) at gnunet-service-mesh.c:3871
#3 0xf7f62c14 in GNUNET_SERVER_inject (server=0x33078, sender=0x34bc8,
message=0xfffed7c0) at server.c:866
#4 0xf7f63f1c in client_message_tokenizer_callback (cls=0x33078,
client=0x34bc8, message=0xfffed7c0) at server.c:1071
#5 0xf7f67048 in GNUNET_SERVER_mst_receive (mst=0x34c40,
client_identity=0x34bc8, buf=0xfffed7c0 "", size=14, purge=0,
one_shot=-1) at server_mst.c:264
#6 0xf7f63a90 in process_incoming (cls=0x34bc8, buf=0xfffed7c0,
available=14, addr=0x33ee0, addrlen=2, errCode=0) at server.c:1015
#7 0xf7f1e360 in receive_ready (cls=0x34b38, tc=0xffffd860) at
connection.c:1054
#8 0xf7f5c3c8 in run_ready (rs=0x32b68, ws=0x32bf0) at scheduler.c:602
#9 0xf7f5d1c4 in GNUNET_SCHEDULER_run (task=0xf7f7111c <service_task>,
task_cls=0xffffda80) at scheduler.c:790
#10 0xf7f73c60 in GNUNET_SERVICE_run (argc=3, argv=0xffffdc94,
service_name=0x2ea60 "mesh", options=GNUNET_SERVICE_OPTION_NONE,
task=0x281ac <run>, task_cls=0x0) at service.c:1766
#11 0x00028ba4 in main (argc=3, argv=0xffffdc94) at
gnunet-service-mesh.c:4870

#0 0xf7f28b24 in idx_of (m=0x34a98, key=0xfffed46a) at
container_multihashmap.c:136


31 static unsigned int
32 idx_of (const struct GNUNET_CONTAINER_MultiHashMap *m,
33 const GNUNET_HashCode * key)
34 {
35 GNUNET_assert (m != NULL);
36 return (*(unsigned int *) key) % m->map_length;
37 }
38

(gdb) print (long) (key)
$1 = -76694
(gdb) print ((long)key) % 4
$2 = -2

Ok, so clearly the bus error is justified. Now, where does "key" come from?

(gdb) up
#1 0xf7f29460 in GNUNET_CONTAINER_multihashmap_put (map=0x34a98,
key=0xfffed46a, value=0x33638,
opt=GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE) at
container_multihashmap.c:425
#2 0x0002278c in handle_local_new_client (cls=0x0, client=0x34bc8,
message=0xfffed7c0) at gnunet-service-mesh.c:3871


3800 static void
3801 handle_local_new_client (void *cls, struct GNUNET_SERVER_Client
*client,
3802 const struct GNUNET_MessageHeader *message)
3803 {
3804 struct GNUNET_MESH_ClientConnect *cc_msg;
3805 struct MeshClient *c;
3806 GNUNET_MESH_ApplicationType *a;
3807 unsigned int size;
3808 uint16_t ntypes;
3809 uint16_t *t;
3810 uint16_t napps;
3811 uint16_t i;
3812
3813 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new client connected
");
3814 /* Check data sanity */
3815 size = ntohs (message->size) - sizeof (struct
GNUNET_MESH_ClientConnect);
3816 cc_msg = (struct GNUNET_MESH_ClientConnect *) message;
3817 ntypes = ntohs (cc_msg->types);
3818 napps = ntohs (cc_msg->applications);
3819 if (size !=
3820 ntypes * sizeof (uint16_t) + napps * sizeof
(GNUNET_MESH_ApplicationType))
3821 {
3822 GNUNET_break (0);
3823 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
3824 return;
3825 }
3826
3827 /* Create new client structure */
3828 c = GNUNET_malloc (sizeof (struct MeshClient));
3829 c->id = next_client_id++;
3830 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " CLIENT NEW %u
", c->id);
3831 c->handle = client;
3832 GNUNET_SERVER_client_keep (client);
3833 a = (GNUNET_MESH_ApplicationType *) &cc_msg[1];
3834 if (napps > 0)
3835 {
3836 GNUNET_MESH_ApplicationType at;
3837 GNUNET_HashCode hc;
3838
3839 c->apps = GNUNET_CONTAINER_multihashmap_create (napps);
3840 for (i = 0; i < napps; i++)
3841 {
3842 at = ntohl (a[i]);
3843 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " app type: %u
", at);
3844 GNUNET_CRYPTO_hash (&at, sizeof (at), &hc);
3845 /* store in clients hashmap */
3846 GNUNET_CONTAINER_multihashmap_put (c->apps, &hc, c,
3847
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
3848 /* store in global hashmap, for announcements */
3849 GNUNET_CONTAINER_multihashmap_put (applications, &hc, c,
3850
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
3851 }
3852 if (GNUNET_SCHEDULER_NO_TASK == announce_applications_task)
3853 announce_applications_task =
3854 GNUNET_SCHEDULER_add_now (&announce_applications, NULL);
3855
3856 }
3857 if (ntypes > 0)
3858 {
3859 uint16_t u16;
3860 GNUNET_HashCode hc;
3861
3862 t = (uint16_t *) & a[napps];
3863 c->types = GNUNET_CONTAINER_multihashmap_create (ntypes);
3864 for (i = 0; i < ntypes; i++)
3865 {
3866 u16 = ntohs (t[i]);
3867 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " msg type: %u
", u16);
3868 GNUNET_CRYPTO_hash (&u16, sizeof (u16), &hc);
3869
3870 /* store in clients hashmap */
3871 GNUNET_CONTAINER_multihashmap_put (c->types, &hc, c,
3872
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
3873 /* store in global hashmap */
3874 GNUNET_CONTAINER_multihashmap_put (types, &hc, c,
3875
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
3876 }
3877 }
3878 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3879 " client has %u+%u subscriptions
", napps, ntypes);
3880
3881 GNUNET_CONTAINER_DLL_insert (clients, clients_tail, c);
3882 c->own_tunnels = GNUNET_CONTAINER_multihashmap_create (32);
3883 c->incoming_tunnels = GNUNET_CONTAINER_multihashmap_create (32);
3884 c->ignore_tunnels = GNUNET_CONTAINER_multihashmap_create (32);
3885 GNUNET_SERVER_notification_context_add (nc, client);
3886
3887 GNUNET_SERVER_receive_done (client, GNUNET_OK);
3888 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new client processed
");
3889 }



Note that "hc" is allocated on the stack here. What is the type of
'hc'? Defined as follows:


/**
* @brief 512-bit hashcode
*/
typedef struct GNUNET_HashCode
{
uint32_t bits[512 / 8 / sizeof (uint32_t)]; /* = 16 */
}
GNUNET_HashCode;


So it's an array of uint32_t, which makes me think that gcc should have
aligned it.


If I change the 'hc' declaration to

3837 GNUNET_HashCode hc __attribute__ ((aligned
(__BIGGEST_ALIGNMENT__)));

the SIGBUS disappears.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+gHxYACgkQv2Bwi0hCbH6UowCfYcqRabem2U bOnKdzP576uurM
jgAAoIKZYi/aR3I92HkEmIGbynjX/9fh
=mUKg
-----END PGP SIGNATURE-----



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4FA01F16.8080400@grothoff.org">http://lists.debian.org/4FA01F16.8080400@grothoff.org


All times are GMT. The time now is 10:54 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.