public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug server/26116] New: gdbserver with zsh as the shell hangs at startup when .zshenv forks
@ 2020-06-14  2:49 simark at simark dot ca
  2020-12-04  6:23 ` [Bug server/26116] " dajiang0055 at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: simark at simark dot ca @ 2020-06-14  2:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26116

            Bug ID: 26116
           Summary: gdbserver with zsh as the shell hangs at startup when
                    .zshenv forks
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: server
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

When using zsh as the shell and a command that forks in ~/.zshenv, like
`/bin/echo` here (plain `echo` is the shell builtin, which doesn't fork):

$ cat ~/.zshenv 
echo Before
/bin/echo Hello
echo After

... gdbserver hangs at startup

$ SHELL=zsh ./gdbserver localhost:9000 /bin/ls 
Before
Hello
<hangs here>

Note that when using a similar bash feature, the BASH_ENV environment variable,
it doesn't hang:

$ SHELL=bash BASH_ENV=~/.zshenv ./gdbserver localhost:9000 /bin/ls 
Before
Hello
After
Process /bin/ls created; pid = 745096
Listening on port 9000

It's also possible that the issue is in zsh, but I haven't dug enough to
understand what's happening exactly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug server/26116] gdbserver with zsh as the shell hangs at startup when .zshenv forks
  2020-06-14  2:49 [Bug server/26116] New: gdbserver with zsh as the shell hangs at startup when .zshenv forks simark at simark dot ca
@ 2020-12-04  6:23 ` dajiang0055 at gmail dot com
  2021-05-05  2:14 ` corydoras at ridiculousfish dot com
  2024-04-22 12:44 ` k4lizen at proton dot me
  2 siblings, 0 replies; 4+ messages in thread
From: dajiang0055 at gmail dot com @ 2020-12-04  6:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26116

dajiang0055 at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dajiang0055 at gmail dot com

--- Comment #1 from dajiang0055 at gmail dot com ---
I had the same problem with tcsh. 
It seems that gdbserver hangs in sigsuspend() and wait for SIGTRAP.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug server/26116] gdbserver with zsh as the shell hangs at startup when .zshenv forks
  2020-06-14  2:49 [Bug server/26116] New: gdbserver with zsh as the shell hangs at startup when .zshenv forks simark at simark dot ca
  2020-12-04  6:23 ` [Bug server/26116] " dajiang0055 at gmail dot com
@ 2021-05-05  2:14 ` corydoras at ridiculousfish dot com
  2024-04-22 12:44 ` k4lizen at proton dot me
  2 siblings, 0 replies; 4+ messages in thread
From: corydoras at ridiculousfish dot com @ 2021-05-05  2:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26116

ridiculous_fish <corydoras at ridiculousfish dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |corydoras at ridiculousfish dot co
                   |                            |m

--- Comment #2 from ridiculous_fish <corydoras at ridiculousfish dot com> ---
fish shell is also seeing this - see
https://github.com/fish-shell/fish-shell/issues/7957

My investigation got as far as follows: gdbserver forks in preparation for
exec'ing the shell. Before exec, it requests ptrace on itself (in
`linux_ptrace_fun`). This causes signals to be delivered to gdbserver before
the inferior shell; however gdbserver does not then arrange for the signal to
be delivered to the shell so it is dropped. fish (and presumably zsh) relies on
SIGCHLD to reap processes, so fish ends up hanging.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug server/26116] gdbserver with zsh as the shell hangs at startup when .zshenv forks
  2020-06-14  2:49 [Bug server/26116] New: gdbserver with zsh as the shell hangs at startup when .zshenv forks simark at simark dot ca
  2020-12-04  6:23 ` [Bug server/26116] " dajiang0055 at gmail dot com
  2021-05-05  2:14 ` corydoras at ridiculousfish dot com
@ 2024-04-22 12:44 ` k4lizen at proton dot me
  2 siblings, 0 replies; 4+ messages in thread
From: k4lizen at proton dot me @ 2024-04-22 12:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26116

k4lizen <k4lizen at proton dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k4lizen at proton dot me

--- Comment #3 from k4lizen <k4lizen at proton dot me> ---
Encountered this downstream:
https://github.com/Gallopsled/pwntools/issues/2377
    workaround: https://github.com/Gallopsled/pwntools/pull/2378

https://github.com/Gallopsled/pwntools/pull/2321
    which links: https://github.com/Gallopsled/pwntools/issues/2030
                 https://github.com/Gallopsled/pwntools/issues/2060
                
https://github.com/cvanloo/rop/blob/ec10a12e3256344e38e4c745781962f5245f5715/README.md?plain=1#L481

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-22 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14  2:49 [Bug server/26116] New: gdbserver with zsh as the shell hangs at startup when .zshenv forks simark at simark dot ca
2020-12-04  6:23 ` [Bug server/26116] " dajiang0055 at gmail dot com
2021-05-05  2:14 ` corydoras at ridiculousfish dot com
2024-04-22 12:44 ` k4lizen at proton dot me

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).