Linux assembly; Is bss partition memory initialized to 0?

In tests, I ran memory in the bss section, my programs were always initialized to zero before writing anything there. Is it a coincidence or a system for “clearing” these memory pages before passing them to me? I am using nasm assembler on Ubuntu (if that can make a difference).

+3
source share
2 answers

Your application executable (ELF) contains information about the size of the BSS partition, when it starts, the kernel allocates a block of memory for the BSS partition and clears it to 0. This is determined by the ABI (Application Binary Interface), so you don’t have to worry about that the other machine is different.

+3

BSS .

0

Source: https://habr.com/ru/post/1777313/


All Articles