Demo: Talking to the Kernel Directly¶
A program that reads a line and echoes it, written in assembly, using nothing but the syscall instruction.
No libc, no wrappers.
Run¶
Type a line and press Enter; it prints back. Then watch the system calls, which are the whole program:
Ask¶
- The
straceoutput is the source. What sits between this program and the kernel? readreturns 12 and the nextwritesends 12 bytes. Where did the length come from?- Every
writeis its own system call here. What would libc'sprintfhave done instead?