Re: calling sys_swapon/swapoff from within the kernel

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

 



--- Seth Arnold <sarnold@wirex.com> wrote:
> On Tue, Jun 10, 2003 at 08:01:17PM -0700, Anthony
> Nicholson wrote:
> > I want to be able to turn the swap on and off from
> within 
> > a kernel module I've written.
> 
> I won't go into this. Suffice to say I think this is
> probably a pretty
> horrible idea.

It's not a horrible idea. my module is implementing 
encrypted swap space. when the module is installed,
everything in the swapfile will be encrypted (decrypted
as it is paged out). when it's not installed, everything
in the swapfile will be handled as normal (unencrypted).

so you can see why, when I'm rmmoding this module, I need
to essentially do this:

swapoff
rmmod <module>
swapon

so that there isn't any encrypted stuff left in the
swapfile
when my module is gone. i wanted to do it directly in the
exit function rather than having to type swapon/swapoff
at the command line (since users won't remember to do that
when removing the module, and bad things happen).

> Chances are good you can "unravel" the sys_swapoff()
> function, and do
> what it does. You may have to unravel several layers of
> functions before
> you're done. But it can probably be done.

of course that can be done. it's just very very ugly. 
swapon calls tons of other functions, all of whom I 
would have to EXPORT_SYMBOL if I wanted to access
them from my module version of sys_swapon().

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
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