mwarning / zerotier-openwrt

A OpenWrt package for ZeroTier One - Pull requests are welcome!
687 stars 144 forks source link

zerotier-cli shows ‘Segmentation fault’ on version 1.8.6 with arm_cortex-a7-neon and arm_cortex-a15_neon-vfpv4 and ARMv6 #99

Closed geo-y closed 2 years ago

geo-y commented 2 years ago

When zerotier config without debug(as workaround). Generated ipk will not work. zt device will not appear in "ip a". And "zerotier-cli info" will get ‘Segmentation fault’.

It happens on ipq40xx,ipq806x,ARMADA-38x,ARM1176JZF-S platforms.

mwarning commented 2 years ago

hi, what OpenWrt version is that on? 22.02? Or is that from master?

geo-y commented 2 years ago

hi, what OpenWrt version is that on? 22.02? Or is that from master?

It's master with latest code.

KA2107 commented 2 years ago

Same issue on ipq806x (Netgear R7800) in OpenWrt 21.02.2

openwrtdiy commented 2 years ago

Version 1.8.4 works fine with OpenWrt-19.07! When upgrading to version 1.8.6, the value of the option secret parameter cannot be obtained normally. ipq40xx

Cerbis commented 2 years ago

hi, i have the same issues on my Router running OpenWrt 21.02.2 r16495-bf0c965af0 on a Linksys WRT1900ACS. It uses 1.8.6-1.

shomodj commented 2 years ago

same here OpenWrt 21.02.1 r16325-88151b8303 Linksys WRT3200ACM

mwarning commented 2 years ago

I do not have that platform available for testing. Can someone try to build Zerotiuer without -fPIE? That might fix it.

Cerbis commented 2 years ago

could you explain me how to do that? i've build openwrt + zerotier for the first time in my life today :D.

the cmds i've run to build zerotier today were

make package/zerotier/compile
make package/zerotier/install 
make package/index

so im not sure where i can find -fPIE

mwarning commented 2 years ago

@Cerbis sorry, it's in this line https://github.com/openwrt/packages/blob/master/net/zerotier/Makefile#L59 In your openwrt directory you can find iit in ./feeds/packages/net/zerotier/Makefile

artemklevtsov commented 2 years ago

Same here on the arm_cortex-a15_neon-vfpv4 with zerotier 1.8.6-1 (with OpenWRT 21.02.2).

openwrtdiy commented 2 years ago

@Cerbis sorry, it's in this line https://github.com/openwrt/packages/blob/master/net/zerotier/Makefile#L59 In your openwrt directory you can find iit in ./feeds/packages/net/zerotier/Makefile

I deleted the "-fPIE" section and recompiled the firmware, but still did not get the "option secret" parameter.

Model:ASUS RT-ACRH17 Architecture:ARMv7 Processor rev 5 (v7l) Firmware Version:OpenWrt-19.07 Kernel Version:4.14.273

k9online commented 2 years ago

Same issue here. R7800 so also ipq806x device. 21.02.1 | I would just downgrade but for the life of me I can't figure out where older versions are hosted. OpenWrt's repository shows the same version no matter where I look/go.

mwarning commented 2 years ago

We probably need to revert this update. I do not have any ipq806x based hardware to test this issue.

openwrtdiy commented 2 years ago

Can do the test on my ipq40x router! I have time to flash the machine every day.

Vadoola commented 2 years ago

I can confirm this is also happening with OpenWRT 21.02.2 on the original Raspberry Pi, which is an ARMv6 I think.

ogarcia commented 2 years ago

Do you try compiling 1.8.7? If it doesn't work, you may have to bisect the upstream code.

mwarning commented 2 years ago

@ogarcia I suspect this is a problem with the patches that have been upstreamed/removed. But if that is not the case, then we have to bisect.

openwrtdiy commented 2 years ago

I used 1.8.4 for most of the original code, only updated zerotier/Makefile to the latest version 1.8.7, and failed to compile OpenWrt-19.07 ARMv7 firmware!

make[3]: Entering directory '/home/kokang/openwrtdiy/feeds/packages/net/zerotier' mkdir -p /home/kokang/openwrtdiy/dl SHELL= flock /home/kokang/openwrtdiy/tmp/.zerotier-1.8.7.tar.gz.flock -c ' /home/kokang/openwrtdiy/scripts/download.pl "/home/kokang/openwrtdiy/dl" "zerotier-1.8.7.tar.gz" "0499d84ec3f5d36eb42f0c3a80fda3badc924915bb640b63f9b2c637f19c5e89" "" "https://codeload.github.com/zerotier/ZeroTierOne/tar.gz/1.8.7?" ' touch /home/kokang/openwrtdiy/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ZeroTierOne-1.8.7/.prepared_e309d7b4246a4b81be7a5e0f94f2d727_6664517399ebbbc92a37c5bb081b5c53_check . /home/kokang/openwrtdiy/include/shell.sh; gzip -dc /home/kokang/openwrtdiy/dl/zerotier-1.8.7.tar.gz | tar -C /home/kokang/openwrtdiy/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ZeroTierOne-1.8.7/.. -xf - [ ! -d ./src/ ] || cp -fpR ./src/. /home/kokang/openwrtdiy/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ZeroTierOne-1.8.7

Applying ./patches/0001-fix-makefile.patch using plaintext: patching file make-linux.mk Hunk #3 FAILED at 68. Hunk #4 succeeded at 300 (offset 20 lines). 1 out of 4 hunks FAILED -- saving rejects to file make-linux.mk.rej Patch failed! Please fix ./patches/0001-fix-makefile.patch! Makefile:79: recipe for target '/home/kokang/openwrtdiy/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ZeroTierOne-1.8.7/.prepared_e309d7b4246a4b81be7a5e0f94f2d727_6664517399ebbbc92a37c5bb081b5c53' failed make[3]: [/home/kokang/openwrtdiy/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/ZeroTierOne-1.8.7/.prepared_e309d7b4246a4b81be7a5e0f94f2d727_6664517399ebbbc92a37c5bb081b5c53] Error 1 make[3]: Leaving directory '/home/kokang/openwrtdiy/feeds/packages/net/zerotier' time: package/feeds/packages/zerotier/compile#0.17#0.62#0.63 package/Makefile:111: recipe for target 'package/feeds/packages/zerotier/compile' failed make[2]: [package/feeds/packages/zerotier/compile] Error 2 make[2]: Leaving directory '/home/kokang/openwrtdiy' package/Makefile:107: recipe for target '/home/kokang/openwrtdiy/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.package_compile' failed make[1]: [/home/kokang/openwrtdiy/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/kokang/openwrtdiy' /home/kokang/openwrtdiy/include/toplevel.mk:225: recipe for target 'world' failed make: [world] Error 2

Vadoola commented 2 years ago

Do you try compiling 1.8.7? If it doesn't work, you may have to bisect the upstream code.

I've never tried doing any development for OpenWRT, and don't really have anything set up for it, I'm just a user who was doing some testing on an old Raspberry Pi and ran into the issue. If I get a chance I will see what I can do, but I don't think I'll really have the time to compile 1.8.7.

mwarning commented 2 years ago

I will try to pick up a raspi tomorrow. Let's see. Update: no raspi :/

KA2107 commented 2 years ago

Downgrading to https://downloads.openwrt.org/releases/21.02.2/packages/arm_cortex-a15_neon-vfpv4/packages/zerotier_1.8.4-2_arm_cortex-a15_neon-vfpv4.ipk works for me in my Netgear R7800 (ipq806x) running OpenWrt 22.03-SNAPSHOT.

chazikai24 commented 2 years ago

1.re-patching line27-34 below,disable fPIE https://github.com/mwarning/zerotier-openwrt/blob/774d674d0b827089432039a37f13e4eb50c9afec/zerotier/patches/0001-fix-makefile.patch#L27 2.disable fPIE below https://github.com/openwrt/packages/blob/master/net/zerotier/Makefile#L59 I compiled 1.8.7 and it works well on wrt1900acv2.

openwrtdiy commented 2 years ago

@chazikai24 https://github.com/zerotier/ZeroTierOne/releases/tag/1.8.8

ZeroTier Release Notes 2022-04-11 -- Version 1.8.8 Fix a local privilege escalation bug in the Windows installer. Dependency fix for some Ubuntu versions. No changes for other platforms. Windows upgrade recommended, everyone else optional.

chazikai24 commented 2 years ago

@chazikai24 https://github.com/zerotier/ZeroTierOne/releases/tag/1.8.8

ZeroTier Release Notes 2022-04-11 -- Version 1.8.8 Fix a local privilege escalation bug in the Windows installer. Dependency fix for some Ubuntu versions. No changes for other platforms. Windows upgrade recommended, everyone else optional.

pull a request here and waiting for merge https://github.com/openwrt/packages/pull/18290

mwarning commented 2 years ago

Here is the fix from @chazikai24 with a green pipeline: https://github.com/openwrt/packages/pull/18300 Can anymore please test and confirm that ZeroTier does not crash on start anymore?

geo-y commented 2 years ago

Here is the fix from @chazikai24 with a green pipeline: openwrt/packages#18300 Can anymore please test and confirm that ZeroTier does not crash on start anymore?

I tested the latest master code. Now it works fine.

mwarning commented 2 years ago

I will close this issue here. Here you can track the merge requests: