On Sun, Aug 15 2021, Claus Assmann <ca+openbsd_m...@esmtp.org> wrote:
> I must misunderstand something about wait (sh command), but I'm not
> sure what: why does wait return 127 for an existing process?
>
> $ PM=31309;kill -HUP $PM; echo $?; ps -p $PM; wait $PM; echo $?; ps -p $PM
> 0 
>   PID TT  STAT        TIME COMMAND
> 31309 p0  S        0:00.03 ../libpmilter/t-pmilter-1 -r m=550
> 127
>   PID TT  STAT        TIME COMMAND
> 31309 p0  S        0:00.03 ../libpmilter/t-pmilter-1 -r m=550
> $ wait $PM; echo $?
> 127
> $ kill -0 $PM;echo $?
> 0
>
> (OpenBSD 6.8)
>
> I guess the (multi-threaded) process is in some "weird" state?

I think Andreas provided a good answer already,

> PS: it seems I can't attach a debugger either:
> $ egdb -p $PM ../libpmilter/t-pmilter-0
> GNU gdb (GDB) 7.12.1
> ...
> Reading symbols from ../libpmilter/t-pmilter-0...done.
> Attaching to program: /home/ca/sm-9/openbsd-111/libpmilter/t-pmilter-0, 
> process 31309
> ptrace: Operation not permitted.

About this one:

revision 1.66
date: 2014/12/12 07:45:46;  author: tedu;  state: Exp;  lines: +9 -1;  
commitid: tOiu53jgNjU0V5Os;
sysctl kern.global_ptrace.
controls whether you can ptrace any process with appropriate privileges
or only one own's children.
ok deraadt

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to