This file is indexed.

/usr/bin/undertaker-tracecontrol is in undertaker 1.6.1-1.

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
#!/bin/bash
# Copyright (C) 2012 Bernhard Heinloth <bernhard@heinloth.net>
# Copyright (C) 2012 Valentin Rothberg <valentinrothberg@gmail.com>
# Copyright (C) 2012 Andreas Ruprecht  <rupran@einserver.de>
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
set -e

DEBUGFSMOUNTPOINT=/sys/kernel/debug
DEBUGFSFTRACE=$DEBUGFSMOUNTPOINT/tracing
TRACEOUTFILE=/run/undertaker-trace.out
TRACEUTIL=undertaker-traceutil

if [ ! `id -u` -eq 0 ] ; then
    echo "This operation requires root - aborting..."
    exit 1
fi
if ( ! cat /boot/config-`uname -r` | grep -q "CONFIG_FTRACE=y" ) && \
   ( ! zcat /proc/config.gz | grep -q "CONFIG_FTRACE=y" ) ; then
    echo "Warning: No ftrace in current kernel available..."
fi

function initftrace {
    if [ ! -d $DEBUGFSMOUNTPOINT ] ; then
        mount -t debugfs none $(DEBUGFSMOUNTPOINT)
    fi
    if [ ! -d $DEBUGFSMOUNTPOINT ] ; then
        echo "Could not mount debugfs to $DEBUGFSMOUNTPOINT - aborting..."
        exit 1
    fi
    echo 0 > $DEBUGFSFTRACE/tracing_on
    echo sym-addr > $DEBUGFSFTRACE/trace_options
    echo sym-offset > $DEBUGFSFTRACE/trace_options
    echo "function" > $DEBUGFSFTRACE/current_tracer
    echo > $DEBUGFSFTRACE/set_ftrace_notrace
}

function tracefile {
    echo "Tracing output is written to $TRACEOUTFILE"
    touch $TRACEOUTFILE
    chmod a+rw $TRACEOUTFILE
}

function help {
    echo "Usage: $0 [start|stop|mount|module] [tracefile (optional)]"
}

if [ $# -gt 0 ] ; then
    if [ $# -eq 2 ] ; then
        TRACEOUTFILE=$2
    fi
    # prefer local version in same directory
    if [ -x $TRACEUTIL ] ; then
        TRACEUTIL=./$TRACEUTIL
    fi
    case "$1" in
        start )
            initftrace
            tracefile
            echo "Starting trace..."
            echo 1 > $DEBUGFSFTRACE/tracing_on
            if ! $TRACEUTIL $DEBUGFSFTRACE/trace_pipe $TRACEOUTFILE $DEBUGFSFTRACE/set_ftrace_notrace ; then
                echo "Traceutil stopped!"
            fi
            echo 0 > $DEBUGFSFTRACE/tracing_on
            ;;
        mount )
            initftrace
            ;;
        module )
            initftrace
            tracefile
            echo "Starting Module trace..."
            echo 1 > $DEBUGFSFTRACE/tracing_on
            if ! $TRACEUTIL $DEBUGFSFTRACE/trace_pipe $TRACEOUTFILE $DEBUGFSFTRACE/set_ftrace_notrace /proc/modules ; then
                echo "Traceutil stopped!"
            fi
            echo 0 > $DEBUGFSFTRACE/tracing_on
            ;;
        stop )
            echo 0 > $DEBUGFSFTRACE/tracing_on
            if ! killall $TRACEUTIL ; then
                echo "Failed to kill $TRACEUTIL"
            fi
            ;;
        * )
            echo "Command '$1' could not be recognized..."
            help
            ;;
    esac
else
    help
fi