Bug #73098 [Opn->Wfx]: please use -Wstack-protector on dev-machines

From: Date: Fri, 16 Sep 2016 15:36:29 +0000
Subject: Bug #73098 [Opn->Wfx]: please use -Wstack-protector on dev-machines
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204082@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73098&edit=1

 ID:                 73098
 Updated by:         nikic@php.net
 Reported by:        spam2 at rhsoft dot net
 Summary:            please use -Wstack-protector on dev-machines
-Status:             Open
+Status:             Wont fix
 Type:               Bug
 Package:            Compile Warning
 PHP Version:        5.6.26
 Block user comment: N
 Private report:     N

 New Comment:

I sampled through a few warnings, it's always alloca(), so nothing actionable here.


Previous Comments:
------------------------------------------------------------------------
[2016-09-16 11:11:05] spam2 at rhsoft dot net

since i am just a package-builder and php-developer meaning develop with PHP i can't qualify it

i think at least build with "-O2 -fstack-protector-strong --param=ssp-buffer-size=6
-D_FORTIFY_SOURCE=2 -Wstack-protector -Wformat" and review the warnings is worth given that the
amount is not too large

------------------------------------------------------------------------
[2016-09-16 11:02:20] nikic@php.net

From the output, it looks like -Wstack-protector simply throws a warning for every function that
uses alloca, or am I missing something? If that is the case, this information is not useful.

------------------------------------------------------------------------
[2016-09-16 10:39:12] spam2 at rhsoft dot net

Description:
------------
probably not all of this is fixable but at least worth a look and PHP7 looks very similar at
buildtime

/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/opcache/Optimizer/zend_optimizer.c: In function
'zend_optimize':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/opcache/Optimizer/zend_optimizer.c:475:13: warning:
stack protector not protecting local variables: variable length buffer [-Wstack-protector]
 static void zend_optimize(zend_op_array           *op_array,
             ^
ext/opcache/Optimizer/block_pass.c: In function 'zend_get_persistent_constant':
ext/opcache/Optimizer/block_pass.c:4:12: warning: stack protector not protecting local variables:
variable length buffer [-Wstack-protector]
 static int zend_get_persistent_constant(char *name, uint name_len, zval *result, int copy TSRMLS_DC
ELS_DC)
            ^
ext/opcache/Optimizer/nop_removal.c: In function 'nop_removal':
ext/opcache/Optimizer/nop_removal.c:5:13: warning: stack protector not protecting local variables:
variable length buffer [-Wstack-protector]
 static void nop_removal(zend_op_array *op_array)
             ^
/bin/sh /home/builduser/rpmbuild/BUILD/php-5.6.26/libtool --silent --preserve-dup-deps
--mode=install cp ext/opcache/opcache.la /home/builduser/rpmbuild/BUILD/php-5.6.26/modules
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regexec.c: In function
'match_at':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regexec.c:1238:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 match_at(regex_t* reg, const UChar* str, const UChar* end,
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regexec.c: In function
'onig_match.constprop':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regexec.c:3049:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region,
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regexec.c: In function
'onig_search.constprop':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regexec.c:3350:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 onig_search(regex_t* reg, const UChar* str, const UChar* end,
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regcomp.c: In function
'disable_noname_group_capture':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mbstring/oniguruma/regcomp.c:1894:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 disable_noname_group_capture(Node** root, regex_t* reg, ScanEnv* env)
 ^
/bin/sh /home/builduser/rpmbuild/BUILD/php-5.6.26/libtool --silent --preserve-dup-deps
--mode=install cp ext/mbstring/mbstring.la /home/builduser/rpmbuild/BUILD/php-5.6.26/modules
/bin/sh /home/builduser/rpmbuild/BUILD/php-5.6.26/libtool --silent --preserve-dup-deps
--mode=install cp ext/soap/soap.la /home/builduser/rpmbuild/BUILD/php-5.6.26/modules
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c: In function
'virtual_chdir_file':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c:1396:13: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC)
TSRMLS_DC) /* {{{ */
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c: In function
'tsrm_realpath_r':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c:780:12: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath,
int is_dir, int *link_is_dir TSRMLS_DC) /* {{{ */
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_closures.c: In function
'zend_closure_get_method':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_closures.c:198:23: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len,
const zend_literal *key TSRMLS_DC) /* {{{ */
                       ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c: In function
'zif_trait_exists':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c:1315:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_FUNCTION(trait_exists)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c: In function
'zif_interface_exists':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c:1272:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_FUNCTION(interface_exists)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c: In function
'zif_class_exists':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c:1229:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_FUNCTION(class_exists)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_execute_API.c: In function
'zend_lookup_class_ex':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_execute_API.c:903:14: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int
use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
              ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_constants.c: In function
'zend_get_special_constant':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_constants.c:214:12: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC)
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/php_variables.c: In function
'php_register_variable_ex':
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/php_variables.c:59:13: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC)
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c: In function
'php_execute_simple_script':
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c:2634:12: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC)
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c: In function 'php_execute_script':
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c:2515:12: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mysqlnd/mysqlnd_auth.c: In function
'mysqlnd_sha256_auth_get_auth_data':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mysqlnd/mysqlnd_auth.c:571:1: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c: In function
'reflection_extension_factory':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c:1246:13: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 static void reflection_extension_factory(zval *object, const char *name_str TSRMLS_DC)
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/spl/php_spl.c: In function
'spl_find_ce_by_name':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/spl/php_spl.c:65:27: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 static zend_class_entry * spl_find_ce_by_name(char *name, int len, zend_bool autoload TSRMLS_DC)
                           ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c: In function
