Execute code in kernel mode.


 
Thread Tools Search this Thread
Top Forums Programming Execute code in kernel mode.
# 15  
Old 03-15-2011
Quote:
Originally Posted by lilezek
I don't need C++. Is just the language I always use. I don't know ASM and I didn't go deeper on C, so I prefer C++.
No, don't write your gettimeofday() in assembly, that'd be just silly. Smilie As is comparing C to assembly. Smilie

C isn't hard if you already know C++. All you'd be learning is the names of a few system calls.
# 16  
Old 03-15-2011
Quote:
Originally Posted by Corona688
It needs the LD_PRELOAD option though, which AFAIK is linux-specific.
Nah. The run-time linker for OpenBSD, NetBSD, FreeBSD, and SunOS/Solaris all support the LD_PRELOAD environment variable. If I'm not mistaken, AIX supports the functionality but the variable's name may be slightly different (LDR_PRELOAD perhaps?). Perhaps other systems as well.

Regards,
Alister
# 17  
Old 03-15-2011
Well. Now it is implemented and working well. The next part is to try to modify that function while Run-Time. Is it possible? I mean, not to launch the application with modified library, but change it while is running.

Thank you for replies. I did this part in the half time I thought it would cost me.
# 18  
Old 03-15-2011
Quote:
Originally Posted by lilezek
Well. Now it is implemented and working well. The next part is to try to modify that function while Run-Time. Is it possible? I mean, not to launch the application with modified library, but change it while is running.
No. But you could have your function check for things to decide whether it should act normally or not.

You could even have it call libc's own gettimeofday() by loading the symbol from libc with dlopen/dlsym and calling it with a function pointer... Again, libkeepalive's source tells you how to do that.
This User Gave Thanks to Corona688 For This Post:
# 19  
Old 03-16-2011
Well. For an unknown reason (unknown for me) LD_PRELOAD is not working for some programs, just half of them:

For instance:

Code:
quake4
ERROR: ld.so: object 'speedhack.so' from LD_PRELOAD cannot be preloaded: ignored.

or:

Code:
tileracer
ERROR: ld.so: object 'speedhack.so' from LD_PRELOAD cannot be preloaded: ignored.

Any idea of what is happening? The library is placed on /usr/lib/ so I guess LD_PRELOAD can find it, because it works with my own test program for testing speedhack.
# 20  
Old 03-16-2011
What exactly have you set LD_PRELOAD to?
# 21  
Old 03-16-2011
Code:
$ echo $LD_PRELOAD
speedhack.so
$ ls /usr/lib/*hack.so
/usr/lib/openglhack.so  /usr/lib/speedhack.so

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Precaution to access user mode buffers from kernel

When accessing a user mode buffers from kernel space drivers what precautions must we take and how those precautions need to be implemented? (0 Replies)
Discussion started by: rupeshkp728
0 Replies

2. Programming

HELP!!: CPU resource allocation between kernel modules and user mode process

Hi,all: I run my program which consists of one kernel module and one user mode process on a dual core server. The problem here is the kernel module consumes 100% of one core while the user mode process only consumes 10% of the other core, is there any solution that I can assign some computing... (1 Reply)
Discussion started by: neyshule
1 Replies

3. Programming

which function copies data from user to kernel mode

when transitionaning from user to kernel mode which function copies data from user mode buffer to kernel mode? (5 Replies)
Discussion started by: rupeshkp728
5 Replies

4. SCO

PANIC: k_trap - Kernel mode trap type 0x0000000E

Hi, i'm another question: I'm a directory /usr/data on my server sco unix 5.0.5: # du /usr/data 4386948 /usr/data I'm tried to connect to ftp directory /usr/data to this server and: PANIC: k_trap - Kernel mode trap type 0x0000000E Cannot dump 262040 pages to dumpdev hd(1/41):space... (3 Replies)
Discussion started by: sebpes
3 Replies

5. UNIX for Dummies Questions & Answers

Kernel Mode

Hi all i have queastion. Can anybody pease help me what is user mode and kernel mode and the term "De-mountable volumes" means? Thanks Palash (2 Replies)
Discussion started by: palash2k
2 Replies

6. Programming

Aplication user and kernel mode (data access)

Hi all, I am trying to setup a program to use a device driver and am confusing buffer access between User and Kernel mode. I think all applications running in User space have to communicate with the device drivers using io control calls and then have some functions called back from the driver... (1 Reply)
Discussion started by: Brendan Kennedy
1 Replies

7. Linux

Kernel panic - not syncing: cannot execute a PAE-enabled kernel on PAE-less CPU

ok so I just installed fedora core 6 on my dell inspiron 700m and I go to boot into linux and I get this error. Has anyone seen this before? I also had XP Pro and Vista installed on this pc prior to putting fedora core 6 on the machine. I'm trying to setup a triple boot system. Please Help... (2 Replies)
Discussion started by: dave043
2 Replies

8. SCO

unexpected trap in kernel mode

hi, I am trying to install sco openserver 5.0.4 on an old system. However, l was not able to proceed after putting the bootstr l have this panic message of PANIC: K_trap - kernel mode trap tupe 0x00000006 will someone kindly help to decode this error kayode (1 Reply)
Discussion started by: kayode
1 Replies

9. Filesystems, Disks and Memory

k_trap - kernel mode trap type 0x0000000E

HELP is urgently required, I run on SCO Unix 3 and this is the panic message that I get every time that I reboot 10U k_trap - kernel mode trap type 0x0000000E I have checked the swap already having the following results: #swap -l path dev swaplo blocks free... (3 Replies)
Discussion started by: alex_slb
3 Replies
Login or Register to Ask a Question