All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: riscv32 wait() problem, qemu or glibc?
@ 2020-09-14 16:23 Andreas K. Huettel
  2020-09-19 20:33 ` Palmer Dabbelt
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas K. Huettel @ 2020-09-14 16:23 UTC (permalink / raw)
  To: qemu-riscv

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]

[forwarding this also to qemu-riscv, not sure what's the right list]
An: qemu-devel@nongnu.org, libc-alpha@sourceware.org

Hi, 

first of all, sorry for crossposting, but I'm dealing with many moving and 
experimental parts here... 

Situation: riscv32 (ilp32) qemu-user [1] chroot, Linux [2], glibc [3], gcc [4]

The following small program outputs "child exited with status 40", which is 
rather unexpected (it should be 42). Any idea what is going on?

(This is a simplified version of code in a configure test. The test has other 
potential issues [5], but in any case it cant produce useful results on 
riscv32 right now.)

TIA, 
Andreas

====================================
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>

main(c, v)
     int c;
     char **v;
{
  pid_t pid, p;
  int s, i, n;

  s = 0;
  pid = fork();
  if (pid == 0)
    exit (42);

  /* wait for the process */
  p = wait(&s);
  if (p != pid)
    exit (255);

  if (WIFEXITED(s))
  {
     int r=WEXITSTATUS(s);
     printf("child exited with status %i\n",r);
  }
}
====================================


[1] qemu built from git master, Sep 12, 2020 16:30:37 EEST
[2] host kernel is 5.8.8
[3] glibc-2.32 with the rv32 patch series backported from master
[4] (Gentoo 10.2.0-r1 p2)
[5] https://lists.gnu.org/archive/html/bug-bash/2020-09/msg00033.html

-- 
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer 
(council, qa, toolchain, base-system, perl, libreoffice)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Fwd: riscv32 wait() problem, qemu or glibc?
  2020-09-14 16:23 Fwd: riscv32 wait() problem, qemu or glibc? Andreas K. Huettel
@ 2020-09-19 20:33 ` Palmer Dabbelt
  2020-09-19 20:41   ` Andreas K. Hüttel
  0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2020-09-19 20:33 UTC (permalink / raw)
  To: dilfridge; +Cc: qemu-riscv

On Mon, 14 Sep 2020 09:23:10 PDT (-0700), dilfridge@gentoo.org wrote:
> [forwarding this also to qemu-riscv, not sure what's the right list]
> An: qemu-devel@nongnu.org, libc-alpha@sourceware.org
>
> Hi, 
>
> first of all, sorry for crossposting, but I'm dealing with many moving and 
> experimental parts here... 
>
> Situation: riscv32 (ilp32) qemu-user [1] chroot, Linux [2], glibc [3], gcc [4]
>
> The following small program outputs "child exited with status 40", which is 
> rather unexpected (it should be 42). Any idea what is going on?
>
> (This is a simplified version of code in a configure test. The test has other 
> potential issues [5], but in any case it cant produce useful results on 
> riscv32 right now.)
>
> TIA, 
> Andreas
>
> ====================================
> #include <stdlib.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <sys/wait.h>
>
> main(c, v)
>      int c;
>      char **v;
> {
>   pid_t pid, p;
>   int s, i, n;
>
>   s = 0;
>   pid = fork();
>   if (pid == 0)
>     exit (42);
>
>   /* wait for the process */
>   p = wait(&s);
>   if (p != pid)
>     exit (255);
>
>   if (WIFEXITED(s))
>   {
>      int r=WEXITSTATUS(s);
>      printf("child exited with status %i\n",r);
>   }
> }
> ====================================
>
>
> [1] qemu built from git master, Sep 12, 2020 16:30:37 EEST
> [2] host kernel is 5.8.8
> [3] glibc-2.32 with the rv32 patch series backported from master
> [4] (Gentoo 10.2.0-r1 p2)
> [5] https://lists.gnu.org/archive/html/bug-bash/2020-09/msg00033.html
>
> -- 
> Andreas K. Hüttel
> dilfridge@gentoo.org
> Gentoo Linux developer 
> (council, qa, toolchain, base-system, perl, libreoffice)

I don't see any replies to this, but for some reason I remember having seen
some.  Did this get resolved in some other thread?  I'd bet that it's a bug in
rv32 user-mode emulation, as that's been only lightly used so far.


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

* Re: Fwd: riscv32 wait() problem, qemu or glibc?
  2020-09-19 20:33 ` Palmer Dabbelt
@ 2020-09-19 20:41   ` Andreas K. Hüttel
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas K. Hüttel @ 2020-09-19 20:41 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: qemu-riscv

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

Hi Palmer,

> > [1] qemu built from git master, Sep 12, 2020 16:30:37 EEST
> > [2] host kernel is 5.8.8
> > [3] glibc-2.32 with the rv32 patch series backported from master
> > [4] (Gentoo 10.2.0-r1 p2)
> > [5] https://lists.gnu.org/archive/html/bug-bash/2020-09/msg00033.html
> 
> I don't see any replies to this, but for some reason I remember having seen
> some.  Did this get resolved in some other thread?  I'd bet that it's a bug
> in rv32 user-mode emulation, as that's been only lightly used so far.

No resolution yet. The conclusion was also that it's likely a bug in rv32 
user-mode emulation, and I put this aside for the moment (to later retry in 
softmmu mode).

(the original mail was on qemu-devel and libc-alpha, and there the thread 
continued a little bit there, see
https://sourceware.org/pipermail/libc-alpha/2020-September/117563.html )

Best,
Andreas

-- 
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer 
(council, qa, toolchain, base-system, perl, libreoffice)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

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

end of thread, other threads:[~2020-09-19 20:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 16:23 Fwd: riscv32 wait() problem, qemu or glibc? Andreas K. Huettel
2020-09-19 20:33 ` Palmer Dabbelt
2020-09-19 20:41   ` Andreas K. Hüttel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.