Re: Re: How Kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28 May 2005 11:08:39 -0000, jhoney jhoney
<jhoney_joney@xxxxxxxxxxxxxx> wrote:
> 
> 
> Hello All,
> 
> Thanks for your explanations.In addition to previous one,
> When any process is started, ie after executing the a.out at the linux shell
> , It starts executing in the 4GB address space of the process. At that time
> it is unable to access the kernel memory. But the moment when it executed
> system call which issues a trap , enters in to kernel mode and could access
> the kernel memory. Now the module is can access the user space(4GB virtual) 
> and the kernel memory space also. How this is achieved.

This is achieved by setting the addr_limit field of current process,
this is done by set_fs() macro, which is defined with following macros
in architecture specific uaccess.h file:

===================

28 #define KERNEL_DS       MAKE_MM_SEG(0xFFFFFFFFUL)
29 #define USER_DS         MAKE_MM_SEG(PAGE_OFFSET)
30 
31 #define get_ds()        (KERNEL_DS)
32 #define get_fs()        (current_thread_info()->addr_limit)
33 #define set_fs(x)       (current_thread_info()->addr_limit = (x))

===================

-Gaurav


> 
> 
> 
> 
> On Wed, 25 May 2005 Gaurav Dhiman wrote :
> 
> >On 24 May 2005 05:16:49 -0000, jhoney jhoney
> ><jhoney_joney@xxxxxxxxxxxxxx> wrote:
> > >
> > >
> > >  Hello All,
> > >
> > >  When application runs ,it can not access the kernel memory but when the
> > > module for the corresponding application runs in kernel mode , it has
> access
> > > to kernel memory.
> >
> >kernel module is a part of kernel code itself once its loaded into the
> >memory, its linked to the kernel core image in memory by insmod.
> >kernel module can be used by any process running in user space by
> >making a specific system call which might lead the control of
> >execution to module code.
> >
> >-gd
> >
> > >
> > >  My question is what made to access the kernel memory module which could
> not
> > > be done by an application.
> > >
> > >  Regards
> > >
> > >  Jhoney
> > >
> > >
> > >
> > >
> >
> >--
> >Kernelnewbies: Help each other learn about the Linux kernel.
> >Archive:      http://mail.nl.linux.org/kernelnewbies/
> >FAQ:          http://kernelnewbies.org/faq/
> >
> 
> 
> 
> 
>

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux