正在加载视频...

视频加载失败

For dynamically linked GCC/glibc programs on Linux, main() is not the process entry point. The kernel starts the loader. It maps libc and applies relocations. _start passes main to glibc, which initializes the process and calls it. I traced the path from source.c to main().

17,090 次观看 • 2 个月前 •via X (Twitter)

10 条评论

why 的头像
why2 个月前

The jump from the kernel entry point to _start, then through libc before main(), is one of those details that makes the runtime feel much less magical.

Recandle 的头像
Recandle2 个月前

Most people think a C program starts at main(). It doesn’t. The kernel starts the loader first.

Sharapov Andrei 的头像
Sharapov Andrei2 个月前

Almost. The kernel does not start _start. It maps the ELF, reads PT_INTERP, jumps into Relocations finish there. Only then does control reach _start, which passes &main into _libc_start_main. main is a callback. If your mental model starts at main, you already skipped the ABI.

klöss 的头像
klöss2 个月前

insightful

ItsekiriBro.skr 的头像
ItsekiriBro.skr2 个月前

@tweem 110000 views

Ivo.usduc 💹🧲 的头像
Ivo.usduc 💹🧲2 个月前

Never fade Tetsuo

GuessNope 的头像
GuessNope1 个月前

It's not the entry point for statically linked ones either. It's just the start of the C platform.

Nidhi Singhal 的头像
Nidhi Singhal2 个月前

@VOLDEMORT2X 😭👈🏻

schrodinger's catgirl 的头像
schrodinger's catgirl2 个月前

cool

Lee Revell 的头像
Lee Revell2 个月前

I tied for the biggest bug bounty at my last employer with an LD_PRELOAD exploit. Any support tech could have gotten root

相关视频