[PATCH] Don't export machine_restart, machine_halt, or machine_power_off.

machine_restart, machine_halt and machine_power_off are machine
specific hooks deep into the reboot logic, that modules
have no business messing with.  Usually code should be calling
kernel_restart, kernel_halt, kernel_power_off, or
emergency_restart. So don't export machine_restart,
machine_halt, and machine_power_off so we can catch buggy users.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Eric W. Biederman 2005-07-26 11:36:01 -06:00 committed by Linus Torvalds
parent 16dcb4bbda
commit 59586e5a26
29 changed files with 0 additions and 152 deletions

View file

@ -165,7 +165,6 @@ machine_restart(char *restart_cmd)
common_shutdown(LINUX_REBOOT_CMD_RESTART, restart_cmd); common_shutdown(LINUX_REBOOT_CMD_RESTART, restart_cmd);
} }
EXPORT_SYMBOL(machine_restart);
void void
machine_halt(void) machine_halt(void)
@ -173,7 +172,6 @@ machine_halt(void)
common_shutdown(LINUX_REBOOT_CMD_HALT, NULL); common_shutdown(LINUX_REBOOT_CMD_HALT, NULL);
} }
EXPORT_SYMBOL(machine_halt);
void void
machine_power_off(void) machine_power_off(void)
@ -181,7 +179,6 @@ machine_power_off(void)
common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL); common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
} }
EXPORT_SYMBOL(machine_power_off);
/* Used by sysrq-p, among others. I don't believe r9-r15 are ever /* Used by sysrq-p, among others. I don't believe r9-r15 are ever
saved in the context it's used. */ saved in the context it's used. */

View file

