r278854 - in /branches/gcc-8-branch/gcc: Change...
wilco@gcc.gnu.org
wilco@gcc.gnu.org
Fri Nov 29 17:22:00 GMT 2019
Author: wilco
Date: Fri Nov 29 17:22:30 2019
New Revision: 278854
URL: https://gcc.gnu.org/viewcvs?rev=278854&root=gcc&view=rev
Log:
aarch64: fix use-after-free in -march=native (PR driver/89014)
Running:
$ valgrind ./xgcc -B. -c test.c -march=native
on aarch64 shows a use-after-free in host_detect_local_cpu due
to the std::string result of aarch64_get_extension_string_for_isa_flags
only living until immediately after a c_str call.
This leads to corrupt "-march=" values being passed to cc1.
This patch fixes the use-after-free, though it appears to also need
Tamar's patch here:
https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01302.html
in order to generate valid values for cc1. This may have worked by
accident in the past, if the corrupt "-march=" value happened to be
0-terminated in the "right" place; with this patch it now appears
to reliably break without Tamar's patch.
Backport from mainline
2019-01-23 David Malcolm <dmalcolm@redhat.com>
PR driver/89014
* config/aarch64/driver-aarch64.c (host_detect_local_cpu): Fix
use-after-free of the result of
aarch64_get_extension_string_for_isa_flags.
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/config/aarch64/driver-aarch64.c
More information about the Gcc-cvs
mailing list