linker - Linux - process killed when linking section into lowest 2 MB of memory? -


i'm learning ld linker scripts, , noticed if link .text section (or section) @ address lower than 2 mb, process gets instantly killed linux run it. here's example script i'm using:

sections {     . = 0x200000;    /* base text section */     .text : { *(.text) }     . = 0x800000;     .rodata : { *(.rodata) }     .data : { *(.data) }     .bss : { *(.bss) } } 

if set text base 0x1fffff or below, program gets killed linux when run it:

$ ./main killed 

0x200000 works fine. linux have type of protection or in place lowest 2 mb of virtual memory?

as more general question, there rules where sections should linked in virtual memory, or anywhere ok long don't step on reserved ranges?

(obviously "real" program i'd use default ld script, i'm asking learning purposes).

does linux have type of protection or in place lowest 2 mb of virtual memory?

yes; mmap_min_addr sysctl value prevents processes mapping low memory pages protect against types of kernel exploits.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -