running post-shutdown code

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

 



I'm in the process of developing an embedded system based off RH
7.2. I'm using 2.4.18 with preempt, lockbreak, and some other tweaks. 

This system will occasionally need to run some code that does some
"strange" things to the system hardware (having to do with security
considerations). This action, if done while the system is running
would more than likely cause a kernel crash.

This system is headless, so dual-booting into DOS isn't really an
option.

My idea is to have this code run in kernel space after the kernel has
shut down, and all things are quiescent. What I'm searching for are
hooks by which I can cause code to be run after the kernel is shut
down.

The kernel seems to provide a mechanism for doing this via the
register_reboot_notifier() call, which arranges to call code blocks
when sys_reboot() is called.

My current plan is that I could make this code the notifier block of a
module, and I would install this module just before halting the system
(when doing the "strange" things is necessary). The module's code
would then (hopefully) execute lastly, at the least dangerous time.


Questions:

Are there any pointers, URLs, etc., that explain how the kernel shuts
itself down? I've walked through the sys_reboot() code, and I'm
wondering if I've missed anything.

Are there any pointers, URLs, etc., that explain what the
register_reboot_notifier() call is for, how it should be used,
semantics, etc. I think I understand it, but more info would be good.

Does anyone have a feel as to whether I'm taking the right approach?
Is there a better way to be thinking about this problem?

Assuming that the register_reboot_notifier() method is acceptable, is
there a way to guarantee that my code block will be the last thing
that is run?

Has anyone tried anything like this before? If so, I'd like to pick
your brain. :-)


Thanks in advance,
stuart.
-- 
Stuart McDow                                    +1-512-345-5006, ext. 15
Ticom Geomatics, Inc.                               fax: +1-512-345-9992
9130 Jollyville Rd., STE 300                        smcdow@ticom-geo.com
Austin, TX 78759 USA

--
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