[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#889817: linux: kernel does not always provide a heap [alpha arm64 mips64el ppc64el ppc64 s390x sparc64]



Source: linux
Version: 4.14.13-1
Severity: normal
Tags: upstream

When ASLR is enabled (which is the default), the Linux kernel on at
least alpha, arm64, mips64el, ppc64el, ppc64, s390x and sparc64 might
not provide a heap to the program. This is the case for example when
the program is run through the program interpreter ld.so. This happens
with different probability depending on the architecture. This causes
issues with GLIBC tunables support, which needs to be able to reserve
a few hundred bytes of memory through brk. This is reproducible with
at least kernel 4.9 and 4.15, and it's likely that the issue has always
been there.

The following script, based on one from James Cowgill, shows the issue:

#!/bin/bash
export LC_ALL=C

interp=$(readelf --headers /bin/cat | grep 'Requesting program interpreter' | sed -e 's/.*: //' -e 's/]//')

for i in {1..10000}
do
        OUT=$($interp /bin/cat /proc/self/maps)
        if [[ $OUT != *heap* ]]
        then
                echo -n F
                echo "$OUT"
        else
                echo -n .
        fi
done

A workaround is to set /proc/sys/kernel/randomize_va_space to 1.


Reply to: