#!/usr/bin/perl -w # # fix_cap_bset.pl # # Sets the linux kernel varilble 'cap_bset' to 0xffffffff, so that # root processes get CAP_SETPCAP. # # This is designed for use with Linux v2.4 kernels, where the default # cap_bset is 0xfffffeff, i.e. everything except CAP_SETPCAP. # # Copyright (c) 2002 Tim Deegan # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: fix_cap_bset.pl,v 1.2 2002/03/26 12:31:03 tjd21 Exp $ # use strict; use vars qw{ %matches @syms $sym }; sub fail() { print "$_[0]\n"; exit 1; } %matches=(); open SYMS, ") { next unless (/^([0-9a-f]+) (cap_bset\S*)\s*$/); $matches{"$2"} = $1; } close SYMS; @syms = keys %matches; if ($#syms < 0) { &fail ("can't find cap_bset in /proc/ksyms"); } if ($#syms > 0) { print "Too many symbols: I see "; foreach $sym (@syms) { print "$sym "; } print "\n"; exit 1; } exec 'kpoke', "0x$matches{$syms[0]}", '0xffffffff'; # # EOF #