[Bug target/110027] Misaligned vector store on detect_stack_use_after_return

2024-03-08 Thread gcc at sicherha dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110027

--- Comment #10 from Christoph Erhardt  ---
I have just verified that the reproducer program I attached above
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110027#c4) still crashes as
expected on Fedora 39 with GCC 13.2.1. It's not super-tiny, but it fails
reliably. :-)

[Bug middle-end/110027] [11/12 regression] Stack objects with extended alignments (vectors etc) misaligned on detect_stack_use_after_return

2024-06-02 Thread gcc at sicherha dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110027

Christoph Erhardt  changed:

   What|Removed |Added

  Attachment #56169|0   |1
is obsolete||

--- Comment #26 from Christoph Erhardt  ---
Created attachment 58325
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58325&action=edit
Reproducer program, new version

Unfortunately, the fix appears to be incomplete. On x86_64 Fedora Linux 40 with
the latest GCC 14.1.1, my reproducer program still segfaults with a misaligned
`vmovdqa64`.
I have managed to further strip the program down to a now-manageable size - see
attachment.

$ gcc -Wall -Wextra -g -Og -fsanitize=address -fno-stack-protector -mavx512f
a-repro.i
$ ./a.out
AddressSanitizer:DEADLYSIGNAL
=
==107156==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00401463
bp 0x7ffd76144620 sp 0x7ffd76144200 T0)
==107156==The signal is caused by a READ memory access.
==107156==Hint: this fault was caused by a dereference of a high value address
(see register values below).  Disassemble the provided pc to learn which
register was used.
#0 0x401463 in blake3_compress_subtree_wide
/home/christoph/Projects/gcc-asan-stack-misalign/repro.c:52
#1 0x40158c in main
/home/christoph/Projects/gcc-asan-stack-misalign/repro.c:57
#2 0x7f60dde3d087 in __libc_start_call_main (/lib64/libc.so.6+0x2a087)
(BuildId: 4a92fcedbba6d6d2629ce066a2970017faa9995e)
#3 0x7f60dde3d14a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x2a14a)
(BuildId: 4a92fcedbba6d6d2629ce066a2970017faa9995e)
#4 0x4010b4 in _start
(/home/christoph/Projects/gcc-asan-stack-misalign/a.out+0x4010b4) (BuildId:
9f1d4d25413300b7347d0776d7087844a8d56649)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
/home/christoph/Projects/gcc-asan-stack-misalign/repro.c:52 in
blake3_compress_subtree_wide
==107156==ABORTING

[Bug target/110027] Misaligned vector store on detect_stack_use_after_return

2023-10-22 Thread gcc at sicherha dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110027

Christoph Erhardt  changed:

   What|Removed |Added

 CC||gcc at sicherha dot de

--- Comment #4 from Christoph Erhardt  ---
Created attachment 56169
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56169&action=edit
Reproducer program

Here's a program that can reproduce this issue more reliably - tested on Fedora
38, Ubuntu 23.04 and Ubuntu 23.10.

I have stripped down the code as far as possible. This is how far I could get
without losing reproducibility.
Sources are in a GitHub repo:
https://github.com/sicherha/gcc-asan-stack-misalign

$ gcc -Wall -Wextra -g -Og -fsanitize=address -fno-stack-protector -mavx512f
a-repro.i 
$ ./a.out 
AddressSanitizer:DEADLYSIGNAL
=
==3618==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x00401789 bp
0x7ffeabbcda00 sp 0x7ffeabbcd580 T0)
==3618==The signal is caused by a READ memory access.
==3618==Hint: this fault was caused by a dereference of a high value address
(see register values below).  Disassemble the provided pc to learn which
register was used.
#0 0x401789 in blake3_compress_subtree_wide
/home/ul26967/Projects/gcc-asan-stack-misalign/a-repro.i:481
#1 0x40189b in main
/home/ul26967/Projects/gcc-asan-stack-misalign/a-repro.i:488
#2 0x7f77a0210b89 in __libc_start_call_main (/lib64/libc.so.6+0x27b89)
(BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#3 0x7f77a0210c4a in __libc_start_main_alias_2 (/lib64/libc.so.6+0x27c4a)
(BuildId: 3ebe8d97a0ed3e1f13476a02665c5a9442adcd78)
#4 0x4010f4 in _start
(/home/ul26967/Projects/gcc-asan-stack-misalign/a.out+0x4010f4) (BuildId:
e25b3ac48fa6dd8cff5d228e201834fa1b0cd18a)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
/home/ul26967/Projects/gcc-asan-stack-misalign/a-repro.i:481 in
blake3_compress_subtree_wide
==3618==ABORTING