For long time we have flat assembler (fasm ) that is allocating memory with the help of the flowing snippet of code:
; r14d = requested size
; eax - allocated block, equal to previous value of [malloc_lbrk]
; ecx = allocated size
; edi = what was in r12d
; esi = what was in r13d
; on error jumps to out_of_memory (does not return)
; preserves: rbx
; note: for internal use only
cmp dword [malloc_lbrk],0
mov eax,12 ; sys_brk
The ELF file itself is not relocatable.
With kernel versions <= v5.1.x this brk syscall returns address within 4Gb range, so eax equals to rax.
With v5.2 (tested on Fedora Rawhide, Linux 5.2.0-1.fc31.x86_64) this syscall returns something like 0x555556a2d000 or 0x5555557b7000.
Please let us know, is it intended kernel behaviour or some kind of regression?