[PATCH v5 0/8] Always use 32-bit time_t for certain syscalls
Alistair Francis
alistair23@gmail.com
Mon Apr 6 18:02:48 GMT 2020
On Mon, Apr 6, 2020 at 10:45 AM Alistair Francis <alistair23@gmail.com> wrote:
>
> On Mon, Apr 6, 2020 at 10:48 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
> >
> > On Apr 06 2020, Adhemerval Zanella wrote:
> >
> > > On 06/04/2020 14:07, Andreas Schwab wrote:
> > >> On Apr 06 2020, Adhemerval Zanella wrote:
> > >>
> > >>> I am not familiar with build-vm command, which would be a easy
> > >>> way to try reproduce it?
> > >>
> > >> Just run any shell script.
> > >>
> > >> See <878sjb5mml.fsf@igel.home>.
> > >>
> > >> Andreas.
> > >>
> > >
> > > I built a bash 5.0 for i686 and I am trying to reproduce it
> > > with master (4531ba8ebfedf):
> > >
> > > i686-linux-gnu$ file /tmp/bash-5.0/install/bin/bash
> > > /tmp/bash-5.0/install/bin/bash: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, BuildID[sha1]=7468b3013138231097ec41a9b35826febc576939, for GNU/Linux 3.2.0, with debug_info, not stripped
> > > i686-linux-gnu$ cat test.sh
> > > echo $@
> > > i686-linux-gnu$ ./testrun.sh /tmp/bash-5.0/install/bin/bash ./test.sh ... +++ ===
> > > ... +++ ===
> > >
> > > What am I missing here?
> >
> > Probably a modern kernel.
>
> I'm building a ARMv7 rootFS and 5.4 kernel now. I'll try to reproduce
> the problem.
I have what I think is a fix based on some other comments on the list.
Testing now then I'll send the patch.
This is the diff:
diff --git a/sysdeps/unix/sysv/linux/wait4.c b/sysdeps/unix/sysv/linux/wait4.c
index d14bd4da27..796691eb2b 100644
--- a/sysdeps/unix/sysv/linux/wait4.c
+++ b/sysdeps/unix/sysv/linux/wait4.c
@@ -32,10 +32,7 @@ __wait4_time64 (pid_t pid, int *stat_loc, int
options, struct __rusage64 *usage)
struct __rusage32 usage32;
pid_t ret = SYSCALL_CANCEL (wait4, pid, stat_loc, options, &usage32);
- if (ret != 0)
- return ret;
-
- if (usage != NULL)
+ if (ret > 0 && usage != NULL)
rusage32_to_rusage64 (&usage32, usage);
return ret;
@@ -119,10 +116,8 @@ __wait4 (pid_t pid, int *stat_loc, int options,
struct rusage *usage)
ret = __wait4_time64 (pid, stat_loc, options, &usage64);
- if (ret != 0)
- return ret;
-
- rusage64_to_rusage (&usage64, usage);
+ if (ret > 0 && usage != NULL)
+ rusage64_to_rusage (&usage64, usage);
return ret;
}
Alistair
>
> Alistair
>
> >
> > Andreas.
> >
> > --
> > Andreas Schwab, schwab@linux-m68k.org
> > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> > "And now for something completely different."
More information about the Libc-alpha
mailing list