Always compile all C and C++ code with -fwrapv
Categories
(Firefox Build System :: General, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: jruderman, Assigned: andi)
References
(Blocks 1 open bug)
Details
(Keywords: platform-parity, sec-want)
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Reporter | ||
Comment 1•10 years ago
|
||
Comment 2•9 years ago
|
||
Reporter | ||
Comment 3•9 years ago
|
||
Comment 4•9 years ago
|
||
Updated•8 years ago
|
Updated•7 years ago
|
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Comment 14•4 years ago
|
||
Can we please add -fwrapv
to our default compilation flags?
IMHO, it's unacceptable that we have UB in our code when we know it can cause exploitable security issues.
Manually wrapping every arithmetic operation (using WrappingAdd
or NSCoordSaturatingAdd
etc) in code
that mostly deals with manipulating coordinates (Layout, Graphics etc) isn't a tenable solution.
Comment 15•4 years ago
|
||
I think this is a matter of adding a line like this, or maybe in security_hardening_cflags instead, depending on whether we want to allow others to compile without it I suppose.
But we should probably run this through raptor/talos at the very least.
Updated•4 years ago
|
Comment 16•4 years ago
|
||
to use raptor/talos, I would do a large try push before and one after. This looks to be linux/windows/osx - will the affect android as well?
ignoring android, I would do something like this:
hg update central
./mach try fuzzy -q 'test-linux1804 raptor' --rebuild 6
hg update <rev> # update to change made
./mach try fuzzy -q 'test-linux1804 raptor' --rebuild 6
once this is done you have two try pushes and use the perfherder compare to find any hints of what changed.
of course I would recommend running raptor, talos, browsertime; and platforms: test-linux1804, test-windows10-64, test-macosx1015-64.
If you are testing on android, hardware is limited, so I would recommend finding a weekend to do a before/after.
Comment 17•4 years ago
|
||
I don't have the cycles for this at the moment, though this does sound valuable to do in the future.
When I originally assigned myself to this, it seemed like a valuable improvement for the C++ folks.
However, when the build team does have time to commit to such build improvements, I'd like to have a good chat with some C++ build peers to ensure that the work that's done aligns with their perception of the most high-impact changes.
Updated•4 years ago
|
Comment 18•3 years ago
|
||
Note that this relates to a dev-platform
discussion about standardizing on signed/unsigned int types.
Assignee | ||
Comment 19•3 years ago
|
||
Assignee | ||
Comment 20•3 years ago
|
||
Comment 21•3 years ago
|
||
(In reply to Andi [:andi] from comment #20)
Default mozilla-central - https://treeherder.mozilla.org/jobs?repo=try&revision=55f80843626e7cb609a0049f0b2e64c583865a23
With the patch - https://treeherder.mozilla.org/jobs?repo=try&revision=e3b0274f66c32879a9c3607ac728d77ecdfb58d6
The pushes only contain raptor on Linux, we should do more suites (raptor, talos, browsertime), and more platforms (linux, win, mac).
Assignee | ||
Comment 22•3 years ago
|
||
(In reply to Marco Castelluccio [:marco] from comment #21)
(In reply to Andi [:andi] from comment #20)
Default mozilla-central - https://treeherder.mozilla.org/jobs?repo=try&revision=55f80843626e7cb609a0049f0b2e64c583865a23
With the patch - https://treeherder.mozilla.org/jobs?repo=try&revision=e3b0274f66c32879a9c3607ac728d77ecdfb58d6The pushes only contain raptor on Linux, we should do more suites (raptor, talos, browsertime), and more platforms (linux, win, mac).
of course, these are only some preliminary runs.
Comment 23•3 years ago
|
||
Here is the Chrome bug to enable -fwrapv and/or -ftrapv:
https://bugs.chromium.org/p/chromium/issues/detail?id=1166960
Assignee | ||
Comment 24•3 years ago
|
||
Assignee | ||
Comment 25•3 years ago
|
||
Looking at the browsertime results they are a mixed bag with gains in perf but also with regressions.
Assignee | ||
Comment 26•3 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #23)
Here is the Chrome bug to enable -fwrapv and/or -ftrapv:
https://bugs.chromium.org/p/chromium/issues/detail?id=1166960
It seems no one has been working on it for a while now. What do you make of the above results?
Comment 27•3 years ago
|
||
As discussed with Marco, if this is causing performance issues, we can also look into enabling this partially on a directory basis or excluding certain parts of the codebase until the performance issues can be resolved (e.g. I assume the layout subdir might cause more issues than other code).
We could also profile more accurately which parts of our code are exhibiting most slowdown from this. According to Google, many options that cause these slowdowns actually only cause major slowdowns through a small portion of the overall code, so we should consider going this route as well.
Assignee | ||
Updated•3 years ago
|
Updated•2 years ago
|
Description
•