kristapsdz / kcgi

minimal CGI and FastCGI library for C/C++
https://kristaps.bsd.lv/kcgi
ISC License
275 stars 40 forks source link

regress tests failing for epoch2datetime #88

Closed epsilon-0 closed 3 years ago

epsilon-0 commented 3 years ago

I've been trying to port this package to Gentoo and am currently running into a small problem with the tests which are failing for test-epoch2datetime with the error

*** buffer overflow detected ***: terminated
[1]    2073 IOT instruction  ./test-epoch2datetime

Would love to know what I am doing wrong or how to fix this.

kristapsdz commented 3 years ago

Is there any way I can get access to that machine? What would help beyond that is to run the test manually and print its backtrace:

./regress/test-epoch2datetime
gdb ./regress/test-epoch2datetime core # or wherever the core file would be
(gdb) bt

Also, to make sure it's not picking up stray libraries:

ldd ./regress/test-epoch2datetime

Also lastly, it would be helpful to know the hardware.

epsilon-0 commented 3 years ago

Sorry, its on my laptop, so I'm not able to get access to other here. OTOH, I've been able to narrow the bug down to the -O2 cflag. If I build with CFLAGS="-O2 -pipe" (-O2 -pipe is the default in gentoo) the test crashes, but when CFLAGS="-pipe" the tests succeed.


CPU = Ryzen 2700u - znver1

kristapsdz commented 3 years ago

I can't replicate this on another AMD64 Linux box. Can you please try to get a backtrace? You'll need to have compiled with -g. If your system doesn't produce coredumps by default, just run the faulting process within gdb.

epsilon-0 commented 3 years ago

OK, I managed to replicate this on another (virtual) machine where I can give you root access. How can I give you the access? EDIT: if you can give your ssh public key here, then I can easily give you access.

kristapsdz commented 3 years ago

temp_key.pub.txt

Enclosed!

epsilon-0 commented 3 years ago

I've added you to the VM - ssh -p 4555 root@vpn.bsd.ac. It is a gentoo machine. The home folder of root has the folder kcgi with the unmodified source code. To reproduce the error:

export CFLAGS="-O2 -pipe"
./configure PREFIX="~/.local"
bmake
bmake regress
kristapsdz commented 3 years ago

Fixed, thank you so much for providing this system! I'll put out a maintenance release in a few that has this fix.

epsilon-0 commented 3 years ago

Awesome!!! thanks a lot :D

epsilon-0 commented 3 years ago

Just to be clear, I want to inform that I am now going to retire and destroy the VM. Thanks a lot for the fix :heart: