← Back to context

Comment by gumby

2 years ago

> in ld.so text, and in that case the main program's text cannot do system calls

I don’t understand this case. Is there a way to do IO in openbsd without a system call? Without IO how can you get the result of the computation?

Is this a singular special case?

ld.so can do so while initially linking the application in pre main, then in

> 4) in libc.so text, and ld.so tells the kernel where that is

> The first 3 were cases were configured entirely by the kernel, the 4th case used a new msyscall(2) system call to identify the correct libc.so region.

ld.so passes its ability to make syscalls to libc.so. The application has to call into libc.so in order to perform any IO.

  • Ah, makes sense, thanks. Libc can sanitize all the inputs, and as long as ld.so has a hardwired path to libc all is well. This way you don’t even need a facility to tell the kernel “this binary is allowed to make system calls.