Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suspicious crash in release mode. #15

Open
vi opened this issue Nov 25, 2019 · 0 comments · May be fixed by #21
Open

Suspicious crash in release mode. #15

vi opened this issue Nov 25, 2019 · 0 comments · May be fixed by #21

Comments

@vi
Copy link

vi commented Nov 25, 2019

Program:

use nfqueue::{Queue, Verdict, Message};

fn callback(msg: &Message, d:&mut ()) {
    println!(" -> msg: {}", msg);

    msg.set_verdict(nfqueue::Verdict::Accept);
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut q = Queue::new(());

    q.open();

    q.create_queue(44, callback);
    q.set_mode(nfqueue::CopyMode::CopyMeta, 0xffff);
    //q.set_queuelen(1024); // linking fails with this

    q.run_loop();
    q.close();

    Ok(())
}

Seems to be working in debug. But in release mode, it crashes:

#0  0x0000555555564850 in <nfqueue::message::Message as core::fmt::Display>::fmt ()
#1  0x00005555555840dc in core::fmt::write () at src/libcore/fmt/mod.rs:1028
#2  0x0000555555568981 in std::io::Write::write_fmt () at src/libstd/io/mod.rs:1412
#3  <std::io::stdio::Stdout as std::io::Write>::write_fmt () at src/libstd/io/stdio.rs:533
#4  0x00005555555691da in std::io::stdio::print_to::{{closure}} () at src/libstd/io/stdio.rs:786
#5  std::thread::local::LocalKey<T>::try_with () at src/libstd/thread/local.rs:262
#6  std::io::stdio::print_to () at src/libstd/io/stdio.rs:780
#7  std::io::stdio::_print () at src/libstd/io/stdio.rs:802
#8  0x00005555555644d8 in nfqnetsim::callback ()
#9  0x0000555555564249 in nfqueue::real_callback ()
#10 0x00007ffff7f5c3e9 in ?? () from /usr/lib/x86_64-linux-gnu/libnetfilter_queue.so.1
#11 0x00007ffff7b5573f in nfnl_handle_packet () from /usr/lib/x86_64-linux-gnu/libnfnetlink.so.0
#12 0x000055555556438f in nfqueue::Queue<T>::run_loop ()
#13 0x000055555556453b in nfqnetsim::main ()
#14 0x00005555555641f3 in std::rt::lang_start::{{closure}} ()
#15 0x000055555556dc93 in std::rt::lang_start_internal::{{closure}} () at src/libstd/rt.rs:48
#16 std::panicking::try::do_call () at src/libstd/panicking.rs:287
#17 0x000055555556f46a in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:78
#18 0x000055555556e6fd in std::panicking::try () at src/libstd/panicking.rs:265
#19 std::panic::catch_unwind () at src/libstd/panic.rs:396
#20 std::rt::lang_start_internal () at src/libstd/rt.rs:47
#21 0x0000555555564562 in main ()

Built with rustc 1.40.0-nightly (2477e2493 2019-11-04) and libnetfilter-queue-dev=1.0.3-1

@serpilliere serpilliere linked a pull request Dec 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant