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

Crash when running a connection event loop #418

Open
amandahkansson opened this issue Mar 7, 2024 · 2 comments
Open

Crash when running a connection event loop #418

amandahkansson opened this issue Mar 7, 2024 · 2 comments

Comments

@amandahkansson
Copy link

amandahkansson commented Mar 7, 2024

Hi,

I have encounter a bug when running a connection event loop. My program gets terminated with signal SIGILL. I have only seen it once and it happened some time after we upgraded sdbus-c++ version from 1.3.0 to 1.4.0.

Stacktrace:

Core was generated by `/usr/bin/foo'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0x76c75d00 in siphash24_compress (_in=_in@entry=0x7e93b7f4, inlen=inlen@entry=4, state=0x7e93b800) at /usr/src/debug/systemd/1_254.4-r0/src/basic/siphash24.c:75
#0  0x76c75d00 in siphash24_compress (_in=_in@entry=0x7e93b7f4, inlen=inlen@entry=4, state=0x7e93b800) at /usr/src/debug/systemd/1_254.4-r0/src/basic/siphash24.c:75
#1  0x76c69a42 in trivial_hash_func (p=<optimized out>, state=<optimized out>) at /usr/src/debug/systemd/1_254.4-r0/src/basic/hash-funcs.c:70
#2  0x76c69bb0 in base_bucket_hash (h=h@entry=0x1d0d9b0, p=p@entry=0x4) at /usr/src/debug/systemd/1_254.4-r0/src/basic/hashmap.c:350
#3  0x76c6b57a in _hashmap_get (h=0x1d0d9b0, key=0x4) at /usr/src/debug/systemd/1_254.4-r0/src/basic/hashmap.c:1359
#4  0x76c19b3c in hashmap_get (key=<optimized out>, h=<optimized out>) at /usr/src/debug/systemd/1_254.4-r0/src/basic/hashmap.h:170
#5  bus_match_run (bus=0x1d0b2f8, node=0x1d0d990, m=0x1d15508) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/bus-match.c:397
#6  0x76c19b62 in bus_match_run (bus=0x1d0b2f8, node=0x1d0d950, m=0x1d15508) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/bus-match.c:424
#7  0x76c19e00 in bus_match_run (bus=0x1d0b2f8, node=0x1d0d930, m=0x1d15508) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/bus-match.c:412
#8  0x76c1a02c in bus_match_run (bus=bus@entry=0x1d0b2f8, node=node@entry=0x1d0b360, m=m@entry=0x1d15508) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/bus-match.c:271
#9  0x76c2c39a in process_match (m=<optimized out>, bus=<optimized out>) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/sd-bus.c:2884
#10 process_match (bus=0x1d0b2f8, m=0x1d15508) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/sd-bus.c:2875
#11 0x76c32672 in process_message (m=0x1d15508, bus=0x1d0b2f8) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/sd-bus.c:3003
#12 process_running (ret=0x0, bus=0x1d0b2f8) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/sd-bus.c:3053
#13 bus_process_internal (bus=0x1d0b2f8, ret=0x0) at /usr/src/debug/systemd/1_254.4-r0/src/libsystemd/sd-bus/sd-bus.c:3273
#14 0x76fc0d78 in sdbus::internal::SdBus::sd_bus_process (this=0x1d0b270, bus=0x1d0b2f8, r=0x0) at /usr/src/debug/sdbus-c++/1.4.0-r0/src/SdBus.cpp:369
#15 0x76facf18 in sdbus::internal::Connection::processPendingRequest (this=this@entry=0x1d0b290) at /usr/src/debug/sdbus-c++/1.4.0-r0/src/Connection.cpp:499
#16 0x76faec66 in sdbus::internal::Connection::enterEventLoop (this=0x1d0b290) at /usr/src/debug/sdbus-c++/1.4.0-r0/src/Connection.cpp:136
#17 0x00425c5e in main () at /usr/src/debug/foo/main.cpp:39

Line 39 of /usr/src/debug/foo/main.cpp, where connection is a sdbus::IConnection:

connection->enterEventLoop();

Expected behavior
No crash

Real (buggy) behavior
Crash with signal SIGILL

Additional context
The program ran on a linux based system, arch armv7hf and was compiled with gcc 13.2. sdbus-c++ version 1.4.0.

I am unsure what might cause this problem, is the above information enough for you to have any ideas of what might be wrong?

@sangelovic
Copy link
Collaborator

sangelovic commented Mar 7, 2024

Hi, have you compiled sdbus-c++ yourself or are you using a packaged one by the distro? From the stack trace, it appears the problem is in the underlying libsystemd library, which is one of the recent releases (v254). You can try an older version of libsystemd and see if you still have the problem. You can do so by building sdbus-c++ with BUILD_LIBSYSTEMD CMake option set to ON. This will build libsystemd v242 and embed it into sdbus-c++ shared library, and will bypass libsystemd available in your system. Let me know.

@amandahkansson
Copy link
Author

Thanks for the quick response!

Since I don't have a reliable way to reproduce the bug I can't say if the problem is fixed by downgrading the version of libsystemd. I will continue to investigate what caused the bug and will let you know when I find a solution.

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

No branches or pull requests

2 participants