Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910071 - www-client/firefox-102.13.0[hardened] _FORTIFY_SOURCE=2 forced by upstream yet gentoo can do 3
Summary: www-client/firefox-102.13.0[hardened] _FORTIFY_SOURCE=2 forced by upstream ye...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 847148
  Show dependency tree
 
Reported: 2023-07-08 20:29 UTC by genBTC
Modified: 2023-11-16 12:32 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
firefox-fortify-source-3.patch (patch to ebuild) (firefox-fortify-source-3.patch,533 bytes, patch)
2023-10-11 09:03 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description genBTC 2023-07-08 20:29:53 UTC
The compile process for firefox with hardened use flags on the hardened profile ends up relying on a file provided by upstream for the toolchain flags,
and this file contains -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2:

firefox-102.13.0/build/moz.configure/toolchain.configure


This works great, theres no warnings, but I have to report that it overrides a recent feature from gentoo hardened, where gcc (or clang) is able to use _FORTIFY_SOURCE=3 from the fortify.h feature headers. 

I've found when a program supports 2, its very likely that it supports 3 as well, so I have made a patch to change a couple 2's to 3's, and recompiled.
There were three other files for 3rd party vendored deps that needed a fix. Im not sure are even activated, I think the webRTC one is, and the libevent one was not, since it was behind a use system-libevent USE.

firefox-102.13.0/third_party/libwebrtc/build/config/compiler/BUILD.gn
firefox-102.13.0/ipc/chromium/src/third_party/libevent/configure.ac
firefox-102.13.0/ipc/chromium/src/third_party/libevent/CMakeLists.txt

This test was successful. consider me a _FORTIFY_SOURCE=3 firefox beta tester 

All the changes can be accomplished by sed'ding a 2 to a 3, but I made the patches manually for now. I can make them available here if need be, but its trivial.

Reporting this here on a bug report so we have something to think about. Thanks

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-08 21:15:36 UTC
Does everything work fine at runtime?
Comment 2 genBTC 2023-07-08 22:03:49 UTC
Yep, I tested it, I'm running it on my main machine that I use for browsing a lot.
everything seems totally fine, and I even attempted to test WebRTC but I dont think my network can cooperate with that for unrelated reasons.
The WebRTC API is detected at least. No crashes. No weird messages. Things seem normal. I know its early, but all signs point to this being viable.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-06 04:43:42 UTC
before I forget:

[19:58:38]  <+sam_> tbh I think a sed might be easiest
[19:58:58]  <+sam_> just for build/moz.configure/toolchain.configure, if hardened, /-D_FORTIFY_SOURCE=/s:2:3:

not tested it yet
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-10-11 09:03:21 UTC
Created attachment 872557 [details, diff]
firefox-fortify-source-3.patch (patch to ebuild)
Comment 5 Larry the Git Cow gentoo-dev 2023-10-12 10:40:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=673ff5ed9ae5da6c5fd58bf9c0b2fe2c138742a8

commit 673ff5ed9ae5da6c5fd58bf9c0b2fe2c138742a8
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2023-10-12 10:38:36 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2023-10-12 10:39:58 +0000

    www-client/firefox: add 118.0.2
    
     - llvm-17 and rust-1.73 compatibility,
     - make 'hardened' use _FORTIFY_SOURCE=3.
    
    Closes: https://bugs.gentoo.org/910071
    Closes: https://bugs.gentoo.org/915306
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 www-client/firefox/Manifest               |  101 ++
 www-client/firefox/firefox-118.0.2.ebuild | 1440 +++++++++++++++++++++++++++++
 2 files changed, 1541 insertions(+)
Comment 6 Joonas Niilola gentoo-dev 2023-10-12 10:42:07 UTC
Will sync to ESR naturally with a version bump.