why my module didn't crash
From: gopan (gop_kumar_at_hotmail.com)
Date: 11/28/03
- Next message: Doug: "Kernel 2.6.x and "Linux Device Drivers, 2nd Ed.""
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: inserting module in kernel"
- Next in thread: Gerhard W. Gruber: "Re: why my module didn't crash"
- Reply: Gerhard W. Gruber: "Re: why my module didn't crash"
- Reply: Kasper Dupont: "Re: why my module didn't crash"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Nov 2003 04:16:51 -0800
hi all,
I know it is absolutely forbidden to pass a user land
program's function pointer to a module and invoke it inside the module
but just to learn exactly what happens i tried it in this fashion.
In my applicaton program, i have a function say fun() which prints a
hello message using printf and allocates about 100 bytes using
malloc(), then fills up the allocatd buffers with some character say
'a'.
Using an ioctl call i passed the address of fun() to my module.
The module on receiving the ioctl, will extract the function pointer
and will execute fun()
Now what i was expecting was a module crash due to the page fault as
what i have read about malloc() is, as soon as u call malloc() only
the virtual mem region is reserved for ur process and the physical
pages are allocated only when u touch those virtual regions( when page
fault happens the mem mgr calls page allocation functions to allocate
physical pages)
Considering this fact when i invoke the user land function from my
module, the following should have happened
a) malloc is executed, and the code touches the allocated memory
b) page fault happens as the physical pages are not yet allocated
c)The kernel (Page Fault handler)on finding that the current Privilege
Level (PL)is 0 gives an Oops..
But nothing of this sort happened, how many ever times i called the
ioctl the code worked fine without any crashes!!!
Does this has to do anything with malloc, i mean on return from malloc
does the PL comes to 3 and hence the kernel services the PFault
without OOPS.??
Awaiting for some explanation
Thanks
- Next message: Doug: "Kernel 2.6.x and "Linux Device Drivers, 2nd Ed.""
- Previous message: Jens.Toerring_at_physik.fu-berlin.de: "Re: inserting module in kernel"
- Next in thread: Gerhard W. Gruber: "Re: why my module didn't crash"
- Reply: Gerhard W. Gruber: "Re: why my module didn't crash"
- Reply: Kasper Dupont: "Re: why my module didn't crash"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|