On Thu, 27 Jul 2000 gshekar@in.ibm.com wrote:
> Hi,
> Is there any way for user apart from system calls to access kernel
> functions.
what do you mean by "access"? You can read (e.g. disassemble) the
functions by using /proc/kcore and gdb like this:
# gdb -q vmlinux /proc/kcore
Core was generated by `BOOT_IMAGE=240test5-badfs ro root=306
video=matrox:vesa:0x118 profile=1'.
#0 0x0 in ?? ()
(gdb) info scope ext2_read_inode
Scope for ext2_read_inode:
Symbol inode is an argument at stack/frame offset 36, length 4.
Symbol inode is a local variable in register $edi, length 4.
Symbol bh is a local variable at frame offset 28, length 4.
Symbol raw_inode is a local variable in register $esi, length 4.
Symbol group_desc is a local variable in register $ebp, length 4.
Symbol desc is a local variable in register $esi, length 4.
Symbol block is a local variable in register $ebx, length 4.
Symbol offset is a local variable in register $ebp, length 4.
Symbol gdp is a local variable in register $eax, length 4.
(gdb) x/10i ext2_read_inode
0xc0151320 <ext2_read_inode>: sub $0x10,%esp
0xc0151323 <ext2_read_inode+3>: push %ebp
0xc0151324 <ext2_read_inode+4>: push %edi
0xc0151325 <ext2_read_inode+5>: push %esi
0xc0151326 <ext2_read_inode+6>: push %ebx
0xc0151327 <ext2_read_inode+7>: mov 0x24(%esp,1),%edi
0xc015132b <ext2_read_inode+11>: mov 0x18(%edi),%esi
0xc015132e <ext2_read_inode+14>: lea 0xfffffffe(%esi),%eax
0xc0151331 <ext2_read_inode+17>: cmp $0x2,%eax
0xc0151334 <ext2_read_inode+20>:
jbe 0xc0151344 <ext2_read_inode+36>
but you cannot execute them. You can also seek in /dev/kmem and read/write
there.
Regards,
Tigran
PS. I suppose one could setup a conforming text segment in ring 0 which
could be accessible from ring3 directly...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:23 EST