<div dir="ltr">A typo in my OP broke the link to the document on Google Docs.  Here is the link:<br><a href="https://docs.google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/edit">https://docs.google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/edit</a><br><br>Here is more specifically what I am looking for:<br>In GCC, it is published that the stack protector option levels do the following things (this is in the linked document):<br>-fno-stack-protector: No protection.<br>-fstack-protector: Protection for functions in which either of the following is true:<div>   * The function uses alloca</div><div>   * There is a char array that is bigger than 8 bytes (actually, bigger than whatever SSP_BUFFER_SIZE is)<br>-fstack-protector-all: Protection for all functions - no heuristic.<br>-fstack-protector-strong: Protection for functions in which any of the following is true:<br>   * Any the address of any local variable used in the RHS of an assignment<br>   * Any local variable is passed by reference to a function<br>   * There is *any* array, regardless of array type or length<br>   * There is a struct/union containing an array<br>   * There are register local variables<br><br>(Also, the stack data is rearranged such that variables are at lower addresses than buffers.)<br><br>What about on Clang? What specifically does -fstack-protector protect? What specifically does -fstack-protector-strong protect?  Is it exactly the same definition as in GCC?<br><br>Thanks!<br><br><br>On Thu, Apr 27, 2017 at 4:14 PM, 陳韋任 <<a href="mailto:chenwj.cs97g@g2.nctu.edu.tw">chenwj.cs97g@g2.nctu.edu.tw</a>> wrote:<br>><br>> Is this <a href="https://clang.llvm.org/docs/ClangCommandLineReference.html">https://clang.llvm.org/docs/ClangCommandLineReference.html</a> what you are looking at?<br>> Under the Clang source directory, `grep -r "stack-protector" docs/*` gives the following result:<br>><br>>   docs/ClangCommandLineReference.rst:.. option:: -fstack-protector, -fno-stack-protector<br>>   docs/ClangCommandLineReference.rst:.. option:: -fstack-protector-all<br>>   docs/ClangCommandLineReference.rst:.. option:: -fstack-protector-strong<br>>   docs/DiagnosticsReference.rst:-Wstack-protector<br>><br>> Or you can goole with "stack protector site:<a href="http://lists.llvm.org/pipermail/cfe-dev/">http://lists.llvm.org/pipermail/cfe-dev/</a>" to find something<br>> on the cfe-dev mailing list. I think that's all you can find.<br>><br>> Regards,<br>> chenwj<br>><br>><br>> 2017-04-28 1:20 GMT+08:00 Yaron Shragai via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>>:<br>>><br>>> Hello,<br>>><br>>> I see documentation out there for the levels of stack-protector in GCC: Regular protects functions that have buffers or that use alloca(), all protects all functions, strong protects functions with the conditions listed in para 3 in this doc: <a href="https://docs.google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/editAlso">https://docs.google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU/editAlso</a>, in GCC, stack-protector puts variables below buffers on the stack (i.e., higher up the stack).<br>>><br>>> I'm having trouble finding similar documentation for Clang. (Even if it's just an official statement that "Clang does the same thing as GCC.")<br>>><br>>> Thanks!<br>>><br>>><br>>><br>>> _______________________________________________<br>>> cfe-dev mailing list<br>>> <a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>>><br>><br>><br>><br>> --<br>> Wei-Ren Chen (陳韋任)<br>> Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj">https://people.cs.nctu.edu.tw/~chenwj</a></div></div>