Skip to content
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

Issue running attachp gdb-tests #2144

Open
gsingh93 opened this issue May 1, 2024 · 0 comments
Open

Issue running attachp gdb-tests #2144

gsingh93 opened this issue May 1, 2024 · 0 comments

Comments

@gsingh93
Copy link
Member

gsingh93 commented May 1, 2024

I don't know why this isn't showing up on CI, but for months now I haven't been able to run ./tests.sh locally without the process being backgrounded and stopped. I can consistently reproduce with:

~/code/pwndbg attachp-tests*                                                                                                                                                                                  gsgx@gsgx-desktop 11:01:06 PM
❯ ./tests.sh -v test_attachp_command_attaches_to_procname_resolve_none
ZIGPATH set to /home/gsgx/code/pwndbg/.zig
[+] Building tls.i386.c
/home/gsgx/code/pwndbg/.zig/zig cc \
-Wall -DDEBUG=1 -ggdb -O0 -gdwarf-4 \
-target i386-linux-gnu \
-o tls.i386.out tls.i386.c
[+] Building tls.x86-64.c
/home/gsgx/code/pwndbg/.zig/zig cc \
-Wall -DDEBUG=1 -ggdb -O0 -gdwarf-4 \
-target x86_64-linux-gnu \
-o tls.x86-64.out tls.x86-64.c
[+] Building initialized_heap_x64.out
/home/gsgx/code/pwndbg/.zig/zig cc \
-Wall -DDEBUG=1 -ggdb -O0 -gdwarf-4 \
-target x86_64-linux-gnu \
-o initialized_heap_x64.out initialized_heap.c
[+] Building initialized_heap_i386_big.out
/home/gsgx/code/pwndbg/.zig/zig cc \
-Wall -DDEBUG=1 -ggdb -O0 -gdwarf-4 \
-target i386-linux-gnu \
-o initialized_heap_i386_big.out initialized_heap.c
[+] Building onegadget.x86-64.out
/home/gsgx/code/pwndbg/.zig/zig cc \
-Wall -DDEBUG=1 -ggdb -O0 -gdwarf-4 \
-target x86_64-linux-gnu \
-o onegadget.x86-64.out onegadget.c
[+] Building onegadget.i386.out
/home/gsgx/code/pwndbg/.zig/zig cc \
-Wall -DDEBUG=1 -ggdb -O0 -gdwarf-4 \
-target i386-linux-gnu \
-o onegadget.i386.out onegadget.c

Running tests in parallel
zsh: suspended (tty input)  ./tests.sh -v test_attachp_command_attaches_to_procname_resolve_none

~/code/pwndbg attachp-tests*                                                                                                                                                                                  gsgx@gsgx-desktop 11:01:12 PM
❯ fg
[1]  + continued  ./tests.sh -v test_attachp_command_attaches_to_procname_resolve_none
test_attachp_command_attaches_to_procname_resolve_none                 PASSED

pwndbg: loaded 157 pwndbg commands and 47 shell commands. Type pwndbg [--shell | --all] [filter] for a list.
pwndbg: created $rebase, $base, $ida GDB functions (can be used with print/break)
Launching pytest with args: ['/home/gsgx/code/pwndbg/tests/gdb-tests/tests/test_attachp.py::test_attachp_command_attaches_to_procname_resolve_none', '-vvv', '-s', '--showlocals', '--color=yes']
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.12.3, pytest-8.0.2, pluggy-1.5.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/gsgx/code/pwndbg/tests/gdb-tests
plugins: cov-4.1.0
collecting ... collected 1 item

tests/test_attachp.py::test_attachp_command_attaches_to_procname_resolve_none Launching command: ['gdb', '--silent', '--nx', '--nh', '--command', '../../gdbinit.py', '--eval-command', 'set attachp-resolution-method none', '--eval-command', 'attachp tmpsc6kuviy', '--eval-command', 'quit']
PASSED

============================================================================================================ 1 passed in 3.26s =============================================================================================================

test_attachp_command_attaches_to_procname_resolve_none_no_truncate     PASSED

pwndbg: loaded 157 pwndbg commands and 47 shell commands. Type pwndbg [--shell | --all] [filter] for a list.
pwndbg: created $rebase, $base, $ida GDB functions (can be used with print/break)
Launching pytest with args: ['/home/gsgx/code/pwndbg/tests/gdb-tests/tests/test_attachp.py::test_attachp_command_attaches_to_procname_resolve_none_no_truncate', '-vvv', '-s', '--showlocals', '--color=yes']
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.12.3, pytest-8.0.2, pluggy-1.5.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/gsgx/code/pwndbg/tests/gdb-tests
plugins: cov-4.1.0
collecting ... collected 1 item

tests/test_attachp.py::test_attachp_command_attaches_to_procname_resolve_none_no_truncate Launching command: ['gdb', '--silent', '--nx', '--nh', '--command', '../../gdbinit.py', '--eval-command', 'set attachp-resolution-method none', '--eval-command', 'attachp --no-truncate tmp6g5q4pz5', '--eval-command', 'quit']
PASSED

============================================================================================================ 1 passed in 3.27s =============================================================================================================

Tests completed in 3 seconds

*********************************
********* TESTS SUMMARY *********
*********************************
Tests passed or skipped: 2
Tests failed: 0

Note the "zsh: suspended (tty input) ./tests.sh -v ". The same thing happens with bash. I thought it might be related to the parallel tests, but it still happens with ./tests.sh --serial.

(To reproduce you also need to run echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant