Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 627918 - sys-devel/gcc-6.x[vtv]: fails to compile with -Werror=format-security in libvtv/vtv_rts.cc
Summary: sys-devel/gcc-6.x[vtv]: fails to compile with -Werror=format-security in libv...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-15 09:55 UTC by Thomas Deutschmann (RETIRED)
Modified: 2020-02-02 19:29 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Deutschmann (RETIRED) gentoo-dev 2017-08-15 09:55:15 UTC
[...]
/bin/bash ./libtool --tag=CC   --mode=compile /var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include    -DPACKAGE_NAME=\"GNU\ Vtable\ Verification\ Runtime\ Library\" -DPACKAGE_TARNAME=\"libvtv\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"GNU\ Vtable\ Verification\ Runtime\ Library\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"http://www.gnu.org/software/libvtv/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"libvtv\" -DVERSION=\"1.0\" -DHAVE_SECURE_GETENV=1 -DHAVE___FORTIFY_FAIL=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE__OBSTACK_BEGIN=1 -I. -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv  -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../include  -D_GNU_SOURCE -Wall -Wextra -fno-exceptions -g -O2 -pipe -march=ivybridge -mtune=ivybridge -mno-xsaveopt -Werror=format-security -Wno-error=clobbered  -m32 -MT vtv_end.lo -MD -MP -MF .deps/vtv_end.Tpo -c -o vtv_end.lo vtv_end.c
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc: In function ‘void read_section_offset_and_length(dl_phdr_info*, const char*, int, off_t*, Elf32_Word*)’:
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc:591:73: error: format not a string literal and no format arguments [-Werror=format-security]
   snprintf (program_name, sizeof (program_name), program_invocation_name);
                                                                         ^
In file included from /var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc:144:0:
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc:682:54: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
         VTV_ASSERT (sect_hdr.sh_size - VTV_PAGE_SIZE >= 0);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_utils.h:40:9: note: in definition of macro ‘VTV_ASSERT’
   if (!(EXPR)) VTV_error();
         ^~~~
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc: In function ‘int dl_iterate_phdr_callback(dl_phdr_info*, size_t, void*)’:
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc:876:73: error: format not a string literal and no format arguments [-Werror=format-security]
   snprintf (program_name, sizeof (program_name), program_invocation_name);
                                                                         ^
mv -f .deps/vtv_malloc.Tpo .deps/vtv_malloc.Plo
true  DO=all multi-do # make
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc: In function ‘void vtv_fail(const char*, void**, const void*)’:
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_rts.cc:1794:29: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
   write (2, buffer, buf_len);
                             ^
