Skip to content

disable KASLR when using GDB #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions boot-qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,18 @@ function decomp_rootfs() {

# Boot QEMU
function setup_qemu_args() {
APPEND_STRING=""
if ${INTERACTIVE:=false}; then
RDINIT=" rdinit=/bin/sh"
APPEND_RDINIT=(-append "${RDINIT}")
APPEND_STRING+="rdinit=/bin/sh "
fi
if ${GDB:=false}; then
APPEND_STRING+="nokaslr "
fi

case ${ARCH} in
arm32_v5)
ARCH=arm
QEMU_ARCH_ARGS=("${APPEND_RDINIT[@]}"
QEMU_ARCH_ARGS=(
-dtb "${KBUILD_DIR}"/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dtb
-machine palmetto-bmc
-no-reboot)
Expand All @@ -117,7 +120,7 @@ function setup_qemu_args() {

arm32_v6)
ARCH=arm
QEMU_ARCH_ARGS=("${APPEND_RDINIT[@]}"
QEMU_ARCH_ARGS=(
-dtb "${KBUILD_DIR}"/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dtb
-machine romulus-bmc
-no-reboot)
Expand All @@ -126,23 +129,25 @@ function setup_qemu_args() {

arm32_v7)
ARCH=arm
QEMU_ARCH_ARGS=(-append "console=ttyAMA0${RDINIT}"
APPEND_STRING+="console=ttyAMA0 "
QEMU_ARCH_ARGS=(
-machine virt
-no-reboot)
QEMU=(qemu-system-arm)
;;

arm64)
KIMAGE=Image.gz
QEMU_ARCH_ARGS=(-append "console=ttyAMA0${RDINIT}"
APPEND_STRING+="console=ttyAMA0 "
QEMU_ARCH_ARGS=(
-cpu cortex-a57
-machine virt)
QEMU=(qemu-system-aarch64)
;;

mips | mipsel)
KIMAGE=vmlinux
QEMU_ARCH_ARGS=("${APPEND_RDINIT[@]}"
QEMU_ARCH_ARGS=(
-cpu 24Kf
-machine malta)
QEMU=(qemu-system-"${ARCH}")
Expand All @@ -151,7 +156,8 @@ function setup_qemu_args() {

ppc32)
ARCH=powerpc
QEMU_ARCH_ARGS=(-append "console=ttyS0${RDINIT}"
APPEND_STRING+="console=ttyS0 "
QEMU_ARCH_ARGS=(
-machine bamboo
-no-reboot)
QEMU_RAM=128m
Expand All @@ -161,7 +167,7 @@ function setup_qemu_args() {
ppc64)
ARCH=powerpc
KIMAGE=vmlinux
QEMU_ARCH_ARGS=("${APPEND_RDINIT[@]}"
QEMU_ARCH_ARGS=(
-machine pseries
-vga none)
QEMU_RAM=1G
Expand All @@ -171,7 +177,7 @@ function setup_qemu_args() {
ppc64le)
ARCH=powerpc
KIMAGE=zImage.epapr
QEMU_ARCH_ARGS=("${APPEND_RDINIT[@]}"
QEMU_ARCH_ARGS=(
-device "ipmi-bmc-sim,id=bmc0"
-device "isa-ipmi-bt,bmc=bmc0,irq=10"
-L "${IMAGES_DIR}/" -bios skiboot.lid
Expand All @@ -182,7 +188,7 @@ function setup_qemu_args() {

x86 | x86_64)
KIMAGE=bzImage
QEMU_ARCH_ARGS=(-append "console=ttyS0${RDINIT}")
APPEND_STRING+="console=ttyS0 "
# Use KVM if the processor supports it (first part) and the KVM module is loaded (second part)
[[ $(grep -c -E 'vmx|svm' /proc/cpuinfo) -gt 0 && $(lsmod 2>/dev/null | grep -c kvm) -gt 0 ]] &&
QEMU_ARCH_ARGS=("${QEMU_ARCH_ARGS[@]}" -cpu host -d "unimp,guest_errors" -enable-kvm)
Expand Down Expand Up @@ -213,6 +219,7 @@ function invoke_qemu() {
# Note: no -serial mon:stdio
"${QEMU[@]}" \
"${QEMU_ARCH_ARGS[@]}" \
-append "${APPEND_STRING}" \
-display none \
-initrd "${ROOTFS}" \
-kernel "${KERNEL}" \
Expand All @@ -239,6 +246,7 @@ function invoke_qemu() {
set -x
"${QEMU[@]}" \
"${QEMU_ARCH_ARGS[@]}" \
-append "${APPEND_STRING}" \
-display none \
-initrd "${ROOTFS}" \
-kernel "${KERNEL}" \
Expand Down