#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'http:--zap.cso.uiuc.edu-~jwessel-projects-stop-a.pl-' <<'END_OF_FILE' X X STOP-A.PL X X designed by [IMAGE] X _________________________________________________________________ X X WHAT IS STOP-A.PL? X Stop-a.pl is a perl program that will disable or enable the break X sequence, , on the keyboard console of a Sun Workstation X or the break sequence on the serial port of a Sun running Solaris X 2.5.x or Solaris 2.6. X X WHERE TO GET IT X Before I go any further, the current place to get the software is at: X http://zap.cso.uiuc.edu/~jwessel/projects/dist/stop-a.pl X X HOW TO USE IT X stop-a.pl [-q] <-serial and/or -keyboard> X X -keyboard will enable or disable the L1-A sequence on a sun X console. X -serial will enable or disable the break sequence on the serial X port. X X -q will suppress the output of the adb program. X X Some Examples: X Running stop-a.pl -serial -keyboard disable would disable both the X sequence and the serial port break sequence. X X Running stop-a.pl -keyboard enable would re-enable the break X sequence on the keyboard, if it was turned off with stop-a.pl. X X HOW TO INSTALL IT X 1. Make sure you have perl installed on your system. X 2. Change the first line of the script to the location of perl on X your system. X 3. Copy the program to /etc/stop-a.pl X 4. Add it to the startup scripts for your workstation found in X /etc/init.d. X ie, as root you could type: X Xecho '#/bin/sh' > /etc/init.d/console-fix Xecho 'case "$1" in' >> /etc/init.d/console-fix Xecho ' start)' >> /etc/init.d/console-fix Xecho ' /etc/stop-a.pl -q -serial -keyboard disable' Xecho ' ;;' >> /etc/init.d/console-fix Xecho 'esac' >> /etc/init.d/console-fix Xchmod 755 /etc/init.d/console-fix Xln -s /etc/init.d/console-fix /etc/rc3.d/S99console-fix X X HOW DOES IT WORK? X This program is basically a wrapper around adb, with the objective to X modify the runtime kernel and remove the call to X abort_sequence_enter. X X For the keyboard console X Disable mode X 1. Open adb X 2. Jump to the memory with keyboard driver X 3. Search for abort_sequence_enter call X 4. Save address and machine instruction to X /etc/stop.adb X 5. Replace call with a NOP X Enable mode X 1. Open adb X 2. Use address and machine instruction information X from /etc/stop.adb to replace NOP instruction. X X For the serial port X Disable mode X 1. Open adb X 2. Jump to the memory with serial port driver X 3. Search for abort_sequence_enter call X 4. Save address and machine instruction to X /etc/break.adb X 5. Replace call with a RET X Enable mode X 1. Open adb X 2. Use address and machine instruction information X from /etc/break.adb to replace NOP instruction. X X This program was written for Sun Workstations running Solaris X 2.5.x and Solaris 2.6. It has been tested on a Sparc 2, Sparc 10, X Sparc 4, Ultra 2200, and an Ultra 3000. This program might work X for other versions and of the OS and other Sparc platforms, but it X has not been tested. X X I wrote the program because I got tired of worrying that some sun X patch would change the address in the kernel, that I had X previously hard coded. I also found that on one occasion, I X actually wanted to re-enable to perform some debugging. X X DISCLAIMER X X X Anyone who uses stop-a.pl does so at their own risk. U of I, CCSO, X or myself will not be responsible for any mental or physical X damages caused by this software. As with any kernel modification X you run the risk of crashing or causing serious damage to your X machine. X X However, if you would like to give me suggestions or submit X patches. I would be happy to hear from you. I am jwessel@uiuc.edu X if you would like to send such information. X X Check out my other projects X _________________________________________________________________ X X Jason Wessel X X Last modified: Thu Oct 9 12:11:32 CDT 1997 END_OF_FILE if test 4564 -ne `wc -c <'http:--zap.cso.uiuc.edu-~jwessel-projects-stop-a.pl-'`; then echo shar: \"'http:--zap.cso.uiuc.edu-~jwessel-projects-stop-a.pl-'\" unpacked with wrong size! fi # end of 'http:--zap.cso.uiuc.edu-~jwessel-projects-stop-a.pl-' fi if test -f 'sol2.6' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'sol2.6'\" else echo shar: Extracting \"'sol2.6'\" \(4285 characters\) sed "s/^X//" >'sol2.6' <<'END_OF_FILE' X================ kbio.h X/* X * KIOCSKABORTEN: X * X * Enable/Disable Keyboard abort effect (Stop/A, Break or other seq). X * The argument is a pointer to an integer. If the integer is zero, X * keyboard abort is disabled. Otherwise, keyboard abort X * is enabled. NB: This ioctl requires root credentials. X */ X#define KIOCSKABORTEN (KIOC|21) X X================ kb(7M) X X KIOCSKABORTEN The argument is a pointer to an int. The X keyboard abort sequence (typically L1-A or X Stop-A on the keyboard on SPARC systems and X BREAK on the serial console device) effect is X enabled if the int has a non-zero value, oth- X erwise, the keyboard abort sequence effect is X disabled. When enabled, the default effect X causes the operating system to suspend and X enter the kernel debugger (if present) or the X system prom (on most systems with OpenBoot X proms). The default effect is 'enabled' on X most systems. The default effect may be dif- X ferent on server systems with key switches X when the key switch is in the 'secure' posi- X tion. On these server systems, the effect is X always 'disabled' when the key switch is in X the 'secure' position. This ioctl returns X EPERM If the caller is not the superuser. X X================ kbd(1) X X On most systems, the default effect of the keyboard abort X sequence is to suspend the operating system and enter the X debugger or the monitor. Some systems have key switches X with a 'secure' position. On these systems, the key switch X in the 'secure' position, overrides any software default set X with this command. X X If you want to permanently change the software default X effect of the keyboard abort sequence, you can add or change X the current value of the KEYBOARD_ABORT variable to the X value disable in the keyboard default file, X /etc/default/kbd, as shown here. X X KEYBOARD_ABORT=disable X X Then, run the command 'kbd -i' to change the current set- X ting. Valid settings for this value are the values enable X and disable. Other values are ignored. If the variable is X not specified in the default file, the setting is unchanged. X X -a enable/disable state X Enable or disable the keyboard abort X sequence effect. X By default, a keyboard abort sequence X (typically, Stop-A or L1-A on the keyboard X and BREAK on the serial console device) X suspends the Operating System on most sys- X tems. This default behavior can be X changed using this option. This option can X only be used by the superuser. X X enable X Enable the default effect of the key- X board abort sequence, which is to X suspend the operating system and X enter the debugger or the monitor. X X disable X Disable the default effect and ignore X keyboard abort sequences. X X================= /etc/default/kbd X X#pragma ident "@(#)kbd.dfl 1.2 96/06/07 SMI" X# X# Copyright 1996, Sun Microsystems, Inc. X# All Rights Reserved. X# X# /etc/default/kbd X# X# kbd default settings processed via kbd(1). X# X# KEYBOARD_ABORT affects the default behavior of the keyboard abort X# sequence, see kbd(1) for details. The default value is "enable". X# The optional value is "disable". Any other value is ignored. X# X# KEYCLICK affects the default keyclick behavior. Possible values are X# 'on' and 'off'. Any other value is ignored. The default behavior is X# to leave the current keyclick setting unchanged. X# X# Uncomment the following lines to change the default values. X# X#KEYBOARD_ABORT=enable X#KEYCLICK=off END_OF_FILE if test 4285 -ne `wc -c <'sol2.6'`; then echo shar: \"'sol2.6'\" unpacked with wrong size! fi # end of 'sol2.6' fi if test -f 'stop-a.pl' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stop-a.pl'\" else echo shar: Extracting \"'stop-a.pl'\" \(6499 characters\) sed "s/^X//" >'stop-a.pl' <<'END_OF_FILE' X X#!/usr/local/bin/perl X# Copyright 1997 - Board of Trustees - University of Illinois - Urbana X# Jason Wessel - jwessel@uiuc.edu X# Computing & Communications Services Office X# All rights reserved. X# X# Free for distribution and modification provided you keep the copyright X# statement. X# X# You are running this program at your own risk. It modifies the X# runtime kernel, and was designed for Solaris 2.5.x and Solaris 2.6. X# It may work for other releases, but as with any kernel modification X# you run the risk of crashing or causing serious damage to your machine. X# X# More information available at X# http://www.uiuc.edu/ph/www/jwessel/projects/stop-a.pl X#------------------------------------------------------------------------ X X X$stop_a_file = "/etc/stop.adb"; X$serial_file = "/etc/break.adb"; X X# When run with disable spawn adb and: X# 1) find the address of the "L1-A callback" X# 2) Save the old address X# 3) Insert a NOP instruction X# X# When run with enable spawn adb and: X# 1) Open the file with the old instruction information X# 2) Rebuild the old callback X# X X$| = 1; X X# Check command line options X$0 =~ s/.*\///; X$verbose = 1; X$enable = 0; Xif ($#ARGV == -1) { X &usage(); X} X X$keyboard = 0; X$serial = 0; X Xwhile ($ARGV[0]) { X if ($ARGV[0] eq "-q") { X $verbose = 0; X } elsif ($ARGV[0] eq "enable") { X $enable = 1; X } elsif ($ARGV[0] eq "disable") { X ; X } elsif ($ARGV[0] eq "-keyboard") { X $keyboard = 1; X } elsif ($ARGV[0] eq "-serial") { X $serial = 1; X } else { X &usage(); X } X shift; X} X Xif (!($keyboard ||$serial)) { X print "Error: Please use -keyboard and/or -serial option\n"; X exit(-1); X} X X# Create some pipes to talk to the adb Xpipe(REALIN,IN); Xpipe(OUT,REALOUT); X$pid = fork; Xif (!$pid) { X close(STDIN); X close(STDOUT); X close(OUT); X close(IN); X open(STDIN,"<&REALIN"); X open(STDOUT,">&REALOUT"); X close(REALIN); X close(REALOUT); X select(STDIN); X $| = 1; X select(STDOUT); X $| = 1; X exec '/usr/bin/adb','-w','-k', '/dev/ksyms', '/dev/mem'; X exit(0); X} Xclose(REALOUT); Xclose(REALIN); X X# Grab initial adb ouput and write to screen Xwhile (1) { X $rin = ''; X vec($rin, fileno(OUT), 1) = 1; X ($nfound, $timeleft) = select($rin,undef, undef, 4); X if ($nfound) { X $var = ; X chop($var); X print "$var\n" if $verbose; X } else { X last; X } X} Xselect(IN); X$| = 1; Xselect(STDOUT); X X X Xif ($enable) { X if ($keyboard) { X if (-f $stop_a_file) { X open(FIL,"$stop_a_file"); X $var = ; X chop($var); X print IN "$var\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X } else { X print "Couldn't find $stop_a_file\n"; X close(IN); X close(OUT); X exit(-1); X } X } X if ($serial) { X if (-f $serial_file) { X open(FIL,"$serial_file"); X $var = ; X chop($var); X print IN "$var\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X } else { X print "Couldn't find $serial_file\n"; X close(IN); X close(OUT); X exit(-1); X } X } X close(IN); X close(OUT); X exit(0); X} X X&l1a_call if ($keyboard); X&serial_call if ($serial); X Xclose(IN); Xclose(OUT); Xexit(0); X X#end Main program X Xsub l1a_call { X# Search for "L1-A" callback X print IN "kbdinput+0 /i\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X $var = &grab_line(); X print "$var\n" if $verbose; X $found = 0; X while ($var =~ /^kbdinput/) { X print IN "\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X if ($var =~ /abort_sequence_enter/) { X $found = 1; X $addr = (split(/:/,(split(/\+/,$var,2))[1]))[0]; X last; X } X } X X if (!$found) { X print "ERROR: 'abort_sequence_enter' not found, exiting\n"; X exit(-1); X } X $addr =~ s/.*\+(.*): .*/$1/; X print IN "/p\n"; X $var = &grab_line(); X $old_inst = (split(/[\t ]+/,$var))[1]; X open(OLDF,">$stop_a_file") || die "couldn't open $stop_a_file"; X print OLDF "kbdinput+$addr/W $old_inst\n"; X close(OLDF); X X print IN "kbdinput+$addr/W 0x01000000\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X} X Xsub serial_call { X# Search for "L1-A" callback X print IN "zsa_xsint+0 /i\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X $var = &grab_line(); X print "$var\n" if $verbose; X $found = 0; X while ($var =~ /^zsa_xsint[:\+]/) { X print IN "\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X if ($var =~ /abort_sequence_enter/) { X $found = 1; X $addr = (split(/:/,(split(/\+/,$var,2))[1]))[0]; X last; X } X } X X if (!$found) { X print "ERROR: 'abort_sequence_enter' not found, exiting\n"; X exit(-1); X } X $addr =~ s/.*\+(.*): .*/$1/; X print IN "/p\n"; X $var = &grab_line(); X $old_inst = (split(/[\t ]+/,$var))[1]; X open(OLDF,">$serial_file") || die "couldn't open $serial_file"; X print OLDF "zsa_xsint+$addr/W $old_inst\n"; X close(OLDF); X X print IN "zsa_xsint+$addr/W 0x81c7e008\n"; X $var = &grab_line(); X print "$var\n" if $verbose; X} X Xsub grab_line { X local($error,$var,$rin,$nfound,$timeleft); X $error = 0; X while (1) { X $rin = ''; X vec($rin, fileno(OUT), 1) = 1; X ($nfound, $timeleft) = select($rin,undef, undef, 4); X if ($nfound) { X $var = ; X chop($var); X return($var); X } else { X if ($error > 3) { X print "adb failed!\n"; X exit(-1); X } X $error++; X } X } X} X Xsub usage { X Xprint< X X -keyboard will enable or disable the L1-A sequence on a sun console. X -serial will enable or disable the break sequence on the serial port. X X -q will suppress the output of adb X X You are running this program at your own risk. It modifies the X runtime kernel, and was designed for Solaris 2.5.x and Solaris 2.6. X It may work for other releases, but as with any kernel modification X you run the risk of crashing or causing serious damage to your machine. X X Designed by Jason Wessel X XEOF X exit(0); X} X END_OF_FILE if test 6499 -ne `wc -c <'stop-a.pl'`; then echo shar: \"'stop-a.pl'\" unpacked with wrong size! fi # end of 'stop-a.pl' fi if test -f 'stop_l1.txt' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'stop_l1.txt'\" else echo shar: Extracting \"'stop_l1.txt'\" \(1956 characters\) sed "s/^X//" >'stop_l1.txt' <<'END_OF_FILE' X X>From: jwessel@uiuc.edu (Jason Wessel) X>Newsgroups: comp.unix.solaris X>Subject: How to disable serial or keyboard break X>Date: 9 Oct 1997 17:12:24 GMT X>Organization: University of Illinois at Urbana-Champaign X>Message-ID: <61j39o$pp2$1@vixen.cso.uiuc.edu> X>Keywords: break console disable X XI added some functionality to stop-a.pl so that it could disable Xthe break sequence on the serial port as well. X Xstop-a.pl has been tested with numerous Sun workstations running XSolaris 2.5.x and Solaris 2.6. X XGoto the following url to get it. Xhttp://www.uiuc.edu/ph/www/jwessel/projects/stop-a.pl X XHere is some info from the page: X XUsage: Xstop-a.pl [-q] <-serial and/or -keyboard> X X -keyboard will enable or disable the L1-A sequence on a sun console. X -serial will enable or disable the break sequence on the serial port. X X -q will suppress the output of adb X X You are running this program at your own risk. It modifies the X runtime kernel, and was designed for Solaris 2.5.x and Solaris 2.6. X It may work for other releases, but as with any kernel modification X you run the risk of crashing or causing serious damage to your machine. X X Designed by Jason Wessel X X>From: Casper.Dik@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer) X>Newsgroups: comp.unix.solaris X>Subject: Re: How to disable serial or keyboard break X>Date: 9 Oct 1997 18:19:13 GMT X>Organization: Sun Microsystems, Netherlands X>Message-ID: X>Keywords: break console disable X XIn Solaris 2.6 you can edit /etc/default/kbd and add: X X KEYBOARD_ABORT=disable X X Xand then run "kbd -i" X XAre just run: X X kbd -a enable Xor X kbd -a disable X XCasper X X-- XExpressed in this posting are my opinions. They are in no way related Xto opinions held by my employer, Sun Microsystems. XStatements on Sun products included here are not gospel and may Xbe fiction rather than truth. X END_OF_FILE if test 1956 -ne `wc -c <'stop_l1.txt'`; then echo shar: \"'stop_l1.txt'\" unpacked with wrong size! fi # end of 'stop_l1.txt' fi echo shar: End of shell archive. exit 0