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: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc64 Linux
: Normal normal
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: 2024-05-19 19:43 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
             ^
Comment 5 James Le Cuirot gentoo-dev 2024-05-19 10:13:42 UTC
How much do we really care about this? The only sparc keyworded package with a dependency on sdl2-ttf is pygame. Meanwhile, the only sparc keyworded package with a dependency on pygame is dev-python/pyopengl. There are no sparc keyworded revdeps of that. If no one answers soon, I will drop the keywords on all of them.
Comment 6 matoro archtester 2024-05-19 18:38:29 UTC
(In reply to James Le Cuirot from comment #5)
> How much do we really care about this? The only sparc keyworded package with
> a dependency on sdl2-ttf is pygame. Meanwhile, the only sparc keyworded
> package with a dependency on pygame is dev-python/pyopengl. There are no
> sparc keyworded revdeps of that. If no one answers soon, I will drop the
> keywords on all of them.

This was fixed in upstream master at least, but my vote is just drop the keywords anyway.  Whenever I file these bugs that's always a perfectly valid solution.  Especially on ppc which has a ton of junk with no business being keyworded there.
Comment 7 Larry the Git Cow gentoo-dev 2024-05-19 19:43:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ce861b8b571aa6aaa062fc628d63aa2b76c0be4

commit 8ce861b8b571aa6aaa062fc628d63aa2b76c0be4
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2024-05-19 19:38:08 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2024-05-19 19:42:31 +0000

    dev-python/pygame: dekeyword sparc
    
    Closes: https://bugs.gentoo.org/920956
    Bug: https://bugs.gentoo.org/917718
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 dev-python/pygame/pygame-2.5.1.ebuild    | 4 ++--
 dev-python/pygame/pygame-2.5.2-r1.ebuild | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd3cfd4312ba99039a323c168ad9571d41dc6043

commit dd3cfd4312ba99039a323c168ad9571d41dc6043
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2024-05-19 19:38:28 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2024-05-19 19:42:31 +0000

    media-libs/sdl2-ttf: dekeyword sparc
    
    Bug: https://bugs.gentoo.org/920956
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 media-libs/sdl2-ttf/sdl2-ttf-2.20.0.ebuild | 4 ++--
 media-libs/sdl2-ttf/sdl2-ttf-2.20.2.ebuild | 4 ++--
 media-libs/sdl2-ttf/sdl2-ttf-2.22.0.ebuild | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b131ee11d10dbd5635b9d1b51559092aa71df8ee

commit b131ee11d10dbd5635b9d1b51559092aa71df8ee
Author:     Arthur Zamarin <arthurzam@gentoo.org>
AuthorDate: 2024-05-19 19:37:47 +0000
Commit:     Arthur Zamarin <arthurzam@gentoo.org>
CommitDate: 2024-05-19 19:42:31 +0000

    dev-python/pyopengl: dekeyword sparc
    
    Bug: https://bugs.gentoo.org/920956
    Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>

 dev-python/pyopengl/pyopengl-3.1.7-r1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)