This file is indexed.

/usr/src/kernel-patches/all/apply/ptmulti-ptvm is in kernel-patch-viewos 0.20141201-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
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#! /bin/bash
set -e

if ! [ -d kernel -a -d Documentation ]
then
    echo >&2 "Not in kernel top level directory. Exiting"
    exit 1
fi
TOPPATCHDIR=/usr/src/kernel-patches
ARCHITECTURE=`dpkg --print-installation-architecture`
DECOMPRESSOR="zcat -f"
PATCH_OPTIONS="--ignore-whitespace --silent"
# This is informational only, used by lskpatches
DHPKPATCHES_VERSION=0.99.36+nmu1

DEPENDS=("" "" "" "" "" "" "" "" "" "")

KVERSIONS=(2.6.15 2.6.16 2.6.17 2.6.18 2.6.19 2.6.20 2.6.21 2.6.22 2.6.23 2.6.24)
PATCHFILES=("/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.15-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.16-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.17-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.18-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.19-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.20-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.21-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.22-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.23-ptmulti-ptvm.gz" "/usr/src/kernel-patches/diffs/ptmulti-ptvm/patch-linux-2.6.24-ptmulti-ptvm.gz")
DEBPATCHFILES=("" "" "" "" "" "" "" "" "" "")
STRIPLEVELS=(1 1 1 1 1 1 1 1 1 1)

[ -f debian/APPLIED_${ARCHITECTURE}_ptmulti-ptvm -o \
  -f debian/APPLIED_all_ptmulti-ptvm ] && exit 0
