Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGBUS on sparc64 #43

Open
omar-polo opened this issue Jan 1, 2023 · 1 comment
Open

SIGBUS on sparc64 #43

omar-polo opened this issue Jan 1, 2023 · 1 comment

Comments

@omar-polo
Copy link
Contributor

Hello,

this issue was brought to my attention from another OpenBSD developer -- I don't have any sparc64 to test. Sparc64 is a strict-alignment architecture, and MD5::processBlocks() seems to access data that's not aligned on a 4-byte boundary, hence getting a SIGBUS and crashing.

This is the stacktrace when running zpaqfranz autotest -all:

(the lines are relative to v56.2)

Program terminated with signal SIGBUS, Bus error.
#0  0x000000084aa44a10 in MD5::processBlock (this=0xfffffffffffc7100, data=0xb17af402b)
    at zpaqfranz.cpp:10243
10243     uint32_t word0  = MYLITTLEENDIAN(words[ 0]);
(gdb) bt
#0  0x000000084aa44a10 in MD5::processBlock (this=0xfffffffffffc7100, data=0xb17af402b)
    at zpaqfranz.cpp:10243
#1  0x000000084aa46a74 in MD5::add (this=0xfffffffffffc7100, data=0xb17af4000, numBytes=333290)
    at zpaqfranz.cpp:10357
#2  0x000000084aad8020 in Jidac::autotest (this=0xfffffffffffc8900) at zpaqfranz.cpp:50097
#3  0x000000084aa97e70 in Jidac::doCommand (this=0xfffffffffffc8900, argc=3,
    argv=0xfffffffffffc8f18) at zpaqfranz.cpp:42649
#4  0x000000084aadd26c in main (argc=3, argv=0xfffffffffffc8f18) at zpaqfranz.cpp:50586

data = 0x...2b is not aligned on a 4-byte boundary. It's cast to a uint32_t pointer on line 10235:

const uint32_t* words = (uint32_t*)data;

and than accessed as words[0] a few lines later.

@fcorbelli
Copy link
Owner

Wow!
Autotest finally works :)
Thanks, I'll try to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants