You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, the Android changes are in my branch; I'm working on testing the iOS changes now. Some notes about iOS changes:
iOS compiles with PIE by default, but I'll add it as explicit flags so it's clear what we're doing.
The compiler flags -fstack-protector-all, -Wa,--noexecstack, -Wformat and -Wformat-security appear to have no corresponding flags in the iOS toolchain. I haven't found good counterparts, but admit I need to continue to look.
The linker flag -Wl,-z,relro,-z,now has no correspondence either.
After chatting with @goderbauer, we agree that we don't want -O2 if we can help it either --- the space hit is just too high --- -Oz on helloworld weighs in at 5,805,240B, while -O2 weighs in at 8,024060B in his test. I'm backing that out now.
Looks like this has caused regressions in disk space size as well as performance for tiles_scroll_perf__timeline_summary/average_frame_rasterizer_time_millis. We've rolled back this CL at present until we pinpoint which flag is the culprit.
Many linux distros are trying to get all executables to be PIE-only as part of the road to full ASLR, so this would be appreciated. -fcf-protection=full in CFLAGS and -Wl,--as-needed in LDFLAGS could also help.
Additionally, enabling LTO could pave the way to eventually supporting Clang's forward-edge CFI with -fsanitize=cfi, and could reduce binary size when paired with -ffunction-sections -fdata-sections. This could help offset the increases in package size, especially if combined with linking some libs statically and dropping the .so files.
Many linux distros are trying to get all executables to be PIE-only as part of the road to full ASLR, so this would be appreciated. -fcf-protection=full in CFLAGS and -Wl,--as-needed in LDFLAGS could also help.
Flutter does have support for plugging in custom toolchains and some support for passing toolchain specific flags. So distros can do this for the engine dylib if they want to build the engine on their own. Is there a specific binary/distro you are thinking of? This may be a good thing to do everywhere.
Additionally, enabling LTO could pave the way to eventually supporting...
Flutter already performs LTO on all optimized targets with at least some of the flags you mentioned already being applied. The last time LTO was tuned was a while ago however so it may be a good time to revisit all LTO flags.
linking some libs statically and dropping the .so files.
All engine libraries are already linked statically into a single engine .so file.
On Thu, Dec 09, 2021 at 02:29:47PM -0800, Chinmay Garde wrote:
> Many linux distros are trying to get all executables to be PIE-only as part of the road to full ASLR, so this would be appreciated. -fcf-protection=full in CFLAGS and -Wl,--as-needed in LDFLAGS could also help.
Flutter does have support for plugging in custom toolchains and some support for passing toolchain specific flags. So distros can do this for the engine dylib if they want to build the engine on their own. Is there a specific binary/distro you are thinking of? This may be a good thing to do everywhere.
Not exactly a distro, but I was thinking about Flatpak. It's common for Flatpak manifests to pull in tarball artifacts from CI. I think that PIE-by-default for release configurations makes sense; there's little reason not to do it (unless there's some regression like massive binary size, which sounds like an important bug).
I didn't know this, thanks. LTO along with -fvisibility=hidden is a pre-requisite for some of Clang's most advanced hardening flags, like -fsanitize=cfi (<1% perf penalty for huge exploit mitigations). -fcf-protection=full also allows some CFI (esp. for GCC toolchains).
All engine libraries are already linked statically into a single engine `.so` file.
I was thinking that perhaps these could be statically linked into the final binary, but I understand that this would be quite a complex undertaking.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
roll buildroot to 82a50e8 (flutter#4368)
kf6gpe commentedon Oct 2, 2018
So, the Android changes are in my branch; I'm working on testing the iOS changes now. Some notes about iOS changes:
-fstack-protector-all,-Wa,--noexecstack,-Wformatand-Wformat-securityappear to have no corresponding flags in the iOS toolchain. I haven't found good counterparts, but admit I need to continue to look.-Wl,-z,relro,-z,nowhas no correspondence either.kf6gpe commentedon Oct 4, 2018
After chatting with @goderbauer, we agree that we don't want -O2 if we can help it either --- the space hit is just too high --- -Oz on helloworld weighs in at 5,805,240B, while -O2 weighs in at 8,024060B in his test. I'm backing that out now.
goderbauer commentedon Oct 4, 2018
@kf6gpe The sizes you quoted are for the uncompressed
libflutter.so, which ships with every app (not just helloworld).kf6gpe commentedon Oct 4, 2018
@goderbauer Good point --- thanks for the clarification.
kf6gpe commentedon Oct 29, 2018
Looks like this has caused regressions in disk space size as well as performance for tiles_scroll_perf__timeline_summary/average_frame_rasterizer_time_millis. We've rolled back this CL at present until we pinpoint which flag is the culprit.
Add compiler flags suggested by security review (flutter#4368) (flutt…
2 remaining items
kf6gpe commentedon Jul 31, 2019
We've left the reversion in place, preferring the reduction in package size over the footprint increase.
Seirdy commentedon Dec 9, 2021
Many linux distros are trying to get all executables to be PIE-only as part of the road to full ASLR, so this would be appreciated.
-fcf-protection=fullin CFLAGS and-Wl,--as-neededin LDFLAGS could also help.Additionally, enabling LTO could pave the way to eventually supporting Clang's forward-edge CFI with
-fsanitize=cfi, and could reduce binary size when paired with-ffunction-sections -fdata-sections. This could help offset the increases in package size, especially if combined with linking some libs statically and dropping the.sofiles.chinmaygarde commentedon Dec 9, 2021
Flutter does have support for plugging in custom toolchains and some support for passing toolchain specific flags. So distros can do this for the engine dylib if they want to build the engine on their own. Is there a specific binary/distro you are thinking of? This may be a good thing to do everywhere.
Flutter already performs LTO on all optimized targets with at least some of the flags you mentioned already being applied. The last time LTO was tuned was a while ago however so it may be a good time to revisit all LTO flags.
All engine libraries are already linked statically into a single engine
.sofile.Seirdy commentedon Dec 9, 2021
Hixie commentedon Mar 16, 2023
I'm going to close this; we have more methodical work ongoing to harden our toolchain now.
github-actions commentedon Mar 30, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.