From 39c8b0c88ee8ffca4b1db1fd70dbe3c0676d60e8 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 26 Feb 2026 21:59:24 +0100 Subject: [PATCH] fuzz: use process::exit panic hook in stdin_fuzz on macOS On macOS, panic=abort causes the process to call abort() which sends SIGABRT. The ReportCrash daemon then tries to generate a crash report, leaving the process stuck in an uninterruptible wait state that cannot be killed even with SIGKILL. This makes stdin_fuzz unusable for crash reproduction on macOS. Install a custom panic hook (gated behind #[cfg(target_os = "macos")]) that flushes stdout (preserving log output), prints the panic info with a full backtrace to stderr, then calls process::exit(1) to terminate cleanly before the abort machinery runs. The hook is only installed on macOS to avoid interfering with debuggers like GDB on Linux. AI tools were used in preparing this commit. --- fuzz/src/bin/base32_target.rs | 12 ++++++++++++ fuzz/src/bin/bech32_parse_target.rs | 12 ++++++++++++ fuzz/src/bin/bolt11_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/chanmon_consistency_target.rs | 12 ++++++++++++ fuzz/src/bin/chanmon_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/feature_flags_target.rs | 12 ++++++++++++ fuzz/src/bin/fromstr_to_netaddress_target.rs | 12 ++++++++++++ fuzz/src/bin/fs_store_target.rs | 12 ++++++++++++ fuzz/src/bin/full_stack_target.rs | 12 ++++++++++++ fuzz/src/bin/indexedmap_target.rs | 12 ++++++++++++ fuzz/src/bin/invoice_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/invoice_request_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/lsps_message_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_accept_channel_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_accept_channel_v2_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_announcement_signatures_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_blinded_message_path_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_channel_announcement_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_channel_details_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_channel_ready_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_channel_reestablish_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_channel_update_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_closing_complete_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_closing_sig_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_closing_signed_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_commitment_signed_target.rs | 12 ++++++++++++ .../src/bin/msg_decoded_onion_error_packet_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_error_message_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_funding_created_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_funding_signed_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_gossip_timestamp_filter_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_init_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_node_announcement_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_open_channel_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_open_channel_v2_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_ping_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_pong_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_query_channel_range_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_query_short_channel_ids_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_reply_channel_range_target.rs | 12 ++++++++++++ .../bin/msg_reply_short_channel_ids_end_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_revoke_and_ack_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_shutdown_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_splice_ack_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_splice_init_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_splice_locked_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_stfu_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_abort_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_ack_rbf_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_add_input_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_add_output_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_complete_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_init_rbf_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_remove_input_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_remove_output_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_tx_signatures_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_update_add_htlc_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_update_fail_htlc_target.rs | 12 ++++++++++++ .../src/bin/msg_update_fail_malformed_htlc_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_update_fee_target.rs | 12 ++++++++++++ fuzz/src/bin/msg_update_fulfill_htlc_target.rs | 12 ++++++++++++ fuzz/src/bin/offer_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/onion_hop_data_target.rs | 12 ++++++++++++ fuzz/src/bin/onion_message_target.rs | 12 ++++++++++++ fuzz/src/bin/peer_crypt_target.rs | 12 ++++++++++++ fuzz/src/bin/process_network_graph_target.rs | 12 ++++++++++++ fuzz/src/bin/process_onion_failure_target.rs | 12 ++++++++++++ fuzz/src/bin/refund_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/router_target.rs | 12 ++++++++++++ fuzz/src/bin/static_invoice_deser_target.rs | 12 ++++++++++++ fuzz/src/bin/target_template.txt | 12 ++++++++++++ fuzz/src/bin/zbase32_target.rs | 12 ++++++++++++ 72 files changed, 864 insertions(+) diff --git a/fuzz/src/bin/base32_target.rs b/fuzz/src/bin/base32_target.rs index 5f168fdcea3..e79e6db7380 100644 --- a/fuzz/src/bin/base32_target.rs +++ b/fuzz/src/bin/base32_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); base32_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/bech32_parse_target.rs b/fuzz/src/bin/bech32_parse_target.rs index ad2f6653843..f9493bb1bc1 100644 --- a/fuzz/src/bin/bech32_parse_target.rs +++ b/fuzz/src/bin/bech32_parse_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); bech32_parse_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/bolt11_deser_target.rs b/fuzz/src/bin/bolt11_deser_target.rs index 9e2f33d92cc..28b1e2db679 100644 --- a/fuzz/src/bin/bolt11_deser_target.rs +++ b/fuzz/src/bin/bolt11_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); bolt11_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/chanmon_consistency_target.rs b/fuzz/src/bin/chanmon_consistency_target.rs index a729e3df1d6..7649900bae5 100644 --- a/fuzz/src/bin/chanmon_consistency_target.rs +++ b/fuzz/src/bin/chanmon_consistency_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); chanmon_consistency_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/chanmon_deser_target.rs b/fuzz/src/bin/chanmon_deser_target.rs index a2f109f17c8..d3cf30b86e3 100644 --- a/fuzz/src/bin/chanmon_deser_target.rs +++ b/fuzz/src/bin/chanmon_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); chanmon_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/feature_flags_target.rs b/fuzz/src/bin/feature_flags_target.rs index 2d23f96b4e6..b1f35f8820f 100644 --- a/fuzz/src/bin/feature_flags_target.rs +++ b/fuzz/src/bin/feature_flags_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); feature_flags_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/fromstr_to_netaddress_target.rs b/fuzz/src/bin/fromstr_to_netaddress_target.rs index fd34e029722..8f3e5c3dc7f 100644 --- a/fuzz/src/bin/fromstr_to_netaddress_target.rs +++ b/fuzz/src/bin/fromstr_to_netaddress_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); fromstr_to_netaddress_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/fs_store_target.rs b/fuzz/src/bin/fs_store_target.rs index 8942ebea7f7..8d84aad7b6b 100644 --- a/fuzz/src/bin/fs_store_target.rs +++ b/fuzz/src/bin/fs_store_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); fs_store_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/full_stack_target.rs b/fuzz/src/bin/full_stack_target.rs index a0be19786b5..c1f20b10af4 100644 --- a/fuzz/src/bin/full_stack_target.rs +++ b/fuzz/src/bin/full_stack_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); full_stack_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/indexedmap_target.rs b/fuzz/src/bin/indexedmap_target.rs index 51d135b372e..3bc4390fee4 100644 --- a/fuzz/src/bin/indexedmap_target.rs +++ b/fuzz/src/bin/indexedmap_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); indexedmap_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/invoice_deser_target.rs b/fuzz/src/bin/invoice_deser_target.rs index bcdbecd0706..44bf1851a40 100644 --- a/fuzz/src/bin/invoice_deser_target.rs +++ b/fuzz/src/bin/invoice_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); invoice_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/invoice_request_deser_target.rs b/fuzz/src/bin/invoice_request_deser_target.rs index f6eee60f142..06d8f87fa55 100644 --- a/fuzz/src/bin/invoice_request_deser_target.rs +++ b/fuzz/src/bin/invoice_request_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); invoice_request_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/lsps_message_target.rs b/fuzz/src/bin/lsps_message_target.rs index 4c6a0f45655..37e6f103fb4 100644 --- a/fuzz/src/bin/lsps_message_target.rs +++ b/fuzz/src/bin/lsps_message_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); lsps_message_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_accept_channel_target.rs b/fuzz/src/bin/msg_accept_channel_target.rs index aa3b6768eba..ee08a5fc344 100644 --- a/fuzz/src/bin/msg_accept_channel_target.rs +++ b/fuzz/src/bin/msg_accept_channel_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_accept_channel_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_accept_channel_v2_target.rs b/fuzz/src/bin/msg_accept_channel_v2_target.rs index 469ae98a410..2903e111f56 100644 --- a/fuzz/src/bin/msg_accept_channel_v2_target.rs +++ b/fuzz/src/bin/msg_accept_channel_v2_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_accept_channel_v2_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_announcement_signatures_target.rs b/fuzz/src/bin/msg_announcement_signatures_target.rs index f53aae636d5..064880abc18 100644 --- a/fuzz/src/bin/msg_announcement_signatures_target.rs +++ b/fuzz/src/bin/msg_announcement_signatures_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_announcement_signatures_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_blinded_message_path_target.rs b/fuzz/src/bin/msg_blinded_message_path_target.rs index 4159e1c6499..277e04c9656 100644 --- a/fuzz/src/bin/msg_blinded_message_path_target.rs +++ b/fuzz/src/bin/msg_blinded_message_path_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_blinded_message_path_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_channel_announcement_target.rs b/fuzz/src/bin/msg_channel_announcement_target.rs index 31cb61165b0..42e72d54b72 100644 --- a/fuzz/src/bin/msg_channel_announcement_target.rs +++ b/fuzz/src/bin/msg_channel_announcement_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_announcement_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_channel_details_target.rs b/fuzz/src/bin/msg_channel_details_target.rs index 618c5d6d297..a03a7a44920 100644 --- a/fuzz/src/bin/msg_channel_details_target.rs +++ b/fuzz/src/bin/msg_channel_details_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_details_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_channel_ready_target.rs b/fuzz/src/bin/msg_channel_ready_target.rs index eacacf10193..a0457815036 100644 --- a/fuzz/src/bin/msg_channel_ready_target.rs +++ b/fuzz/src/bin/msg_channel_ready_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_ready_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_channel_reestablish_target.rs b/fuzz/src/bin/msg_channel_reestablish_target.rs index 9ed4a5d1ad3..b5449a90e37 100644 --- a/fuzz/src/bin/msg_channel_reestablish_target.rs +++ b/fuzz/src/bin/msg_channel_reestablish_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_reestablish_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_channel_update_target.rs b/fuzz/src/bin/msg_channel_update_target.rs index 56ffeff2c4d..9feb6e6c6b4 100644 --- a/fuzz/src/bin/msg_channel_update_target.rs +++ b/fuzz/src/bin/msg_channel_update_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_channel_update_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_closing_complete_target.rs b/fuzz/src/bin/msg_closing_complete_target.rs index 3d8b1375266..22dd97c79c9 100644 --- a/fuzz/src/bin/msg_closing_complete_target.rs +++ b/fuzz/src/bin/msg_closing_complete_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_closing_complete_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_closing_sig_target.rs b/fuzz/src/bin/msg_closing_sig_target.rs index 8bd8e30b50f..26058a5277d 100644 --- a/fuzz/src/bin/msg_closing_sig_target.rs +++ b/fuzz/src/bin/msg_closing_sig_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_closing_sig_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_closing_signed_target.rs b/fuzz/src/bin/msg_closing_signed_target.rs index 68ed7239693..94408bc2ba9 100644 --- a/fuzz/src/bin/msg_closing_signed_target.rs +++ b/fuzz/src/bin/msg_closing_signed_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_closing_signed_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_commitment_signed_target.rs b/fuzz/src/bin/msg_commitment_signed_target.rs index bac1912c616..e8987848417 100644 --- a/fuzz/src/bin/msg_commitment_signed_target.rs +++ b/fuzz/src/bin/msg_commitment_signed_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_commitment_signed_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs b/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs index 546acafd089..47d8970b453 100644 --- a/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs +++ b/fuzz/src/bin/msg_decoded_onion_error_packet_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_decoded_onion_error_packet_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_error_message_target.rs b/fuzz/src/bin/msg_error_message_target.rs index f020c4532b3..ee3904a724e 100644 --- a/fuzz/src/bin/msg_error_message_target.rs +++ b/fuzz/src/bin/msg_error_message_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_error_message_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_funding_created_target.rs b/fuzz/src/bin/msg_funding_created_target.rs index cfa74aca486..028aa17ad8a 100644 --- a/fuzz/src/bin/msg_funding_created_target.rs +++ b/fuzz/src/bin/msg_funding_created_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_funding_created_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_funding_signed_target.rs b/fuzz/src/bin/msg_funding_signed_target.rs index de5f3b22300..4894c66df0b 100644 --- a/fuzz/src/bin/msg_funding_signed_target.rs +++ b/fuzz/src/bin/msg_funding_signed_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_funding_signed_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs b/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs index 4fd905b3edd..6da383b2e6f 100644 --- a/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs +++ b/fuzz/src/bin/msg_gossip_timestamp_filter_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_gossip_timestamp_filter_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_init_target.rs b/fuzz/src/bin/msg_init_target.rs index 9d2bc346304..f1d17c99289 100644 --- a/fuzz/src/bin/msg_init_target.rs +++ b/fuzz/src/bin/msg_init_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_init_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_node_announcement_target.rs b/fuzz/src/bin/msg_node_announcement_target.rs index 820fea1adca..b0615f3c5e5 100644 --- a/fuzz/src/bin/msg_node_announcement_target.rs +++ b/fuzz/src/bin/msg_node_announcement_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_node_announcement_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_open_channel_target.rs b/fuzz/src/bin/msg_open_channel_target.rs index fbfd0938924..b3dbf388c08 100644 --- a/fuzz/src/bin/msg_open_channel_target.rs +++ b/fuzz/src/bin/msg_open_channel_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_open_channel_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_open_channel_v2_target.rs b/fuzz/src/bin/msg_open_channel_v2_target.rs index 8c46c4c09df..0df11adf32e 100644 --- a/fuzz/src/bin/msg_open_channel_v2_target.rs +++ b/fuzz/src/bin/msg_open_channel_v2_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_open_channel_v2_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_ping_target.rs b/fuzz/src/bin/msg_ping_target.rs index 52cd3d941ab..48f855985de 100644 --- a/fuzz/src/bin/msg_ping_target.rs +++ b/fuzz/src/bin/msg_ping_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_ping_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_pong_target.rs b/fuzz/src/bin/msg_pong_target.rs index da9e9cc2b89..434e9cfe310 100644 --- a/fuzz/src/bin/msg_pong_target.rs +++ b/fuzz/src/bin/msg_pong_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_pong_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_query_channel_range_target.rs b/fuzz/src/bin/msg_query_channel_range_target.rs index e177b23072f..cb87260e1ef 100644 --- a/fuzz/src/bin/msg_query_channel_range_target.rs +++ b/fuzz/src/bin/msg_query_channel_range_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_query_channel_range_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_query_short_channel_ids_target.rs b/fuzz/src/bin/msg_query_short_channel_ids_target.rs index 53ca822bb21..bc286a7e523 100644 --- a/fuzz/src/bin/msg_query_short_channel_ids_target.rs +++ b/fuzz/src/bin/msg_query_short_channel_ids_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_query_short_channel_ids_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_reply_channel_range_target.rs b/fuzz/src/bin/msg_reply_channel_range_target.rs index 2a776eaabf7..c7df076c6c6 100644 --- a/fuzz/src/bin/msg_reply_channel_range_target.rs +++ b/fuzz/src/bin/msg_reply_channel_range_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_reply_channel_range_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs b/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs index 02ffd90ebcb..2c73d866bd9 100644 --- a/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs +++ b/fuzz/src/bin/msg_reply_short_channel_ids_end_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_reply_short_channel_ids_end_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_revoke_and_ack_target.rs b/fuzz/src/bin/msg_revoke_and_ack_target.rs index 0a20ea7586c..6379d39591f 100644 --- a/fuzz/src/bin/msg_revoke_and_ack_target.rs +++ b/fuzz/src/bin/msg_revoke_and_ack_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_revoke_and_ack_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_shutdown_target.rs b/fuzz/src/bin/msg_shutdown_target.rs index ed26a25949c..6bf0409b7b5 100644 --- a/fuzz/src/bin/msg_shutdown_target.rs +++ b/fuzz/src/bin/msg_shutdown_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_shutdown_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_splice_ack_target.rs b/fuzz/src/bin/msg_splice_ack_target.rs index 0a1f13b7e08..96f373d5a1c 100644 --- a/fuzz/src/bin/msg_splice_ack_target.rs +++ b/fuzz/src/bin/msg_splice_ack_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_splice_ack_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_splice_init_target.rs b/fuzz/src/bin/msg_splice_init_target.rs index 9a7bc60ebda..73d4319c44a 100644 --- a/fuzz/src/bin/msg_splice_init_target.rs +++ b/fuzz/src/bin/msg_splice_init_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_splice_init_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_splice_locked_target.rs b/fuzz/src/bin/msg_splice_locked_target.rs index 0f9b0a2ed60..9210113a0c8 100644 --- a/fuzz/src/bin/msg_splice_locked_target.rs +++ b/fuzz/src/bin/msg_splice_locked_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_splice_locked_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_stfu_target.rs b/fuzz/src/bin/msg_stfu_target.rs index d6b898ba11b..d00536c7bcd 100644 --- a/fuzz/src/bin/msg_stfu_target.rs +++ b/fuzz/src/bin/msg_stfu_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_stfu_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_abort_target.rs b/fuzz/src/bin/msg_tx_abort_target.rs index 3b824095062..8f216b46e63 100644 --- a/fuzz/src/bin/msg_tx_abort_target.rs +++ b/fuzz/src/bin/msg_tx_abort_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_abort_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_ack_rbf_target.rs b/fuzz/src/bin/msg_tx_ack_rbf_target.rs index d4905a5ce14..90b34c7f93f 100644 --- a/fuzz/src/bin/msg_tx_ack_rbf_target.rs +++ b/fuzz/src/bin/msg_tx_ack_rbf_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_ack_rbf_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_add_input_target.rs b/fuzz/src/bin/msg_tx_add_input_target.rs index 627797fdc6f..ce9700bd344 100644 --- a/fuzz/src/bin/msg_tx_add_input_target.rs +++ b/fuzz/src/bin/msg_tx_add_input_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_add_input_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_add_output_target.rs b/fuzz/src/bin/msg_tx_add_output_target.rs index be301558f6f..02682194e13 100644 --- a/fuzz/src/bin/msg_tx_add_output_target.rs +++ b/fuzz/src/bin/msg_tx_add_output_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_add_output_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_complete_target.rs b/fuzz/src/bin/msg_tx_complete_target.rs index 12abb32e020..48864f053c8 100644 --- a/fuzz/src/bin/msg_tx_complete_target.rs +++ b/fuzz/src/bin/msg_tx_complete_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_complete_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_init_rbf_target.rs b/fuzz/src/bin/msg_tx_init_rbf_target.rs index 6ede611b2ae..a8b613cdfca 100644 --- a/fuzz/src/bin/msg_tx_init_rbf_target.rs +++ b/fuzz/src/bin/msg_tx_init_rbf_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_init_rbf_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_remove_input_target.rs b/fuzz/src/bin/msg_tx_remove_input_target.rs index a508497e151..1e46c547dbf 100644 --- a/fuzz/src/bin/msg_tx_remove_input_target.rs +++ b/fuzz/src/bin/msg_tx_remove_input_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_remove_input_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_remove_output_target.rs b/fuzz/src/bin/msg_tx_remove_output_target.rs index 993ddb044b2..3a9c178e75f 100644 --- a/fuzz/src/bin/msg_tx_remove_output_target.rs +++ b/fuzz/src/bin/msg_tx_remove_output_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_remove_output_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_tx_signatures_target.rs b/fuzz/src/bin/msg_tx_signatures_target.rs index 8054d4241ee..77f34cc1f6a 100644 --- a/fuzz/src/bin/msg_tx_signatures_target.rs +++ b/fuzz/src/bin/msg_tx_signatures_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_tx_signatures_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_update_add_htlc_target.rs b/fuzz/src/bin/msg_update_add_htlc_target.rs index 258dd2445f2..3ff5cf83dbe 100644 --- a/fuzz/src/bin/msg_update_add_htlc_target.rs +++ b/fuzz/src/bin/msg_update_add_htlc_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_add_htlc_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_update_fail_htlc_target.rs b/fuzz/src/bin/msg_update_fail_htlc_target.rs index b4ae4e52e1e..5b8a7e55dcb 100644 --- a/fuzz/src/bin/msg_update_fail_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fail_htlc_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fail_htlc_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs b/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs index fb5325d54f7..e3e8918e492 100644 --- a/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fail_malformed_htlc_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fail_malformed_htlc_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_update_fee_target.rs b/fuzz/src/bin/msg_update_fee_target.rs index d8e9a26dc08..98e51181c79 100644 --- a/fuzz/src/bin/msg_update_fee_target.rs +++ b/fuzz/src/bin/msg_update_fee_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fee_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/msg_update_fulfill_htlc_target.rs b/fuzz/src/bin/msg_update_fulfill_htlc_target.rs index cec5ccfc1fe..cb156448e13 100644 --- a/fuzz/src/bin/msg_update_fulfill_htlc_target.rs +++ b/fuzz/src/bin/msg_update_fulfill_htlc_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); msg_update_fulfill_htlc_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/offer_deser_target.rs b/fuzz/src/bin/offer_deser_target.rs index d788a8b04c9..c4a03f628b3 100644 --- a/fuzz/src/bin/offer_deser_target.rs +++ b/fuzz/src/bin/offer_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); offer_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/onion_hop_data_target.rs b/fuzz/src/bin/onion_hop_data_target.rs index 1677d075ebd..3b9b55bbfa9 100644 --- a/fuzz/src/bin/onion_hop_data_target.rs +++ b/fuzz/src/bin/onion_hop_data_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); onion_hop_data_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/onion_message_target.rs b/fuzz/src/bin/onion_message_target.rs index ff5feec3fb4..bb343e9de83 100644 --- a/fuzz/src/bin/onion_message_target.rs +++ b/fuzz/src/bin/onion_message_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); onion_message_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/peer_crypt_target.rs b/fuzz/src/bin/peer_crypt_target.rs index 6b21d8e6e5a..c68111deb06 100644 --- a/fuzz/src/bin/peer_crypt_target.rs +++ b/fuzz/src/bin/peer_crypt_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); peer_crypt_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/process_network_graph_target.rs b/fuzz/src/bin/process_network_graph_target.rs index 26306648151..7da2aafe3c8 100644 --- a/fuzz/src/bin/process_network_graph_target.rs +++ b/fuzz/src/bin/process_network_graph_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); process_network_graph_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/process_onion_failure_target.rs b/fuzz/src/bin/process_onion_failure_target.rs index 4c613a055b1..9e1cc8aa6d0 100644 --- a/fuzz/src/bin/process_onion_failure_target.rs +++ b/fuzz/src/bin/process_onion_failure_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); process_onion_failure_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/refund_deser_target.rs b/fuzz/src/bin/refund_deser_target.rs index c61c4f7a5d9..13837d2be73 100644 --- a/fuzz/src/bin/refund_deser_target.rs +++ b/fuzz/src/bin/refund_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); refund_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/router_target.rs b/fuzz/src/bin/router_target.rs index 73d6d1b3f7b..52a8c3408ff 100644 --- a/fuzz/src/bin/router_target.rs +++ b/fuzz/src/bin/router_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); router_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/static_invoice_deser_target.rs b/fuzz/src/bin/static_invoice_deser_target.rs index 59b854486ac..477f7869e7f 100644 --- a/fuzz/src/bin/static_invoice_deser_target.rs +++ b/fuzz/src/bin/static_invoice_deser_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); static_invoice_deser_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/target_template.txt b/fuzz/src/bin/target_template.txt index b085ae7ad7b..9b0dff8eb8c 100644 --- a/fuzz/src/bin/target_template.txt +++ b/fuzz/src/bin/target_template.txt @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); TARGET_NAME_test(&data, lightning_fuzz::utils::test_logger::Stdout {}); diff --git a/fuzz/src/bin/zbase32_target.rs b/fuzz/src/bin/zbase32_target.rs index c17ea0ae8b5..68c8cf3e19c 100644 --- a/fuzz/src/bin/zbase32_target.rs +++ b/fuzz/src/bin/zbase32_target.rs @@ -57,6 +57,18 @@ fuzz_target!(|data: &[u8]| { fn main() { use std::io::Read; + // On macOS, panic=abort causes the process to send SIGABRT which can leave it + // stuck in an uninterruptible state due to the ReportCrash daemon. Using + // process::exit in a panic hook avoids this by terminating cleanly. + #[cfg(target_os = "macos")] + std::panic::set_hook(Box::new(|panic_info| { + use std::io::Write; + let _ = std::io::stdout().flush(); + eprintln!("{}\n{}", panic_info, std::backtrace::Backtrace::force_capture()); + let _ = std::io::stderr().flush(); + std::process::exit(1); + })); + let mut data = Vec::with_capacity(8192); std::io::stdin().read_to_end(&mut data).unwrap(); zbase32_test(&data, lightning_fuzz::utils::test_logger::Stdout {});