[fixed-upstream] kernel null pointer dereference after setsockopt(…IP_ADD_MEMBERSHIP…)
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | linux-goldfish (Ubuntu) |
High
|
Ricardo Salveti | ||
Bug Description
Update: The "freeze" I explain in this bug is not an emulator freeze (which I thought at first), but a goldfish kernel panic.
-------
This might be a bug in one of the products the ubuntu emulator is based on, or maybe it's a configuration issue. I don't know so I report this here.
I'm trying to use libupnp in the Ubuntu emulator (My app was compiled using a 15.04 framework / i386 "kit" chroot created through ubuntu-sdk on Ubuntu 14.04, the emulator runs the "devel" i386 system image, I think r1, and libupnp is statically linked against my c++ backend module).
My system is 14.04 and I use the SDK PPA, so…
ubuntu-emulator is version 0.10-0ubuntu1
ubuntu-
There is a problem because InitUpnp() freezes the emulator instead of initializing the library correctly.
By single-stepping through that library function and the functions called by that function, I figured out that it probably freezes in a setsockopt() call: (*)
> ret = setsockopt(
> (char *)&ssdpMcastAddr, sizeof(struct ip_mreq));
Line 846:
> http://
* (That guess is based on the fact that after entering create_
That system call apparently changes the socket to receive multicast packets.
Related: http://
| Florian W. (florian-will) wrote : | #2 |
Okay, so it's not actually the emulator. The "guest system" (goldfish?) simply kernel panics, see the attachment.
I guess the android source package is still correct though.
| summary: |
- emulator freeze on setsockopt(…IP_ADD_MEMBERSHIP…) + goldfish kernel panic after setsockopt(…IP_ADD_MEMBERSHIP…) |
| description: | updated |
| Florian W. (florian-will) wrote : Re: goldfish kernel panic after setsockopt(…IP_ADD_MEMBERSHIP…) | #3 |
I have some more details about the kernel panic.
In net/ipv4/igmp.c, line 320, ip_route_
In include/
That sock_i_uid() call is not in mainline Linux (neither 3.4 nor 3.18), but it is in the Google android goldfish kernel.
I'd say that code is faulty, because the ip_route_
In net/core/sock.c, line 1477, the sock_i_uid() function then dereferences the NULL pointer, which probably explains my kernel panic issue.
| Florian W. (florian-will) wrote : | #4 |
I think the goldfish kernel is not maintained in the android source package, but in this separate linux-goldfish package, so it's time to move this bug again.
| affects: | android (Ubuntu) → linux-goldfish (Ubuntu) |
| summary: |
- goldfish kernel panic after setsockopt(…IP_ADD_MEMBERSHIP…) + kernel null pointer dereference after setsockopt(…IP_ADD_MEMBERSHIP…) |
| Florian W. (florian-will) wrote : Re: kernel null pointer dereference after setsockopt(…IP_ADD_MEMBERSHIP…) | #5 |
There's actually a fix upstream, :
https:/
I hope there are plans to rebase to a recent goldfish kernel some time. :)
| Florian W. (florian-will) wrote : | #6 |
I have now verified that building the goldfish kernel from git with the upstream commit cherry-picked, and then booting that kernel in the emulator, solves my issue with libupnp.
| summary: |
- kernel null pointer dereference after setsockopt(…IP_ADD_MEMBERSHIP…) + [fixed-upstream] kernel null pointer dereference after + setsockopt(…IP_ADD_MEMBERSHIP…) |
| Changed in linux-goldfish (Ubuntu): | |
| assignee: | nobody → Ricardo Salveti (rsalveti) |
| status: | New → Confirmed |
| importance: | Undecided → High |


Turns out that goget-ubuntu-touch is not the correct source package for this bug, since the emulator runtime is in the "android" package.