OT: calling kernel syscall manually
Quoted 9 lines · David Woodhouse
Quoted 5 lines · On Tue, 2006-09-12 at 14:05 +0200, guest01 wrote:
3 -> using kernel directly
Ok, the third one is a little bit tricky, at least for me. I found an example for lseek, but I don't know how to convert that for mkdir. I don't know the necessary arguments, ..
The third one has always been broken on i386 for PIC code
No, I was just using it today in PIC i386 code. The %ebx register gets pushed, the needed value gets moved into %ebx, the int 0x80 is done, and the %ebx register gets popped. Only a few odd calls like clone() need something different.
(not that this should be needed: gcc is broken if it can't save/restore the needed registers)
Quoted 4 lines
and was pointless anyway, since glibc provides this functionality. The kernel method has been removed from userspace visibility all architectures, and we plan to remove it entirely in 2.6.19 since it's not at all useful.
It's damn useful. Hint: Linux does not require glibc.
I could hack up my own assembly. I did that for clone(), but I didn't enjoy that waste of my time.
Quoted 7 lines · Albert Cahalan
Quoted 1 line
The third one has always been broken on i386 for PIC code
No, I was just using it today in PIC i386 code. The %ebx register gets pushed, the needed value gets moved into %ebx, the int
0x80is done, and the %ebx register gets popped. Only a few odd calls likeclone()need something different.
That's a very recent change -- it was broken for years before that.
Quoted 6 lines
Quoted 4 lines
and was pointless anyway, since glibc provides this functionality. The kernel method has been removed from userspace visibility all architectures, and we plan to remove it entirely in 2.6.19 since it's not at all useful.
It's damn useful. Hint: Linux does not require glibc.
Are you being deliberately obtuse or is it just a natural talent?
Other C libraries also provide syscall() -- at least dietlibc and uClibc do.
Kernel headers do not exist to provide a library of random crap for userspace to use.
Signature · 1 line
dwmw2
Quoted 10 lines · David Woodhouse
Quoted 7 lines · Albert Cahalan
Quoted 1 line
The third one has always been broken on i386 for PIC code
No, I was just using it today in PIC i386 code. The %ebx register gets pushed, the needed value gets moved into %ebx, the int
0x80is done, and the %ebx register gets popped. Only a few odd calls likeclone()need something different.That's a very recent change -- it was broken for years before that.
It's fixed now. Obviously people care. Probably the only reason it wasn't fixed earlier is that PIC code just isn't all that popular for i386 executables.
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
and was pointless anyway, since glibc provides this functionality. The kernel method has been removed from userspace visibility all architectures, and we plan to remove it entirely in 2.6.19 since it's not at all useful.
It's damn useful. Hint: Linux does not require glibc.
Are you being deliberately obtuse or is it just a natural talent?
Other C libraries also provide
syscall()-- at least dietlibc and uClibc do.
OK, but I don't need to be using a C library. I could write my own or do without.
Quoted 2 lines
Kernel headers do not exist to provide a library of random crap for userspace to use.
Sure, but this is existing functionality. It also isn't random crap; it's the kernel's system call interface.