-
Notifications
You must be signed in to change notification settings - Fork 126
Feat/x86 64 ptrace clean #1062
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
Feat/x86 64 ptrace clean #1062
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…
546d443
feat(starry): add gdb smoke test app and update mount-umount2 compat …
2001d49
fix(starry-kernel): gate #DB handler behind #[cfg(target_arch = "x86_…
6f89581
test(starryos): extend gdb batch timeout
cf73381
test(starryos): isolate gdb apk install stage
abe822b
fix(starry-kernel): harden x86_64 ptrace reg writes
a604631
fix(starryos): bundle gdb runtime for batch test
70ed6ec
fix(apps): replace docker-run gdb install with qemu-user + native apk
bd39581
fix(apps): use musl ld directly instead of qemu-user for same-arch x8…
e49f15d
fix(apps): fix gdb app prebuild with musl ld and complete runtime assets
7df142f
fix(apps): enable virtio-blk and virtio-net drivers for gdb app
c98b513
fix(apps): add missing virtio-gpu, virtio-input, virtio-socket features
d517d01
fix(axbuild): handle symlinks in overlay injection via debugfs
1b73808
chore(ci): trigger re-run
4d68178
chore(ci): trigger re-run 2
052e3b0
fix(starry-kernel): add x86_64 ptrace FP register support (GETFPREGS/…
cc91ae0
fix(axbuild): swap debugfs symlink args to link-path-first order
4936b93
fix(starry-kernel): detach live tracees when tracer exits
0e9bd47
fix(starry-kernel): align x86 ptrace fp snapshots
d06ce5d
fix(starry-kernel): stabilize x86 native gdb ptrace flow
73bb8dd
fix(starry-kernel): clean up ptrace gdb follow-up fixes
6c74709
fix(starry-mm): fix file_read_offset computation for unaligned COW split
d501b87
fix(starry-kernel): fix clippy manual_is_multiple_of warning
59eb698
fix(starry-mm): extend file_end to cover PT_TLS init image and add ex…
b75339d
fix(starry-mm): add AT_NULL auxv terminator to prevent ldso out-of-bo…
8119073
chore(ci): re-trigger CI
bef54ec
test(starry): add SIGSEGV detection to board test fail_regex patterns
9c2fa59
chore(ci): re-trigger CI after rustc segfault flake
7176e13
fix(starry-mm): add AT_NULL auxv terminator and execve/loader diagnos…
7f229da
fix(starry-mm): flush I-cache after populating executable pages on ri…
0ac9325
fix(starry-mm): write back D-cache after populating executable pages …
4acf7e4
chore(starry-mm): dump full auxv and entry bytes for SG2002 crash triage
932e49e
fix(starry-mm): read unaligned COW segment first page from correct fi…
d6472d7
chore(ci): trigger CI after sync with main
3a74f52
chore(starry): add proc maps area diagnostics for bug-proc-maps-lseek…
0706148
fix(starry): fix bug-proc-maps-lseek-refresh test failure
acf9926
fix: resolve merge conflicts with upstream/dev PR #1167
6f8c72b
fix: complete per-TID ptrace API migration and execve stop semantics
0c49be9
fix(starry-kernel): correct x86_64 ptrace single-step, exec-stop and …
89da2a7
test(starry): convert test-gdb-native-batch to a raw-ptrace tracer
6203978
test(starry): migrate x86 ptrace/gdb cases into grouped system and fi…
3be29fd
chore(ci): re-trigger CI after roc-rk3568 board u-boot flake
ad7a381
ci: trigger test run
9f82a3b
ci: trigger test run
84fd212
chore: remove accidentally committed internal ptrace/gdb reports
6a52a09
fix(axbuild): tolerate slow guests in host HTTP test server
de4d22a
test(starry): wire x86 ptrace/gdb cases into grouped system runner
3b6514b
fix(starry-kernel): rebase x86_64 ptrace onto upstream/dev per-tid ba…
589c680
fix(starry-kernel): store full FxsaveArea in x86_64 PtraceStopFpData
070f2b0
fix(starry): downgrade loader/execve logs to debug, restore kernel #D…
c06dc18
test(starry): add x86_64 ptrace FP register coverage
3024d98
fix(starry-kernel): remove duplicate ptrace_setregset_prstatus, fix a…
9de4ef1
chore: fmt execve.rs register call
13b9c05
fix(starry-kernel): remove unused VirtAddr and DirectRwFsFileOps impo…
d776c4b
chore: fmt proc.rs import line
1cd347f
fix(starry-kernel): gate format_statm/format_status_vm_lines with cfg…
6f88897
fix(starry-kernel): gate alloc::format import with cfg(test)
9f263d9
chore: reorder stats.rs imports for fmt
9ba1caa
Merge branch 'dev' into feat/x86_64-ptrace-clean
54dK3n 1f30182
fix(starry-kernel): scope ptrace get/setfpregs cfg to all non-x86 arches
830ad84
fix(starry-kernel): restore /proc features dropped by a bad merge revert
b6e779e
fix(axbuild): restore upstream overlay symlink injection
5bfaddf
fix(starry-kernel): un-gate ProcessMemStats format methods for /proc
55ec2db
chore: remove accidentally committed GitHub page snapshot
356fadf
fix(starry): use STARRY_ROOTFS in gdb app prebuild
493f6b1
refactor(starry-kernel): converge x86_64 GP registers into ArchUserRe…
ba2cbe4
Merge remote-tracking branch 'upstream/dev' into feat/x86_64-ptrace-c…
d9ba075
fix(starry): use dynamic platform for gdb x86_64 app build config
66ddbf9
Merge remote-tracking branch 'upstream/dev' into feat/x86_64-ptrace-c…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", | ||
| "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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.