Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1d2SXPFG2oXUh7LrkVgjcDnoH2TYy_HNaHFocVO8KEGA@mail.gmail.com>
Date: Thu, 3 Sep 2020 17:36:24 +0200
From: Arnd Bergmann <arnd@...db.de>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 07/14] Emulate wait4 using waitid

On Thu, Sep 3, 2020 at 4:56 PM Stefan O'Rear <sorear@...tmail.com> wrote:
>
> On Thu, Sep 3, 2020, at 7:23 AM, Stefan O'Rear wrote:
> > +             case CLD_STOPPED:
> > +             case CLD_TRAPPED:
> > +                     sw = ((info.si_status&0xff) << 8) + 0x7f;
> > +                     break;
>
> This is trying to be defensive but it is the cause of the strace issue
> in the cover letter since the ptrace interface generates si_status
> greater than 8 bits which must be visible in WSTOPSIG; the v2 will not
> mask here.

Ah, I was trying to find out what exactly the masking was for since
I did not have that in my original version of the same function for Arm:


+       if (status) {
+               *status = 0;
+               switch (info.si_code) {
+               case CLD_EXITED:
+                       *status = info.si_status << 8;
+                       break;
+               case CLD_DUMPED:
+                       *status = 0x80;
+               case CLD_KILLED:
+                       *status |= info.si_status;
+                       break;
+               case CLD_TRAPPED:
+               case CLD_STOPPED:
+                       *status = info.si_status << 8 | 0x7f;
+                       break;
+               case CLD_CONTINUED:
+                       *status = 0xffff;
+                       break;
+               }
+       }

Aside from the mask, this seems to be functionally the same.

      Arnd

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.