Re: Linux-2.6.11 can't disable CAD

From: Richard B. Johnson
Date: Fri Apr 08 2005 - 15:57:41 EST



It wasn't the kernel.

Many thanks to those who helped me track down this problem.
It seems that the 'C' runtime library was trapping the call
to reboot() which probably should have been _reboot() in
earlier code to prevent this. Anyway, the fix is to call
the kernel directly so it doesn't get blamed for something
it didn't do.

Simple external procedure is attached if anybody else is
interested. It ends up being only 0x30 bytes in length.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Copyright(c) 2005 Analogic Corporation
#
# This program may be distributed under the GNU Public License
# version 2, as published by the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330 Boston, MA, 02111.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Disable Ctl-Alt-Del
# Test environment 'C' runtime libraries are screwing with
# this so I have to call the kernel directly. This is now
# handled in assembly.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

.extern __set_errno
.LREBOOT = 88
.LMAGIC1 = 0xfee1dead
.LMAGIC2 = 672274793
.LCADOFF = 0x00000000

disable_shutdown:
pushl %ebx # Save precious registers
pushl %esi
movl $.LREBOOT, %eax # Reboot command
movl $.LMAGIC1, %ebx # First magic parameter
movl $.LMAGIC2, %ecx # Second magic parameter
movl $.LCADOFF, %edx # Command
xorl %esi, %esi # Zero ignored pointer
int $0x80 # Make the call
popl %esi # Restore precious registers
popl %ebx
orl %eax,%eax # Check return value
jns 1f # It's okay
negl %eax # Make positive
pushl %eax
call __set_errno # Set new errno
addl $0x04, %esp # Level stack
movl $-1, %eax
1: ret

.size disable_shutdown,.-disable_shutdown
.type disable_shutdown,@function
.global disable_shutdown
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
.end