'zim_reflection_extension___construct':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c:5247:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_METHOD(reflection_extension, __construct)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha512.c: In function
'php_sha512_crypt_r.constprop':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha512.c:369:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) {
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha256.c: In function
'php_sha256_crypt_r.constprop':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha256.c:334:8: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
        ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_compile.c: In function
'zend_do_begin_function_declaration':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_compile.c:1535:6: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method,
int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */
      ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c: In function
'zend_std_get_static_method':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c:1179:25: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char
*function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
                         ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c: In function
'zend_std_get_method':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c:1037:30: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int
method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
                              ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c: In function
'reflection_extension_factory':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c:1246:13: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 static void reflection_extension_factory(zval *object, const char *name_str TSRMLS_DC)
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c: In function
'zim_reflection_extension___construct':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/reflection/php_reflection.c:5247:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_METHOD(reflection_extension, __construct)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/spl/php_spl.c: In function
'spl_find_ce_by_name':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/spl/php_spl.c:65:27: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 static zend_class_entry * spl_find_ce_by_name(char *name, int len, zend_bool autoload TSRMLS_DC)
                           ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/php_variables.c: In function
'php_register_variable_ex':
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/php_variables.c:59:13: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC)
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c: In function
'php_execute_simple_script':
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c:2634:12: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 PHPAPI int php_execute_simple_script(zend_file_handle *primary_file, zval **ret TSRMLS_DC)
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c: In function 'php_execute_script':
/home/builduser/rpmbuild/BUILD/php-5.6.26/main/main.c:2515:12: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c: In function
'virtual_chdir_file':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c:1396:13: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC)
TSRMLS_DC) /* {{{ */
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c: In function
'tsrm_realpath_r':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_virtual_cwd.c:780:12: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, int use_realpath,
int is_dir, int *link_is_dir TSRMLS_DC) /* {{{ */
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_closures.c: In function
'zend_closure_get_method':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_closures.c:198:23: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 static zend_function *zend_closure_get_method(zval **object_ptr, char *method_name, int method_len,
const zend_literal *key TSRMLS_DC) /* {{{ */
                       ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/sapi/cli/php_cli_server.c: In function
'php_cli_server_dispatch_router.isra.13':
/home/builduser/rpmbuild/BUILD/php-5.6.26/sapi/cli/php_cli_server.c:2150:12: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server_client *client
TSRMLS_DC) /* {{{ */
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/sapi/cli/php_cli_server.c: In function
'add_response_header':
/home/builduser/rpmbuild/BUILD/php-5.6.26/sapi/cli/php_cli_server.c:508:13: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS_DC) /* {{{ */
             ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha512.c: In function
'php_sha512_crypt_r.constprop':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha512.c:369:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 php_sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) {
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha256.c: In function
'php_sha256_crypt_r.constprop':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/standard/crypt_sha256.c:334:8: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 char * php_sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
        ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_execute_API.c: In function
'zend_lookup_class_ex':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_execute_API.c:903:14: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int
use_autoload, zend_class_entry ***ce TSRMLS_DC) /* {{{ */
              ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_constants.c: In function
'zend_get_special_constant':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_constants.c:214:12: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 static int zend_get_special_constant(const char *name, uint name_len, zend_constant **c TSRMLS_DC)
            ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c: In function
'zif_trait_exists':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c:1315:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_FUNCTION(trait_exists)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c: In function
'zif_interface_exists':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c:1272:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_FUNCTION(interface_exists)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c: In function
'zif_class_exists':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_builtin_functions.c:1229:1: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_FUNCTION(class_exists)
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mysqlnd/mysqlnd_auth.c: In function
'mysqlnd_sha256_auth_get_auth_data':
/home/builduser/rpmbuild/BUILD/php-5.6.26/ext/mysqlnd/mysqlnd_auth.c:571:1: warning: stack protector
not protecting local variables: variable length buffer [-Wstack-protector]
 mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
 ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c: In function
'zend_std_get_static_method':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c:1179:25: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, const char
*function_name_strval, int function_name_strlen, const zend_literal *key TSRMLS_DC) /* {{{ */
                         ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c: In function
'zend_std_get_method':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_object_handlers.c:1037:30: warning: stack
protector not protecting local variables: variable length buffer [-Wstack-protector]
 static union _zend_function *zend_std_get_method(zval **object_ptr, char *method_name, int
method_len, const zend_literal *key TSRMLS_DC) /* {{{ */
                              ^
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_compile.c: In function
'zend_do_begin_function_declaration':
/home/builduser/rpmbuild/BUILD/php-5.6.26/Zend/zend_compile.c:1535:6: warning: stack protector not
protecting local variables: variable length buffer [-Wstack-protector]
 void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method,
int return_reference, znode *fn_flags_znode TSRMLS_DC) /* {{{ */




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73098&edit=1


Thread (4 messages)

« previous php.bugs (#204082) next »