core-lightning/lightningd
Rusty Russell 5e6b0f9445 lightningd: fix crash if we abort after enabling notifications.
The rpc_command hook means that we have a delay between receiving
a JSON command and actually calling the handler.  In this case, the
caller can go away:

```
==1348== Invalid write of size 1
==1348==    at 0x130EA6: json_notifications (jsonrpc.c:1350)
==1348==    by 0x12EE9E: command_exec (jsonrpc.c:636)
==1348==    by 0x12F3C6: rpc_command_hook_callback (jsonrpc.c:752)
==1348==    by 0x15AA08: plugin_hook_callback (plugin_hook.c:210)
==1348==    by 0x155C9D: plugin_response_handle (plugin.c:398)
==1348==    by 0x155E84: plugin_read_json_one (plugin.c:504)
==1348==    by 0x15603D: plugin_read_json (plugin.c:548)
==1348==    by 0x1D4AB3: next_plan (io.c:59)
==1348==    by 0x1D5630: do_plan (io.c:407)
==1348==    by 0x1D566E: io_ready (io.c:417)
==1348==    by 0x1D7834: io_loop (poll.c:445)
==1348==    by 0x12CFAC: io_loop_with_timers (io_loop_with_timers.c:24)
==1348==  Address 0x58 is not stack'd, malloc'd or (recently) free'd
==1348==
lightningd: FATAL SIGNAL 11 (version v0.9.1-266-ga4df315)
0x180f7e send_backtrace
	common/daemon.c:38
0x181024 crashdump
	common/daemon.c:51
0x5bd7fcf ???
	???:0
0x130ea6 json_notifications
	lightningd/jsonrpc.c:1350
0x12ee9e command_exec
	lightningd/jsonrpc.c:636
0x12f3c6 rpc_command_hook_callback
	lightningd/jsonrpc.c:752
0x15aa08 plugin_hook_callback
	lightningd/plugin_hook.c:210
0x155c9d plugin_response_handle
	lightningd/plugin.c:398
0x155e84 plugin_read_json_one
	lightningd/plugin.c:504
0x15603d plugin_read_json
	lightningd/plugin.c:548
0x1d4ab3 next_plan
	ccan/ccan/io/io.c:59
0x1d5630 do_plan
	ccan/ccan/io/io.c:407
0x1d566e io_ready
	ccan/ccan/io/io.c:417
0x1d7834 io_loop
	ccan/ccan/io/poll.c:445
0x12cfac io_loop_with_timers
	lightningd/io_loop_with_timers.c:24
0x132825 main
	lightningd/lightningd.c:1016
0x5bbab96 ???
	???:0
0x1159e9 ???
	???:0
0xffffffffffffffff ???
	???:0
Log dumped in crash.log.20201106001723
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-11-06 14:05:44 -06:00
..
test close: add notification for slow closes. 2020-10-23 13:53:16 +10:30
.gitignore dualopend: new dualopend daemon, containing most of accepter side 2020-09-09 19:54:20 +09:30
bitcoind.c lightningd: forward notifications from plugins if enabled. 2020-10-23 13:53:16 +10:30
bitcoind.h plugins/bcli.c: sendrawtransaction now has a required allowhighfees argument. 2020-09-09 12:38:19 +09:30
chaintopology.c topo: Do not keep txids in memory indefinitely 2020-09-23 13:52:49 +09:30
chaintopology.h plugins/bcli.c: sendrawtransaction now has a required allowhighfees argument. 2020-09-09 12:38:19 +09:30
channel_control.c df: add notification for receiving peer's funding tx sigs 2020-10-21 09:04:32 +10:30
channel_control.h peer_channeld: pass over PSBT, remove second message 2020-10-20 12:50:31 +10:30
channel_state.h
channel.c Makefile: make check-includes check all the non-generated files. 2020-10-22 12:14:34 +10:30
channel.h dual-fund: rework where we send our tx-sigs message, allow peers in 2020-10-21 09:04:32 +10:30
closing_control.c lightningd: separate fee_states out of struct channel_info. 2020-09-23 15:51:13 +09:30
closing_control.h
coin_mvts.c channel_id: save to database, dont derive from funding_txid 2020-09-09 19:54:20 +09:30
coin_mvts.h coins: re-write API interface for htlc notices 2020-05-12 15:46:58 +09:30
connect_control.c connectd: implement connection timeout (60 seconds). 2020-09-11 21:27:45 +09:30
connect_control.h
dual_open_control.c dual_open: correct silent enum conversions 2020-11-04 14:29:22 -06:00
dual_open_control.h dual-fund: accepter side implementation on lightningd 2020-09-09 19:54:20 +09:30
gossip_control.c Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES 2020-09-08 09:42:00 +09:30
gossip_control.h
gossip_msg.c wire: make fromwire_fail return non-const, use it more 2020-05-20 11:36:13 +02:00
gossip_msg.h gossipd: return channel_announcement features for listchannels. 2020-05-07 08:44:58 +09:30
hsm_control.c hsmd: convert to new wire generation style. 2020-08-25 12:53:13 +09:30
hsm_control.h hsm: decouple hsm from wallet; init before wallet 2020-06-11 13:13:13 +02:00
htlc_end.c coins: have we_fulfilled be fully 'ternary' 2020-05-12 15:46:58 +09:30
htlc_end.h Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES 2020-09-08 09:42:00 +09:30
htlc_set.c lightningd: note whether payment secret is used or not. 2020-10-28 12:03:14 +01:00
htlc_set.h Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES 2020-09-08 09:42:00 +09:30
invoice.c bolt11: have caller supply preferred chain. 2020-09-24 09:24:14 +09:30
invoice.h Makefile: use completely separate spec-derived files for EXPERIMENTAL_FEATURES 2020-09-08 09:42:00 +09:30
io_loop_with_timers.c
io_loop_with_timers.h
json.c json_command: command_fail_badparam helper. 2020-09-02 09:46:37 +09:30
json.h common: hoist param_bitcoin_address where plugins can use it. 2020-08-11 08:39:24 +09:30
jsonrpc.c lightningd: fix crash if we abort after enabling notifications. 2020-11-06 14:05:44 -06:00
jsonrpc.h lightningd: infrastructure for internal notifications. 2020-10-23 13:53:16 +10:30
lightningd.c nit: lightningd.c: fix "Richard Stevens' advice" 2020-10-28 14:32:35 -05:00
lightningd.h df-open: add a 'open_commands' list to stash pending opens around in 2020-10-20 12:50:31 +10:30
log_status.c common: convert to new wire generation style. 2020-08-25 12:53:13 +09:30
log_status.h
log.c common: add routines for log level names. 2020-10-23 13:53:16 +10:30
log.h
Makefile Makefile: add $(LIGHTNINGD_SRC_NOHDR) to $(ALL_C_SOURCES) for "make clean" to work properly 2020-10-27 10:42:48 +10:30
memdump.c common/memleak: simplify and document API. 2020-09-23 13:52:49 +09:30
memdump.h
notification.c df: add notification for receiving peer's funding tx sigs 2020-10-21 09:04:32 +10:30
notification.h df: add notification for receiving peer's funding tx sigs 2020-10-21 09:04:32 +10:30
onchain_control.c channel_id: save to database, dont derive from funding_txid 2020-09-09 19:54:20 +09:30
onchain_control.h closingd: convert to new wire generation style. 2020-08-25 12:53:13 +09:30
onion_message.c json_command: command_fail_badparam helper. 2020-09-02 09:46:37 +09:30
onion_message.h
opening_common.c df-open: use channel_id for openchannel_update and openchannel_signed 2020-10-20 12:50:31 +10:30
opening_common.h df-open: use channel_id for openchannel_update and openchannel_signed 2020-10-20 12:50:31 +10:30
opening_control.c channel: save funding_psbt to database 2020-10-20 12:50:31 +10:30
opening_control.h memleak: 'generify' the memleak calling to code for openingd/dualopend 2020-09-17 10:12:08 +09:30
options.c dev-force-features: adds a second valid format for forcing features 2020-10-26 21:31:24 -05:00
options.h
pay.c bolt11: have caller supply preferred chain. 2020-09-24 09:24:14 +09:30
pay.h lightningd: don't report spurious temporary_node_failure on local failures. 2020-05-04 18:56:33 +09:30
peer_control.c close: add notification for slow closes. 2020-10-23 13:53:16 +10:30
peer_control.h peer_control: move open_command up to where channeld can get it, 2020-10-20 12:50:31 +10:30
peer_htlcs.c lightningd: fix crash when we try to send fail_htlc msg to onchaind. 2020-10-14 16:08:05 +10:30
peer_htlcs.h lightningd: separate fee_states out of struct channel_info. 2020-09-23 15:51:13 +09:30
ping.c gossipd: convert wire to new scheme. 2020-08-25 12:53:13 +09:30
ping.h
plugin_control.c lightningd: remove deprecated result for plugin stop. 2020-09-18 12:08:07 +09:30
plugin_control.h lightningd: attach plugins natively to the command which started it. 2020-05-05 13:45:17 +09:30
plugin_hook.c lightningd: forward notifications from plugins if enabled. 2020-10-23 13:53:16 +10:30
plugin_hook.h plugin_hook_call: return indication whether we called the callback or not. 2020-05-05 13:45:17 +09:30
plugin.c lightningd: forward notifications from plugins if enabled. 2020-10-23 13:53:16 +10:30
plugin.h lightningd: always do incremental parsing of JSON inputs. 2020-08-21 09:52:33 +09:30
routehint.c lightningd: extract routehint selection code. 2020-09-08 19:47:11 +09:30
routehint.h lightningd: extract routehint selection code. 2020-09-08 19:47:11 +09:30
signmessage.c gossipd: convert wire to new scheme. 2020-08-25 12:53:13 +09:30
subd.c Makefile: use generic rules to make spec-derived sources. 2020-08-31 21:33:26 -05:00
subd.h
watch.c
watch.h