I want to be able to check if stack smashing protection (-fstack-protector-all) is enabled in an iOS app built on Xcode 9 with a target of iOS 11.
I built an app with -fstack-protector-all enabled in "Other C flags", and it does build and run, but how can I verify that stack smashing protection is enabled?
There are lots of older (2013 and earlier) resources out there that mention otool -Iv appName |grep stack_chk
, but I ran that on my app binary and stack_chk was nowhere to be found in the output.
Is there a modern equivalent to that command? Is -fstack-protector-all even necessary anymore given the current set of defaults in Xcode?
stack
-related symbols.Other C flags
should have no effect on Swift compilerswiftc
--fstack-protector-all
should only work for the files compiled withclang
. Ifotool/grep
on the binary shows the presence ofstack*
symbols this does not mean they are coming from Swift files - they can come from C/Objective-C objects. I would guess that the absence of stack protection in Swift, at least if we decide based on absence ofstack*
symbols in the binary, is either intended or a regression. – Winder