Drop glibc-rh1470060.patch
Addressed by this upstream commit in a different way: commit eac43cbb8d808a40004aa0a4a286f5c5155beccb Author: Florian Weimer <fweimer@redhat.com> Date: Thu Aug 10 15:58:28 2017 +0200 malloc: Avoid optimizer warning with GCC 7 and -O3
This commit is contained in:
parent
beff5c2326
commit
a6b9bec157
@ -1,48 +0,0 @@
|
|||||||
Upstream thread:
|
|
||||||
|
|
||||||
https://sourceware.org/ml/libc-alpha/2017-07/msg00487.html
|
|
||||||
|
|
||||||
Relevant analysis:
|
|
||||||
|
|
||||||
_int_malloc is inlined into tcache_init, and the allocation size is
|
|
||||||
constant-propagated into it. GCC does not realize that global_max_fast
|
|
||||||
is limited MAX_FAST_SIZE, so it compiles the true branch of the if
|
|
||||||
statement:
|
|
||||||
|
|
||||||
if ((unsigned long) (nb) <= (unsigned long) (get_max_fast ()))
|
|
||||||
{
|
|
||||||
idx = fastbin_index (nb);
|
|
||||||
mfastbinptr *fb = &fastbin (av, idx);
|
|
||||||
mchunkptr pp = *fb;
|
|
||||||
REMOVE_FB (fb, victim, pp);
|
|
||||||
if (victim != 0)
|
|
||||||
|
|
||||||
under the assumption that nb == sizeof (tcache_perthread_struct) == 576,
|
|
||||||
which is larger than MAX_FAST_SIZE, so the fastbin access is compiled
|
|
||||||
into an OOB array subscript. GCC does not proceed to eliminate this
|
|
||||||
code, even though it has undefined behavior and will never execute in
|
|
||||||
practice.
|
|
||||||
|
|
||||||
This is neither a glibc bug nor a GCC bug. It merely reflects the
|
|
||||||
difficulty of producing good warnings from optimizers. But it does
|
|
||||||
break the build in rawhide due to -Werror.
|
|
||||||
|
|
||||||
Index: b/malloc/malloc.c
|
|
||||||
===================================================================
|
|
||||||
--- a/malloc/malloc.c
|
|
||||||
+++ b/malloc/malloc.c
|
|
||||||
@@ -3566,6 +3566,14 @@ _int_malloc (mstate av, size_t bytes)
|
|
||||||
while ((pp = catomic_compare_and_exchange_val_acq (fb, victim->fd, victim)) \
|
|
||||||
!= victim); \
|
|
||||||
|
|
||||||
+ /* _int_malloc can be inlined to a caller with a constant size
|
|
||||||
+ argument. In this case, the compiler will see an out-of-bounds
|
|
||||||
+ array access in the true branch of the if statement below if it
|
|
||||||
+ cannot show that global_max_fast cannot be larger than
|
|
||||||
+ MAX_FAST_SIZE. The assert shows the compiler that this cannot
|
|
||||||
+ happen. */
|
|
||||||
+ assert (!__builtin_constant_p (nb) || global_max_fast <= MAX_FAST_SIZE);
|
|
||||||
+
|
|
||||||
if ((unsigned long) (nb) <= (unsigned long) (get_max_fast ()))
|
|
||||||
{
|
|
||||||
idx = fastbin_index (nb);
|
|
@ -250,8 +250,6 @@ Patch2037: glibc-rh1315108.patch
|
|||||||
# sln implemented by ldconfig, to conserve disk space.
|
# sln implemented by ldconfig, to conserve disk space.
|
||||||
Patch2112: glibc-rh1315476-2.patch
|
Patch2112: glibc-rh1315476-2.patch
|
||||||
|
|
||||||
Patch2114: glibc-rh1470060.patch
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# End of glibc patches.
|
# End of glibc patches.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -736,7 +734,6 @@ microbenchmark tests on the system.
|
|||||||
%patch0060 -p1
|
%patch0060 -p1
|
||||||
%patch2037 -p1
|
%patch2037 -p1
|
||||||
%patch2112 -p1
|
%patch2112 -p1
|
||||||
%patch2114 -p1
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# %%prep - Additional prep required...
|
# %%prep - Additional prep required...
|
||||||
|
Loading…
Reference in New Issue
Block a user