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

Fix crashes when compiled with ASan #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hpoggie
Copy link

@hpoggie hpoggie commented Jan 23, 2019

This fixes #54.

Compiling with ASan makes it easier to find memory errors. Previously the game would compile with ASan but immediately crash if run.

@sago007
Copy link
Member

sago007 commented Feb 9, 2019

Still crashes for me:

=================================================================
==28650==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7fffec0394c0 at pc 0x0000006e0f3e bp 0x7fffec0390f0 sp 0x7fffec0390e8
READ of size 4 at 0x7fffec0394c0 thread T0
    #0 0x6e0f3d in VM_Call /home/poul/programmering/openarena/git-engine/engine/code/qcommon/vm.c:855:16
    #1 0x612254 in Com_Init /home/poul/programmering/openarena/git-engine/engine/code/qcommon/common.c:2819:2
    #2 0x8111d9 in main /home/poul/programmering/openarena/git-engine/engine/code/sys/sys_main.c:645:2
    #3 0x7f686903709a in __libc_start_main /build/glibc-B9XfQf/glibc-2.28/csu/../csu/libc-start.c:308:16
    #4 0x420029 in _start (/bighome/poul/games/openarena-0.8.8/openarena.x86_64_asan+0x420029)

Address 0x7fffec0394c0 is located in stack of thread T0 at offset 0 in frame
    #0 0x610c9f in Com_Init /home/poul/programmering/openarena/git-engine/engine/code/qcommon/common.c:2636

  This frame has 2 object(s):
    [32, 36) 'seed.i' (line 2623)
    [48, 52) 'qport' (line 2638)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-underflow /home/poul/programmering/openarena/git-engine/engine/code/qcommon/vm.c:855:16 in VM_Call

Looks like some nasty C variable argument list to me.

@hpoggie
Copy link
Author

hpoggie commented Feb 12, 2019

That's a sketchy thing that the quake vm does. It copies a fixed number of arguments into the vm (12, I think) and then figures out how many it actually needs later. I meant to ignore this by including -fsanitize-blacklist=asan_ignore.txt in Makefile.local.asan but somehow that didn't get committed.

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

Successfully merging this pull request may close these issues.

Crashing when compiled with address sanitization
2 participants