libtool: compile:  /var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/ "-DPACKAGE_NAME=\"GNU Vtable Verification Runtime Library\"" -DPACKAGE_TARNAME=\"libvtv\" -DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"GNU Vtable Verification Runtime Library 1.0\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"http://www.gnu.org/software/libvtv/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"libvtv\" -DVERSION=\"1.0\" -DHAVE_SECURE_GETENV=1 -DHAVE___FORTIFY_FAIL=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE__OBSTACK_BEGIN=1 -I. -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../include -D_GNU_SOURCE -Wall -Wextra -fno-exceptions -I./../libstdc++-v3/include -I./../libstdc++-v3/include/x86_64-pc-linux-gnu -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../libstdc++-v3/libsupc++ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end -g -O2 -pipe -march=ivybridge -mtune=ivybridge -mno-xsaveopt -Werror=format-security -Wno-error=clobbered -D_GNU_SOURCE -m32 -MT vtv_utils.lo -MD -MP -MF .deps/vtv_utils.Tpo -c /var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_utils.cc  -fPIC -DPIC -o .libs/vtv_utils.o
libtool: compile:  /var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include "-DPACKAGE_NAME=\"GNU Vtable Verification Runtime Library\"" -DPACKAGE_TARNAME=\"libvtv\" -DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"GNU Vtable Verification Runtime Library 1.0\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"http://www.gnu.org/software/libvtv/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"libvtv\" -DVERSION=\"1.0\" -DHAVE_SECURE_GETENV=1 -DHAVE___FORTIFY_FAIL=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE__OBSTACK_BEGIN=1 -I. -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../include -D_GNU_SOURCE -Wall -Wextra -fno-exceptions -g -O2 -pipe -march=ivybridge -mtune=ivybridge -mno-xsaveopt -Werror=format-security -Wno-error=clobbered -m32 -MT vtv_end.lo -MD -MP -MF .deps/vtv_end.Tpo -c vtv_end.c  -fPIC -DPIC -o .libs/vtv_end.o
vtv_end.c:58:1: warning: constructor priorities from 0 to 100 are reserved for the implementation
 {
 ^
libtool: compile:  /var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include "-DPACKAGE_NAME=\"GNU Vtable Verification Runtime Library\"" -DPACKAGE_TARNAME=\"libvtv\" -DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"GNU Vtable Verification Runtime Library 1.0\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"http://www.gnu.org/software/libvtv/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"libvtv\" -DVERSION=\"1.0\" -DHAVE_SECURE_GETENV=1 -DHAVE___FORTIFY_FAIL=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE__OBSTACK_BEGIN=1 -I. -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../include -D_GNU_SOURCE -Wall -Wextra -fno-exceptions -g -O2 -pipe -march=ivybridge -mtune=ivybridge -mno-xsaveopt -Werror=format-security -Wno-error=clobbered -m32 -MT vtv_end.lo -MD -MP -MF .deps/vtv_end.Tpo -c vtv_end.c -o vtv_end.o >/dev/null 2>&1
mv -f .deps/vtv_malloc.Tpo .deps/vtv_malloc.Plo
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_utils.cc: In function ‘int __vtv_open_log(const char*)’:
/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_utils.cc:78:8: warning: variable ‘logs_dir_specified’ set but not used [-Wunused-but-set-variable]
   bool logs_dir_specified = false;
        ^~~~~~~~~~~~~~~~~~
mv -f .deps/vtv_end.Tpo .deps/vtv_end.Plo
libtool: compile:  /var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/./gcc/ "-DPACKAGE_NAME=\"GNU Vtable Verification Runtime Library\"" -DPACKAGE_TARNAME=\"libvtv\" -DPACKAGE_VERSION=\"1.0\" "-DPACKAGE_STRING=\"GNU Vtable Verification Runtime Library 1.0\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"http://www.gnu.org/software/libvtv/\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"libvtv\" -DVERSION=\"1.0\" -DHAVE_SECURE_GETENV=1 -DHAVE___FORTIFY_FAIL=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE__OBSTACK_BEGIN=1 -I. -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../include -D_GNU_SOURCE -Wall -Wextra -fno-exceptions -I./../libstdc++-v3/include -I./../libstdc++-v3/include/x86_64-pc-linux-gnu -I/var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/../libstdc++-v3/libsupc++ -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end -g -O2 -pipe -march=ivybridge -mtune=ivybridge -mno-xsaveopt -Werror=format-security -Wno-error=clobbered -D_GNU_SOURCE -m32 -MT vtv_utils.lo -MD -MP -MF .deps/vtv_utils.Tpo -c /var/tmp/portage/sys-devel/gcc-6.4.0/work/gcc-6.4.0/libvtv/vtv_utils.cc -o vtv_utils.o >/dev/null 2>&1
mv -f .deps/vtv_utils.Tpo .deps/vtv_utils.Plo
cc1plus: some warnings being treated as errors
make[5]: *** [Makefile:503: vtv_rts.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
cc1plus: some warnings being treated as errors
make[9]: *** [Makefile:503: vtv_rts.lo] Error 1
make[9]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/32/libvtv'
make[8]: *** [Makefile:563: all-recursive] Error 1
make[8]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/32/libvtv'
make[7]: *** [Makefile:378: all] Error 2
make[7]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/32/libvtv'
make[6]: *** [Makefile:856: multi-do] Error 1
make[6]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/libvtv'
make[5]: *** [Makefile:522: all-multi] Error 2
make[5]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/libvtv'
make[4]: *** [Makefile:563: all-recursive] Error 1
make[4]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/libvtv'
make[3]: *** [Makefile:378: all] Error 2
make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build/x86_64-pc-linux-gnu/libvtv'
make[2]: *** [Makefile:14467: all-stage1-target-libvtv] Error 2
make[2]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build'
make[1]: *** [Makefile:20222: stage1-bubble] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-6.4.0/work/build'
make: *** [Makefile:20554: bootstrap-lean] Error 2
 * ERROR: sys-devel/gcc-6.4.0::gentoo failed (compile phase):
 *   emake failed
 *
Comment 1 Victor Kustov 2018-05-19 09:26:15 UTC
same problem here
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-02 00:02:48 UTC
Still in gcc's master:

> snprintf (program_name, sizeof (program_name), program_invocation_name);

I think the intent was to add "%s" here. Or a call to strncpy().
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-02 19:29:05 UTC
On top of that gettext helpers trigger it today as well:

"""
x86_64-pc-linux-gnu-g++  -I/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp -I. -I/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/../include -I/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/include  -O2 -Werror=format-security -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute -pedantic -Wno-long-long  -fno-exceptions -fno-rtti -I/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp -I. -I/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/../include -I/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/include   -c -o expr.o -MT expr.o -MMD -MP -MF .deps/expr.Tpo /tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/expr.c
/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/expr.c: In function 'unsigned int cpp_classify_number(cpp_reader*, const cpp_token*, const char**, location_t)':
/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/expr.c:797:18: error: format not a string literal and no format arguments [-Werror=format-security]
  797 |        0, message);
      |                  ^
/tmp/portage/sys-devel/gcc-9.2.0-r3/work/gcc-9.2.0/libcpp/expr.c:800:39: error: format not a string literal and no format arguments [-Werror=format-security]
  800 |           virtual_location, 0, message);
      |                                       ^
"""

I suggest reporting them upstream and fix there.