3 # Copyright (C) 2008 Jeffrey Brian Arnold <jbarnold@mit.edu>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License, version 2.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
19 use Cwd
'abs_path', 'getcwd';
23 use lib
'KSPLICE_DATA_DIR';
26 my ($help, $wantversion, $debug) = (0, 0, 0);
27 GetOptions
("help|?" => \
$help,
28 "version" => \
$wantversion,
29 "verbose|v!" => \
$verbose,
30 "debug=i" => \
$debug) or pod2usage
(1);
36 pod2usage
(1) if($help || scalar(@ARGV != 1));
39 $kid =~ s/^ksplice[_-]//;
42 if(! -d
"/sys/module/ksplice_$kid") {
43 die "/sys/module/ksplice_$kid does not exist";
45 elsif(! -d
"/sys/module/ksplice_$kid/parameters") {
46 runval
("echo $debug > /sys/module/ksplice_$kid/debug");
49 runval
("echo $debug > /sys/module/ksplice_$kid/parameters/debug");
53 unless(-e
"/proc/ksplice_$kid") {
54 print "Ksplice id $kid is not present in the kernel\n";
57 unless(runval
("echo 1 > /proc/ksplice_$kid") == 0 and
58 (runstr
("lsmod") =~ m/- $/m or runval_raw
("rmmod ksplice_$kid") == 0)) {
59 my $dmesg = runstr
("dmesg | grep ksplice");
60 while($dmesg =~ /ksplice: Preparing to reverse/) {
64 if($dmesg =~ /to-be-reversed code is busy/) {
67 Ksplice has aborted the undo operation because it appears that the code that
68 you are trying to change is continuously in use by the system. More
69 specifically, Ksplice has been unable to find a moment when one or more of the
70 to-be-changed functions is not on a thread's kernel stack
.
82 ksplice-undo - Undo a Ksplice update that has been applied to the running kernel
86 B<ksplice-undo> I<KSPLICE_ID>
90 B<ksplice-undo> takes as input a Ksplice identification tag, as reported by
91 L<ksplice-view(8)>, and it reverses that update within the running binary kernel.
99 Reverses the update with debugging output enabled. Recommended only for
100 debugging. I<DEBUG_LEVEL> should be an integer between 0 and 2. B<--debug=2>
101 provides the most debugging information.
111 Provides basic kernel stack check debugging output.
115 Provides full kernel stack check debugging output.
123 L<ksplice-create(8)>, L<ksplice-apply(8)>, L<ksplice-view(8)>
127 Copyright (C) 2008 Jeffrey Brian Arnold <jbarnold@mit.edu>.
129 This is free software and documentation. You can redistribute and/or modify it
130 under the terms of the GNU General Public License, version 2.