Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 920956 - dev-python/pygame-2.5.2: pygame.tests.font_test SIGBUS on sparc
Summary: dev-python/pygame-2.5.2: pygame.tests.font_test SIGBUS on sparc
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc64 Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: unaligned-access 917718
  Show dependency tree
 
Reported: 2023-12-29 21:52 UTC by matoro
Modified: 2023-12-30 02:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log and emerge --info (file_920956.txt,289.60 KB, text/plain)
2023-12-29 21:53 UTC, matoro
Details
UBSAN run (file_920956.txt,633.06 KB, text/plain)
2023-12-30 00:35 UTC, matoro
Details
backtrace (file_920956.txt,267.18 KB, text/plain)
2023-12-30 00:45 UTC, matoro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description matoro archtester 2023-12-29 21:52:47 UTC
Also present in 2.5.1.  There is no output, but I confirmed manually that this is caused by SIGBUS.

Backtrace and UBSAN run forthcoming.

Reproducible: Always
Comment 1 matoro archtester 2023-12-29 21:53:55 UTC
Created attachment 880967 [details]
build.log and emerge --info
Comment 2 matoro archtester 2023-12-30 00:35:40 UTC
Created attachment 880970 [details]
UBSAN run

So, the first failure is actually a fault in media-libs/sdl2-ttf.  However there is a second failure that I suspect will come up next should the first one be fixed.

loading pygame.tests.font_test
/var/tmp/portage/media-libs/sdl2-ttf-2.20.2/work/SDL2_ttf-2.20.2/SDL_ttf.c:919:9: runtime error: load of misaligned address 0x0001478311c7 for type 'const Uint64', which requires 8 byte alignment
0x0001478311c7: note: pointer points here
 00 00 00 00 01  01 01 01 01 01 01 01 01  01 00 00 00 00 00 00 00  01 01 01 01 01 01 01 01  01 01 00
             ^ 


Culprit somewhere in here:  https://github.com/libsdl-org/SDL_ttf/blob/release-2.20.2/SDL_ttf.c#L910-L926
Comment 3 matoro archtester 2023-12-30 00:45:04 UTC
Created attachment 880971 [details]
backtrace

I also tried -UUSE_DUFFS_LOOP here but it didn't work, because the actual unalignment seems to occur outside of the loop body.
Comment 4 matoro archtester 2023-12-30 02:37:25 UTC
Minimized reproducer:

$ wget "https://github.com/pygame/pygame/raw/main/src_py/freesansbold.ttf"
$ cat test.c
#include <SDL2/SDL_ttf.h>

int main()
{
        TTF_Init();
        TTF_RenderUTF8_Solid(
                TTF_OpenFont("./freesansbold.ttf", 24),
                "Test",
                (struct SDL_Color){ 255, 255, 255, 255 }
        );
        return 0;
}
$ gcc -O0 -ggdb3 -pipe test.c -o test -lSDL2_ttf
$ ./test
Bus error (core dumped)


And with UBSAN:

$ ./test
/var/tmp/portage/media-libs/sdl2-ttf-2.20.2/work/SDL2_ttf-2.20.2/SDL_ttf.c:919:9: runtime error: load of misaligned address 0x000122b09817 for type 'const Uint64', which requires 8 byte alignment
0x000122b09817: note: pointer points here
 00 00 00 00 01  01 01 01 01 01 01 01 01  01 01 01 01 01 00 00 00  00 00 00 00 01 01 01 01  01 01 01
             ^