Skip to content
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
d41bd12
feat(starry-kernel): x86_64 ptrace register r/w and PTRACE_SINGLESTEP…
May 31, 2026
546d443
feat(starry): add gdb smoke test app and update mount-umount2 compat …
May 31, 2026
2001d49
fix(starry-kernel): gate #DB handler behind #[cfg(target_arch = "x86_…
May 31, 2026
6f89581
test(starryos): extend gdb batch timeout
May 31, 2026
cf73381
test(starryos): isolate gdb apk install stage
May 31, 2026
abe822b
fix(starry-kernel): harden x86_64 ptrace reg writes
Jun 2, 2026
a604631
fix(starryos): bundle gdb runtime for batch test
Jun 2, 2026
70ed6ec
fix(apps): replace docker-run gdb install with qemu-user + native apk
Jun 2, 2026
bd39581
fix(apps): use musl ld directly instead of qemu-user for same-arch x8…
Jun 2, 2026
e49f15d
fix(apps): fix gdb app prebuild with musl ld and complete runtime assets
Jun 2, 2026
7df142f
fix(apps): enable virtio-blk and virtio-net drivers for gdb app
Jun 2, 2026
c98b513
fix(apps): add missing virtio-gpu, virtio-input, virtio-socket features
Jun 2, 2026
d517d01
fix(axbuild): handle symlinks in overlay injection via debugfs
Jun 2, 2026
1b73808
chore(ci): trigger re-run
Jun 2, 2026
4d68178
chore(ci): trigger re-run 2
Jun 2, 2026
052e3b0
fix(starry-kernel): add x86_64 ptrace FP register support (GETFPREGS/…
Jun 3, 2026
cc91ae0
fix(axbuild): swap debugfs symlink args to link-path-first order
Jun 4, 2026
4936b93
fix(starry-kernel): detach live tracees when tracer exits
Jun 5, 2026
0e9bd47
fix(starry-kernel): align x86 ptrace fp snapshots
Jun 5, 2026
d06ce5d
fix(starry-kernel): stabilize x86 native gdb ptrace flow
Jun 5, 2026
73bb8dd
fix(starry-kernel): clean up ptrace gdb follow-up fixes
Jun 5, 2026
6c74709
fix(starry-mm): fix file_read_offset computation for unaligned COW split
Jun 5, 2026
d501b87
fix(starry-kernel): fix clippy manual_is_multiple_of warning
Jun 5, 2026
59eb698
fix(starry-mm): extend file_end to cover PT_TLS init image and add ex…
Jun 5, 2026
b75339d
fix(starry-mm): add AT_NULL auxv terminator to prevent ldso out-of-bo…
Jun 5, 2026
8119073
chore(ci): re-trigger CI
Jun 5, 2026
bef54ec
test(starry): add SIGSEGV detection to board test fail_regex patterns
Jun 6, 2026
9c2fa59
chore(ci): re-trigger CI after rustc segfault flake
Jun 6, 2026
7176e13
fix(starry-mm): add AT_NULL auxv terminator and execve/loader diagnos…
Jun 6, 2026
7f229da
fix(starry-mm): flush I-cache after populating executable pages on ri…
Jun 6, 2026
0ac9325
fix(starry-mm): write back D-cache after populating executable pages …
Jun 6, 2026
4acf7e4
chore(starry-mm): dump full auxv and entry bytes for SG2002 crash triage
Jun 6, 2026
932e49e
fix(starry-mm): read unaligned COW segment first page from correct fi…
Jun 6, 2026
d6472d7
chore(ci): trigger CI after sync with main
Jun 6, 2026
3a74f52
chore(starry): add proc maps area diagnostics for bug-proc-maps-lseek…
Jun 7, 2026
0706148
fix(starry): fix bug-proc-maps-lseek-refresh test failure
Jun 7, 2026
acf9926
fix: resolve merge conflicts with upstream/dev PR #1167
Jun 8, 2026
6f8c72b
fix: complete per-TID ptrace API migration and execve stop semantics
Jun 8, 2026
0c49be9
fix(starry-kernel): correct x86_64 ptrace single-step, exec-stop and …
Jun 9, 2026
89da2a7
test(starry): convert test-gdb-native-batch to a raw-ptrace tracer
Jun 9, 2026
6203978
test(starry): migrate x86 ptrace/gdb cases into grouped system and fi…
Jun 10, 2026
3be29fd
chore(ci): re-trigger CI after roc-rk3568 board u-boot flake
Jun 10, 2026
ad7a381
ci: trigger test run
Jun 10, 2026
9f82a3b
ci: trigger test run
Jun 11, 2026
84fd212
chore: remove accidentally committed internal ptrace/gdb reports
Jun 11, 2026
6a52a09
fix(axbuild): tolerate slow guests in host HTTP test server
Jun 11, 2026
de4d22a
test(starry): wire x86 ptrace/gdb cases into grouped system runner
Jun 11, 2026
3b6514b
fix(starry-kernel): rebase x86_64 ptrace onto upstream/dev per-tid ba…
Jun 17, 2026
589c680
fix(starry-kernel): store full FxsaveArea in x86_64 PtraceStopFpData
Jun 17, 2026
070f2b0
fix(starry): downgrade loader/execve logs to debug, restore kernel #D…
Jun 17, 2026
c06dc18
test(starry): add x86_64 ptrace FP register coverage
Jun 17, 2026
3024d98
fix(starry-kernel): remove duplicate ptrace_setregset_prstatus, fix a…
Jun 17, 2026
9de4ef1
chore: fmt execve.rs register call
Jun 17, 2026
13b9c05
fix(starry-kernel): remove unused VirtAddr and DirectRwFsFileOps impo…
Jun 17, 2026
d776c4b
chore: fmt proc.rs import line
Jun 17, 2026
1cd347f
fix(starry-kernel): gate format_statm/format_status_vm_lines with cfg…
Jun 17, 2026
6f88897
fix(starry-kernel): gate alloc::format import with cfg(test)
Jun 17, 2026
9f263d9
chore: reorder stats.rs imports for fmt
Jun 17, 2026
9ba1caa
Merge branch 'dev' into feat/x86_64-ptrace-clean
54dK3n Jun 17, 2026
1f30182
fix(starry-kernel): scope ptrace get/setfpregs cfg to all non-x86 arches
Jun 17, 2026
830ad84
fix(starry-kernel): restore /proc features dropped by a bad merge revert
Jun 17, 2026
b6e779e
fix(axbuild): restore upstream overlay symlink injection
Jun 17, 2026
5bfaddf
fix(starry-kernel): un-gate ProcessMemStats format methods for /proc
Jun 17, 2026
55ec2db
chore: remove accidentally committed GitHub page snapshot
Jun 18, 2026
356fadf
fix(starry): use STARRY_ROOTFS in gdb app prebuild
Jun 18, 2026
493f6b1
refactor(starry-kernel): converge x86_64 GP registers into ArchUserRe…
Jun 18, 2026
ba2cbe4
Merge remote-tracking branch 'upstream/dev' into feat/x86_64-ptrace-c…
Jun 18, 2026
d9ba075
fix(starry): use dynamic platform for gdb x86_64 app build config
Jun 18, 2026
66ddbf9
Merge remote-tracking branch 'upstream/dev' into feat/x86_64-ptrace-c…
Jun 18, 2026
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ third_party/
os/StarryOS-REF
.Ds_Store
starry-*.log
loongarch64-axvisor-guest-tests.md
loongarch64-axvisor-guest-tests.md

# GitHub page snapshots accidentally saved into the repo
*rcore-os_tgoskits*.html
14 changes: 14 additions & 0 deletions apps/starry/gdb/build-x86_64-unknown-none.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
target = "x86_64-unknown-none"
env = { AX_IP = "10.0.2.15", AX_GW = "10.0.2.2" }
log = "Warn"
features = [
"ax-hal/x86-pc",
Comment thread
ZR233 marked this conversation as resolved.
Outdated
"qemu",
"ax-driver/plat-static",
"ax-driver/virtio-blk",
"ax-driver/virtio-net",
"ax-driver/virtio-gpu",
"ax-driver/virtio-input",
"ax-driver/virtio-socket",
]
plat_dyn = false
177 changes: 177 additions & 0 deletions apps/starry/gdb/prebuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
#!/usr/bin/env bash
set -euo pipefail

app_dir="${STARRY_APP_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
base_rootfs="${STARRY_ROOTFS:-${STARRY_BASE_ROOTFS:-}}"
staging_root="${STARRY_STAGING_ROOT:-}"
overlay_dir="${STARRY_OVERLAY_DIR:-}"

READELF="${READELF:-readelf}"

require_env() {
local name="$1"
local value="$2"
if [[ -z "$value" ]]; then
echo "error: $name is required" >&2
exit 1
fi
}

ensure_host_tools() {
local missing=()

command -v debugfs >/dev/null 2>&1 || missing+=(e2fsprogs)
command -v install >/dev/null 2>&1 || missing+=(coreutils)
command -v "$READELF" >/dev/null 2>&1 || missing+=("readelf (binutils)")

if [[ ${#missing[@]} -eq 0 ]]; then
return
fi

if ! command -v apt-get >/dev/null 2>&1; then
echo "error: missing required host packages and apt-get is unavailable: ${missing[*]}" >&2
exit 1
fi

echo "installing missing host packages: ${missing[*]}"
apt-get update
apt-get install -y --no-install-recommends "${missing[@]}"
}

extract_base_rootfs() {
debugfs -R "rdump / $staging_root" "$base_rootfs"
}

ensure_musl_ld() {
local musl_ld="$staging_root/lib/ld-musl-x86_64.so.1"

if [[ ! -x "$musl_ld" ]]; then
echo "error: musl dynamic linker not found: $musl_ld" >&2
exit 1
fi
}

install_gdb_package() {
local musl_ld="$staging_root/lib/ld-musl-x86_64.so.1"
local guest_apk="$staging_root/sbin/apk"
local apk_cache="${STARRY_WORKSPACE:-$(cd "$app_dir/../../.." && pwd)}/target/gdb-apk-cache"

mkdir -p "$apk_cache"

if [[ ! -x "$guest_apk" ]]; then
echo "error: staging root is missing guest apk: $guest_apk" >&2
exit 1
fi

if [[ -f /etc/resolv.conf ]]; then
cp /etc/resolv.conf "$staging_root/etc/resolv.conf"
fi

echo "Installing gdb via musl ld (Alpine x86_64)..."
"$musl_ld" \
--library-path "$staging_root/lib:$staging_root/usr/lib:$staging_root/usr/local/lib" \
"$guest_apk" \
--root "$staging_root" \
--repositories-file "$staging_root/etc/apk/repositories" \
--keys-dir "$staging_root/etc/apk/keys" \
--cache-dir "$apk_cache" \
--update-cache \
--timeout 60 \
--no-interactive \
--force-no-chroot \
--scripts=no \
add gdb
}

copy_file_to_overlay() {
local guest_path="$1"
local mode="$2"
local source="$staging_root${guest_path}"
local target="$overlay_dir${guest_path}"

if [[ ! -e "$source" ]]; then
echo "error: missing guest file after gdb package install: $guest_path" >&2
exit 1
fi

if [[ -L "$source" ]]; then
source="$(readlink -f "$source")"
fi

install -Dm"$mode" "$source" "$target"
}

find_library_path() {
local library="$1"
local dir

for dir in lib usr/lib usr/local/lib; do
if [[ -e "$staging_root/$dir/$library" ]]; then
printf '/%s/%s\n' "$dir" "$library"
return 0
fi
done

return 1
}

copy_runtime_dependencies() {
local pending=("$@")
local seen=" "
local guest_path library

while [[ ${#pending[@]} -gt 0 ]]; do
guest_path="${pending[0]}"
pending=("${pending[@]:1}")

if [[ "$seen" == *" $guest_path "* ]]; then
continue
fi
seen+="$guest_path "

while IFS= read -r library; do
local library_path
if ! library_path="$(find_library_path "$library")"; then
continue
fi
copy_file_to_overlay "$library_path" 0644
pending+=("$library_path")
done < <(
"$READELF" -d "$staging_root$guest_path" 2>/dev/null |
sed -n 's/.*Shared library: \[\(.*\)\].*/\1/p'
)
done
}

populate_overlay() {
copy_file_to_overlay /usr/bin/gdb 0755
copy_file_to_overlay /usr/bin/python3 0755
copy_runtime_dependencies /usr/bin/gdb /usr/bin/python3

if [[ -d "$staging_root/usr/share/gdb" ]]; then
mkdir -p "$overlay_dir/usr/share"
cp -rL "$staging_root/usr/share/gdb" "$overlay_dir/usr/share/"
fi
if [[ -d "$staging_root/usr/lib/python3.12" ]]; then
mkdir -p "$overlay_dir/usr/lib"
cp -rL "$staging_root/usr/lib/python3.12" "$overlay_dir/usr/lib/"
fi
if [[ -e "$staging_root/usr/lib/python312.zip" ]]; then
copy_file_to_overlay /usr/lib/python312.zip 0644
fi
for lib in "$staging_root"/usr/lib/libpython3.12.so*; do
if [[ -f "$lib" ]] && [[ ! -L "$lib" ]]; then
copy_file_to_overlay "/usr/lib/$(basename "$lib")" 0644
fi
done
}

require_env STARRY_ROOTFS "$base_rootfs"
require_env STARRY_STAGING_ROOT "$staging_root"
require_env STARRY_OVERLAY_DIR "$overlay_dir"

ensure_host_tools
extract_base_rootfs
ensure_musl_ld
install_gdb_package
populate_overlay
17 changes: 17 additions & 0 deletions apps/starry/gdb/qemu-x86_64-interactive.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
args = [
"-nographic",
"-m",
"512M",
"-device",
"virtio-blk-pci,drive=disk0",
"-drive",
"id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-x86_64-alpine.img",
"-device",
"virtio-net-pci,netdev=net0",
"-netdev",
"user,id=net0",
]
uefi = false
to_bin = false
shell_prefix = "root@starry:"
timeout = 3600
20 changes: 20 additions & 0 deletions apps/starry/gdb/qemu-x86_64.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
args = [
"-nographic",
"-m",
"512M",
"-device",
"virtio-blk-pci,drive=disk0",
"-drive",
"id=disk0,if=none,format=raw,file=${workspace}/tmp/axbuild/rootfs/rootfs-x86_64-alpine.img",
"-device",
"virtio-net-pci,netdev=net0",
"-netdev",
"user,id=net0",
]
uefi = false
to_bin = false
shell_prefix = "root@starry:"
shell_init_cmd = "gdb --version && echo GDB_SMOKE_PASSED"
success_regex = ["(?m)^GDB_SMOKE_PASSED\\s*$"]
fail_regex = ['(?i)\bpanic(?:ked)?\b']
timeout = 120
2 changes: 1 addition & 1 deletion components/axcpu/src/x86_64/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct ContextSwitchFrame {
/// See <https://www.felixcloutier.com/x86/fxsave> for more details.
#[allow(missing_docs)]
#[repr(C, align(16))]
#[derive(Debug)]
#[derive(Clone, Copy, Debug)]
pub struct FxsaveArea {
pub fcw: u16,
pub fsw: u16,
Expand Down
7 changes: 7 additions & 0 deletions components/axcpu/src/x86_64/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ fn handle_debug(tf: &mut TrapFrame) {
if crate::trap::debug_handler(tf) {
return;
}
// Kernel-mode #DB was not claimed by any handler.
// Unclaimed user-mode #DB is routed through the user-space exception loop
// (.Ltrap_user → .Lexit_user in trap.S), so `x86_trap_handler` is only
// reached for kernel-mode traps. An unhandled kernel #DB is a fatal
// condition: if resumed the CPU re-executes the faulting instruction,
// likely looping into a triple fault.
warn!("Unhandled kernel #DB @ {:#x}", tf.rip);
let bt = tf.backtrace();
panic!(
"Unhandled #DB @ {:#x}, error_code={:#x}:\n{:#x?}\n{}",
Expand Down
Loading
Loading