Loading video...

Video Failed to Load

Go Home

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().

16,714 views • 12 days ago •via X (Twitter)

10 Comments

why's profile picture
why12 days ago

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's profile picture
Recandle12 days ago

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

Sharapov Andrei's profile picture
Sharapov Andrei10 days ago

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's profile picture
klöss12 days ago

insightful

ItsekiriBro.skr's profile picture
ItsekiriBro.skr12 days ago

@tweem 110000 views

Ivo.usduc 💹🧲's profile picture
Ivo.usduc 💹🧲12 days ago

Never fade Tetsuo

GuessNope's profile picture
GuessNope6 days ago

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

Nidhi Singhal's profile picture
Nidhi Singhal12 days ago

@VOLDEMORT2X 😭👈🏻

schrodinger's catgirl's profile picture
schrodinger's catgirl11 days ago

cool

Lee Revell's profile picture
Lee Revell11 days ago

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

Related Videos