Closed Bug 741272 Opened 8 years ago Closed 8 years ago

Implement a wrapper around raise() for Android and Gonk

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: cyu, Assigned: cyu)

Details

Attachments

(1 file)

Due to the bug in bionic libc's implementation of raise(), we will need a wrapper around it. Bug 730229 shows a typical symptom of the bug: when one thread hits an assertion, a random thread receives SIGABRT instead of the thread that calls raise(). The implementation in android 4.0 at the time being is even worse, which mixes gettid() and kill() and could in theory kill another process.

As POSIX specifies that raise(signo) is equivalent to pthread_kill(pthread_self(), signo), I would suggest implementing the wrapper in this way if there's no other concern. It should work correctly under bionic's pthread implementation.
Implement raise() using pthread_kill() so the signal will be sent to the the
caller thread instead of a random thread in the thread group due to the bug in bionic libc.
Attachment #611708 - Flags: review?(khuey)
Attachment #611708 - Flags: review?(blassey.bugs)
Why don't you fix bionic in gonk instead? That would fix it for more than just gecko.
Per discussion with Michael Wu, the fix will be needed for both gonk and android. Firefox for android will need the fix for some time.

I also sent a patch to bionic, but we don't know how long we need to wait before the fix will be available. And there is no guarantee the fix will be backported to previous releases of Android.

Given the above reasons, it's suggested that we wrap the call in gecko.
This is the discussion thread for your reference: https://github.com/mozilla-b2g/platform_bionic/pull/2
Attachment #611708 - Flags: review?(blassey.bugs) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/dde6ab4aa2c3

I have no idea what Target Milestone to use for B2G...
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/dde6ab4aa2c3
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.