Closed Bug 1415595 Opened 7 years ago Closed 3 years ago

Enable FORTIFY_SOURCE on Android

Categories

(Core :: Security, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox58 --- wontfix
firefox59 --- wontfix
firefox97 --- fixed

People

(Reporter: tjr, Assigned: glandium)

References

(Blocks 1 open bug)

Details

(Keywords: sec-want, Whiteboard: [adv-main97-])

Attachments

(3 files)

In Bug 1359908 we tried to land FORTIFY_SOURCE, but a typo in the configure comparison did not actually enable it. When trying to fix it in Bug 1414067 we successfully turned it on and discovered it broke Android in two ways. Problem 1: PROP_VALUE_MAX is not defined inside the libstagefright directory. This is because we set up some empty stub files (I'm not sure why.) I can resolve this with this type of patch: https://hg.mozilla.org/try/rev/13e7ccbe49ff Problem 2: With FORTIFY_SOURCE enabled, the android ndk defines a macro for snprintf (only in AArch64) in android-ndk/platforms/android-21/arch-arm64/usr/include/stdio.h. You can see some details of here: https://treeherder.mozilla.org/logviewer.html#?job_id=142520083&repo=try&lineNumber=8646 https://pastebin.mozilla.org/9072222 (line 394) In the tree, we have our own functions named snprintf (at least two, below) and the macro clobbers it in a way that doesn't work. http://searchfox.org/mozilla-central/source/ipc/chromium/src/base/string_util.h#55 http://searchfox.org/mozilla-central/source/xpcom/string/nsTextFormatter.h#54 In order to land FORTIFY_SOURCE on Desktop, we disable it for Android and hope to re-enable it later (in this bug). For more discussion, read from https://bugzilla.mozilla.org/show_bug.cgi?id=1414067#c10 on down.
Note that when we disabled it on Android, we did not disable it for js/src - this is intentional since we can get the improvement there at least.
Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED

They don't differ anymore.

Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/3538e74d9d8e Remove unnecessary mode when opening ASHMEM_NAME_DEF. r=jld https://hg.mozilla.org/integration/autoland/rev/bc3c81ff4620 Enable FORTIFY_SOURCE on Android. r=tjr https://hg.mozilla.org/integration/autoland/rev/4d72a962b007 Remove support for different hardening flags in js/. r=firefox-build-system-reviewers,andi
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Whiteboard: [adv-main97-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: