snowyu / libtorrent

Automatically exported from code.google.com/p/libtorrent
Other
1 stars 0 forks source link

SIGBUS in all_set function on ARM #651

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In libtorrent 1.0 on ARM (in this case an Android device), I get a SIGBUS in 
all_set function of bitfield.hpp.

This appears to be because of typecasting to uint32_t :
boost::uint32_t* bits = (boost::uint32_t*)m_bytes;

I read somewhere that pointers need to be aligned (in the case of uint32_t, 
aligned to 32 bits) on ARM.

Original issue reported on code.google.com by ganeshbh...@gmail.com on 27 Jul 2014 at 4:02

GoogleCodeExporter commented 9 years ago
yes, this is a bug. I'm surprised none of the architectures I'm running 
regression tests on have triggered this.

I'll look into how to fix it. It will definitely be fixed in the next release 
(1.0.1)

Original comment by arvid.no...@gmail.com on 28 Jul 2014 at 3:45

GoogleCodeExporter commented 9 years ago
Thanks. If there is a fix I'd be happy to test.
Currently I have fixed it by checking only on byte level and not on uint32_t 
level.

Original comment by ganeshbh...@gmail.com on 28 Jul 2014 at 4:12

GoogleCodeExporter commented 9 years ago
please test this patch:

http://dpaste.com/0D8H9SV

I've also checked it in to the RC_1_0 branch

Original comment by arvid.no...@gmail.com on 28 Jul 2014 at 4:33

GoogleCodeExporter commented 9 years ago

Original comment by arvid.no...@gmail.com on 28 Jul 2014 at 4:41

GoogleCodeExporter commented 9 years ago
Sorry for the late reply. I read the change and if I am not mistaken, line no 
149 should be:

num_words = num_bytes / 4;

and not
num_words = num_bytes / 32;

right?

I have tested by changing that and I got no SIGBUS in 10 minutes of 
downloading. (Generally I got SIGBUS as soon as peers started connecting). So 
this appears to be fixed (considering aforementioned change). Thanks!

Original comment by ganeshbh...@gmail.com on 28 Jul 2014 at 5:55

GoogleCodeExporter commented 9 years ago
you're right. thanks.

Original comment by arvid.no...@gmail.com on 28 Jul 2014 at 6:00