问题描述
我想做什么? (如果你愿意,你可以跳过这部分)
我正在尝试进行 android 内核开发。不过,这不是我目前的问题。要学习内核利用,我需要能够获得易受某个漏洞攻击的 android 版本。所以这就是我正在做的:
- 前往 here 选择我想学习如何利用的 CVE
- 选择 CVE 后,我需要从 here 中选择容易受到该 CVE 攻击的构建
- 既然我已经选择了一个构建版本(在我的例子中是
QQ3A.200805.001
),我会记下它的分支名称(在我的例子中是android-10.0.0_r41
) - 现在我需要能够在 android 模拟器 (qemu) 中运行此构建一次作为生产构建,一次使用 KASAN+KCOV+gdb 的调试符号
在开始之前,我遵循以下指南:
- https://source.android.com/devices/tech/debug/kasan-kcov
- https://source.android.com/setup/build/building-kernels-deprecated
- 谷歌 :)
我的设置:
我这样做是为了下载我需要的一切:
git clone https://android.googlesource.com/kernel/msm
cd msm
git fetch --all --tags --prune
git checkout remotes/origin/android-msm-coral-4.14-Android10
cd ..
mkdir AOSP
cd AOSP
repo init -u https://android.googlesource.com/platform/manifest
repo sync -j`nproc`
repo init -b android-10.0.0_r41
repo sync -j`nproc`
cd ..
当我进入 AOSP 目录并尝试编译时:
source ./build/envsetup.sh
lunch aosp_flame-userdebug # For the Pixel 4
m
它在 4 小时内编译完成,但它奏效了。
我的第一期:
然后我在主文件夹中创建了这个 bash 脚本来尝试正常编译 msm 内核(没有 KASAN/KCOV):
###########
# Params: #
###########
ARCH=arm64
CONfig=cuttlefish_defconfig
###########
# Script: #
###########
read -p "Compile with clang instead of gcc? [y/N] " USE_CLANG
if [ $USE_CLANG == y ] || [ $USE_CLANG == Y ]; then
COMPILER=clang
CC_PATH=$(pwd)/AOSP/prebuilts/clang/host/linux-x86/clang-r346389c/bin/
else
COMPILER=gcc
CC_PATH=$(pwd)/AOSP/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/
export CROSS_COMPILE=aarch64-linux-android-
fi
export ARCH=$ARCH
export PATH=$PATH:$CC_PATH
cd msm
make clean
make distclean
make $CONfig
make CC=$COMPILER
当我使用 GCC 运行它时,我收到了折旧警告的轰炸,并收到一个错误:
Android GCC has been deprecated in favor of Clang,and will be removed from
Android in 2020-01 as per the deprecation plan in:
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/master/GCC_4_9_DEPRECATION.md
...
Cannot use CONfig_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
当我用 clang 运行它时,我也收到了大量警告和这个错误:
./arch/arm64/include/asm/stack_pointer.h:8:51: error: register 'sp' unsuitable for global register variables on this target
register unsigned long current_stack_pointer asm ("sp");
...
In file included from ./include/linux/kvm_host.h:14:
./include/linux/signal.h:81:11: warning: array index 3 is past the end of the array (which contains 1 element) [-Warray-bounds]
return (set->sig[3] | set->sig[2] |
脚本的完整输出可以在 here (for gcc) 和 here (for clang) 中找到。基本上我的第一个问题是我不知道为什么会出现这些编译错误。因此,任何建议将不胜感激。
我的第二个问题:
现在,我正在检查 msm repo 中的 remotes/origin/android-msm-coral-4.14-Android10
分支,但我认为这不是可行的方法,因为我需要与某个构建/分支相对应的内核版本({{1 }} 或 QQ3A.200805.001
在我的情况下)。我想我需要构建在 AOSP 存储库中预编译的确切版本。
例如,如果我转到 android-10.0.0_r41
目录并运行 AOSP/device/google/coral
,我会得到如下信息:
git log
可以在 here 找到此确切提交/标记的链接。但是,msm source repo 中没有 commit 62d311ad7cfc3e76a5278634427596462069b44d (HEAD,tag: android-10.0.0_r41,tag: m/android-10.0.0_r41,aosp/Android10-qpr3-release)
Merge: 7b91fff 0657c80
Author: android-build-team Robot <android-build-team-robot@google.com>
Date: Wed Jun 10 23:45:11 2020 +0000
Merge cherrypicks of [11827366,11829660,11829049,11829662,11829647,11829300,11826697,11829719,11829051,11829663,11829664,11829838,11829052,11829472,11829586] into qt-qpr3-release
Change-Id: Ic126de75c24133f8d43df7c9d8f09059a9ca8089
commit 0657c80f016720f70ed6f9618f928a30e71f2b79
Author: wenchangliu <wenchangliu@google.com>
Date: Tue Mar 24 18:11:18 2020 +0800
coral: Add seccomp policy for Codec2 process
Add seccomp policy for Codec2 process.
Bug: 149511958
Test: adb shell killall media.hwcodec
Change-Id: Iab64bd42ead0c5a27769a757007282c2dddf911d
(cherry picked from commit 3628a510a808a52c4ebf69958a8343928e5df3f2)
(cherry picked from commit 45a6093f3d085ca2a531c2607bd12dbc1eff6bf9)
commit 7b91fffc14afb41cf14772566272c72b37c36785
Merge: 2e7f1a3 e8c9484
Author: android-build-team Robot <android-build-team-robot@google.com>
Date: Wed Jun 10 00:37:23 2020 +0000
...
标签,所以我不知道哪个版本的 msm repo 对应于 AOSP 目录中的预构建版本。而且.. 我不知道从哪里开始寻找 tbh。
非常感谢任何帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)