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

cjdns: Segmentation Fault on OpenWRT 22.03 #908

Open
ringtailedfox opened this issue Oct 8, 2022 · 6 comments
Open

cjdns: Segmentation Fault on OpenWRT 22.03 #908

ringtailedfox opened this issue Oct 8, 2022 · 6 comments

Comments

@ringtailedfox
Copy link

ringtailedfox commented Oct 8, 2022

Maintainer: @[wfleurant] (https://github.com/wfleurant) (find it by checking history of the package Makefile)
Environment: (put here ARMv7 / ipq806x, Netgear R7800, OpenWrt 22.03)

Description:
cjdns cannot be configured because the program segfaults.

root@Nighthawk:/etc# cjdroute --genconf > /etc/cjdroute.conf
Segmentation Fault

In all honesty, running cjdrouteconf with ANY switches, including none at all, resulgs in SIGSEV (Segmentation Fault).

root@Nighthawk:/usr/bin# cat /etc/cjdroute.conf | cjdrouteconf set
lua: /usr/lib/lua/cjdns/uci.lua:141: attempt to index field 'admin' (a nil value)
stack traceback:
        /usr/lib/lua/cjdns/uci.lua:141: in function 'set'
        /usr/bin/cjdrouteconf:23: in main chunk
        [C]: ?
root@Nighthawk:/usr/bin# root@Nighthawk:/usr/bin# cat /etc/cjdroute.conf | cjdro
uteconf set
stack traceback:
        /usr/lib/lua/cjdns/uci.lua:141: in function 'set'
        /usr/bin/cjdrouteconf:23: in main chunk
        [C]: ?
root@Nighthawk:/usr/bin# cat /etc/cjdroute.conf | cjdrouteconf set
lua: /usr/lib/lua/cjdns/uci.lua:141: attempt to index field 'admin' (a nil value)
stack traceback:
        /usr/lib/lua/cjdns/uci.lua:141: in function 'set'
        /usr/bin/cjdrouteconf:23: in main chunk
        [C]: ?

running GDB gives a similar result:

root@Nighthawk:/etc# gdb $(which cjdroute) -ex 'r --genconf'
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-openwrt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/cjdroute...
(No debugging symbols found in /usr/sbin/cjdroute)
Starting program: /usr/sbin/cjdroute --genconf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
0xb6fd90bc in ?? ()
(gdb) Program received signal SIGSEGV, Segmentation fault.
Quit
(gdb) bt
#0  0xb6fd90bc in ?? ()
#1  0xb6fd9840 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) Reading symbols from /usr/sbin/cjdroute...
(No debugging symbols found in /usr/sbin/cjdroute)
Starting program: /usr/sbin/cjdroute --genconf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
Undefined command: "Reading".  Try "help".
(gdb) quit
A debugging session is active.

        Inferior 1 [process 28290] will be killed.

Quit anyway? (y or n) y

This might be why the service/daemon for CJDNS crashes when it tries to start:

root@Nighthawk:/usr/bin# /etc/init.d/cjdns start
Segmentation fault
Segmentation fault
dkjson: no valid JSON value (reached the end) (try cjdroute --cleanconf)

When i looked at that lua file (/usr/lib/lua/cjdns/uci.lua), this is what line 141 says:

local admin_address, admin_port = string.match(obj.admin.bind, "^(.*):(.*)$")

As for what line 23 in /usr/bin/cjdrouteconf says? That's below:

    cjdns.uci.set(obj)

None of this makes any sense to me... can anyone else understand this?

@PolynomialDivision
Copy link
Member

@wfleurant

@wfleurant
Copy link
Member

yes.. seems duplicate from last time toolchain patches. give me a minute to catch up

@wfleurant
Copy link
Member

i am really bogged down to figure this out at the moment. anyone have a hint? is it another compiler update like before?

@predators46
Copy link

what changed in openwrt 22.03.x? i had the same problem, i created a file in openwrt 22.03.x and got "Segmentation Fault" error if i created it on openwrt 21.02.x everything went smoothly

@ringtailedfox
Copy link
Author

has there been any news regarding progress on cjdns on openwrt? I'd love to test an updated version to see if it works...

@ringtailedfox
Copy link
Author

Okay, I do have an update to this!

I managed to re-compile cjdns from source for OpenWrt 23.05.2, r23630-842932a63d .... it no longer segfaults during install, but it still segfaults when i attempt to run it. sadly, gdb says there's no debug symbols for it this time.

output when i run gdb:
root@Nighthawk:~# gdb $(which cjdroute) -ex 'r --genconf'
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-openwrt-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/sbin/cjdroute...
(No debugging symbols found in /usr/sbin/cjdroute)
Starting program: /usr/sbin/cjdroute --genconf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.

Program received signal SIGSEGV, Segmentation fault.
0xb6fe84f8 in ?? ()

(gdb) Quit

root@Nighthawk:~# file /usr/sbin/cjdroute
/usr/sbin/cjdroute: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-armhf.so.1, no section header

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

4 participants