ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.8k stars 889 forks source link

General protection fault in lightning_connectd after SYN flood warning #4359

Open whitslack opened 3 years ago

whitslack commented 3 years ago

Issue and Steps to Reproduce

C-Lightning crashed with a general protection fault in lightning_connectd immediately following a kernel warning about possible SYN flooding on TCP port 9735:

[Wed Jan 27 02:33:38 2021] TCP: request_sock_TCP: Possible SYN flooding on port 9735. Dropping request.  Check SNMP counters.
[Wed Jan 27 02:33:40 2021] traps: lightning_conne[2884] general protection fault ip:7fd3d30276fd sp:7ffe67cc3600 error:0 in libc-2.32.so[7fd3d2fc5000+144000]

Unfortunately, no backtrace was emitted to C-Lightning's log, and no crash log file was generated either. If this happens again, I'll enable core dumps and try to get a backtrace with gdb.

Is it possible that someone has discovered a way to DoS C-Lightning?

getinfo output

{
   "id": "#######",
   "alias": "XXXXXXXX",
   "color": "######",
   "num_peers": ##,
   "num_pending_channels": 1,
   "num_active_channels": ##,
   "num_inactive_channels": 2,
   "address": [
      {
         "type": "ipv4",
         "address": "###.###.###.###",
         "port": 9735
      },
      {
         "type": "ipv6",
         "address": "####:####:####:####:####:####:####:####",
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv6",
         "address": "::",
         "port": 9735
      },
      {
         "type": "ipv4",
         "address": "0.0.0.0",
         "port": 9735
      }
   ],
   "version": "0.9.3",
   "blockheight": 667919,
   "network": "bitcoin",
   "msatoshi_fees_collected": #####,
   "fees_collected_msat": "#####msat",
   "lightning-dir": "/var/lib/lightning/bitcoin"
}
cdecker commented 3 years ago

@rustyrussell could this be somehow related to a resource exhaustion due to half-open connections?