@ -131,7 +131,6 @@ void machine_halt(void)
{ {
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
@ -139,7 +138,6 @@ void machine_power_off(void)
pm_power_off(); pm_power_off();
} }
EXPORT_SYMBOL(machine_power_off);
void machine_restart(char * __unused) void machine_restart(char * __unused)
{ {
@ -169,8 +167,6 @@ void machine_restart(char * __unused)
while (1); while (1);
} }
EXPORT_SYMBOL(machine_restart);
void __show_regs(struct pt_regs *regs) void __show_regs(struct pt_regs *regs)
{ {
unsigned long flags = condition_codes(regs); unsigned long flags = condition_codes(regs);

View file

@ -103,9 +103,6 @@ void machine_power_off(void)
{ {
} }
EXPORT_SYMBOL(machine_halt);
EXPORT_SYMBOL(machine_power_off);
void machine_restart(char * __unused) void machine_restart(char * __unused)
{ {
/* /*
@ -136,8 +133,6 @@ void machine_restart(char * __unused)
while (1); while (1);
} }
EXPORT_SYMBOL(machine_restart);
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
unsigned long flags; unsigned long flags;

View file

@ -214,8 +214,6 @@ void machine_restart(char *cmd)
hard_reset_now(); hard_reset_now();
} }
EXPORT_SYMBOL(machine_restart);
/* /*
* Similar to machine_power_off, but don't shut off power. Add code * Similar to machine_power_off, but don't shut off power. Add code
* here to freeze the system for e.g. post-mortem debug purpose when * here to freeze the system for e.g. post-mortem debug purpose when
@ -226,16 +224,12 @@ void machine_halt(void)
{ {
} }
EXPORT_SYMBOL(machine_halt);
/* If or when software power-off is implemented, add code here. */ /* If or when software power-off is implemented, add code here. */
void machine_power_off(void) void machine_power_off(void)
{ {
} }
EXPORT_SYMBOL(machine_power_off);
/* /*
* When a process does an "exec", machine state like FPU and debug * When a process does an "exec", machine state like FPU and debug
* registers need to be reset. This is a hook function for that. * registers need to be reset. This is a hook function for that.

View file

@ -90,8 +90,6 @@ void machine_restart(char * __unused)
__asm__("jmp @@0"); __asm__("jmp @@0");
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
local_irq_disable(); local_irq_disable();
@ -99,8 +97,6 @@ void machine_halt(void)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
local_irq_disable(); local_irq_disable();
@ -108,8 +104,6 @@ void machine_power_off(void)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_power_off);
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
printk("\nPC: %08lx Status: %02x", printk("\nPC: %08lx Status: %02x",

View file

@ -337,14 +337,10 @@ void machine_restart(char * __unused)
machine_real_restart(jump_to_bios, sizeof(jump_to_bios)); machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
lapic_shutdown(); lapic_shutdown();
@ -355,5 +351,4 @@ void machine_power_off(void)
pm_power_off(); pm_power_off();
} }
EXPORT_SYMBOL(machine_power_off);

View file

@ -22,8 +22,6 @@ void machine_restart(char * __unused)
outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT); outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off(void) void machine_power_off(void)
{ {
unsigned short pm_status; unsigned short pm_status;
@ -43,10 +41,7 @@ void machine_power_off(void)
outl(PIIX_SPECIAL_STOP, 0xCFC); outl(PIIX_SPECIAL_STOP, 0xCFC);
} }
EXPORT_SYMBOL(machine_power_off);
void machine_halt(void) void machine_halt(void)
{ {
} }
EXPORT_SYMBOL(machine_halt);

View file

@ -278,8 +278,6 @@ machine_restart(char *cmd)
} }
} }
EXPORT_SYMBOL(machine_restart);
void void
mca_nmi_hook(void) mca_nmi_hook(void)
{ {
@ -315,12 +313,9 @@ machine_halt(void)
machine_power_off(); machine_power_off();
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
if (pm_power_off) if (pm_power_off)
pm_power_off(); pm_power_off();
} }
EXPORT_SYMBOL(machine_power_off);

View file

@ -807,16 +807,12 @@ machine_restart (char *restart_cmd)
(*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL); (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL);
} }
EXPORT_SYMBOL(machine_restart);
void void
machine_halt (void) machine_halt (void)
{ {
cpu_halt(); cpu_halt();
} }
EXPORT_SYMBOL(machine_halt);
void void
machine_power_off (void) machine_power_off (void)
{ {
@ -825,4 +821,3 @@ machine_power_off (void)
machine_halt(); machine_halt();
} }
EXPORT_SYMBOL(machine_power_off);

View file

@ -115,8 +115,6 @@ void machine_restart(char *__unused)
cpu_relax(); cpu_relax();
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
printk("Please push reset button!\n"); printk("Please push reset button!\n");
@ -124,15 +122,11 @@ void machine_halt(void)
cpu_relax(); cpu_relax();
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
/* M32R_FIXME */ /* M32R_FIXME */
} }
EXPORT_SYMBOL(machine_power_off);
static int __init idle_setup (char *str) static int __init idle_setup (char *str)
{ {
if (!strncmp(str, "poll", 4)) { if (!strncmp(str, "poll", 4)) {

View file

@ -113,8 +113,6 @@ void machine_restart(char * __unused)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
if (mach_halt) if (mach_halt)
@ -122,8 +120,6 @@ void machine_halt(void)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
if (mach_power_off) if (mach_power_off)
@ -131,8 +127,6 @@ void machine_power_off(void)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_power_off);
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
printk("\n"); printk("\n");

View file

@ -80,8 +80,6 @@ void machine_restart(char * __unused)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
if (mach_halt) if (mach_halt)
@ -89,8 +87,6 @@ void machine_halt(void)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
if (mach_power_off) if (mach_power_off)
@ -98,8 +94,6 @@ void machine_power_off(void)
for (;;); for (;;);
} }
EXPORT_SYMBOL(machine_power_off);
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
printk(KERN_NOTICE "\n"); printk(KERN_NOTICE "\n");

View file

@ -26,18 +26,13 @@ void machine_restart(char *command)
_machine_restart(command); _machine_restart(command);
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
_machine_halt(); _machine_halt();
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
_machine_power_off(); _machine_power_off();
} }
EXPORT_SYMBOL(machine_power_off);

View file

@ -150,8 +150,6 @@ void machine_restart(char *cmd)
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
/* /*
@ -160,8 +158,6 @@ void machine_halt(void)
*/ */
} }
EXPORT_SYMBOL(machine_halt);
/* /*
* This routine is called from sys_reboot to actually turn off the * This routine is called from sys_reboot to actually turn off the
@ -187,8 +183,6 @@ void machine_power_off(void)
KERN_EMERG "Please power this system off now."); KERN_EMERG "Please power this system off now.");
} }
EXPORT_SYMBOL(machine_power_off);
/* /*
* Create a kernel thread * Create a kernel thread

View file

@ -121,8 +121,6 @@ void machine_restart(char *cmd)
ppc_md.restart(cmd); ppc_md.restart(cmd);
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off(void) void machine_power_off(void)
{ {
#ifdef CONFIG_NVRAM #ifdef CONFIG_NVRAM
@ -131,8 +129,6 @@ void machine_power_off(void)
ppc_md.power_off(); ppc_md.power_off();
} }
EXPORT_SYMBOL(machine_power_off);
void machine_halt(void) void machine_halt(void)
{ {
#ifdef CONFIG_NVRAM #ifdef CONFIG_NVRAM
@ -141,8 +137,6 @@ void machine_halt(void)
ppc_md.halt(); ppc_md.halt();
} }
EXPORT_SYMBOL(machine_halt);
void (*pm_power_off)(void) = machine_power_off; void (*pm_power_off)(void) = machine_power_off;
#ifdef CONFIG_TAU #ifdef CONFIG_TAU

View file

@ -694,7 +694,6 @@ void machine_restart(char *cmd)
local_irq_disable(); local_irq_disable();
while (1) ; while (1) ;
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off(void) void machine_power_off(void)
{ {
@ -707,7 +706,6 @@ void machine_power_off(void)
local_irq_disable(); local_irq_disable();
while (1) ; while (1) ;
} }
EXPORT_SYMBOL(machine_power_off);
void machine_halt(void) void machine_halt(void)
{ {
@ -720,7 +718,6 @@ void machine_halt(void)
local_irq_disable(); local_irq_disable();
while (1) ; while (1) ;
} }
EXPORT_SYMBOL(machine_halt);
static int ppc64_panic_event(struct notifier_block *this, static int ppc64_panic_event(struct notifier_block *this,
unsigned long event, void *ptr) unsigned long event, void *ptr)

View file

@ -299,24 +299,18 @@ void machine_restart(char *command)
_machine_restart(command); _machine_restart(command);
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
console_unblank(); console_unblank();
_machine_halt(); _machine_halt();
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
console_unblank(); console_unblank();
_machine_power_off(); _machine_power_off();
} }
EXPORT_SYMBOL(machine_power_off);
static void __init static void __init
add_memory_hole(unsigned long start, unsigned long end) add_memory_hole(unsigned long start, unsigned long end)
{ {

View file

@ -80,8 +80,6 @@ void machine_restart(char * __unused)
"mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001)); "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
#if defined(CONFIG_SH_HS7751RVOIP) #if defined(CONFIG_SH_HS7751RVOIP)
@ -96,8 +94,6 @@ void machine_halt(void)
cpu_sleep(); cpu_sleep();
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
#if defined(CONFIG_SH_HS7751RVOIP) #if defined(CONFIG_SH_HS7751RVOIP)
@ -110,8 +106,6 @@ void machine_power_off(void)
#endif #endif
} }
EXPORT_SYMBOL(machine_power_off);
void show_regs(struct pt_regs * regs) void show_regs(struct pt_regs * regs)
{ {
printk("\n"); printk("\n");

View file

@ -158,8 +158,6 @@ void machine_halt(void)
panic("Halt failed!"); panic("Halt failed!");
} }
EXPORT_SYMBOL(machine_halt);
void machine_restart(char * cmd) void machine_restart(char * cmd)
{ {
char *p; char *p;
@ -180,8 +178,6 @@ void machine_restart(char * cmd)
panic("Reboot failed!"); panic("Reboot failed!");
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off(void) void machine_power_off(void)
{ {
#ifdef CONFIG_SUN_AUXIO #ifdef CONFIG_SUN_AUXIO
@ -191,8 +187,6 @@ void machine_power_off(void)
machine_halt(); machine_halt();
} }
EXPORT_SYMBOL(machine_power_off);
static DEFINE_SPINLOCK(sparc_backtrace_lock); static DEFINE_SPINLOCK(sparc_backtrace_lock);
void __show_backtrace(unsigned long fp) void __show_backtrace(unsigned long fp)

View file

@ -69,8 +69,6 @@ void machine_power_off(void)
machine_halt(); machine_halt();
} }
EXPORT_SYMBOL(machine_power_off);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static int powerd(void *__unused) static int powerd(void *__unused)
{ {

View file

@ -124,8 +124,6 @@ void machine_halt(void)
panic("Halt failed!"); panic("Halt failed!");
} }
EXPORT_SYMBOL(machine_halt);
void machine_alt_power_off(void) void machine_alt_power_off(void)
{ {
if (!serial_console && prom_palette) if (!serial_console && prom_palette)
@ -154,8 +152,6 @@ void machine_restart(char * cmd)
panic("Reboot failed!"); panic("Reboot failed!");
} }
EXPORT_SYMBOL(machine_restart);
static void show_regwindow32(struct pt_regs *regs) static void show_regwindow32(struct pt_regs *regs)
{ {
struct reg_window32 __user *rw; struct reg_window32 __user *rw;

View file

@ -49,23 +49,17 @@ void machine_restart(char * __unused)
CHOOSE_MODE(reboot_tt(), reboot_skas()); CHOOSE_MODE(reboot_tt(), reboot_skas());
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off(void) void machine_power_off(void)
{ {
uml_cleanup(); uml_cleanup();
CHOOSE_MODE(halt_tt(), halt_skas()); CHOOSE_MODE(halt_tt(), halt_skas());
} }
EXPORT_SYMBOL(machine_power_off);
void machine_halt(void) void machine_halt(void)
{ {
machine_power_off(); machine_power_off();
} }
EXPORT_SYMBOL(machine_halt);
/* /*
* Overrides for Emacs so that we follow Linus's tabbing style. * Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically * Emacs will notice this stuff at the end of the file and automatically

View file

@ -132,8 +132,6 @@ void machine_restart (char *__unused)
asm ("jmp r0"); /* Jump to the reset vector. */ asm ("jmp r0"); /* Jump to the reset vector. */
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt (void) void machine_halt (void)
{ {
#ifdef CONFIG_RESET_GUARD #ifdef CONFIG_RESET_GUARD
@ -145,15 +143,11 @@ void machine_halt (void)
asm ("halt; nop; nop; nop; nop; nop"); asm ("halt; nop; nop; nop; nop; nop");
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off (void) void machine_power_off (void)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_power_off);
/* Called before configuring an on-chip UART. */ /* Called before configuring an on-chip UART. */
void anna_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud) void anna_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
{ {

View file

@ -160,8 +160,6 @@ void machine_restart (char *__unused)
asm ("jmp r0"); /* Jump to the reset vector. */ asm ("jmp r0"); /* Jump to the reset vector. */
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt (void) void machine_halt (void)
{ {
#ifdef CONFIG_RESET_GUARD #ifdef CONFIG_RESET_GUARD
@ -173,15 +171,11 @@ void machine_halt (void)
asm ("halt; nop; nop; nop; nop; nop"); asm ("halt; nop; nop; nop; nop; nop");
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off (void) void machine_power_off (void)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_power_off);
/* Called before configuring an on-chip UART. */ /* Called before configuring an on-chip UART. */
void as85ep1_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud) void as85ep1_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
{ {

View file

@ -121,22 +121,16 @@ void machine_halt (void)
} }
} }
EXPORT_SYMBOL(machine_halt);
void machine_restart (char *__unused) void machine_restart (char *__unused)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off (void) void machine_power_off (void)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_power_off);
/* Interrupts */ /* Interrupts */

View file

@ -67,8 +67,6 @@ void machine_restart (char *__unused)
asm ("jmp r0"); /* Jump to the reset vector. */ asm ("jmp r0"); /* Jump to the reset vector. */
} }
EXPORT_SYMBOL(machine_restart);
/* This says `HALt.' in LEDese. */ /* This says `HALt.' in LEDese. */
static unsigned char halt_leds_msg[] = { 0x76, 0x77, 0x38, 0xF8 }; static unsigned char halt_leds_msg[] = { 0x76, 0x77, 0x38, 0xF8 };
@ -89,15 +87,11 @@ void machine_halt (void)
asm ("halt; nop; nop; nop; nop; nop"); asm ("halt; nop; nop; nop; nop; nop");
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off (void) void machine_power_off (void)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_power_off);
/* Animated LED display for timer tick. */ /* Animated LED display for timer tick. */

View file

@ -104,24 +104,18 @@ void machine_restart (char *__unused)
V850_SIM_SYSCALL (exit, 0); V850_SIM_SYSCALL (exit, 0);
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt (void) void machine_halt (void)
{ {
V850_SIM_SYSCALL (write, 1, "HALT\n", 5); V850_SIM_SYSCALL (write, 1, "HALT\n", 5);
V850_SIM_SYSCALL (exit, 0); V850_SIM_SYSCALL (exit, 0);
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off (void) void machine_power_off (void)
{ {
V850_SIM_SYSCALL (write, 1, "POWER OFF\n", 10); V850_SIM_SYSCALL (write, 1, "POWER OFF\n", 10);
V850_SIM_SYSCALL (exit, 0); V850_SIM_SYSCALL (exit, 0);
} }
EXPORT_SYMBOL(machine_power_off);
/* Load data from a file called NAME into ram. The address and length /* Load data from a file called NAME into ram. The address and length
of the data image are returned in ADDR and LEN. */ of the data image are returned in ADDR and LEN. */

View file

@ -184,18 +184,13 @@ void machine_halt (void)
for (;;) {} for (;;) {}
} }
EXPORT_SYMBOL(machine_halt);
void machine_restart (char *__unused) void machine_restart (char *__unused)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_restart);
void machine_power_off (void) void machine_power_off (void)
{ {
machine_halt (); machine_halt ();
} }
EXPORT_SYMBOL(machine_power_off);

View file

@ -150,18 +150,13 @@ void machine_restart(char * __unused)
} }
} }
EXPORT_SYMBOL(machine_restart);
void machine_halt(void) void machine_halt(void)
{ {
} }
EXPORT_SYMBOL(machine_halt);
void machine_power_off(void) void machine_power_off(void)
{ {
if (pm_power_off) if (pm_power_off)
pm_power_off(); pm_power_off();
} }
EXPORT_SYMBOL(machine_power_off);