Skip to content

arm chroot problem - [!] Command 'context' failed to execute properly, reason: attempted relative import with no known parent package #125

@micsthepick

Description

@micsthepick

Bug Report

  • Is your bug specific to GEF (not GDB)? - Try to reproduce it running gdb -nx
  • Did you search through the documentation first?
  • Did you check issues (including
    the closed ones) - and the PR?

Step 1: Describe your environment

  • Operating System / Distribution: Debian (+ arm7 alpine rootfs chroot for target)
  • Architecture: amd64 or x86_64
  • GEF version (including the Python library version) run version in GEF.
    GEF: (Standalone)
    Blob Hash(/home/mike/.gef-revisit-target-remote.py): 7363309ca813527fba7d73038dc43d4770417eed
    SHA256(/home/mike/.gef-revisit-target-remote.py): dcaa4fc5b8218d14124f9e391f972c8ebb05e534dc90ed9e51f22e905e50412c
    GDB: 13.1
    GDB-Python: 3.11

Step 2: Describe your problem

Steps to reproduce

  1. breaking on certain syscalls? in an arm 32 bit chroot.

Minimalist test case

# enable qemu-user-static and binfmt like so: https://gist.github.com/gokart23/8ade2d431ead2de47340160301837cab 
wget https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/armhf/alpine-minirootfs-3.21.3-armhf.tar.gz
tar xzf ./alpine-minirootfs-3.21.3-armhf.tar.gz
cp $(which qemu-arm-static) ./$(which qemu-arm-static
sudo chroot . $(which qemu-arm-static) -g 4444 /usr/bin/scanelf -v

<open another terminal in same dir>
gdb-multiarch -ex "set systroot ." -ex "file ./lib/libc.musl-armhf.so.1" -ex "target remote localhost:4444" -ex "b __uflow" -ex "c"
# or use gef-remote with appropriate params if on main

Observed Results

  • context fails to print the gef-extras
─────────────────────────────────────────────────────────────────────────────────────────── threads ────
[#0] Id 1, stopped 0x3f7af94c in __uflow (), reason: BREAKPOINT
───────────────────────────────────────────────────────────────────────────────────────────── trace ────
[#0] 0x3f7af94c → __uflow()
[#1] 0x3f7b1f70 → getdelim()
────────────────────────────────────────────────────────────────────────── Glibc Function Arguments ────
[!] Command 'context' failed to execute properly, reason: attempted relative import with no known parent package

Expected results

  • No errors when printing context

Traces

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions