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

evdns crash in evdns_request_transmit #64

Closed
ghazel opened this issue May 28, 2013 · 4 comments
Closed

evdns crash in evdns_request_transmit #64

ghazel opened this issue May 28, 2013 · 4 comments

Comments

@ghazel
Copy link
Contributor

ghazel commented May 28, 2013

This is with libevent 2.0.21

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x12d
Stack frame #00  pc 00024872  mylib.so: Routine evdns_request_transmit in libevent/evdns.c:2262
Stack frame #01  pc 00024c29  mylib.so: Routine evdns_requests_pump_waiting_queue in libevent/evdns.c:760
Stack frame #02  pc 000273a9  mylib.so: Routine evdns_base_resume in libevent/evdns.c:2448

The line numbers are a little funny I think because of gcc optimization. Anyway, on this system, it appears that 0x12d matches the offset of the choked member of a struct nameserver * which is NULL. So the crash is probably in the access to req->ns->choked where req->ns is NULL. Not sure how it got to be NULL -- right before this, I did this:

void update_dns()
{
    evdns_base_clear_nameservers_and_suspend(g_evdns_base);

    evdns_base_nameserver_ip_add(g_evdns_base, "8.8.8.8");
    evdns_base_nameserver_ip_add(g_evdns_base, "8.8.4.4");

    // crashes in here
    evdns_base_resume(g_evdns_base);
}
@nmathewson
Copy link
Member

I applied a few patches by Azat Khuzhin to the Libevent 2.1 branch recently to resolve these; please check for his name in the commit logs to see them. Any interest in backporting these to 2.0?

@ghazel
Copy link
Contributor Author

ghazel commented May 29, 2013

His patch ( 14971a8 ) does seem related (and even addresses the issue), but as you can see from my code some nameservers were just installed. Maybe doesn't matter, but it seems like there is some way the nameservers are being removed. It's also worth noting that 5c710c0 solves the issue too.

I backported Azat Khuzhin's changeset to 2.0 here https://github.com/ghazel/Libevent/tree/20_evdns_resume_fix . Want a pull request?

@nmathewson
Copy link
Member

A pull request would be great there, yes! Especially if the backport was at all nontrivial.

I think that the issue isn't that the nameservers are being removed, but that any requests inflight when clear_and_suspend wind up with NULL-valued nameservers.

@azat
Copy link
Member

azat commented Sep 8, 2015

Seems that patches are merged in https://github.com/nmathewson/Libevent/pull/79
Can this be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants