Closed ghost closed 10 years ago
1403585619 CRITICAL Configurator.c:103 Got error [Security.c:119 Testing of memory limit not possible, unable to map memory] calling [Security_dropPermissions]
Ansuz had this on a 3.11.0-12 x86_64 Linux Mint box recently.
@rundfreifunk I think you mentioned the same error a couple of days ago, could you paste info about your system as well?
could we please rename this ticket? i think there is more than one problem left with openwrt..
and to your problem: i think you have to write your interface-ip using cjdns to your config (instead of 0.0.0.0) whats that interface making of? is it a bridge? and finally: did you reboot your device after installing cjdns? that may cause problems :-o
I'll try hardcoding an IP into the config, but was hoping long range to use ETHInterface on an adhoc network.
Since the device is a router that was flashed with an image that contained cjdns, yes, it has been rebooted since "install".
I'll update once I get the chance to put IP into the config.
With this as the config (generated with 'cjdrouteconf get'):
{
"publicKey":"
It is still giving the same error: ~# cjdrouteconf get | cjdroute 1403628762 INFO cjdroute2.c:540 Cjdns MIPS 32-bit LittleEndian linux 1403628762 INFO cjdroute2.c:544 Checking for running instance... 1403628762 DEBUG AdminClient.c:349 Connecting to [127.0.0.1:11234] 1403628762 DEBUG UDPAddrInterface.c:289 Bound to address [0.0.0.0:49404] 1403628762 INFO cjdroute2.c:570 Forking angel to background. 1403628762 DEBUG Pipe.c:135 Buffering a message 1403628762 INFO RandomSeed.c:42 Attempting to seed random number generator 1403628762 INFO RandomSeed.c:50 Trying random seed [/dev/urandom] Success 1403628762 INFO RandomSeed.c:56 Trying random seed [sysctl(RANDOM_UUID) (Linux)] Failed 1403628762 INFO RandomSeed.c:50 Trying random seed [/proc/sys/kernel/random/uuid (Linux)] Success 1403628762 INFO RandomSeed.c:64 Seeding random number generator succeeded with [2] sources 1403628762 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_client-angel-2xrn65khg2xbzbd933vxquz5b525wc] established connection 1403628762 DEBUG Pipe.c:254 Sending buffered message 1403628762 DEBUG AngelInit.c:180 Getting pre-configuration from client 1403628762 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_client-angel-2xrn65khg2xbzbd933vxquz5b525wc] established connection 1403628762 DEBUG AngelInit.c:184 Finished getting pre-configuration from client 1403628762 INFO AngelInit.c:215 Initializing core [/usr/sbin/cjdroute] 1403628762 DEBUG AngelInit.c:219 Sending pre-configuration to core. 1403628762 DEBUG Pipe.c:135 Buffering a message 1403628762 INFO RandomSeed.c:42 Attempting to seed random number generator 1403628762 INFO RandomSeed.c:50 Trying random seed [/dev/urandom] Success 1403628762 INFO RandomSeed.c:56 Trying random seed [sysctl(RANDOM_UUID) (Linux)] Failed 1403628762 INFO RandomSeed.c:50 Trying random seed [/proc/sys/kernel/random/uuid (Linux)] Success 1403628762 INFO RandomSeed.c:64 Seeding random number generator succeeded with [2] sources 1403628762 INFO LibuvEntropyProvider.c:59 Taking clock samples every [1000]ms for random generator 1403628762 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_m0trh4w272tugmvypbrs6xptk4hm2g] established connection 1403628762 DEBUG Pipe.c:254 Sending buffered message 1403628762 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_m0trh4w272tugmvypbrs6xptk4hm2g] established connection 1403628762 DEBUG UDPAddrInterface.c:250 Binding to address [127.0.0.1:11234] 1403628762 DEBUG UDPAddrInterface.c:289 Bound to address [127.0.0.1:11234] 1403628762 DEBUG Hermes.c:180 Sending [64] bytes to angel [d5:error4:none5:admind4:bind15:127.0.0.1:11234e4:txid8:00000000e]. 1403628762 DEBUG AdminClient.c:349 Connecting to [127.0.0.1:11234] 1403628762 DEBUG UDPAddrInterface.c:289 Bound to address [0.0.0.0:39543] 1403628762 INFO Configurator.c:126 Checking authorized password 0. 1403628762 INFO Configurator.c:147 Adding authorized password #[0] for user [password [0]]. 1403628762 CRITICAL Configurator.c:103 Got error [Security.c:119 Testing of memory limit not possible, unable to map memory] calling [Security_dropPermissions] 1403628762 CRITICAL Configurator.c:54 enable Log_LEVEL=KEYS to see message content. 1403628762 INFO Angel.c:43 Got request to exit 1403628767 CRITICAL Configurator.c:66 Failed to stop the core. 1403628767 CRITICAL Configurator.c:68 Aborting.
Ok...digging into the code, it appears that in Security.c:119 it is calling this function which contains the CRITICAL error thrown above:
90 static unsigned long getMaxMem(struct Except* eh)
91 {
92 struct rlimit lim = { 0, 0 };
93 if (getrlimit(Security_MEMORY_RLIMIT, &lim)) {
94 Except_throw(eh, "Failed to get memory limit [%s]", strerror(errno));
95 }
96
97 // First time around, we try a very small mapping just to make sure it works.
98 size_t tryMapping = 100;
99 if (lim.rlim_max > 0) {
100 tryMapping = lim.rlim_max * 2l;
101 }
102
103 void* ptr = mmap(NULL, tryMapping, PROT_READ | PROT_WRITE, MAP_ANONYMOUS, -1, 0);
104 if (ptr != MAP_FAILED) {
105 munmap(ptr, tryMapping);
106 if (lim.rlim_max > 0) {
107 Except_throw(eh, "Memory limit is not enforced, successfully mapped [%zu] bytes",
108 tryMapping);
109 }
110 } else if (lim.rlim_max == 0) {
111 Except_throw(eh, "Testing of memory limit not possible, unable to map memory");
112 }
113
114 return lim.rlim_max;
115 }
I'll keep digging into this, but it's been a long while since I touched this type of stuff.
same errormessage here for x86/kvm
root@71-42:~# cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 6 model : 2 model name : QEMU Virtual CPU version 0.15.1
I might have pointed you to the wrong code. We switched back to cjdns' crashey branch for OpenWRT, so the line throwing the error is here: https://github.com/cjdelisle/cjdns/blob/crashey/util/Security.c#L119
@cjdelisle @vadipp I suspect this regression might have been introduced with cjdelisle/cjdns#542, what do you think? Ufo is also seeing this error on kvm-x86 and ar71xx.
Also seeing this on my TP-Link MR3020
I will try to take a look today, if I can.
As far as I can see, the following happens:
lim.rlim_max == 0
or lim.rlim_max == RLIM_INFINITY
mmap
100 bytes on line 111 to check that mapping worksmmap
returns MAP_FAILED
(for unknown reason yet)mmap
failedIf it is the case that lim.rlim_max == RLIM_INFINITY
on your platform, then before my change in #542 this could work in the following way:
lim.rlim_max == RLIM_INFINITY
mmap
100 bytes on line 111 to check that mapping worksmmap
returns MAP_FAILED
(for unknown reason yet)lim.rlim_max != 0
.So I think that my change just revealed that mmap doesn't work for some reason. Please try to comment out my lines (https://github.com/cjdelisle/cjdns/blob/crashey/util/Security.c#L97-103) and see if the whole application works.
I did verify it, with your fix for cjdelisle/cjdns#521 reverted it works: https://github.com/lgierth/cjdns/commits/openwrt
@FreifunkUFO @XaosTX try again, I just committed a workaround.
Seems like I've found the problem, will submit a patch upstream soon.
@lgierth just updated my feeds and recompiled. Transferred the upkeep over and installed. Appears to run fine now. Will fully test in the morning when not ssh hopping from my tablet.
@vadipp this is great, thank you!
@XaosTX I reproduced 1 of the Critical issues with your configuration. I understand the the cjdns configuration has the public and private fields removed.
Did you removing authorizedpasswords too? if authorized passwords is really [[]] then we should try setting it to []
rm /etc/config/cjdns && touch /etc/config/cjdns vi /tmp/cjdroute.conf # (Entered a valid public, private Keys, and BindIPv4)
cat /tmp/cjdroute.conf | cjdroute --cleanconf | cjdrouteconf set
uci changes # displays the following:
uci commit
cjdrouteconf get | cjdroute cjdrouteconf get | cjdroute --cleanconf | cjdroute
1403750684 CRITICAL Configurator.c:128 Not a dictionary type 0.
18412 root 13744 S /usr/sbin/cjdroute angel client-angel-gts33f7n1h83r2mhnyvlfgz231gn3k 18413 root 13848 S /usr/sbin/cjdroute core nsznpm936bnbdxkbychjtbdsu4gqlk ...
I have not been able to reproduce this in the LuCI admin. When i changed authpass to just [] I can confirm cjdns does not go idle after throwing a Critical error.
Fix for mmap
problem merged to crashey.
yes, i can couple openwrt-ath71 (tplink) with my openwrt-vm (kvm) :+1:
Fresh build based on instructions here: https://github.com/seattlemeshnet/meshbox Flashed onto a WRT54G-TM Same error on two separate (but identical) WRT54G-TM's.
Output when running: ~# cjdrouteconf get | cjdroute 1403585619 INFO cjdroute2.c:540 Cjdns MIPS 32-bit LittleEndian linux 1403585619 INFO cjdroute2.c:544 Checking for running instance... 1403585619 DEBUG AdminClient.c:349 Connecting to [127.0.0.1:11234] 1403585619 DEBUG UDPAddrInterface.c:289 Bound to address [0.0.0.0:52928] 1403585619 INFO cjdroute2.c:570 Forking angel to background. 1403585619 DEBUG Pipe.c:135 Buffering a message 1403585619 INFO RandomSeed.c:42 Attempting to seed random number generator 1403585619 INFO RandomSeed.c:50 Trying random seed [/dev/urandom] Success 1403585619 INFO RandomSeed.c:56 Trying random seed [sysctl(RANDOM_UUID) (Linux)] Failed 1403585619 INFO RandomSeed.c:50 Trying random seed [/proc/sys/kernel/random/uuid (Linux)] Success 1403585619 INFO RandomSeed.c:64 Seeding random number generator succeeded with [2] sources 1403585619 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_client-angel-lmk4q3035j4ct1xnzs1yxgfuw2zu7d] established connection 1403585619 DEBUG AngelInit.c:180 Getting pre-configuration from client 1403585619 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_client-angel-lmk4q3035j4ct1xnzs1yxgfuw2zu7d] established connection 1403585619 DEBUG Pipe.c:254 Sending buffered message 1403585619 DEBUG AngelInit.c:184 Finished getting pre-configuration from client 1403585619 INFO AngelInit.c:215 Initializing core [/usr/sbin/cjdroute] 1403585619 DEBUG AngelInit.c:219 Sending pre-configuration to core. 1403585619 DEBUG Pipe.c:135 Buffering a message 1403585619 INFO RandomSeed.c:42 Attempting to seed random number generator 1403585619 INFO RandomSeed.c:50 Trying random seed [/dev/urandom] Success 1403585619 INFO RandomSeed.c:56 Trying random seed [sysctl(RANDOM_UUID) (Linux)] Failed 1403585619 INFO RandomSeed.c:50 Trying random seed [/proc/sys/kernel/random/uuid (Linux)] Success 1403585619 INFO RandomSeed.c:64 Seeding random number generator succeeded with [2] sources 1403585619 INFO LibuvEntropyProvider.c:59 Taking clock samples every [1000]ms for random generator 1403585619 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_bthmyh3v8d2dhqjs33b7zynzp06nlk] established connection 1403585619 DEBUG Pipe.c:254 Sending buffered message 1403585619 DEBUG Pipe.c:232 Pipe [/tmp/cjdns_pipe_bthmyh3v8d2dhqjs33b7zynzp06nlk] established connection 1403585619 DEBUG UDPAddrInterface.c:250 Binding to address [127.0.0.1:11234] 1403585619 DEBUG UDPAddrInterface.c:289 Bound to address [127.0.0.1:11234] 1403585619 DEBUG Hermes.c:180 Sending [64] bytes to angel [d5:error4:none5:admind4:bind15:127.0.0.1:11234e4:txid8:00000000e]. 1403585619 DEBUG AdminClient.c:349 Connecting to [127.0.0.1:11234] 1403585619 DEBUG UDPAddrInterface.c:289 Bound to address [0.0.0.0:36110] 1403585619 INFO Configurator.c:126 Checking authorized password 0. 1403585619 INFO Configurator.c:147 Adding authorized password #[0] for user [password [0]]. 1403585619 CRITICAL Configurator.c:103 Got error [Security.c:119 Testing of memory limit not possible, unable to map memory] calling [Security_dropPermissions] 1403585619 CRITICAL Configurator.c:54 enable Log_LEVEL=KEYS to see message content. 1403585619 INFO Angel.c:43 Got request to exit 1403585624 CRITICAL Configurator.c:66 Failed to stop the core. 1403585624 CRITICAL Configurator.c:68 Aborting.
Able to get Benchmarks to work: BusyBox v1.22.1 (2014-06-23 15:10:51 CDT) built-in shell (ash) Enter 'help' for a list of built-in commands.
| |.-----.-----.-----.| | | |.----.| | | - || | -| || | | || || | |_____|| |___||||____||| |__| |__| W I R E L E S S F R E E D O M
BARRIER BREAKER (Bleeding Edge, r41302)
2 tsp. Creme de Cacao
~# cjdroute --bench 1403584914 INFO RandomSeed.c:42 Attempting to seed random number generator 1403584914 INFO RandomSeed.c:50 Trying random seed [/dev/urandom] Success 1403584914 INFO RandomSeed.c:56 Trying random seed [sysctl(RANDOM_UUID) (Linux)] Failed 1403584914 INFO RandomSeed.c:50 Trying random seed [/proc/sys/kernel/random/uuid (Linux)] Success 1403584914 INFO RandomSeed.c:64 Seeding random number generator succeeded with [2] sources These metrics are speed of encryption and decryption similar to the usage pattern when decrypting a packet, switching it, and re-encrypting it with another key. Test sending 1000 64 byte hello packets Finished in 18421ms. 27 Kb/s
Test sending 1000 1500 byte hello packets Finished in 19400ms. 618 Kb/s
Test sending 1000 64 byte key packets Finished in 17521ms. 29 Kb/s
Test sending 1000 1500 byte key packets Finished in 18486ms. 649 Kb/s
Test sending 100000 64 byte data packets Finished in 17541ms. 2918 Kb/s
This is the switch configuration so this indicates expected switch throughput: Test sending 100000 1500 byte data packets Finished in 111113ms. 10799 Kb/s
~# cat /proc/cpuinfo system type : Broadcom BCM5352 machine : Linksys WRT54G/GS/GL processor : 0 cpu model : Broadcom BMIPS3300 V0.8 BogoMIPS : 199.06 wait instruction : yes microsecond timers : yes tlb_entries : 32 extra interrupt vector : yes hardware watchpoint : no isa : mips1 mips2 mips32r1 ASEs implemented : shadow register sets : 1 kscratch registers : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available