This file is indexed.

/usr/bin/stap-prep is in systemtap 2.3-1ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /bin/bash
LANG=C; export LANG
check_error() { if test $1 != 0; then echo $2; exit $1; fi }

prep_rpm_based() {
# uname -r can produce different kinds of output:
# 2.6.32-30.el6.x86_64 (no variant, but including ".arch")
# 2.6.18-194.3.1.el5debug ("variant", without dot, no arch)
# 2.6.33.4-95.fc13.i686.PAE (".arch.variant", two dots)
if [ "$#" -lt 1 ]; then
    UNAME=`uname -r` # determine the kernel running on the machine
else
    UNAME=$1 #user passed in uname value
fi
UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace
KERNEL="kernel"
for VARIANT in debug kdump PAE xen; do
  # strip out ".variant" or else "variant" at end.
  TMP=`echo $UNAME | sed s/\\\\.$VARIANT\$// | sed s/$VARIANT\$//`
  if [ "$TMP" != "$UNAME" ]; then
      UNAME=$TMP; KERNEL="kernel-$VARIANT"
  fi
done
KERN_ARCH=`uname -m`
KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname
CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \
  $KERNEL-devel-$KERN_REV.$KERN_ARCH \
  $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH"
NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \
    -q $CANDIDATES | grep "is not installed" | awk '{print $2}'`
if [ "$NEEDED" != "" ]; then
    echo -e "Need to install the following packages:\n$NEEDED"
    if [ `id -u` = "0" ]; then #attempt download and install
        DIR=`mktemp -d` || exit 1
        if [ ! -x /usr/bin/yumdownloader ]; then
            echo "Need to first install yum-utils for yumdownloader"
            yum install -y yum-utils
        fi
        yumdownloader --enablerepo="*debuginfo*" $NEEDED --destdir=$DIR \
                      --resolve
        check_error $? "problem downloading rpm(s) $NEEDED"
        rpm --force -ivh $DIR/*.rpm
        check_error $? "problem installing rpm(s) $NEEDED"
        rm -r $DIR #cleanup
    fi
fi
}

prep_deb_based() {
if [ $# -ne 0 ]; then
    echo "Specifying kernel version is not yet support on deb based systems." 1>&2
    exit 1
fi

# 2.6.32-5-amd64
# 2.6.32-37-generic
ABINAME="$(cut -d " " -f 3 /proc/version)"

# 2.6.32
BASEVERSION="$(echo "$ABINAME" | cut -d "-" -f 1)"

case "$DISTRO" in 
    Debian) # 2.6.32-39
	if uname -v | grep -q Debian; then
	    VERSION="$(uname -v | cut -d " " -f 4)"
	else
	    VERSION="$(cut -d " " -f 5 /proc/version | cut -d ")" -f 1)"
	fi
	;;
    Ubuntu)
	# 2.6.32-37.81
	VERSION="$(cut -d " " -f 2 /proc/version_signature | cut -d "-" -f 1-2)"
	;;
esac

(
    echo "make >= 0"
    echo "linux-image-$ABINAME = $VERSION"
    echo "linux-headers-$ABINAME = $VERSION"
    case "$DISTRO" in
	Debian)
	    echo "linux-image-$ABINAME-dbg = $VERSION"
	    ;;
	Ubuntu)
	    echo "linux-image-$ABINAME-dbgsym = $VERSION"
	    ;;
    esac
) | while read package relation requiredversion; do
    installedversion="$(dpkg-query -W "$package" 2> /dev/null | cut -f 2)"
    if [ "$installedversion" = "" ]; then
	availableversion="$(apt-cache show $package 2> /dev/null | grep ^Version: | cut -d " " -f 2)"
	if [ "$availableversion" = "" ]; then
	    echo "You need package $package but it does not seem to be available"
	    if [ "$DISTRO" = "Ubuntu" -a "$(echo $package | grep dbgsym$)" ]; then
		echo " Ubuntu -dbgsym packages are typically in a separate repository"
		echo " Follow https://wiki.ubuntu.com/DebuggingProgramCrash to add this repository"
	    elif [ "$DISTRO" = "Debian" -a "$(echo $package | grep dbg$)" ]; then
		echo " Debian does not have -dbg packages for all kernels. Consider switching to a kernel that has one."
	    fi
	else
	    echo "Please install $package"
	fi
    elif ! dpkg --compare-versions $installedversion $relation $requiredversion; then
	echo "Package $package version $installedversion does not match version of currently running kernel: $requiredversion"
	echo " Consider apt-get upgrade && reboot"
    fi
done

user="$(id --user --name)"
if [ "$user" != "root" ]; then
    groups="$(id --groups --name)"
    for i in stapusr stapdev; do
	if [ "$(echo $groups | grep $i)" = "" ]; then
	    echo "Be root or adduser $user $i"
	fi
    done
fi
}

DISTRO="$(lsb_release --id --short 2> /dev/null)"
if [ $? -ne 0 ]; then
    DISTRO="unknown"
fi
case "$DISTRO" in
Debian|Ubuntu)
	prep_deb_based "$@"
	;;
*)
	prep_rpm_based "$@"
	;;
esac