VERSION=$(grep ^VERSION Makefile 2>/dev/null | \
        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
PATCHLEVEL=$( grep ^PATCHLEVEL Makefile 2>/dev/null | \
        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
SUBLEVEL=$(grep ^SUBLEVEL Makefile 2>/dev/null | \
        sed -e 's/[^0-9]*\([0-9]*\)/\1/')
EXTRAVERSION=$(grep ^EXTRAVERSION Makefile | head -1 2>/dev/null | \
        sed -e 's/EXTRAVERSION =[       ]*\([^  ]*\)$/\1/')
KERNELBRANCHLET=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}
KERNELRELEASE=${KERNELBRANCHLET}${EXTRAVERSION}
IDX=

declare -i i=${#PATCHFILES[*]}-1
while [ $i -ge 0 ]
do
    v=${KVERSIONS[$i]}
    if [ -n "$KPATCH_ptmulti_ptvm" -a "$v" = "$KPATCH_ptmulti_ptvm" \
         -o "$v" = "$KERNELRELEASE" \
         -o "$v" = "$KERNELBRANCHLET" \
         -o "$v" = all ]
    then
        IDX=$i
    fi
    i=i-1
done

if [ -n "$KPATCH_ptmulti_ptvm" -a ${KVERSIONS[$IDX]} != "$KPATCH_ptmulti_ptvm" ]
then
    echo >&2 "Requested kernel version \`$KPATCH_ptmulti_ptvm' not found for patch ptmulti-ptvm"
    exit 1
elif [ -z "$IDX" ]
then
    echo >&2 "No \"ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)\" patch found for kernel version $KERNELRELEASE"
    exit 1
fi
KVERSION=${KVERSIONS[$IDX]}
STRIPLEVEL=${STRIPLEVELS[$IDX]}

if [ "${DEBPATCHFILES[$IDX]}" != '' -a \
    \( -r version.Debian -o -r README.Debian \) ]
then
    PATCHFILE=${DEBPATCHFILES[$IDX]}
else
    PATCHFILE=${PATCHFILES[$IDX]}
fi

echo >&2 "START applying ptmulti-ptvm patch (ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM))"

NEEDED_DEPS=
for dep in ${DEPENDS[$IDX]}
do
    if [ -x ${TOPPATCHDIR}/${ARCHITECTURE}/${KERNELBRANCHLET}/apply/$dep ]
    then
        NEEDED_DEPS="${ARCHITECTURE}/${KERNELBRANCHLET}/apply/$dep $NEEDED_DEPS"
    elif [ -x ${TOPPATCHDIR}/all/${KERNELBRANCHLET}/apply/$dep ]
    then
        NEEDED_DEPS="all/${KERNELBRANCHLET}/apply/$dep $NEEDED_DEPS"
    elif [ -x ${TOPPATCHDIR}/${ARCHITECTURE}/apply/$dep ]
    then
        NEEDED_DEPS="${ARCHITECTURE}/apply/$dep $NEEDED_DEPS"
    elif [ -x ${TOPPATCHDIR}/all/apply/$dep ]
    then
        NEEDED_DEPS="all/apply/$dep $NEEDED_DEPS"
    else
        echo >&2 "ERROR: Patch dependency \`$dep' not found - aborting"
        echo >&2 "END applying ptmulti-ptvm patch"
        exit 1
    fi
done
if [ "$NEEDED_DEPS" ]
then
    echo >&2 "Ensuring the following patches are applied first: $NEEDED_DEPS"
    for apply in ${NEEDED_DEPS}
    do
        dep=$(basename $apply)
        ${TOPPATCHDIR}/$apply

        # check something was applied
        if [ ! -f debian/APPLIED_${ARCHITECTURE}_$dep -a \
             ! -f debian/APPLIED_all_$dep ]
        then
            echo >&2 "ERROR: patch dependency did not left a patch stamp (version mismatch ?) - aborting"
            echo >&2 "END applying ptmulti-ptvm patch"
            exit 1
        fi
    done
    UNPATCHDEPS=$(echo ${NEEDED_DEPS} | sed s,/apply/,/unpatch/,g)
fi

echo >&2 "Testing whether \"ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)\" patch for $KVERSION applies (dry run):"
if ! [ -r $PATCHFILE ]
then
    echo >&2 "\"ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)\" patch for $KVERSION not found"
    exit 1
elif ! $DECOMPRESSOR $PATCHFILE |
        patch --force --dry-run $PATCH_OPTIONS -p$STRIPLEVEL
then
    echo >&2 "\"ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)\" patch for $KVERSION does not apply cleanly"
    exit 1
fi
if ! $DECOMPRESSOR $PATCHFILE |
        patch $PATCH_OPTIONS -p$STRIPLEVEL
then
    # This should never happen, thanks to the dry-run
    echo >&2 "ASSERTION FAILED - \"ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)\" patch for $KVERSION failed"
    echo >&2 "END applying ptmulti-ptvm patch"
    exit 1
fi
echo >&2 "\"ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)\" patch for $KVERSION succeeded"

echo >&2 "Removing empty files:"
# make an exception for ./debian, or else the stamp files will go too.
find . -path ./debian -prune -o \
       -type f -size 0 ! -name 'APPLIED*' -exec rm {} \; -print
echo >&2 "Done."

mkdir -p debian
cat > 'debian/APPLIED_all_ptmulti-ptvm' <<EOF
PATCHFILE='$PATCHFILE'
STRIPLEVEL='$STRIPLEVEL'
DEPENDS='$UNPATCHDEPS'
EOF
mkdir -p debian/image.d
PKGNAME=`dpkg -S $PATCHFILE | cut -d: -f1`
PKGVERS=`grep-dctrl -n -P $PKGNAME -s Version -X /var/lib/dpkg/status`
cat > 'debian/image.d/register-ptmulti-ptvm' <<EOF
#!/bin/sh

# This scripts documents the "ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM)" kernel patch into the
# kernel-image package, as being applied to the kernel.

docdir=\${IMAGE_TOP}/usr/share/doc/kernel-image-\${version}

mkdir -p \${docdir}

(
    printf 'ptrace optimization for UMView et al. (PTRACE_MULTI, PTRACE_SYSVM) (ptmulti-ptvm)${KPATCH_ptmulti_ptvm:+ for kernel ${KPATCH_ptmulti_ptvm}},'
    echo ' from package $PKGNAME, version $PKGVERS'
) >> \${docdir}/applied-patches
EOF
chmod +x 'debian/image.d/register-ptmulti-ptvm'

echo >&2 "END applying ptmulti-ptvm patch"