All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
@ 2020-09-10  3:46 Hansni Bu
  2020-09-10  6:18 ` [Bug 1895080] " Laurent Vivier
                   ` (5 more replies)
  0 siblings, 6 replies; 73+ messages in thread
From: Hansni Bu @ 2020-09-10  3:46 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
(commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
user.

Firstly, compile fails:
Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
     FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

I have to add below include to linux-user/strace.c
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 11fea14fba..22e51d4a8a 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -7,6 +7,7 @@
 #include <sys/mount.h>
 #include <arpa/inet.h>
 #include <netinet/tcp.h>
+#include <linux/falloc.h>
 #include <linux/if_packet.h>
 #include <linux/netlink.h>
 #include <sched.h>

Then trying qemu-riscv32 with a simple ELF, I get:
linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

strace shows that:
mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
) = 103

The source code is in the function pgb_reserved_va (linux-
user/elfload.c). I think mmap cannot guarantee that the returned pointer
(test) equals to the parameter of addr. So is this a bug to assert (addr
== test)?

Attached configure script and test ELF file.

Thanks.

** Affects: qemu
     Importance: Undecided
         Status: New

** Attachment added: "config script and test ELF file"
   https://bugs.launchpad.net/bugs/1895080/+attachment/5409254/+files/config_and_elf.tar.xz

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
@ 2020-09-10  6:18 ` Laurent Vivier
  2020-09-10 19:04 ` [Bug 1895080] [NEW] " Laurent Vivier
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 73+ messages in thread
From: Laurent Vivier @ 2020-09-10  6:18 UTC (permalink / raw)
  To: qemu-devel

** Tags added: linux-user

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
  2020-09-10  6:18 ` [Bug 1895080] " Laurent Vivier
@ 2020-09-10 19:04 ` Laurent Vivier
  2020-09-11  5:57   ` Hansni Bu
  2020-09-11  9:34   ` Alex Bennée
  2020-09-11  8:30 ` [Bug 1895080] " Alex Bennée
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 73+ messages in thread
From: Laurent Vivier @ 2020-09-10 19:04 UTC (permalink / raw)
  To: qemu-devel

Le 10/09/2020 à 07:21, Launchpad Bug Tracker a écrit :
> This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
> (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
> user.

I tried to build qemu-5.1 on CentOS-7.5.1 but as python 3.5 is not
available, I gave up.

> Firstly, compile fails:
> Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
> ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
>      FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
> 
> I have to add below include to linux-user/strace.c
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index 11fea14fba..22e51d4a8a 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -7,6 +7,7 @@
>  #include <sys/mount.h>
>  #include <arpa/inet.h>
>  #include <netinet/tcp.h>
> +#include <linux/falloc.h>
>  #include <linux/if_packet.h>
>  #include <linux/netlink.h>
>  #include <sched.h>

In fact, fallocate(2) says fcntl.h must be included.
And qemu/osdep.h includes it.
So you should not have this problem.

> 
> Then trying qemu-riscv32 with a simple ELF, I get:
> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
> 
> strace shows that:
> mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
> ) = 103
> 
> The source code is in the function pgb_reserved_va (linux-
> user/elfload.c). I think mmap cannot guarantee that the returned pointer
> (test) equals to the parameter of addr. So is this a bug to assert (addr
> == test)?

I think Alex Bennée knows better this code than I do, so cc'ing him.

Thnaks
Laurent

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10 19:04 ` [Bug 1895080] [NEW] " Laurent Vivier
@ 2020-09-11  5:57   ` Hansni Bu
  2020-09-11  9:34   ` Alex Bennée
  1 sibling, 0 replies; 73+ messages in thread
From: Hansni Bu @ 2020-09-11  5:57 UTC (permalink / raw)
  To: qemu-devel

> This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
> > (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
> > user.
>
> I tried to build qemu-5.1 on CentOS-7.5.1 but as python 3.5 is not
> available, I gave up.
>

Thank you for your effort. I installed python3 with yum:
python3.x86_64                           3.6.8-10.el7              @centos
Then maybe you can specify python3 in configure with
"--python=/bin/python3" in case configure cannot find it.


>
> > Firstly, compile fails:
> > Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
> > ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
> undeclared here (not in a function)
> >      FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
> >
> > I have to add below include to linux-user/strace.c
> > diff --git a/linux-user/strace.c b/linux-user/strace.c
> > index 11fea14fba..22e51d4a8a 100644
> > --- a/linux-user/strace.c
> > +++ b/linux-user/strace.c
> > @@ -7,6 +7,7 @@
> >  #include <sys/mount.h>
> >  #include <arpa/inet.h>
> >  #include <netinet/tcp.h>
> > +#include <linux/falloc.h>
> >  #include <linux/if_packet.h>
> >  #include <linux/netlink.h>
> >  #include <sched.h>
>
> In fact, fallocate(2) says fcntl.h must be included.
> And qemu/osdep.h includes it.
> So you should not have this problem.
>

I tried to save the file after pre-processing, namely strace.i. Though
_GNU_SOURCE is defined and fcntl.h is included, falloc.h is not included,
in which FALLOC_FL_KEEP_SIZE is defined. I'm not sure if it's some
environmental problem.

Thanks.

>
> > Then trying qemu-riscv32 with a simple ELF, I get:
> > linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> failed.
> >
> > strace shows that:
> > mmap(0x1000, 4294963200, PROT_NONE,
> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
> > write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
> test' failed.
> > ) = 103
> >
> > The source code is in the function pgb_reserved_va (linux-
> > user/elfload.c). I think mmap cannot guarantee that the returned pointer
> > (test) equals to the parameter of addr. So is this a bug to assert (addr
> > == test)?
>
> I think Alex Bennée knows better this code than I do, so cc'ing him.
>
> Thnaks
> Laurent
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1895080
>
> Title:
>   pgb_reserved_va: Assertion `addr == test' failed
>
> Status in QEMU:
>   New
>
> Bug description:
>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>   user.
>
>   Firstly, compile fails:
>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
> undeclared here (not in a function)
>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>
>   I have to add below include to linux-user/strace.c
>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>   index 11fea14fba..22e51d4a8a 100644
>   --- a/linux-user/strace.c
>   +++ b/linux-user/strace.c
>   @@ -7,6 +7,7 @@
>    #include <sys/mount.h>
>    #include <arpa/inet.h>
>    #include <netinet/tcp.h>
>   +#include <linux/falloc.h>
>    #include <linux/if_packet.h>
>    #include <linux/netlink.h>
>    #include <sched.h>
>
>   Then trying qemu-riscv32 with a simple ELF, I get:
>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> failed.
>
>   strace shows that:
>   mmap(0x1000, 4294963200, PROT_NONE,
> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
> test' failed.
>   ) = 103
>
>   The source code is in the function pgb_reserved_va (linux-
>   user/elfload.c). I think mmap cannot guarantee that the returned
>   pointer (test) equals to the parameter of addr. So is this a bug to
>   assert (addr == test)?
>
>   Attached configure script and test ELF file.
>
>   Thanks.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
  2020-09-10  6:18 ` [Bug 1895080] " Laurent Vivier
  2020-09-10 19:04 ` [Bug 1895080] [NEW] " Laurent Vivier
@ 2020-09-11  8:30 ` Alex Bennée
  2020-09-11  9:31   ` Hansni Bu
  2020-09-15  2:09 ` Hansni Bu
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-11  8:30 UTC (permalink / raw)
  To: qemu-devel

Have you got a static version of the test binary (or a mini rootfs with
the libraries it needs)?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
  2020-09-11  8:30 ` [Bug 1895080] " Alex Bennée
@ 2020-09-11  9:31   ` Hansni Bu
  0 siblings, 0 replies; 73+ messages in thread
From: Hansni Bu @ 2020-09-11  9:31 UTC (permalink / raw)
  To: qemu-devel

Have you got a static version of the test binary (or a mini rootfs with
> the libraries it needs)?
>

If the problem occurs, it does not reach the stage of the dependent
libraries  of the test ELF. Anyway, I've attached the static test binary as
hello.static.elf.
Thanks


> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1895080
>
> Title:
>   pgb_reserved_va: Assertion `addr == test' failed
>
> Status in QEMU:
>   New
>
> Bug description:
>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>   user.
>
>   Firstly, compile fails:
>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
> undeclared here (not in a function)
>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>
>   I have to add below include to linux-user/strace.c
>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>   index 11fea14fba..22e51d4a8a 100644
>   --- a/linux-user/strace.c
>   +++ b/linux-user/strace.c
>   @@ -7,6 +7,7 @@
>    #include <sys/mount.h>
>    #include <arpa/inet.h>
>    #include <netinet/tcp.h>
>   +#include <linux/falloc.h>
>    #include <linux/if_packet.h>
>    #include <linux/netlink.h>
>    #include <sched.h>
>
>   Then trying qemu-riscv32 with a simple ELF, I get:
>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> failed.
>
>   strace shows that:
>   mmap(0x1000, 4294963200, PROT_NONE,
> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
> test' failed.
>   ) = 103
>
>   The source code is in the function pgb_reserved_va (linux-
>   user/elfload.c). I think mmap cannot guarantee that the returned
>   pointer (test) equals to the parameter of addr. So is this a bug to
>   assert (addr == test)?
>
>   Attached configure script and test ELF file.
>
>   Thanks.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>


** Attachment added: "hello.static.elf"
   https://bugs.launchpad.net/bugs/1895080/+attachment/5409715/+files/hello.static.elf

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10 19:04 ` [Bug 1895080] [NEW] " Laurent Vivier
  2020-09-11  5:57   ` Hansni Bu
@ 2020-09-11  9:34   ` Alex Bennée
  2020-09-11  9:38     ` Alex Bennée
  1 sibling, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-11  9:34 UTC (permalink / raw)
  To: qemu-devel

Laurent Vivier <laurent@vivier.eu> writes:

> Le 10/09/2020 à 07:21, Launchpad Bug Tracker a écrit :
>> This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>> (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>> user.
>
> I tried to build qemu-5.1 on CentOS-7.5.1 but as python 3.5 is not
> available, I gave up.
>
>> Firstly, compile fails:
>> Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>> ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
>>      FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>> 
>> I have to add below include to linux-user/strace.c
>> diff --git a/linux-user/strace.c b/linux-user/strace.c
>> index 11fea14fba..22e51d4a8a 100644
>> --- a/linux-user/strace.c
>> +++ b/linux-user/strace.c
>> @@ -7,6 +7,7 @@
>>  #include <sys/mount.h>
>>  #include <arpa/inet.h>
>>  #include <netinet/tcp.h>
>> +#include <linux/falloc.h>
>>  #include <linux/if_packet.h>
>>  #include <linux/netlink.h>
>>  #include <sched.h>
>
> In fact, fallocate(2) says fcntl.h must be included.
> And qemu/osdep.h includes it.
> So you should not have this problem.
>
>> 
>> Then trying qemu-riscv32 with a simple ELF, I get:
>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
>> 
>> strace shows that:
>> mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
>> ) = 103
>> 
>> The source code is in the function pgb_reserved_va (linux-
>> user/elfload.c). I think mmap cannot guarantee that the returned pointer
>> (test) equals to the parameter of addr. So is this a bug to assert (addr
>> == test)?
>
> I think Alex Bennée knows better this code than I do, so cc'ing him.

It should be able to do so because the earlier code (pgb_static) checks
for a hole the size of reserved_va in the host memory map. This should
be fairly easy for 32 bit guests given the amount of spare address space
you have on a 64 bit system.

I'm assuming CentOS 7.5 actually has a definition for
MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
otherwise we are in the position of hoping the kernel honours what we
asked for.

>
> Thnaks
> Laurent


-- 
Alex Bennée

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
  2020-09-11  9:34   ` Alex Bennée
@ 2020-09-11  9:38     ` Alex Bennée
  2020-09-11 10:18       ` Hansni Bu
  0 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-11  9:38 UTC (permalink / raw)
  To: qemu-devel

Alex Bennée <alex.bennee@linaro.org> writes:

> Laurent Vivier <laurent@vivier.eu> writes:
>
<snip>
>>> Then trying qemu-riscv32 with a simple ELF, I get:
>>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
>>> 
>>> strace shows that:
>>> mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
>>> ) = 103
>>> 
>>> The source code is in the function pgb_reserved_va (linux-
>>> user/elfload.c). I think mmap cannot guarantee that the returned pointer
>>> (test) equals to the parameter of addr. So is this a bug to assert (addr
>>> == test)?
>>
> I'm assuming CentOS 7.5 actually has a definition for
> MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
> otherwise we are in the position of hoping the kernel honours what we
> asked for.

Doh re-reading I see it's not set in the strace output. Maybe we should
promote the assert case to the failure leg so we have:

    if (addr == MAP_FAILED || addr != test) {
        error_report(...)
    }

so we at least fail with a user friendly error rather than an abort?

-- 
Alex Bennée

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
  2020-09-11  9:38     ` Alex Bennée
@ 2020-09-11 10:18       ` Hansni Bu
  2020-09-11 11:54           ` Alex Bennée
  0 siblings, 1 reply; 73+ messages in thread
From: Hansni Bu @ 2020-09-11 10:18 UTC (permalink / raw)
  To: qemu-devel

No, it's not set by CentOS-7.5.
Does it mean that we just cannot run the ELF in such a case? I've tried
many times, the assert always fails. Maybe, we can blame CentOS-7.5.
BTW: with the option "-p 65536", the case runs successfully.

On Fri, Sep 11, 2020 at 5:50 PM Alex Bennée <1895080@bugs.launchpad.net>
wrote:

> Alex Bennée <alex.bennee@linaro.org> writes:
>
> > Laurent Vivier <laurent@vivier.eu> writes:
> >
> <snip>
> >>> Then trying qemu-riscv32 with a simple ELF, I get:
> >>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> failed.
> >>>
> >>> strace shows that:
> >>> mmap(0x1000, 4294963200, PROT_NONE,
> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
> >>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
> test' failed.
> >>> ) = 103
> >>>
> >>> The source code is in the function pgb_reserved_va (linux-
> >>> user/elfload.c). I think mmap cannot guarantee that the returned
> pointer
> >>> (test) equals to the parameter of addr. So is this a bug to assert
> (addr
> >>> == test)?
> >>
> > I'm assuming CentOS 7.5 actually has a definition for
> > MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
> > otherwise we are in the position of hoping the kernel honours what we
> > asked for.
>
> Doh re-reading I see it's not set in the strace output. Maybe we should
> promote the assert case to the failure leg so we have:
>
>     if (addr == MAP_FAILED || addr != test) {
>         error_report(...)
>     }
>
> so we at least fail with a user friendly error rather than an abort?
>
> --
> Alex Bennée
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1895080
>
> Title:
>   pgb_reserved_va: Assertion `addr == test' failed
>
> Status in QEMU:
>   New
>
> Bug description:
>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>   user.
>
>   Firstly, compile fails:
>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
> undeclared here (not in a function)
>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>
>   I have to add below include to linux-user/strace.c
>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>   index 11fea14fba..22e51d4a8a 100644
>   --- a/linux-user/strace.c
>   +++ b/linux-user/strace.c
>   @@ -7,6 +7,7 @@
>    #include <sys/mount.h>
>    #include <arpa/inet.h>
>    #include <netinet/tcp.h>
>   +#include <linux/falloc.h>
>    #include <linux/if_packet.h>
>    #include <linux/netlink.h>
>    #include <sched.h>
>
>   Then trying qemu-riscv32 with a simple ELF, I get:
>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> failed.
>
>   strace shows that:
>   mmap(0x1000, 4294963200, PROT_NONE,
> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
> test' failed.
>   ) = 103
>
>   The source code is in the function pgb_reserved_va (linux-
>   user/elfload.c). I think mmap cannot guarantee that the returned
>   pointer (test) equals to the parameter of addr. So is this a bug to
>   assert (addr == test)?
>
>   Attached configure script and test ELF file.
>
>   Thanks.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
@ 2020-09-11 11:54           ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-11 11:54 UTC (permalink / raw)
  To: Bug 1895080; +Cc: qemu-devel


Hansni Bu <1895080@bugs.launchpad.net> writes:

> No, it's not set by CentOS-7.5.
> Does it mean that we just cannot run the ELF in such a case? I've tried
> many times, the assert always fails. Maybe, we can blame CentOS-7.5.

The trouble is without MAP_FIXED_NOREPLACE we are at the mercy of the
host kernel to allow the address request to be honoured. A plain
MAP_FIXED won't do as it can clober existing mappings. In theory a
suitable hole has been identified but sometimes the kernel makes a
decision to offset the suggested mapping for it's own reasons. 

> BTW: with the option "-p 65536", the case runs successfully.

Hmm interesting. I wonder if we are seeing a fail due to mmap_min_addr?
What does:

  /proc/sys/vm/mmap_min_addr

give you on the system?

You can manually set the reserved_va and the base address using -R and
-B although that is more of a developer work around. I think moving the
assert to the condition above would be an improvement just because it
tells us what the requested base address was and what the kernel decided
to give us.

>
> On Fri, Sep 11, 2020 at 5:50 PM Alex Bennée <1895080@bugs.launchpad.net>
> wrote:
>
>> Alex Bennée <alex.bennee@linaro.org> writes:
>>
>> > Laurent Vivier <laurent@vivier.eu> writes:
>> >
>> <snip>
>> >>> Then trying qemu-riscv32 with a simple ELF, I get:
>> >>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> failed.
>> >>>
>> >>> strace shows that:
>> >>> mmap(0x1000, 4294963200, PROT_NONE,
>> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> >>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
>> test' failed.
>> >>> ) = 103
>> >>>
>> >>> The source code is in the function pgb_reserved_va (linux-
>> >>> user/elfload.c). I think mmap cannot guarantee that the returned
>> pointer
>> >>> (test) equals to the parameter of addr. So is this a bug to assert
>> (addr
>> >>> == test)?
>> >>
>> > I'm assuming CentOS 7.5 actually has a definition for
>> > MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
>> > otherwise we are in the position of hoping the kernel honours what we
>> > asked for.
>>
>> Doh re-reading I see it's not set in the strace output. Maybe we should
>> promote the assert case to the failure leg so we have:
>>
>>     if (addr == MAP_FAILED || addr != test) {
>>         error_report(...)
>>     }
>>
>> so we at least fail with a user friendly error rather than an abort?
>>
>> --
>> Alex Bennée
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1895080
>>
>> Title:
>>   pgb_reserved_va: Assertion `addr == test' failed
>>
>> Status in QEMU:
>>   New
>>
>> Bug description:
>>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>>   user.
>>
>>   Firstly, compile fails:
>>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
>> undeclared here (not in a function)
>>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>>
>>   I have to add below include to linux-user/strace.c
>>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>>   index 11fea14fba..22e51d4a8a 100644
>>   --- a/linux-user/strace.c
>>   +++ b/linux-user/strace.c
>>   @@ -7,6 +7,7 @@
>>    #include <sys/mount.h>
>>    #include <arpa/inet.h>
>>    #include <netinet/tcp.h>
>>   +#include <linux/falloc.h>
>>    #include <linux/if_packet.h>
>>    #include <linux/netlink.h>
>>    #include <sched.h>
>>
>>   Then trying qemu-riscv32 with a simple ELF, I get:
>>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> failed.
>>
>>   strace shows that:
>>   mmap(0x1000, 4294963200, PROT_NONE,
>> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
>> test' failed.
>>   ) = 103
>>
>>   The source code is in the function pgb_reserved_va (linux-
>>   user/elfload.c). I think mmap cannot guarantee that the returned
>>   pointer (test) equals to the parameter of addr. So is this a bug to
>>   assert (addr == test)?
>>
>>   Attached configure script and test ELF file.
>>
>>   Thanks.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>>


-- 
Alex Bennée


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
@ 2020-09-11 11:54           ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-11 11:54 UTC (permalink / raw)
  To: qemu-devel

Hansni Bu <1895080@bugs.launchpad.net> writes:

> No, it's not set by CentOS-7.5.
> Does it mean that we just cannot run the ELF in such a case? I've tried
> many times, the assert always fails. Maybe, we can blame CentOS-7.5.

The trouble is without MAP_FIXED_NOREPLACE we are at the mercy of the
host kernel to allow the address request to be honoured. A plain
MAP_FIXED won't do as it can clober existing mappings. In theory a
suitable hole has been identified but sometimes the kernel makes a
decision to offset the suggested mapping for it's own reasons. 

> BTW: with the option "-p 65536", the case runs successfully.

Hmm interesting. I wonder if we are seeing a fail due to mmap_min_addr?
What does:

  /proc/sys/vm/mmap_min_addr

give you on the system?

You can manually set the reserved_va and the base address using -R and
-B although that is more of a developer work around. I think moving the
assert to the condition above would be an improvement just because it
tells us what the requested base address was and what the kernel decided
to give us.

>
> On Fri, Sep 11, 2020 at 5:50 PM Alex Bennée <1895080@bugs.launchpad.net>
> wrote:
>
>> Alex Bennée <alex.bennee@linaro.org> writes:
>>
>> > Laurent Vivier <laurent@vivier.eu> writes:
>> >
>> <snip>
>> >>> Then trying qemu-riscv32 with a simple ELF, I get:
>> >>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> failed.
>> >>>
>> >>> strace shows that:
>> >>> mmap(0x1000, 4294963200, PROT_NONE,
>> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> >>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
>> test' failed.
>> >>> ) = 103
>> >>>
>> >>> The source code is in the function pgb_reserved_va (linux-
>> >>> user/elfload.c). I think mmap cannot guarantee that the returned
>> pointer
>> >>> (test) equals to the parameter of addr. So is this a bug to assert
>> (addr
>> >>> == test)?
>> >>
>> > I'm assuming CentOS 7.5 actually has a definition for
>> > MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
>> > otherwise we are in the position of hoping the kernel honours what we
>> > asked for.
>>
>> Doh re-reading I see it's not set in the strace output. Maybe we should
>> promote the assert case to the failure leg so we have:
>>
>>     if (addr == MAP_FAILED || addr != test) {
>>         error_report(...)
>>     }
>>
>> so we at least fail with a user friendly error rather than an abort?
>>
>> --
>> Alex Bennée
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1895080
>>
>> Title:
>>   pgb_reserved_va: Assertion `addr == test' failed
>>
>> Status in QEMU:
>>   New
>>
>> Bug description:
>>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>>   user.
>>
>>   Firstly, compile fails:
>>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
>> undeclared here (not in a function)
>>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>>
>>   I have to add below include to linux-user/strace.c
>>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>>   index 11fea14fba..22e51d4a8a 100644
>>   --- a/linux-user/strace.c
>>   +++ b/linux-user/strace.c
>>   @@ -7,6 +7,7 @@
>>    #include <sys/mount.h>
>>    #include <arpa/inet.h>
>>    #include <netinet/tcp.h>
>>   +#include <linux/falloc.h>
>>    #include <linux/if_packet.h>
>>    #include <linux/netlink.h>
>>    #include <sched.h>
>>
>>   Then trying qemu-riscv32 with a simple ELF, I get:
>>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> failed.
>>
>>   strace shows that:
>>   mmap(0x1000, 4294963200, PROT_NONE,
>> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
>> test' failed.
>>   ) = 103
>>
>>   The source code is in the function pgb_reserved_va (linux-
>>   user/elfload.c). I think mmap cannot guarantee that the returned
>>   pointer (test) equals to the parameter of addr. So is this a bug to
>>   assert (addr == test)?
>>
>>   Attached configure script and test ELF file.
>>
>>   Thanks.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>>


-- 
Alex Bennée

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
  2020-09-11 11:54           ` Alex Bennée
  (?)
@ 2020-09-11 12:32           ` Hansni Bu
  2020-09-11 14:47               ` Alex Bennée
  -1 siblings, 1 reply; 73+ messages in thread
From: Hansni Bu @ 2020-09-11 12:32 UTC (permalink / raw)
  To: qemu-devel

> > No, it's not set by CentOS-7.5.
> > Does it mean that we just cannot run the ELF in such a case? I've tried
> > many times, the assert always fails. Maybe, we can blame CentOS-7.5.
>
> The trouble is without MAP_FIXED_NOREPLACE we are at the mercy of the
> host kernel to allow the address request to be honoured. A plain
> MAP_FIXED won't do as it can clober existing mappings. In theory a
> suitable hole has been identified but sometimes the kernel makes a
> decision to offset the suggested mapping for it's own reasons.
>

MAP_FIXED_NOREPLACE is quite a new feature.


> > BTW: with the option "-p 65536", the case runs successfully.
>
> Hmm interesting. I wonder if we are seeing a fail due to mmap_min_addr?
> What does:
>
>   /proc/sys/vm/mmap_min_addr
>
> give you on the system?
>

It gives me 4096. And guest_base has this value. Maybe that's the strange
point. mmap_min_addr give us 0x1000. While we are requesting this address,
the kernel gives us 0x10000.


>
> You can manually set the reserved_va and the base address using -R and
> -B although that is more of a developer work around. I think moving the
> assert to the condition above would be an improvement just because it
> tells us what the requested base address was and what the kernel decided
> to give us.
>

Setting guest_base with -B to 0x10000 works. Tried some -R values, no luck.
Agree to print a more hintful message.


>
> >
> > On Fri, Sep 11, 2020 at 5:50 PM Alex Bennée <1895080@bugs.launchpad.net>
> > wrote:
> >
> >> Alex Bennée <alex.bennee@linaro.org> writes:
> >>
> >> > Laurent Vivier <laurent@vivier.eu> writes:
> >> >
> >> <snip>
> >> >>> Then trying qemu-riscv32 with a simple ELF, I get:
> >> >>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> >> failed.
> >> >>>
> >> >>> strace shows that:
> >> >>> mmap(0x1000, 4294963200, PROT_NONE,
> >> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
> >> >>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> >> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr
> ==
> >> test' failed.
> >> >>> ) = 103
> >> >>>
> >> >>> The source code is in the function pgb_reserved_va (linux-
> >> >>> user/elfload.c). I think mmap cannot guarantee that the returned
> >> pointer
> >> >>> (test) equals to the parameter of addr. So is this a bug to assert
> >> (addr
> >> >>> == test)?
> >> >>
> >> > I'm assuming CentOS 7.5 actually has a definition for
> >> > MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
> >> > otherwise we are in the position of hoping the kernel honours what we
> >> > asked for.
> >>
> >> Doh re-reading I see it's not set in the strace output. Maybe we should
> >> promote the assert case to the failure leg so we have:
> >>
> >>     if (addr == MAP_FAILED || addr != test) {
> >>         error_report(...)
> >>     }
> >>
> >> so we at least fail with a user friendly error rather than an abort?
> >>
> >> --
> >> Alex Bennée
> >>
> >> --
> >> You received this bug notification because you are subscribed to the bug
> >> report.
> >> https://bugs.launchpad.net/bugs/1895080
> >>
> >> Title:
> >>   pgb_reserved_va: Assertion `addr == test' failed
> >>
> >> Status in QEMU:
> >>   New
> >>
> >> Bug description:
> >>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
> >>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
> >>   user.
> >>
> >>   Firstly, compile fails:
> >>   Compiling C object
> libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
> >>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
> >> undeclared here (not in a function)
> >>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
> >>
> >>   I have to add below include to linux-user/strace.c
> >>   diff --git a/linux-user/strace.c b/linux-user/strace.c
> >>   index 11fea14fba..22e51d4a8a 100644
> >>   --- a/linux-user/strace.c
> >>   +++ b/linux-user/strace.c
> >>   @@ -7,6 +7,7 @@
> >>    #include <sys/mount.h>
> >>    #include <arpa/inet.h>
> >>    #include <netinet/tcp.h>
> >>   +#include <linux/falloc.h>
> >>    #include <linux/if_packet.h>
> >>    #include <linux/netlink.h>
> >>    #include <sched.h>
> >>
> >>   Then trying qemu-riscv32 with a simple ELF, I get:
> >>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> >> failed.
> >>
> >>   strace shows that:
> >>   mmap(0x1000, 4294963200, PROT_NONE,
> >> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
> >>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> >> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr
> ==
> >> test' failed.
> >>   ) = 103
> >>
> >>   The source code is in the function pgb_reserved_va (linux-
> >>   user/elfload.c). I think mmap cannot guarantee that the returned
> >>   pointer (test) equals to the parameter of addr. So is this a bug to
> >>   assert (addr == test)?
> >>
> >>   Attached configure script and test ELF file.
> >>
> >>   Thanks.
> >>
> >> To manage notifications about this bug go to:
> >> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
> >>
>
>
> --
> Alex Bennée
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1895080
>
> Title:
>   pgb_reserved_va: Assertion `addr == test' failed
>
> Status in QEMU:
>   New
>
> Bug description:
>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>   user.
>
>   Firstly, compile fails:
>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
> undeclared here (not in a function)
>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>
>   I have to add below include to linux-user/strace.c
>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>   index 11fea14fba..22e51d4a8a 100644
>   --- a/linux-user/strace.c
>   +++ b/linux-user/strace.c
>   @@ -7,6 +7,7 @@
>    #include <sys/mount.h>
>    #include <arpa/inet.h>
>    #include <netinet/tcp.h>
>   +#include <linux/falloc.h>
>    #include <linux/if_packet.h>
>    #include <linux/netlink.h>
>    #include <sched.h>
>
>   Then trying qemu-riscv32 with a simple ELF, I get:
>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
> failed.
>
>   strace shows that:
>   mmap(0x1000, 4294963200, PROT_NONE,
> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
> test' failed.
>   ) = 103
>
>   The source code is in the function pgb_reserved_va (linux-
>   user/elfload.c). I think mmap cannot guarantee that the returned
>   pointer (test) equals to the parameter of addr. So is this a bug to
>   assert (addr == test)?
>
>   Attached configure script and test ELF file.
>
>   Thanks.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
@ 2020-09-11 14:47               ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-11 14:47 UTC (permalink / raw)
  To: Bug 1895080; +Cc: qemu-devel


Hansni Bu <1895080@bugs.launchpad.net> writes:

>> > No, it's not set by CentOS-7.5.
>> > Does it mean that we just cannot run the ELF in such a case? I've tried
>> > many times, the assert always fails. Maybe, we can blame CentOS-7.5.
>>
>> The trouble is without MAP_FIXED_NOREPLACE we are at the mercy of the
>> host kernel to allow the address request to be honoured. A plain
>> MAP_FIXED won't do as it can clober existing mappings. In theory a
>> suitable hole has been identified but sometimes the kernel makes a
>> decision to offset the suggested mapping for it's own reasons.
>>
>
> MAP_FIXED_NOREPLACE is quite a new feature.
>
>
>> > BTW: with the option "-p 65536", the case runs successfully.
>>
>> Hmm interesting. I wonder if we are seeing a fail due to mmap_min_addr?
>> What does:
>>
>>   /proc/sys/vm/mmap_min_addr
>>
>> give you on the system?
>>
>
> It gives me 4096. And guest_base has this value. Maybe that's the strange
> point. mmap_min_addr give us 0x1000. While we are requesting this address,
> the kernel gives us 0x10000.

Yeah the meaning of mmap_min_addr should be exactly that which is odd
why the kernel doesn't honour the request. That said it seems to be a
user tweakable knob so you could just up it.

>>
>> You can manually set the reserved_va and the base address using -R and
>> -B although that is more of a developer work around. I think moving the
>> assert to the condition above would be an improvement just because it
>> tells us what the requested base address was and what the kernel decided
>> to give us.
>>
>
> Setting guest_base with -B to 0x10000 works. Tried some -R values, no luck.
> Agree to print a more hintful message.

OK - one other test you try is running inside a chroot which *does not*
have visibility of /proc. That will cause it to fall back to the old
probing technique of trying multiple mmap operations to find the hole. I
suspect that works because the attempt to map 0x1000 would fail the
check. The reason we default to probing /proc/self/map now is that brute
force technique falls over when trying to probe for a hole on 64 bit
systems, especially when built with stack protection/clang debug
instrumentation.

In the meantime I'll spin up a patch to improve the failure mode.

>
>
>>
>> >
>> > On Fri, Sep 11, 2020 at 5:50 PM Alex Bennée <1895080@bugs.launchpad.net>
>> > wrote:
>> >
>> >> Alex Bennée <alex.bennee@linaro.org> writes:
>> >>
>> >> > Laurent Vivier <laurent@vivier.eu> writes:
>> >> >
>> >> <snip>
>> >> >>> Then trying qemu-riscv32 with a simple ELF, I get:
>> >> >>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> >> failed.
>> >> >>>
>> >> >>> strace shows that:
>> >> >>> mmap(0x1000, 4294963200, PROT_NONE,
>> >> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> >> >>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> >> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr
>> ==
>> >> test' failed.
>> >> >>> ) = 103
>> >> >>>
>> >> >>> The source code is in the function pgb_reserved_va (linux-
>> >> >>> user/elfload.c). I think mmap cannot guarantee that the returned
>> >> pointer
>> >> >>> (test) equals to the parameter of addr. So is this a bug to assert
>> >> (addr
>> >> >>> == test)?
>> >> >>
>> >> > I'm assuming CentOS 7.5 actually has a definition for
>> >> > MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
>> >> > otherwise we are in the position of hoping the kernel honours what we
>> >> > asked for.
>> >>
>> >> Doh re-reading I see it's not set in the strace output. Maybe we should
>> >> promote the assert case to the failure leg so we have:
>> >>
>> >>     if (addr == MAP_FAILED || addr != test) {
>> >>         error_report(...)
>> >>     }
>> >>
>> >> so we at least fail with a user friendly error rather than an abort?
>> >>
>> >> --
>> >> Alex Bennée
>> >>
>> >> --
>> >> You received this bug notification because you are subscribed to the bug
>> >> report.
>> >> https://bugs.launchpad.net/bugs/1895080
>> >>
>> >> Title:
>> >>   pgb_reserved_va: Assertion `addr == test' failed
>> >>
>> >> Status in QEMU:
>> >>   New
>> >>
>> >> Bug description:
>> >>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>> >>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>> >>   user.
>> >>
>> >>   Firstly, compile fails:
>> >>   Compiling C object
>> libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>> >>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
>> >> undeclared here (not in a function)
>> >>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>> >>
>> >>   I have to add below include to linux-user/strace.c
>> >>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>> >>   index 11fea14fba..22e51d4a8a 100644
>> >>   --- a/linux-user/strace.c
>> >>   +++ b/linux-user/strace.c
>> >>   @@ -7,6 +7,7 @@
>> >>    #include <sys/mount.h>
>> >>    #include <arpa/inet.h>
>> >>    #include <netinet/tcp.h>
>> >>   +#include <linux/falloc.h>
>> >>    #include <linux/if_packet.h>
>> >>    #include <linux/netlink.h>
>> >>    #include <sched.h>
>> >>
>> >>   Then trying qemu-riscv32 with a simple ELF, I get:
>> >>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> >> failed.
>> >>
>> >>   strace shows that:
>> >>   mmap(0x1000, 4294963200, PROT_NONE,
>> >> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> >>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> >> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr
>> ==
>> >> test' failed.
>> >>   ) = 103
>> >>
>> >>   The source code is in the function pgb_reserved_va (linux-
>> >>   user/elfload.c). I think mmap cannot guarantee that the returned
>> >>   pointer (test) equals to the parameter of addr. So is this a bug to
>> >>   assert (addr == test)?
>> >>
>> >>   Attached configure script and test ELF file.
>> >>
>> >>   Thanks.
>> >>
>> >> To manage notifications about this bug go to:
>> >> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>> >>
>>
>>
>> --
>> Alex Bennée
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1895080
>>
>> Title:
>>   pgb_reserved_va: Assertion `addr == test' failed
>>
>> Status in QEMU:
>>   New
>>
>> Bug description:
>>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>>   user.
>>
>>   Firstly, compile fails:
>>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
>> undeclared here (not in a function)
>>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>>
>>   I have to add below include to linux-user/strace.c
>>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>>   index 11fea14fba..22e51d4a8a 100644
>>   --- a/linux-user/strace.c
>>   +++ b/linux-user/strace.c
>>   @@ -7,6 +7,7 @@
>>    #include <sys/mount.h>
>>    #include <arpa/inet.h>
>>    #include <netinet/tcp.h>
>>   +#include <linux/falloc.h>
>>    #include <linux/if_packet.h>
>>    #include <linux/netlink.h>
>>    #include <sched.h>
>>
>>   Then trying qemu-riscv32 with a simple ELF, I get:
>>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> failed.
>>
>>   strace shows that:
>>   mmap(0x1000, 4294963200, PROT_NONE,
>> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
>> test' failed.
>>   ) = 103
>>
>>   The source code is in the function pgb_reserved_va (linux-
>>   user/elfload.c). I think mmap cannot guarantee that the returned
>>   pointer (test) equals to the parameter of addr. So is this a bug to
>>   assert (addr == test)?
>>
>>   Attached configure script and test ELF file.
>>
>>   Thanks.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>>


-- 
Alex Bennée


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

* Re: [Bug 1895080] [NEW] pgb_reserved_va: Assertion `addr == test' failed
@ 2020-09-11 14:47               ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-11 14:47 UTC (permalink / raw)
  To: qemu-devel

Hansni Bu <1895080@bugs.launchpad.net> writes:

>> > No, it's not set by CentOS-7.5.
>> > Does it mean that we just cannot run the ELF in such a case? I've tried
>> > many times, the assert always fails. Maybe, we can blame CentOS-7.5.
>>
>> The trouble is without MAP_FIXED_NOREPLACE we are at the mercy of the
>> host kernel to allow the address request to be honoured. A plain
>> MAP_FIXED won't do as it can clober existing mappings. In theory a
>> suitable hole has been identified but sometimes the kernel makes a
>> decision to offset the suggested mapping for it's own reasons.
>>
>
> MAP_FIXED_NOREPLACE is quite a new feature.
>
>
>> > BTW: with the option "-p 65536", the case runs successfully.
>>
>> Hmm interesting. I wonder if we are seeing a fail due to mmap_min_addr?
>> What does:
>>
>>   /proc/sys/vm/mmap_min_addr
>>
>> give you on the system?
>>
>
> It gives me 4096. And guest_base has this value. Maybe that's the strange
> point. mmap_min_addr give us 0x1000. While we are requesting this address,
> the kernel gives us 0x10000.

Yeah the meaning of mmap_min_addr should be exactly that which is odd
why the kernel doesn't honour the request. That said it seems to be a
user tweakable knob so you could just up it.

>>
>> You can manually set the reserved_va and the base address using -R and
>> -B although that is more of a developer work around. I think moving the
>> assert to the condition above would be an improvement just because it
>> tells us what the requested base address was and what the kernel decided
>> to give us.
>>
>
> Setting guest_base with -B to 0x10000 works. Tried some -R values, no luck.
> Agree to print a more hintful message.

OK - one other test you try is running inside a chroot which *does not*
have visibility of /proc. That will cause it to fall back to the old
probing technique of trying multiple mmap operations to find the hole. I
suspect that works because the attempt to map 0x1000 would fail the
check. The reason we default to probing /proc/self/map now is that brute
force technique falls over when trying to probe for a hole on 64 bit
systems, especially when built with stack protection/clang debug
instrumentation.

In the meantime I'll spin up a patch to improve the failure mode.

>
>
>>
>> >
>> > On Fri, Sep 11, 2020 at 5:50 PM Alex Bennée <1895080@bugs.launchpad.net>
>> > wrote:
>> >
>> >> Alex Bennée <alex.bennee@linaro.org> writes:
>> >>
>> >> > Laurent Vivier <laurent@vivier.eu> writes:
>> >> >
>> >> <snip>
>> >> >>> Then trying qemu-riscv32 with a simple ELF, I get:
>> >> >>> linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> >> failed.
>> >> >>>
>> >> >>> strace shows that:
>> >> >>> mmap(0x1000, 4294963200, PROT_NONE,
>> >> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> >> >>> write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> >> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr
>> ==
>> >> test' failed.
>> >> >>> ) = 103
>> >> >>>
>> >> >>> The source code is in the function pgb_reserved_va (linux-
>> >> >>> user/elfload.c). I think mmap cannot guarantee that the returned
>> >> pointer
>> >> >>> (test) equals to the parameter of addr. So is this a bug to assert
>> >> (addr
>> >> >>> == test)?
>> >> >>
>> >> > I'm assuming CentOS 7.5 actually has a definition for
>> >> > MAP_FIXED_NOREPLACE which should ensure we get what we asked for -
>> >> > otherwise we are in the position of hoping the kernel honours what we
>> >> > asked for.
>> >>
>> >> Doh re-reading I see it's not set in the strace output. Maybe we should
>> >> promote the assert case to the failure leg so we have:
>> >>
>> >>     if (addr == MAP_FAILED || addr != test) {
>> >>         error_report(...)
>> >>     }
>> >>
>> >> so we at least fail with a user friendly error rather than an abort?
>> >>
>> >> --
>> >> Alex Bennée
>> >>
>> >> --
>> >> You received this bug notification because you are subscribed to the bug
>> >> report.
>> >> https://bugs.launchpad.net/bugs/1895080
>> >>
>> >> Title:
>> >>   pgb_reserved_va: Assertion `addr == test' failed
>> >>
>> >> Status in QEMU:
>> >>   New
>> >>
>> >> Bug description:
>> >>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>> >>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>> >>   user.
>> >>
>> >>   Firstly, compile fails:
>> >>   Compiling C object
>> libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>> >>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
>> >> undeclared here (not in a function)
>> >>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>> >>
>> >>   I have to add below include to linux-user/strace.c
>> >>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>> >>   index 11fea14fba..22e51d4a8a 100644
>> >>   --- a/linux-user/strace.c
>> >>   +++ b/linux-user/strace.c
>> >>   @@ -7,6 +7,7 @@
>> >>    #include <sys/mount.h>
>> >>    #include <arpa/inet.h>
>> >>    #include <netinet/tcp.h>
>> >>   +#include <linux/falloc.h>
>> >>    #include <linux/if_packet.h>
>> >>    #include <linux/netlink.h>
>> >>    #include <sched.h>
>> >>
>> >>   Then trying qemu-riscv32 with a simple ELF, I get:
>> >>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> >> failed.
>> >>
>> >>   strace shows that:
>> >>   mmap(0x1000, 4294963200, PROT_NONE,
>> >> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>> >>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> >> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr
>> ==
>> >> test' failed.
>> >>   ) = 103
>> >>
>> >>   The source code is in the function pgb_reserved_va (linux-
>> >>   user/elfload.c). I think mmap cannot guarantee that the returned
>> >>   pointer (test) equals to the parameter of addr. So is this a bug to
>> >>   assert (addr == test)?
>> >>
>> >>   Attached configure script and test ELF file.
>> >>
>> >>   Thanks.
>> >>
>> >> To manage notifications about this bug go to:
>> >> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>> >>
>>
>>
>> --
>> Alex Bennée
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1895080
>>
>> Title:
>>   pgb_reserved_va: Assertion `addr == test' failed
>>
>> Status in QEMU:
>>   New
>>
>> Bug description:
>>   This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
>>   (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
>>   user.
>>
>>   Firstly, compile fails:
>>   Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
>>   ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’
>> undeclared here (not in a function)
>>        FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),
>>
>>   I have to add below include to linux-user/strace.c
>>   diff --git a/linux-user/strace.c b/linux-user/strace.c
>>   index 11fea14fba..22e51d4a8a 100644
>>   --- a/linux-user/strace.c
>>   +++ b/linux-user/strace.c
>>   @@ -7,6 +7,7 @@
>>    #include <sys/mount.h>
>>    #include <arpa/inet.h>
>>    #include <netinet/tcp.h>
>>   +#include <linux/falloc.h>
>>    #include <linux/if_packet.h>
>>    #include <linux/netlink.h>
>>    #include <sched.h>
>>
>>   Then trying qemu-riscv32 with a simple ELF, I get:
>>   linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test'
>> failed.
>>
>>   strace shows that:
>>   mmap(0x1000, 4294963200, PROT_NONE,
>> MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
>>   write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32:
>> ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr ==
>> test' failed.
>>   ) = 103
>>
>>   The source code is in the function pgb_reserved_va (linux-
>>   user/elfload.c). I think mmap cannot guarantee that the returned
>>   pointer (test) equals to the parameter of addr. So is this a bug to
>>   assert (addr == test)?
>>
>>   Attached configure script and test ELF file.
>>
>>   Thanks.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions
>>


-- 
Alex Bennée

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [RFC PATCH] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-11 14:56 ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-11 14:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Laurent Vivier, Bug 1895080

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Ameliorates: ee94743034
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 linux-user/elfload.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e2..f6022fd7049 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1



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

* [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
@ 2020-09-11 14:56 ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-11 14:56 UTC (permalink / raw)
  To: qemu-devel

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Ameliorates: ee94743034
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 linux-user/elfload.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e2..f6022fd7049 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1


** Tags added: mmap

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [PATCH  v1 0/6] deprecation and linux-user tweaks (+test fix)
@ 2020-09-14 15:07 Alex Bennée
  2020-09-14 15:07   ` [Bug 1895080] " Alex Bennée
                   ` (5 more replies)
  0 siblings, 6 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Hi,

This series contains the previously posted linux-user fix for dealing
with weird mmap semantics as well as some tweaks to configure as
suggested in a late review of my last PR. It includes tilegx in the
modified configure logic for handling deprecated fixes. There is also
a fix from Max for iotests although I suspect there will be a v2 of
the patch soon.

Most need review:
 - gitlab: create a build-deprecated target
 - configure: include tilegx-linux-user in the auto-exclude logic
 - configure: also skip deprecated targets with target-list-exclude
 - configure: use add_to for tweaking deprecated_features
 - linux-user: test, don't assert addr != test in pgb_reserved_va

Alex Bennée (5):
  linux-user: test, don't assert addr != test in pgb_reserved_va
  configure: use add_to for tweaking deprecated_features
  configure: also skip deprecated targets with target-list-exclude
  configure: include tilegx-linux-user in the auto-exclude logic
  gitlab: create a build-deprecated target

Max Reitz (1):
  iotests: Work around failing readlink -f

 configure                | 15 +++++++++++----
 linux-user/elfload.c     |  9 ++++-----
 .gitlab-ci.yml           | 10 ++++++++++
 .travis.yml              |  3 +--
 tests/qemu-iotests/check |  4 ++++
 5 files changed, 30 insertions(+), 11 deletions(-)

-- 
2.20.1



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

* [PATCH  v1 1/6] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-14 15:07   ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Laurent Vivier, Bug 1895080

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Ameliorates: ee94743034
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 linux-user/elfload.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1



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

* [Bug 1895080] [PATCH  v1 1/6] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-14 15:07   ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Ameliorates: ee94743034
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 linux-user/elfload.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [PATCH v1 2/6] configure: use add_to for tweaking deprecated_features
  2020-09-14 15:07 [PATCH v1 0/6] deprecation and linux-user tweaks (+test fix) Alex Bennée
  2020-09-14 15:07   ` [Bug 1895080] " Alex Bennée
@ 2020-09-14 15:07 ` Alex Bennée
  2020-09-14 16:14   ` Thomas Huth
  2020-09-14 15:07 ` [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude Alex Bennée
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 2b6a1196da50..e365a90cc133 100755
--- a/configure
+++ b/configure
@@ -7668,7 +7668,7 @@ case "$target_name" in
     TARGET_SYSTBL_ABI=common,nospu,32
     echo "TARGET_ABI32=y" >> $config_target_mak
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
-    deprecated_features="ppc64abi32 ${deprecated_features}"
+    add_to deprecated_features ppc64abi32
   ;;
   riscv32)
     TARGET_BASE_ARCH=riscv
-- 
2.20.1



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

* [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude
  2020-09-14 15:07 [PATCH v1 0/6] deprecation and linux-user tweaks (+test fix) Alex Bennée
  2020-09-14 15:07   ` [Bug 1895080] " Alex Bennée
  2020-09-14 15:07 ` [PATCH v1 2/6] configure: use add_to for tweaking deprecated_features Alex Bennée
@ 2020-09-14 15:07 ` Alex Bennée
  2020-09-14 19:17   ` Peter Maydell
  2020-09-14 15:07 ` [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic Alex Bennée
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Now the user has to make an even more deliberate decision to
enable a deprecated target rather than getting it as a side effect of
using --target-exclude-list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index e365a90cc133..50052378e417 100755
--- a/configure
+++ b/configure
@@ -1722,9 +1722,15 @@ if [ "$bsd_user" = "yes" ]; then
     mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
 fi
 
-if test -z "$target_list_exclude" -a -z "$target_list"; then
-    # if the user doesn't specify anything lets skip deprecating stuff
-    target_list_exclude=ppc64abi32-linux-user
+# If the user doesn't explicitly specify a deprecated target we will
+# skip it.
+if test -z "$target_list"; then
+    deprecated_targets_list=ppc64abi32-linux-user
+    if test -z "$target_list_exclude"; then
+        target_list_exclude="$deprecated_targets_list"
+    else
+        target_list_exclude="$target_list_exclude,$deprecated_targets_list"
+    fi
 fi
 
 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
-- 
2.20.1



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

* [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic
  2020-09-14 15:07 [PATCH v1 0/6] deprecation and linux-user tweaks (+test fix) Alex Bennée
                   ` (2 preceding siblings ...)
  2020-09-14 15:07 ` [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude Alex Bennée
@ 2020-09-14 15:07 ` Alex Bennée
  2020-09-15 12:58   ` Philippe Mathieu-Daudé
  2020-09-14 15:07 ` [PATCH v1 5/6] gitlab: create a build-deprecated target Alex Bennée
  2020-09-14 15:07 ` [PATCH v1 6/6] iotests: Work around failing readlink -f Alex Bennée
  5 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

The target is already marked as deprecated in the documentation.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 50052378e417..d998723cccc3 100755
--- a/configure
+++ b/configure
@@ -1725,7 +1725,7 @@ fi
 # If the user doesn't explicitly specify a deprecated target we will
 # skip it.
 if test -z "$target_list"; then
-    deprecated_targets_list=ppc64abi32-linux-user
+    deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
     if test -z "$target_list_exclude"; then
         target_list_exclude="$deprecated_targets_list"
     else
@@ -7719,6 +7719,7 @@ case "$target_name" in
     gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
   ;;
   tilegx)
+    add_to deprecated_features tilegx
   ;;
   tricore)
   ;;
-- 
2.20.1



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

* [PATCH  v1 5/6] gitlab: create a build-deprecated target
  2020-09-14 15:07 [PATCH v1 0/6] deprecation and linux-user tweaks (+test fix) Alex Bennée
                   ` (3 preceding siblings ...)
  2020-09-14 15:07 ` [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic Alex Bennée
@ 2020-09-14 15:07 ` Alex Bennée
  2020-09-14 15:15   ` Philippe Mathieu-Daudé
  2020-09-14 16:16   ` Thomas Huth
  2020-09-14 15:07 ` [PATCH v1 6/6] iotests: Work around failing readlink -f Alex Bennée
  5 siblings, 2 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

These targets might be deprecated but we should keep them building
before the final axe comes down. Lets keep them all in one place and
don't hold up the CI if they do fail. They are either poorly tested or
already flaky anyway,

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .gitlab-ci.yml | 10 ++++++++++
 .travis.yml    |  3 +--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72e8604579ee..f027b55aef15 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -254,6 +254,16 @@ build-clang:
       ppc-softmmu s390x-softmmu arm-linux-user
     MAKE_CHECK_ARGS: check
 
+# These targets are on the way out
+build-deprecated:
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: debian-all-test-cross
+    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
+    MAKE_CHECK_ARGS: check-tcg
+    TARGETS: ppc64abi32-linux-user tilegx-linux-user
+  allow_failure: true
+
 build-oss-fuzz:
   <<: *native_build_job_definition
   variables:
diff --git a/.travis.yml b/.travis.yml
index 65341634d02a..c75221dca3e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -344,10 +344,9 @@ jobs:
     # Run check-tcg against linux-user (with plugins)
     # we skip sparc64-linux-user until it has been fixed somewhat
     # we skip cris-linux-user as it doesn't use the common run loop
-    # we skip ppc64abi32-linux-user as it seems to have a broken libc
     - name: "GCC plugins check-tcg (user)"
       env:
-        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"
+        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user"
         - TEST_BUILD_CMD="make build-tcg"
         - TEST_CMD="make check-tcg"
         - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
-- 
2.20.1



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

* [PATCH  v1 6/6] iotests: Work around failing readlink -f
  2020-09-14 15:07 [PATCH v1 0/6] deprecation and linux-user tweaks (+test fix) Alex Bennée
                   ` (4 preceding siblings ...)
  2020-09-14 15:07 ` [PATCH v1 5/6] gitlab: create a build-deprecated target Alex Bennée
@ 2020-09-14 15:07 ` Alex Bennée
  5 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-14 15:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Thomas Huth, open list:Block layer core, Max Reitz,
	Claudio Fontana, Alex Bennée

From: Max Reitz <mreitz@redhat.com>

On macOS, (out of the box) readlink does not have -f.  If the recent
"readlink -f" call introduced by b1cbc33a397 fails, just fall back to
the old behavior (which means you can run the iotests only from the
build tree, but that worked fine for six years, so it should be fine
still).

Keep any potential error message on stderr.  If users want to run the
iotests from outside the build tree, this may point them to what's wrong
(with their system).

Fixes: b1cbc33a3971b6bb005d5ac3569feae35a71de0f
       ("iotests: Allow running from different directory")
Reported-by: Claudio Fontana <cfontana@suse.de>
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200914113809.63640-1-mreitz@redhat.com>
---
 tests/qemu-iotests/check | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e14a1f354dd9..75675e1a18f0 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -45,6 +45,10 @@ then
     fi
     source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
     build_iotests=$(readlink -f $(dirname "$0"))
+    if [ "$?" -ne 0 ]; then
+        # Perhaps -f is unsupported, revert to pre-b1cbc33a397 behavior
+        build_iotests=$PWD
+    fi
 else
     # called from the source tree
     source_iotests=$PWD
-- 
2.20.1



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

* Re: [PATCH v1 5/6] gitlab: create a build-deprecated target
  2020-09-14 15:07 ` [PATCH v1 5/6] gitlab: create a build-deprecated target Alex Bennée
@ 2020-09-14 15:15   ` Philippe Mathieu-Daudé
  2020-09-14 16:16   ` Thomas Huth
  1 sibling, 0 replies; 73+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-14 15:15 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Fam Zheng, Thomas Huth, Wainer dos Santos Moschetta

On 9/14/20 5:07 PM, Alex Bennée wrote:
> These targets might be deprecated but we should keep them building
> before the final axe comes down. Lets keep them all in one place and
> don't hold up the CI if they do fail. They are either poorly tested or
> already flaky anyway,
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  .gitlab-ci.yml | 10 ++++++++++
>  .travis.yml    |  3 +--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 72e8604579ee..f027b55aef15 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -254,6 +254,16 @@ build-clang:
>        ppc-softmmu s390x-softmmu arm-linux-user
>      MAKE_CHECK_ARGS: check
>  
> +# These targets are on the way out
> +build-deprecated:
> +  <<: *native_build_job_definition
> +  variables:
> +    IMAGE: debian-all-test-cross
> +    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
> +    MAKE_CHECK_ARGS: check-tcg
> +    TARGETS: ppc64abi32-linux-user tilegx-linux-user
> +  allow_failure: true
> +
>  build-oss-fuzz:
>    <<: *native_build_job_definition
>    variables:
> diff --git a/.travis.yml b/.travis.yml
> index 65341634d02a..c75221dca3e7 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -344,10 +344,9 @@ jobs:
>      # Run check-tcg against linux-user (with plugins)
>      # we skip sparc64-linux-user until it has been fixed somewhat
>      # we skip cris-linux-user as it doesn't use the common run loop
> -    # we skip ppc64abi32-linux-user as it seems to have a broken libc
>      - name: "GCC plugins check-tcg (user)"
>        env:
> -        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"

Maybe split the patch in 2, first the Travis-CI removal,
mentioning commit c609274b853 ("docs/system/deprecated: mark
ppc64abi32-linux-user for deprecation"), then adding the
build-deprecated to GitLab-CI in a different patch.

Preferably split:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user"
>          - TEST_BUILD_CMD="make build-tcg"
>          - TEST_CMD="make check-tcg"
>          - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
> 



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

* Re: [PATCH v1 2/6] configure: use add_to for tweaking deprecated_features
  2020-09-14 15:07 ` [PATCH v1 2/6] configure: use add_to for tweaking deprecated_features Alex Bennée
@ 2020-09-14 16:14   ` Thomas Huth
  0 siblings, 0 replies; 73+ messages in thread
From: Thomas Huth @ 2020-09-14 16:14 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 14/09/2020 17.07, Alex Bennée wrote:
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 2b6a1196da50..e365a90cc133 100755
> --- a/configure
> +++ b/configure
> @@ -7668,7 +7668,7 @@ case "$target_name" in
>      TARGET_SYSTBL_ABI=common,nospu,32
>      echo "TARGET_ABI32=y" >> $config_target_mak
>      gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
> -    deprecated_features="ppc64abi32 ${deprecated_features}"
> +    add_to deprecated_features ppc64abi32
>    ;;
>    riscv32)
>      TARGET_BASE_ARCH=riscv
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v1 5/6] gitlab: create a build-deprecated target
  2020-09-14 15:07 ` [PATCH v1 5/6] gitlab: create a build-deprecated target Alex Bennée
  2020-09-14 15:15   ` Philippe Mathieu-Daudé
@ 2020-09-14 16:16   ` Thomas Huth
  1 sibling, 0 replies; 73+ messages in thread
From: Thomas Huth @ 2020-09-14 16:16 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé, Wainer dos Santos Moschetta

On 14/09/2020 17.07, Alex Bennée wrote:
> These targets might be deprecated but we should keep them building
> before the final axe comes down. Lets keep them all in one place and
> don't hold up the CI if they do fail. They are either poorly tested or
> already flaky anyway,
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  .gitlab-ci.yml | 10 ++++++++++
>  .travis.yml    |  3 +--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 72e8604579ee..f027b55aef15 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -254,6 +254,16 @@ build-clang:
>        ppc-softmmu s390x-softmmu arm-linux-user
>      MAKE_CHECK_ARGS: check
>  
> +# These targets are on the way out
> +build-deprecated:
> +  <<: *native_build_job_definition
> +  variables:
> +    IMAGE: debian-all-test-cross
> +    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
> +    MAKE_CHECK_ARGS: check-tcg
> +    TARGETS: ppc64abi32-linux-user tilegx-linux-user
> +  allow_failure: true
> +
>  build-oss-fuzz:
>    <<: *native_build_job_definition
>    variables:
> diff --git a/.travis.yml b/.travis.yml
> index 65341634d02a..c75221dca3e7 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -344,10 +344,9 @@ jobs:
>      # Run check-tcg against linux-user (with plugins)
>      # we skip sparc64-linux-user until it has been fixed somewhat
>      # we skip cris-linux-user as it doesn't use the common run loop
> -    # we skip ppc64abi32-linux-user as it seems to have a broken libc
>      - name: "GCC plugins check-tcg (user)"
>        env:
> -        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"
> +        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user"
>          - TEST_BUILD_CMD="make build-tcg"
>          - TEST_CMD="make check-tcg"
>          - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
> 

Acked-by: Thomas Huth <thuth@redhat.com>



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

* Re: [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude
  2020-09-14 15:07 ` [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude Alex Bennée
@ 2020-09-14 19:17   ` Peter Maydell
  2020-09-15  9:22     ` Alex Bennée
  0 siblings, 1 reply; 73+ messages in thread
From: Peter Maydell @ 2020-09-14 19:17 UTC (permalink / raw)
  To: Alex Bennée; +Cc: QEMU Developers

On Mon, 14 Sep 2020 at 16:27, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Now the user has to make an even more deliberate decision to
> enable a deprecated target rather than getting it as a side effect of
> using --target-exclude-list.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index e365a90cc133..50052378e417 100755
> --- a/configure
> +++ b/configure
> @@ -1722,9 +1722,15 @@ if [ "$bsd_user" = "yes" ]; then
>      mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
>  fi
>
> -if test -z "$target_list_exclude" -a -z "$target_list"; then
> -    # if the user doesn't specify anything lets skip deprecating stuff
> -    target_list_exclude=ppc64abi32-linux-user
> +# If the user doesn't explicitly specify a deprecated target we will
> +# skip it.
> +if test -z "$target_list"; then
> +    deprecated_targets_list=ppc64abi32-linux-user

If you put this variable setting outside the if...

> +    if test -z "$target_list_exclude"; then
> +        target_list_exclude="$deprecated_targets_list"
> +    else
> +        target_list_exclude="$target_list_exclude,$deprecated_targets_list"
> +    fi
>  fi
>
>  exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')

then later on once we've parsed the exclude list and set
default_target_list we can say something like (untested!)

for dep_target in $(echo "$deprecated_targets_list" | sed -e 's/,/ /g'); do
    for target in $default_target_list; do
        if "$dep_target" = "target"; then
            add_to deprecated_features $target
            break
        fi
    done
done

and then the only thing necessary to add another deprecated target
will be to add it to the variable (ie we can just delete the
add_to line your patch 2 puts in as we don't need to modify
that code at all any more).

(Side note: I just followed the code we have currently for
doing the "is the target in the exclude list" but this
seems tremendously clunky given we're really just trying
to ask "is string X in set Y"...)

thanks
-- PMM


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

* [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
                   ` (2 preceding siblings ...)
  2020-09-11  8:30 ` [Bug 1895080] " Alex Bennée
@ 2020-09-15  2:09 ` Hansni Bu
  2020-11-08  9:43 ` Thomas Huth
  2020-12-10  9:17 ` Thomas Huth
  5 siblings, 0 replies; 73+ messages in thread
From: Hansni Bu @ 2020-09-15  2:09 UTC (permalink / raw)
  To: qemu-devel

chroot works as you expected.
And the patch makes sense.
Thanks.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude
  2020-09-14 19:17   ` Peter Maydell
@ 2020-09-15  9:22     ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15  9:22 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers


Peter Maydell <peter.maydell@linaro.org> writes:

> On Mon, 14 Sep 2020 at 16:27, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> Now the user has to make an even more deliberate decision to
>> enable a deprecated target rather than getting it as a side effect of
>> using --target-exclude-list.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  configure | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/configure b/configure
>> index e365a90cc133..50052378e417 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1722,9 +1722,15 @@ if [ "$bsd_user" = "yes" ]; then
>>      mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
>>  fi
>>
>> -if test -z "$target_list_exclude" -a -z "$target_list"; then
>> -    # if the user doesn't specify anything lets skip deprecating stuff
>> -    target_list_exclude=ppc64abi32-linux-user
>> +# If the user doesn't explicitly specify a deprecated target we will
>> +# skip it.
>> +if test -z "$target_list"; then
>> +    deprecated_targets_list=ppc64abi32-linux-user
>
> If you put this variable setting outside the if...
>
>> +    if test -z "$target_list_exclude"; then
>> +        target_list_exclude="$deprecated_targets_list"
>> +    else
>> +        target_list_exclude="$target_list_exclude,$deprecated_targets_list"
>> +    fi
>>  fi
>>
>>  exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
>
> then later on once we've parsed the exclude list and set
> default_target_list we can say something like (untested!)
>
> for dep_target in $(echo "$deprecated_targets_list" | sed -e 's/,/ /g'); do
>     for target in $default_target_list; do
>         if "$dep_target" = "target"; then
>             add_to deprecated_features $target
>             break
>         fi
>     done
> done
>
> and then the only thing necessary to add another deprecated target
> will be to add it to the variable (ie we can just delete the
> add_to line your patch 2 puts in as we don't need to modify
> that code at all any more).

That makes sense - actually I think we can do:

    # if a deprecated target is enabled we note it here
    if echo "$deprecated_targets_list" | grep -q "$1"; then
        add_to deprecated_features $1
    fi

just before test "$tcg" = "yes" && return 0 in supported_target.

>
> (Side note: I just followed the code we have currently for
> doing the "is the target in the exclude list" but this
> seems tremendously clunky given we're really just trying
> to ask "is string X in set Y"...)

Yeah that can be cleaned up.

>
> thanks
> -- PMM


-- 
Alex Bennée


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

* Re: [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic
  2020-09-14 15:07 ` [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic Alex Bennée
@ 2020-09-15 12:58   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 73+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-15 12:58 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 9/14/20 5:07 PM, Alex Bennée wrote:
> The target is already marked as deprecated in the documentation.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 50052378e417..d998723cccc3 100755
> --- a/configure
> +++ b/configure
> @@ -1725,7 +1725,7 @@ fi
>  # If the user doesn't explicitly specify a deprecated target we will
>  # skip it.
>  if test -z "$target_list"; then
> -    deprecated_targets_list=ppc64abi32-linux-user
> +    deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
>      if test -z "$target_list_exclude"; then
>          target_list_exclude="$deprecated_targets_list"
>      else
> @@ -7719,6 +7719,7 @@ case "$target_name" in
>      gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml s390-gs.xml"
>    ;;
>    tilegx)
> +    add_to deprecated_features tilegx
>    ;;
>    tricore)
>    ;;
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



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

* [PATCH  v2 0/8] configure deprecation, linux-user and iotest fixes
@ 2020-09-15 13:43 Alex Bennée
  2020-09-15 13:43   ` [Bug 1895080] " Alex Bennée
                   ` (7 more replies)
  0 siblings, 8 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Hi,

This series contains the previously posted linux-user fix for dealing
with weird mmap semantics as well as some tweaks to configure. Since
last version I've included Max's latest iotest update as well as
re-factored the configure logic. I've also added a patch for to
deprecate lm32 and unicore32 from configure.

Most need review:
 - configure: add [lm32|unicore32]-softmmu to deprecation logic
 - configure: include tilegx-linux-user in the deprecation logic
 - configure: clean-up the target-list-exclude logic
 - configure: also skip deprecated targets with target-list-exclude
 - configure: move deprecated feature processing to supported_target
 - linux-user: test, don't assert addr != test in pgb_reserved_va

Alex Bennée (7):
  linux-user: test, don't assert addr != test in pgb_reserved_va
  configure: move deprecated feature processing to supported_target
  configure: also skip deprecated targets with target-list-exclude
  configure: clean-up the target-list-exclude logic
  configure: include tilegx-linux-user in the deprecation logic
  gitlab: create a build-deprecated target
  configure: add [lm32|unicore32]-softmmu to deprecation logic

Max Reitz (1):
  iotests: Drop readlink -f

 configure                | 33 ++++++++++++++++++---------------
 linux-user/elfload.c     |  9 ++++-----
 .gitlab-ci.yml           | 15 +++++++++++++--
 .shippable.yml           |  2 +-
 .travis.yml              |  3 +--
 tests/qemu-iotests/check |  2 +-
 6 files changed, 38 insertions(+), 26 deletions(-)

-- 
2.20.1



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

* [PATCH  v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-15 13:43   ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Laurent Vivier, Bug 1895080

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Ameliorates: ee94743034
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 linux-user/elfload.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1



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

* [Bug 1895080] [PATCH  v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-15 13:43   ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Ameliorates: ee94743034
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 linux-user/elfload.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [PATCH  v2 2/8] iotests: Drop readlink -f
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
  2020-09-15 13:43   ` [Bug 1895080] " Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 17:14   ` Richard Henderson
  2020-09-15 13:43 ` [PATCH v2 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	open list:Block layer core, Max Reitz, Claudio Fontana,
	Alex Bennée

From: Max Reitz <mreitz@redhat.com>

On macOS, (out of the box) readlink does not have -f.  We do not really
need readlink here, though, it was just a replacement for realpath
(which is not available on our BSD test systems), which we needed to
make the $(dirname) into an absolute path.

Instead of using either, just use "cd; pwd" like is done for
$source_iotests.

       ("iotests: Allow running from different directory")

Fixes: b1cbc33a3971b6bb005d5ac3569feae35a71de0f
Reported-by: Claudio Fontana <cfontana@suse.de>
Reported-by: Thomas Huth <thuth@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200914145606.94620-1-mreitz@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/qemu-iotests/check | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e14a1f354dd9..678b6e49103a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -44,7 +44,7 @@ then
         _init_error "failed to obtain source tree name from check symlink"
     fi
     source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
-    build_iotests=$(readlink -f $(dirname "$0"))
+    build_iotests=$(cd "$(dirname "$0")"; pwd)
 else
     # called from the source tree
     source_iotests=$PWD
-- 
2.20.1



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

* [PATCH v2 3/8] configure: move deprecated feature processing to supported_target
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
  2020-09-15 13:43   ` [Bug 1895080] " Alex Bennée
  2020-09-15 13:43 ` [PATCH v2 2/8] iotests: Drop readlink -f Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 13:51   ` Michael Tokarev
  2020-09-15 13:43 ` [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

This is the common point at which we validate targets so it makes
sense to add_to deprecated_features here. It will make future target
deprecation easier as we only need to tweak one list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index ce27eafb0a9e..51d03a8d340f 100755
--- a/configure
+++ b/configure
@@ -280,6 +280,9 @@ supported_whpx_target() {
     return 1
 }
 
+deprecated_targets_list=ppc64abi32-linux-user
+deprecated_features=""
+
 supported_target() {
     case "$1" in
         *-softmmu)
@@ -301,6 +304,12 @@ supported_target() {
             return 1
             ;;
     esac
+
+    # if a deprecated target is enabled we note it here
+    if echo "$deprecated_targets_list" | grep -q "$1"; then
+        add_to deprecated_features $1
+    fi
+
     test "$tcg" = "yes" && return 0
     supported_kvm_target "$1" && return 0
     supported_xen_target "$1" && return 0
@@ -542,8 +551,6 @@ gettext=""
 bogus_os="no"
 malloc_trim=""
 
-deprecated_features=""
-
 # parse CC options first
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
@@ -1724,7 +1731,7 @@ fi
 
 if test -z "$target_list_exclude" -a -z "$target_list"; then
     # if the user doesn't specify anything lets skip deprecating stuff
-    target_list_exclude=ppc64abi32-linux-user
+    target_list_exclude=$deprecated_targets_list
 fi
 
 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
@@ -7668,7 +7675,6 @@ case "$target_name" in
     TARGET_SYSTBL_ABI=common,nospu,32
     echo "TARGET_ABI32=y" >> $config_target_mak
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
-    deprecated_features="ppc64abi32 ${deprecated_features}"
   ;;
   riscv32)
     TARGET_BASE_ARCH=riscv
-- 
2.20.1



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

* [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
                   ` (2 preceding siblings ...)
  2020-09-15 13:43 ` [PATCH v2 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 17:16   ` Richard Henderson
  2020-09-15 13:43 ` [PATCH v2 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Now the user has to make an even more deliberate decision to
enable a deprecated target rather than getting it as a side effect of
using --target-exclude-list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 51d03a8d340f..f5fe48d6dd7b 100755
--- a/configure
+++ b/configure
@@ -1729,9 +1729,14 @@ if [ "$bsd_user" = "yes" ]; then
     mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
 fi
 
-if test -z "$target_list_exclude" -a -z "$target_list"; then
-    # if the user doesn't specify anything lets skip deprecating stuff
-    target_list_exclude=$deprecated_targets_list
+# If the user doesn't explicitly specify a deprecated target we will
+# skip it.
+if test -z "$target_list"; then
+    if test -z "$target_list_exclude"; then
+        target_list_exclude="$deprecated_targets_list"
+    else
+        target_list_exclude="$target_list_exclude,$deprecated_targets_list"
+    fi
 fi
 
 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
-- 
2.20.1



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

* [PATCH  v2 5/8] configure: clean-up the target-list-exclude logic
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
                   ` (3 preceding siblings ...)
  2020-09-15 13:43 ` [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 17:17   ` Richard Henderson
  2020-09-15 13:43 ` [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Rather than sed and loop just do a grep.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/configure b/configure
index f5fe48d6dd7b..58be974065c8 100755
--- a/configure
+++ b/configure
@@ -1739,17 +1739,9 @@ if test -z "$target_list"; then
     fi
 fi
 
-exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
 for config in $mak_wilds; do
     target="$(basename "$config" .mak)"
-    exclude="no"
-    for excl in $exclude_list; do
-        if test "$excl" = "$target"; then
-            exclude="yes"
-            break;
-        fi
-    done
-    if test "$exclude" = "no"; then
+    if echo "$target_list_exclude" | grep -vq "$target"; then
         default_target_list="${default_target_list} $target"
     fi
 done
-- 
2.20.1



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

* [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
                   ` (4 preceding siblings ...)
  2020-09-15 13:43 ` [PATCH v2 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 17:17   ` Richard Henderson
  2020-09-15 17:47   ` Philippe Mathieu-Daudé
  2020-09-15 13:43 ` [PATCH v2 7/8] gitlab: create a build-deprecated target Alex Bennée
  2020-09-15 13:43 ` [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
  7 siblings, 2 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

The target is already marked as deprecated in the documentation.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 58be974065c8..dfd7f18dcb24 100755
--- a/configure
+++ b/configure
@@ -280,7 +280,7 @@ supported_whpx_target() {
     return 1
 }
 
-deprecated_targets_list=ppc64abi32-linux-user
+deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
 deprecated_features=""
 
 supported_target() {
-- 
2.20.1



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

* [PATCH  v2 7/8] gitlab: create a build-deprecated target
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
                   ` (5 preceding siblings ...)
  2020-09-15 13:43 ` [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 13:43 ` [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
  7 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

These targets might be deprecated but we should keep them building
before the final axe comes down. Lets keep them all in one place and
don't hold up the CI if they do fail. They are either poorly tested or
already flaky anyway.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
---
 .gitlab-ci.yml | 10 ++++++++++
 .travis.yml    |  3 +--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72e8604579ee..f027b55aef15 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -254,6 +254,16 @@ build-clang:
       ppc-softmmu s390x-softmmu arm-linux-user
     MAKE_CHECK_ARGS: check
 
+# These targets are on the way out
+build-deprecated:
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: debian-all-test-cross
+    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
+    MAKE_CHECK_ARGS: check-tcg
+    TARGETS: ppc64abi32-linux-user tilegx-linux-user
+  allow_failure: true
+
 build-oss-fuzz:
   <<: *native_build_job_definition
   variables:
diff --git a/.travis.yml b/.travis.yml
index 65341634d02a..c75221dca3e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -344,10 +344,9 @@ jobs:
     # Run check-tcg against linux-user (with plugins)
     # we skip sparc64-linux-user until it has been fixed somewhat
     # we skip cris-linux-user as it doesn't use the common run loop
-    # we skip ppc64abi32-linux-user as it seems to have a broken libc
     - name: "GCC plugins check-tcg (user)"
       env:
-        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"
+        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user"
         - TEST_BUILD_CMD="make build-tcg"
         - TEST_CMD="make check-tcg"
         - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
-- 
2.20.1



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

* [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic
  2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
                   ` (6 preceding siblings ...)
  2020-09-15 13:43 ` [PATCH v2 7/8] gitlab: create a build-deprecated target Alex Bennée
@ 2020-09-15 13:43 ` Alex Bennée
  2020-09-15 17:20   ` Richard Henderson
  2020-10-29 12:25   ` Thomas Huth
  7 siblings, 2 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-15 13:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

While we are at it move the few places where they are into the
deprecation build bucket.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 configure      | 2 +-
 .gitlab-ci.yml | 9 +++++----
 .shippable.yml | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index dfd7f18dcb24..756447900855 100755
--- a/configure
+++ b/configure
@@ -280,7 +280,7 @@ supported_whpx_target() {
     return 1
 }
 
-deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
+deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user,lm32-softmmu,unicore32-softmmu
 deprecated_features=""
 
 supported_target() {
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f027b55aef15..a18e18b57e54 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -134,7 +134,7 @@ build-system-fedora:
   variables:
     IMAGE: fedora
     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
-    TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
+    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
       xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
     MAKE_CHECK_ARGS: check-build
   artifacts:
@@ -166,7 +166,7 @@ build-system-centos:
   variables:
     IMAGE: centos8
     CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
-    TARGETS: ppc64-softmmu lm32-softmmu or1k-softmmu s390x-softmmu
+    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
       x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
     MAKE_CHECK_ARGS: check-build
   artifacts:
@@ -259,9 +259,10 @@ build-deprecated:
   <<: *native_build_job_definition
   variables:
     IMAGE: debian-all-test-cross
-    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
+    CONFIGURE_ARGS: --disable-docs --disable-tools
     MAKE_CHECK_ARGS: check-tcg
-    TARGETS: ppc64abi32-linux-user tilegx-linux-user
+    TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
+      unicore32-softmmu
   allow_failure: true
 
 build-oss-fuzz:
diff --git a/.shippable.yml b/.shippable.yml
index 89d8be4291b0..0b4fd6df1d81 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -8,7 +8,7 @@ env:
     - IMAGE=debian-amd64
       TARGET_LIST=x86_64-softmmu,x86_64-linux-user
     - IMAGE=debian-win32-cross
-      TARGET_LIST=arm-softmmu,i386-softmmu,lm32-softmmu
+      TARGET_LIST=arm-softmmu,i386-softmmu
     - IMAGE=debian-win64-cross
       TARGET_LIST=aarch64-softmmu,sparc64-softmmu,x86_64-softmmu
     - IMAGE=debian-armel-cross
-- 
2.20.1



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

* Re: [PATCH v2 3/8] configure: move deprecated feature processing to supported_target
  2020-09-15 13:43 ` [PATCH v2 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
@ 2020-09-15 13:51   ` Michael Tokarev
  0 siblings, 0 replies; 73+ messages in thread
From: Michael Tokarev @ 2020-09-15 13:51 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

15.09.2020 16:43, Alex Bennée wrote:
> This is the common point at which we validate targets so it makes
> sense to add_to deprecated_features here. It will make future target
> deprecation easier as we only need to tweak one list.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 14 ++++++++++----

> +
> +    # if a deprecated target is enabled we note it here
> +    if echo "$deprecated_targets_list" | grep -q "$1"; then
> +        add_to deprecated_features $1
> +    fi


  case " $deprecated_targets_list " in (*" $1 "*) add_to deprecated_features $1;; esac

JFYI, - there's nothing wrong with echo|grep, it will work about the same way.. :)

/mjt


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

* Re: [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-15 15:58     ` Laurent Vivier
  0 siblings, 0 replies; 73+ messages in thread
From: Laurent Vivier @ 2020-09-15 15:58 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Bug 1895080

Le 15/09/2020 à 15:43, Alex Bennée a écrit :
> On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
> may still fail to give us the address we asked for despite having
> already probed the map for a valid hole. Asserting isn't particularly
> useful to the user so let us move the check up and expand the
> error_report a little to give them a fighting chance of working around
> the problem.
> 
> Ameliorates: ee94743034
> Cc: Bug 1895080 <1895080@bugs.launchpad.net>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  linux-user/elfload.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 4961e6119e24..f6022fd70493 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
>      assert(guest_base != 0);
>      test = g2h(0);
>      addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
> -    if (addr == MAP_FAILED) {
> +    if (addr == MAP_FAILED || addr != test) {
>          error_report("Unable to reserve 0x%lx bytes of virtual address "
> -                     "space (%s) for use as guest address space (check your "
> -                     "virtual memory ulimit setting or reserve less "
> -                     "using -R option)", reserved_va, strerror(errno));
> +                     "space at %p (%s) for use as guest address space (check your"
> +                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
> +                     "using -R option)", reserved_va, test, strerror(errno));
>          exit(EXIT_FAILURE);
>      }
> -    assert(addr == test);
>  }
>  
>  void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


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

* [Bug 1895080] Re: [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-15 15:58     ` Laurent Vivier
  0 siblings, 0 replies; 73+ messages in thread
From: Laurent Vivier @ 2020-09-15 15:58 UTC (permalink / raw)
  To: qemu-devel

Le 15/09/2020 à 15:43, Alex Bennée a écrit :
> On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
> may still fail to give us the address we asked for despite having
> already probed the map for a valid hole. Asserting isn't particularly
> useful to the user so let us move the check up and expand the
> error_report a little to give them a fighting chance of working around
> the problem.
> 
> Ameliorates: ee94743034
> Cc: Bug 1895080 <1895080@bugs.launchpad.net>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  linux-user/elfload.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 4961e6119e24..f6022fd70493 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
>      assert(guest_base != 0);
>      test = g2h(0);
>      addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
> -    if (addr == MAP_FAILED) {
> +    if (addr == MAP_FAILED || addr != test) {
>          error_report("Unable to reserve 0x%lx bytes of virtual address "
> -                     "space (%s) for use as guest address space (check your "
> -                     "virtual memory ulimit setting or reserve less "
> -                     "using -R option)", reserved_va, strerror(errno));
> +                     "space at %p (%s) for use as guest address space (check your"
> +                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
> +                     "using -R option)", reserved_va, test, strerror(errno));
>          exit(EXIT_FAILURE);
>      }
> -    assert(addr == test);
>  }
>  
>  void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* Re: [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
  2020-09-15 13:43   ` [Bug 1895080] " Alex Bennée
  (?)
  (?)
@ 2020-09-15 17:13   ` Richard Henderson
  -1 siblings, 0 replies; 73+ messages in thread
From: Richard Henderson @ 2020-09-15 17:13 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Laurent Vivier, Bug 1895080

On 9/15/20 6:43 AM, Alex Bennée wrote:
> On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
> may still fail to give us the address we asked for despite having
> already probed the map for a valid hole. Asserting isn't particularly
> useful to the user so let us move the check up and expand the
> error_report a little to give them a fighting chance of working around
> the problem.
> 
> Ameliorates: ee94743034
> Cc: Bug 1895080 <1895080@bugs.launchpad.net>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  linux-user/elfload.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH v2 2/8] iotests: Drop readlink -f
  2020-09-15 13:43 ` [PATCH v2 2/8] iotests: Drop readlink -f Alex Bennée
@ 2020-09-15 17:14   ` Richard Henderson
  0 siblings, 0 replies; 73+ messages in thread
From: Richard Henderson @ 2020-09-15 17:14 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Kevin Wolf, Peter Maydell, Thomas Huth,
	open list:Block layer core, Max Reitz, Claudio Fontana

On 9/15/20 6:43 AM, Alex Bennée wrote:
> From: Max Reitz <mreitz@redhat.com>
> 
> On macOS, (out of the box) readlink does not have -f.  We do not really
> need readlink here, though, it was just a replacement for realpath
> (which is not available on our BSD test systems), which we needed to
> make the $(dirname) into an absolute path.
> 
> Instead of using either, just use "cd; pwd" like is done for
> $source_iotests.
> 
>        ("iotests: Allow running from different directory")
> 
> Fixes: b1cbc33a3971b6bb005d5ac3569feae35a71de0f
> Reported-by: Claudio Fontana <cfontana@suse.de>
> Reported-by: Thomas Huth <thuth@redhat.com>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Message-Id: <20200914145606.94620-1-mreitz@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/qemu-iotests/check | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



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

* Re: [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude
  2020-09-15 13:43 ` [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
@ 2020-09-15 17:16   ` Richard Henderson
  0 siblings, 0 replies; 73+ messages in thread
From: Richard Henderson @ 2020-09-15 17:16 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 9/15/20 6:43 AM, Alex Bennée wrote:
> Now the user has to make an even more deliberate decision to
> enable a deprecated target rather than getting it as a side effect of
> using --target-exclude-list.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



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

* Re: [PATCH v2 5/8] configure: clean-up the target-list-exclude logic
  2020-09-15 13:43 ` [PATCH v2 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
@ 2020-09-15 17:17   ` Richard Henderson
  0 siblings, 0 replies; 73+ messages in thread
From: Richard Henderson @ 2020-09-15 17:17 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 9/15/20 6:43 AM, Alex Bennée wrote:
> Rather than sed and loop just do a grep.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



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

* Re: [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic
  2020-09-15 13:43 ` [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
@ 2020-09-15 17:17   ` Richard Henderson
  2020-09-15 17:47   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 73+ messages in thread
From: Richard Henderson @ 2020-09-15 17:17 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 9/15/20 6:43 AM, Alex Bennée wrote:
> The target is already marked as deprecated in the documentation.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



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

* Re: [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic
  2020-09-15 13:43 ` [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
@ 2020-09-15 17:20   ` Richard Henderson
  2020-10-29 12:25   ` Thomas Huth
  1 sibling, 0 replies; 73+ messages in thread
From: Richard Henderson @ 2020-09-15 17:20 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Fam Zheng, Thomas Huth, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta

On 9/15/20 6:43 AM, Alex Bennée wrote:
> While we are at it move the few places where they are into the
> deprecation build bucket.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure      | 2 +-
>  .gitlab-ci.yml | 9 +++++----
>  .shippable.yml | 2 +-
>  3 files changed, 7 insertions(+), 6 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



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

* Re: [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic
  2020-09-15 13:43 ` [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
  2020-09-15 17:17   ` Richard Henderson
@ 2020-09-15 17:47   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 73+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-15 17:47 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 9/15/20 3:43 PM, Alex Bennée wrote:
> The target is already marked as deprecated in the documentation.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 58be974065c8..dfd7f18dcb24 100755
> --- a/configure
> +++ b/configure
> @@ -280,7 +280,7 @@ supported_whpx_target() {
>      return 1
>  }
>  
> -deprecated_targets_list=ppc64abi32-linux-user
> +deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
>  deprecated_features=""
>  
>  supported_target() {
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>



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

* [PULL 0/8] configure deprecation, linux-user and test fix
@ 2020-09-16 12:26 Alex Bennée
  2020-09-16 12:26   ` [Bug 1895080] " Alex Bennée
                   ` (8 more replies)
  0 siblings, 9 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell; +Cc: Alex Bennée, qemu-devel

The following changes since commit de39a045bd8d2b49e4f3d07976622c29d58e0bac:

  Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200915-pull-request' into staging (2020-09-15 14:25:05 +0100)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-configure-fixes-160920-1

for you to fetch changes up to 3ffc7f013763bf4fc50c3b403cbacca2bee68cfa:

  configure: add [lm32|unicore32]-softmmu to deprecation logic (2020-09-16 10:07:01 +0100)

----------------------------------------------------------------
configure tweaks for deprecation

  - iotest fix for readlink -f
  - linux-user, report rather than assert on mmap failure
  - clean-up and re-factor the logic
  - add tilegx-linux-user to deprecated_targets_list
  - add [lm32|unicore32]-softmmu deprecated_targets_list
  - add a gitlab deprecated builds test

----------------------------------------------------------------
Alex Bennée (7):
      linux-user: test, don't assert addr != test in pgb_reserved_va
      configure: move deprecated feature processing to supported_target
      configure: also skip deprecated targets with target-list-exclude
      configure: clean-up the target-list-exclude logic
      configure: include tilegx-linux-user in the deprecation logic
      gitlab: create a build-deprecated target
      configure: add [lm32|unicore32]-softmmu to deprecation logic

Max Reitz (1):
      iotests: Drop readlink -f

 configure                | 33 ++++++++++++++++++---------------
 linux-user/elfload.c     |  9 ++++-----
 .gitlab-ci.yml           | 15 +++++++++++++--
 .shippable.yml           |  2 +-
 .travis.yml              |  3 +--
 tests/qemu-iotests/check |  2 +-
 6 files changed, 38 insertions(+), 26 deletions(-)

-- 
2.20.1



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

* [PULL 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-16 12:26   ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell
  Cc: Richard Henderson, Bug 1895080, Alex Bennée, qemu-devel,
	Laurent Vivier

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Ameliorates: ee94743034
Message-Id: <20200915134317.11110-2-alex.bennee@linaro.org>

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1



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

* [Bug 1895080] [PULL 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va
@ 2020-09-16 12:26   ` Alex Bennée
  0 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: qemu-devel

On older kernels which don't implement MAP_FIXED_NOREPLACE the kernel
may still fail to give us the address we asked for despite having
already probed the map for a valid hole. Asserting isn't particularly
useful to the user so let us move the check up and expand the
error_report a little to give them a fighting chance of working around
the problem.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Bug 1895080 <1895080@bugs.launchpad.net>
Ameliorates: ee94743034
Message-Id: <20200915134317.11110-2-alex.bennee@linaro.org>

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4961e6119e24..f6022fd70493 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2331,14 +2331,13 @@ static void pgb_reserved_va(const char *image_name, abi_ulong guest_loaddr,
     assert(guest_base != 0);
     test = g2h(0);
     addr = mmap(test, reserved_va, PROT_NONE, flags, -1, 0);
-    if (addr == MAP_FAILED) {
+    if (addr == MAP_FAILED || addr != test) {
         error_report("Unable to reserve 0x%lx bytes of virtual address "
-                     "space (%s) for use as guest address space (check your "
-                     "virtual memory ulimit setting or reserve less "
-                     "using -R option)", reserved_va, strerror(errno));
+                     "space at %p (%s) for use as guest address space (check your"
+                     "virtual memory ulimit setting, min_mmap_addr or reserve less "
+                     "using -R option)", reserved_va, test, strerror(errno));
         exit(EXIT_FAILURE);
     }
-    assert(addr == test);
 }
 
 void probe_guest_base(const char *image_name, abi_ulong guest_loaddr,
-- 
2.20.1

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  New

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [PULL 2/8] iotests: Drop readlink -f
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
  2020-09-16 12:26   ` [Bug 1895080] " Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-16 12:26 ` [PULL 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell
  Cc: Kevin Wolf, Thomas Huth, open list:Block layer core,
	Richard Henderson, qemu-devel, Max Reitz, Claudio Fontana,
	Alex Bennée

From: Max Reitz <mreitz@redhat.com>

On macOS, (out of the box) readlink does not have -f.  We do not really
need readlink here, though, it was just a replacement for realpath
(which is not available on our BSD test systems), which we needed to
make the $(dirname) into an absolute path.

Instead of using either, just use "cd; pwd" like is done for
$source_iotests.

       ("iotests: Allow running from different directory")

Fixes: b1cbc33a3971b6bb005d5ac3569feae35a71de0f
Reported-by: Claudio Fontana <cfontana@suse.de>
Reported-by: Thomas Huth <thuth@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200914145606.94620-1-mreitz@redhat.com>
Message-Id: <20200915134317.11110-3-alex.bennee@linaro.org>

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e14a1f354dd9..678b6e49103a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -44,7 +44,7 @@ then
         _init_error "failed to obtain source tree name from check symlink"
     fi
     source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
-    build_iotests=$(readlink -f $(dirname "$0"))
+    build_iotests=$(cd "$(dirname "$0")"; pwd)
 else
     # called from the source tree
     source_iotests=$PWD
-- 
2.20.1



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

* [PULL 3/8] configure: move deprecated feature processing to supported_target
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
  2020-09-16 12:26   ` [Bug 1895080] " Alex Bennée
  2020-09-16 12:26 ` [PULL 2/8] iotests: Drop readlink -f Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-16 12:26 ` [PULL 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell; +Cc: Alex Bennée, qemu-devel

This is the common point at which we validate targets so it makes
sense to add_to deprecated_features here. It will make future target
deprecation easier as we only need to tweak one list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200915134317.11110-4-alex.bennee@linaro.org>

diff --git a/configure b/configure
index ce27eafb0a9e..51d03a8d340f 100755
--- a/configure
+++ b/configure
@@ -280,6 +280,9 @@ supported_whpx_target() {
     return 1
 }
 
+deprecated_targets_list=ppc64abi32-linux-user
+deprecated_features=""
+
 supported_target() {
     case "$1" in
         *-softmmu)
@@ -301,6 +304,12 @@ supported_target() {
             return 1
             ;;
     esac
+
+    # if a deprecated target is enabled we note it here
+    if echo "$deprecated_targets_list" | grep -q "$1"; then
+        add_to deprecated_features $1
+    fi
+
     test "$tcg" = "yes" && return 0
     supported_kvm_target "$1" && return 0
     supported_xen_target "$1" && return 0
@@ -542,8 +551,6 @@ gettext=""
 bogus_os="no"
 malloc_trim=""
 
-deprecated_features=""
-
 # parse CC options first
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
@@ -1724,7 +1731,7 @@ fi
 
 if test -z "$target_list_exclude" -a -z "$target_list"; then
     # if the user doesn't specify anything lets skip deprecating stuff
-    target_list_exclude=ppc64abi32-linux-user
+    target_list_exclude=$deprecated_targets_list
 fi
 
 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
@@ -7668,7 +7675,6 @@ case "$target_name" in
     TARGET_SYSTBL_ABI=common,nospu,32
     echo "TARGET_ABI32=y" >> $config_target_mak
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml power-vsx.xml"
-    deprecated_features="ppc64abi32 ${deprecated_features}"
   ;;
   riscv32)
     TARGET_BASE_ARCH=riscv
-- 
2.20.1



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

* [PULL 4/8] configure: also skip deprecated targets with target-list-exclude
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
                   ` (2 preceding siblings ...)
  2020-09-16 12:26 ` [PULL 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-16 12:26 ` [PULL 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell; +Cc: Richard Henderson, Alex Bennée, qemu-devel

Now the user has to make an even more deliberate decision to
enable a deprecated target rather than getting it as a side effect of
using --target-exclude-list.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-5-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 51d03a8d340f..f5fe48d6dd7b 100755
--- a/configure
+++ b/configure
@@ -1729,9 +1729,14 @@ if [ "$bsd_user" = "yes" ]; then
     mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
 fi
 
-if test -z "$target_list_exclude" -a -z "$target_list"; then
-    # if the user doesn't specify anything lets skip deprecating stuff
-    target_list_exclude=$deprecated_targets_list
+# If the user doesn't explicitly specify a deprecated target we will
+# skip it.
+if test -z "$target_list"; then
+    if test -z "$target_list_exclude"; then
+        target_list_exclude="$deprecated_targets_list"
+    else
+        target_list_exclude="$target_list_exclude,$deprecated_targets_list"
+    fi
 fi
 
 exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
-- 
2.20.1



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

* [PULL 5/8] configure: clean-up the target-list-exclude logic
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
                   ` (3 preceding siblings ...)
  2020-09-16 12:26 ` [PULL 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-16 12:26 ` [PULL 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell; +Cc: Richard Henderson, Alex Bennée, qemu-devel

Rather than sed and loop just do a grep.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-6-alex.bennee@linaro.org>

diff --git a/configure b/configure
index f5fe48d6dd7b..58be974065c8 100755
--- a/configure
+++ b/configure
@@ -1739,17 +1739,9 @@ if test -z "$target_list"; then
     fi
 fi
 
-exclude_list=$(echo "$target_list_exclude" | sed -e 's/,/ /g')
 for config in $mak_wilds; do
     target="$(basename "$config" .mak)"
-    exclude="no"
-    for excl in $exclude_list; do
-        if test "$excl" = "$target"; then
-            exclude="yes"
-            break;
-        fi
-    done
-    if test "$exclude" = "no"; then
+    if echo "$target_list_exclude" | grep -vq "$target"; then
         default_target_list="${default_target_list} $target"
     fi
 done
-- 
2.20.1



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

* [PULL 6/8] configure: include tilegx-linux-user in the deprecation logic
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
                   ` (4 preceding siblings ...)
  2020-09-16 12:26 ` [PULL 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-16 12:26 ` [PULL 7/8] gitlab: create a build-deprecated target Alex Bennée
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell
  Cc: Richard Henderson, Alex Bennée, qemu-devel,
	Philippe Mathieu-Daudé

The target is already marked as deprecated in the documentation.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-7-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 58be974065c8..dfd7f18dcb24 100755
--- a/configure
+++ b/configure
@@ -280,7 +280,7 @@ supported_whpx_target() {
     return 1
 }
 
-deprecated_targets_list=ppc64abi32-linux-user
+deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
 deprecated_features=""
 
 supported_target() {
-- 
2.20.1



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

* [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
                   ` (5 preceding siblings ...)
  2020-09-16 12:26 ` [PULL 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-16 12:40   ` Peter Maydell
  2020-09-16 12:26 ` [PULL 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
  2020-09-17 19:40 ` [PULL 0/8] configure deprecation, linux-user and test fix Peter Maydell
  8 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell
  Cc: Fam Zheng, Thomas Huth, Alex Bennée, qemu-devel,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé

These targets might be deprecated but we should keep them building
before the final axe comes down. Lets keep them all in one place and
don't hold up the CI if they do fail. They are either poorly tested or
already flaky anyway.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200915134317.11110-8-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 72e8604579ee..f027b55aef15 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -254,6 +254,16 @@ build-clang:
       ppc-softmmu s390x-softmmu arm-linux-user
     MAKE_CHECK_ARGS: check
 
+# These targets are on the way out
+build-deprecated:
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: debian-all-test-cross
+    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
+    MAKE_CHECK_ARGS: check-tcg
+    TARGETS: ppc64abi32-linux-user tilegx-linux-user
+  allow_failure: true
+
 build-oss-fuzz:
   <<: *native_build_job_definition
   variables:
diff --git a/.travis.yml b/.travis.yml
index 65341634d02a..c75221dca3e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -344,10 +344,9 @@ jobs:
     # Run check-tcg against linux-user (with plugins)
     # we skip sparc64-linux-user until it has been fixed somewhat
     # we skip cris-linux-user as it doesn't use the common run loop
-    # we skip ppc64abi32-linux-user as it seems to have a broken libc
     - name: "GCC plugins check-tcg (user)"
       env:
-        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user,ppc64abi32-linux-user"
+        - CONFIG="--disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user"
         - TEST_BUILD_CMD="make build-tcg"
         - TEST_CMD="make check-tcg"
         - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-debug-tcg"
-- 
2.20.1



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

* [PULL 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
                   ` (6 preceding siblings ...)
  2020-09-16 12:26 ` [PULL 7/8] gitlab: create a build-deprecated target Alex Bennée
@ 2020-09-16 12:26 ` Alex Bennée
  2020-09-17 19:40 ` [PULL 0/8] configure deprecation, linux-user and test fix Peter Maydell
  8 siblings, 0 replies; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 12:26 UTC (permalink / raw)
  To: peter.maydell
  Cc: Fam Zheng, Thomas Huth, Philippe Mathieu-Daudé,
	Richard Henderson, qemu-devel, Wainer dos Santos Moschetta,
	Alex Bennée

While we are at it move the few places where they are into the
deprecation build bucket.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200915134317.11110-9-alex.bennee@linaro.org>

diff --git a/configure b/configure
index dfd7f18dcb24..756447900855 100755
--- a/configure
+++ b/configure
@@ -280,7 +280,7 @@ supported_whpx_target() {
     return 1
 }
 
-deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user
+deprecated_targets_list=ppc64abi32-linux-user,tilegx-linux-user,lm32-softmmu,unicore32-softmmu
 deprecated_features=""
 
 supported_target() {
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f027b55aef15..a18e18b57e54 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -134,7 +134,7 @@ build-system-fedora:
   variables:
     IMAGE: fedora
     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
-    TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
+    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
       xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
     MAKE_CHECK_ARGS: check-build
   artifacts:
@@ -166,7 +166,7 @@ build-system-centos:
   variables:
     IMAGE: centos8
     CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
-    TARGETS: ppc64-softmmu lm32-softmmu or1k-softmmu s390x-softmmu
+    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
       x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
     MAKE_CHECK_ARGS: check-build
   artifacts:
@@ -259,9 +259,10 @@ build-deprecated:
   <<: *native_build_job_definition
   variables:
     IMAGE: debian-all-test-cross
-    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
+    CONFIGURE_ARGS: --disable-docs --disable-tools
     MAKE_CHECK_ARGS: check-tcg
-    TARGETS: ppc64abi32-linux-user tilegx-linux-user
+    TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
+      unicore32-softmmu
   allow_failure: true
 
 build-oss-fuzz:
diff --git a/.shippable.yml b/.shippable.yml
index 89d8be4291b0..0b4fd6df1d81 100644
--- a/.shippable.yml
+++ b/.shippable.yml
@@ -8,7 +8,7 @@ env:
     - IMAGE=debian-amd64
       TARGET_LIST=x86_64-softmmu,x86_64-linux-user
     - IMAGE=debian-win32-cross
-      TARGET_LIST=arm-softmmu,i386-softmmu,lm32-softmmu
+      TARGET_LIST=arm-softmmu,i386-softmmu
     - IMAGE=debian-win64-cross
       TARGET_LIST=aarch64-softmmu,sparc64-softmmu,x86_64-softmmu
     - IMAGE=debian-armel-cross
-- 
2.20.1



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

* Re: [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-16 12:26 ` [PULL 7/8] gitlab: create a build-deprecated target Alex Bennée
@ 2020-09-16 12:40   ` Peter Maydell
  2020-09-16 13:23     ` Alex Bennée
  0 siblings, 1 reply; 73+ messages in thread
From: Peter Maydell @ 2020-09-16 12:40 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Fam Zheng, Thomas Huth, Philippe Mathieu-Daudé,
	QEMU Developers, Wainer dos Santos Moschetta

On Wed, 16 Sep 2020 at 13:27, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> These targets might be deprecated but we should keep them building
> before the final axe comes down. Lets keep them all in one place and
> don't hold up the CI if they do fail. They are either poorly tested or
> already flaky anyway.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Acked-by: Thomas Huth <thuth@redhat.com>
> Message-Id: <20200915134317.11110-8-alex.bennee@linaro.org>
>
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 72e8604579ee..f027b55aef15 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -254,6 +254,16 @@ build-clang:
>        ppc-softmmu s390x-softmmu arm-linux-user
>      MAKE_CHECK_ARGS: check
>
> +# These targets are on the way out
> +build-deprecated:
> +  <<: *native_build_job_definition
> +  variables:
> +    IMAGE: debian-all-test-cross
> +    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
> +    MAKE_CHECK_ARGS: check-tcg
> +    TARGETS: ppc64abi32-linux-user tilegx-linux-user
> +  allow_failure: true

It's kind of awkward to have the CI config need to be updated when
we mark a config as deprecated. Can we have something so that
the CI just arranges to build all of the deprecated targets?

(As demonstration, this list is missing unicore32, which is also deprecated.)

Also, "allow_failure: true" seems wrong to me. These targets
are only deprecated, which means we promise that the feature
should still work (to whatever extent it already did) for the 2
releases in which it is deprecated. We want our CI to tell us
if it fails to compile or fails tests, because we would need to
fix those bugs for a release.

thanks
-- PMM


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

* Re: [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-16 12:40   ` Peter Maydell
@ 2020-09-16 13:23     ` Alex Bennée
  2020-09-16 13:52       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-09-16 13:23 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Fam Zheng, Thomas Huth, Philippe Mathieu-Daudé,
	QEMU Developers, Wainer dos Santos Moschetta


Peter Maydell <peter.maydell@linaro.org> writes:

> On Wed, 16 Sep 2020 at 13:27, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> These targets might be deprecated but we should keep them building
>> before the final axe comes down. Lets keep them all in one place and
>> don't hold up the CI if they do fail. They are either poorly tested or
>> already flaky anyway.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Acked-by: Thomas Huth <thuth@redhat.com>
>> Message-Id: <20200915134317.11110-8-alex.bennee@linaro.org>
>>
>> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
>> index 72e8604579ee..f027b55aef15 100644
>> --- a/.gitlab-ci.yml
>> +++ b/.gitlab-ci.yml
>> @@ -254,6 +254,16 @@ build-clang:
>>        ppc-softmmu s390x-softmmu arm-linux-user
>>      MAKE_CHECK_ARGS: check
>>
>> +# These targets are on the way out
>> +build-deprecated:
>> +  <<: *native_build_job_definition
>> +  variables:
>> +    IMAGE: debian-all-test-cross
>> +    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
>> +    MAKE_CHECK_ARGS: check-tcg
>> +    TARGETS: ppc64abi32-linux-user tilegx-linux-user
>> +  allow_failure: true
>
> It's kind of awkward to have the CI config need to be updated when
> we mark a config as deprecated. Can we have something so that
> the CI just arranges to build all of the deprecated targets?

You mean a configure --enable-deprecated-targets?

>
> (As demonstration, this list is missing unicore32, which is also
> deprecated.)

That was fixed up in the next patch.

> Also, "allow_failure: true" seems wrong to me. These targets
> are only deprecated, which means we promise that the feature
> should still work (to whatever extent it already did) for the 2
> releases in which it is deprecated. We want our CI to tell us
> if it fails to compile or fails tests, because we would need to
> fix those bugs for a release.

I can revert that bit.

-- 
Alex Bennée


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

* Re: [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-16 13:23     ` Alex Bennée
@ 2020-09-16 13:52       ` Philippe Mathieu-Daudé
  2020-09-25 15:54         ` Peter Maydell
  0 siblings, 1 reply; 73+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-16 13:52 UTC (permalink / raw)
  To: Alex Bennée, Peter Maydell
  Cc: Fam Zheng, Thomas Huth, QEMU Developers, Wainer dos Santos Moschetta

On 9/16/20 3:23 PM, Alex Bennée wrote:
> 
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> On Wed, 16 Sep 2020 at 13:27, Alex Bennée <alex.bennee@linaro.org> wrote:
>>>
>>> These targets might be deprecated but we should keep them building
>>> before the final axe comes down. Lets keep them all in one place and
>>> don't hold up the CI if they do fail. They are either poorly tested or
>>> already flaky anyway.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> Acked-by: Thomas Huth <thuth@redhat.com>
>>> Message-Id: <20200915134317.11110-8-alex.bennee@linaro.org>
>>>
>>> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
>>> index 72e8604579ee..f027b55aef15 100644
>>> --- a/.gitlab-ci.yml
>>> +++ b/.gitlab-ci.yml
>>> @@ -254,6 +254,16 @@ build-clang:
>>>        ppc-softmmu s390x-softmmu arm-linux-user
>>>      MAKE_CHECK_ARGS: check
>>>
>>> +# These targets are on the way out
>>> +build-deprecated:
>>> +  <<: *native_build_job_definition
>>> +  variables:
>>> +    IMAGE: debian-all-test-cross
>>> +    CONFIGURE_ARGS: --disable-docs --disable-tools --disable-system
>>> +    MAKE_CHECK_ARGS: check-tcg
>>> +    TARGETS: ppc64abi32-linux-user tilegx-linux-user
>>> +  allow_failure: true
>>
>> It's kind of awkward to have the CI config need to be updated when
>> we mark a config as deprecated. Can we have something so that
>> the CI just arranges to build all of the deprecated targets?
> 
> You mean a configure --enable-deprecated-targets?
> 
>>
>> (As demonstration, this list is missing unicore32, which is also
>> deprecated.)
> 
> That was fixed up in the next patch.
> 
>> Also, "allow_failure: true" seems wrong to me. These targets
>> are only deprecated, which means we promise that the feature
>> should still work (to whatever extent it already did) for the 2
>> releases in which it is deprecated. We want our CI to tell us
>> if it fails to compile or fails tests, because we would need to
>> fix those bugs for a release.

Should we stop building the ppc64abi32 target instead?

From c609274b853 ("docs/system/deprecated: mark
ppc64abi32-linux-user for deprecation"):

 The ppc64abi32 architecture has a number of issues which regularly
 trip up our CI testing and is suspected to be quite broken. For that
 reason the maintainers strongly suspect no one actually uses it.

> 
> I can revert that bit.
> 



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

* Re: [PULL 0/8] configure deprecation, linux-user and test fix
  2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
                   ` (7 preceding siblings ...)
  2020-09-16 12:26 ` [PULL 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
@ 2020-09-17 19:40 ` Peter Maydell
  8 siblings, 0 replies; 73+ messages in thread
From: Peter Maydell @ 2020-09-17 19:40 UTC (permalink / raw)
  To: Alex Bennée; +Cc: QEMU Developers

On Wed, 16 Sep 2020 at 13:26, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit de39a045bd8d2b49e4f3d07976622c29d58e0bac:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200915-pull-request' into staging (2020-09-15 14:25:05 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-configure-fixes-160920-1
>
> for you to fetch changes up to 3ffc7f013763bf4fc50c3b403cbacca2bee68cfa:
>
>   configure: add [lm32|unicore32]-softmmu to deprecation logic (2020-09-16 10:07:01 +0100)
>
> ----------------------------------------------------------------
> configure tweaks for deprecation
>
>   - iotest fix for readlink -f
>   - linux-user, report rather than assert on mmap failure
>   - clean-up and re-factor the logic
>   - add tilegx-linux-user to deprecated_targets_list
>   - add [lm32|unicore32]-softmmu deprecated_targets_list
>   - add a gitlab deprecated builds test
>
> ----------------------------------------------------------------
> Alex Bennée (7):
>       linux-user: test, don't assert addr != test in pgb_reserved_va
>       configure: move deprecated feature processing to supported_target
>       configure: also skip deprecated targets with target-list-exclude
>       configure: clean-up the target-list-exclude logic
>       configure: include tilegx-linux-user in the deprecation logic
>       gitlab: create a build-deprecated target
>       configure: add [lm32|unicore32]-softmmu to deprecation logic
>
> Max Reitz (1):
>       iotests: Drop readlink -f



Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM


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

* Re: [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-16 13:52       ` Philippe Mathieu-Daudé
@ 2020-09-25 15:54         ` Peter Maydell
  2020-09-25 18:34           ` Richard Henderson
  0 siblings, 1 reply; 73+ messages in thread
From: Peter Maydell @ 2020-09-25 15:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Fam Zheng, Thomas Huth, Alex Bennée, QEMU Developers,
	Wainer dos Santos Moschetta

On Wed, 16 Sep 2020 at 14:52, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Should we stop building the ppc64abi32 target instead?
>
> From c609274b853 ("docs/system/deprecated: mark
> ppc64abi32-linux-user for deprecation"):
>
>  The ppc64abi32 architecture has a number of issues which regularly
>  trip up our CI testing and is suspected to be quite broken. For that
>  reason the maintainers strongly suspect no one actually uses it.

It still builds fine and it also runs the 'ls' binary in
the linux-user-test collection (ie the 32-bit PPC binary).

thanks
-- PMM


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

* Re: [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-25 15:54         ` Peter Maydell
@ 2020-09-25 18:34           ` Richard Henderson
  2020-09-25 18:47             ` Peter Maydell
  0 siblings, 1 reply; 73+ messages in thread
From: Richard Henderson @ 2020-09-25 18:34 UTC (permalink / raw)
  To: Peter Maydell, Philippe Mathieu-Daudé
  Cc: Fam Zheng, Thomas Huth, Alex Bennée, QEMU Developers,
	Wainer dos Santos Moschetta

On 9/25/20 8:54 AM, Peter Maydell wrote:
> On Wed, 16 Sep 2020 at 14:52, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>> Should we stop building the ppc64abi32 target instead?
>>
>> From c609274b853 ("docs/system/deprecated: mark
>> ppc64abi32-linux-user for deprecation"):
>>
>>  The ppc64abi32 architecture has a number of issues which regularly
>>  trip up our CI testing and is suspected to be quite broken. For that
>>  reason the maintainers strongly suspect no one actually uses it.
> 
> It still builds fine and it also runs the 'ls' binary in
> the linux-user-test collection (ie the 32-bit PPC binary).

But signal handling is completely wrong, so
tests/tcg/multiarch/linux-test.c will fail.


r~


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

* Re: [PULL 7/8] gitlab: create a build-deprecated target
  2020-09-25 18:34           ` Richard Henderson
@ 2020-09-25 18:47             ` Peter Maydell
  0 siblings, 0 replies; 73+ messages in thread
From: Peter Maydell @ 2020-09-25 18:47 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Fam Zheng, Thomas Huth, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, QEMU Developers, Alex Bennée

On Fri, 25 Sep 2020 at 19:34, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 9/25/20 8:54 AM, Peter Maydell wrote:
> > On Wed, 16 Sep 2020 at 14:52, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> >> Should we stop building the ppc64abi32 target instead?
> >>
> >> From c609274b853 ("docs/system/deprecated: mark
> >> ppc64abi32-linux-user for deprecation"):
> >>
> >>  The ppc64abi32 architecture has a number of issues which regularly
> >>  trip up our CI testing and is suspected to be quite broken. For that
> >>  reason the maintainers strongly suspect no one actually uses it.
> >
> > It still builds fine and it also runs the 'ls' binary in
> > the linux-user-test collection (ie the 32-bit PPC binary).
>
> But signal handling is completely wrong

That is also true for sparc linux-user (RT signal frames
completely unimplemented)...

Anyway, my point was mostly that there is a class of programs
which do run OK on it, so we should continue to build and test
it to the level we do today until the deprecation period runs
out. It is not so badly broken as to be a candidate for dropping
immediately.

thanks
-- PMM


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

* Re: [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic
  2020-09-15 13:43 ` [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
  2020-09-15 17:20   ` Richard Henderson
@ 2020-10-29 12:25   ` Thomas Huth
  2020-10-29 14:42     ` Alex Bennée
  1 sibling, 1 reply; 73+ messages in thread
From: Thomas Huth @ 2020-10-29 12:25 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Fam Zheng, Peter Maydell, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta

On 15/09/2020 15.43, Alex Bennée wrote:
> While we are at it move the few places where they are into the
> deprecation build bucket.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  configure      | 2 +-
>  .gitlab-ci.yml | 9 +++++----
>  .shippable.yml | 2 +-
>  3 files changed, 7 insertions(+), 6 deletions(-)

 Hi Alex,

I noticed that these deprecated targets do not show up in the
output of "configure --help" at all anymore:

 --target-list=LIST       set target list (default: build everything)
                           Available targets: aarch64-softmmu alpha-softmmu 
                           arm-softmmu avr-softmmu cris-softmmu hppa-softmmu 
                           i386-softmmu m68k-softmmu microblazeel-softmmu 
                           microblaze-softmmu mips64el-softmmu mips64-softmmu 
                           mipsel-softmmu mips-softmmu moxie-softmmu 
                           nios2-softmmu or1k-softmmu ppc64-softmmu ppc-softmmu 
                           riscv32-softmmu riscv64-softmmu rx-softmmu 
                           s390x-softmmu sh4eb-softmmu sh4-softmmu 
                           sparc64-softmmu sparc-softmmu tricore-softmmu 
                           x86_64-softmmu xtensaeb-softmmu xtensa-softmmu 
                           aarch64_be-linux-user aarch64-linux-user 
                           alpha-linux-user armeb-linux-user arm-linux-user 
                           cris-linux-user hppa-linux-user i386-linux-user 
                           m68k-linux-user microblazeel-linux-user 
                           microblaze-linux-user mips64el-linux-user 
                           mips64-linux-user mipsel-linux-user mips-linux-user 
                           mipsn32el-linux-user mipsn32-linux-user 
                           nios2-linux-user or1k-linux-user ppc64le-linux-user 
                           ppc64-linux-user ppc-linux-user riscv32-linux-user 
                           riscv64-linux-user s390x-linux-user sh4eb-linux-user 
                           sh4-linux-user sparc32plus-linux-user 
                           sparc64-linux-user sparc-linux-user 
                           x86_64-linux-user xtensaeb-linux-user 
                           xtensa-linux-user

The text "default: build everything" is now also not accurate anymore.
How is a user who is still interested in these targets supposed to find
the right --target-list parameters now?

 Thomas



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

* Re: [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic
  2020-10-29 12:25   ` Thomas Huth
@ 2020-10-29 14:42     ` Alex Bennée
  2020-10-29 15:28       ` Thomas Huth
  0 siblings, 1 reply; 73+ messages in thread
From: Alex Bennée @ 2020-10-29 14:42 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Fam Zheng, Peter Maydell, Philippe Mathieu-Daudé,
	qemu-devel, Wainer dos Santos Moschetta


Thomas Huth <thuth@redhat.com> writes:

> On 15/09/2020 15.43, Alex Bennée wrote:
>> While we are at it move the few places where they are into the
>> deprecation build bucket.
>> 
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  configure      | 2 +-
>>  .gitlab-ci.yml | 9 +++++----
>>  .shippable.yml | 2 +-
>>  3 files changed, 7 insertions(+), 6 deletions(-)
>
>  Hi Alex,
>
> I noticed that these deprecated targets do not show up in the
> output of "configure --help" at all anymore:
>
>  --target-list=LIST       set target list (default: build everything)
>                            Available targets: aarch64-softmmu alpha-softmmu 
>                            arm-softmmu avr-softmmu cris-softmmu hppa-softmmu 
>                            i386-softmmu m68k-softmmu microblazeel-softmmu 
>                            microblaze-softmmu mips64el-softmmu mips64-softmmu 
>                            mipsel-softmmu mips-softmmu moxie-softmmu 
>                            nios2-softmmu or1k-softmmu ppc64-softmmu ppc-softmmu 
>                            riscv32-softmmu riscv64-softmmu rx-softmmu 
>                            s390x-softmmu sh4eb-softmmu sh4-softmmu 
>                            sparc64-softmmu sparc-softmmu tricore-softmmu 
>                            x86_64-softmmu xtensaeb-softmmu xtensa-softmmu 
>                            aarch64_be-linux-user aarch64-linux-user 
>                            alpha-linux-user armeb-linux-user arm-linux-user 
>                            cris-linux-user hppa-linux-user i386-linux-user 
>                            m68k-linux-user microblazeel-linux-user 
>                            microblaze-linux-user mips64el-linux-user 
>                            mips64-linux-user mipsel-linux-user mips-linux-user 
>                            mipsn32el-linux-user mipsn32-linux-user 
>                            nios2-linux-user or1k-linux-user ppc64le-linux-user 
>                            ppc64-linux-user ppc-linux-user riscv32-linux-user 
>                            riscv64-linux-user s390x-linux-user sh4eb-linux-user 
>                            sh4-linux-user sparc32plus-linux-user 
>                            sparc64-linux-user sparc-linux-user 
>                            x86_64-linux-user xtensaeb-linux-user 
>                            xtensa-linux-user
>
> The text "default: build everything" is now also not accurate anymore.
> How is a user who is still interested in these targets supposed to find
> the right --target-list parameters now?

How about:

--8<---------------cut here---------------start------------->8---
modified   configure
@@ -1644,9 +1644,11 @@ Standard options:
   --prefix=PREFIX          install in PREFIX [$prefix]
   --interp-prefix=PREFIX   where to find shared libraries, etc.
                            use %M for cpu name [$interp_prefix]
-  --target-list=LIST       set target list (default: build everything)
+  --target-list=LIST       set target list (default: build all non-deprcated)
 $(echo Available targets: $default_target_list | \
   fold -s -w 53 | sed -e 's/^/                           /')
+$(echo Deprecated targets: $deprecated_targets_list | \
+  fold -s -w 53 | sed -e 's/^/                           /')
   --target-list-exclude=LIST exclude a set of targets from the default target-list
 
 Advanced options (experts only):
--8<---------------cut here---------------end--------------->8---

Which would give:


  --target-list=LIST       set target list (default: build all non-deprcated)
                           Available targets: aarch64-softmmu alpha-softmmu 
                           arm-softmmu avr-softmmu cris-softmmu hppa-softmmu 
                           i386-softmmu m68k-softmmu microblaze-softmmu 
                           microblazeel-softmmu mips-softmmu mips64-softmmu 
                           mips64el-softmmu mipsel-softmmu moxie-softmmu 
                           nios2-softmmu or1k-softmmu ppc-softmmu ppc64-softmmu 
                           riscv32-softmmu riscv64-softmmu rx-softmmu 
                           s390x-softmmu sh4-softmmu sh4eb-softmmu 
                           sparc-softmmu sparc64-softmmu tricore-softmmu 
                           x86_64-softmmu xtensa-softmmu xtensaeb-softmmu 
                           aarch64-linux-user aarch64_be-linux-user 
                           alpha-linux-user arm-linux-user armeb-linux-user 
                           cris-linux-user hppa-linux-user i386-linux-user 
                           m68k-linux-user microblaze-linux-user 
                           microblazeel-linux-user mips-linux-user 
                           mips64-linux-user mips64el-linux-user 
                           mipsel-linux-user mipsn32-linux-user 
                           mipsn32el-linux-user nios2-linux-user 
                           or1k-linux-user ppc-linux-user ppc64-linux-user 
                           ppc64le-linux-user riscv32-linux-user 
                           riscv64-linux-user s390x-linux-user sh4-linux-user 
                           sh4eb-linux-user sparc-linux-user 
                           sparc32plus-linux-user sparc64-linux-user 
                           x86_64-linux-user xtensa-linux-user 
                           xtensaeb-linux-user
                           Deprecated targets: 
                           ppc64abi32-linux-user,tilegx-linux-user,lm32-softmmu,
                           unicore32-softmmu
  --target-list-exclude=LIST exclude a set of targets from the default target-list

-- 
Alex Bennée


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

* Re: [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic
  2020-10-29 14:42     ` Alex Bennée
@ 2020-10-29 15:28       ` Thomas Huth
  0 siblings, 0 replies; 73+ messages in thread
From: Thomas Huth @ 2020-10-29 15:28 UTC (permalink / raw)
  To: Alex Bennée
  Cc: Fam Zheng, Peter Maydell, Philippe Mathieu-Daudé,
	qemu-devel, Wainer dos Santos Moschetta

On 29/10/2020 15.42, Alex Bennée wrote:
> 
> Thomas Huth <thuth@redhat.com> writes:
> 
>> On 15/09/2020 15.43, Alex Bennée wrote:
>>> While we are at it move the few places where they are into the
>>> deprecation build bucket.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> ---
>>>  configure      | 2 +-
>>>  .gitlab-ci.yml | 9 +++++----
>>>  .shippable.yml | 2 +-
>>>  3 files changed, 7 insertions(+), 6 deletions(-)
>>
>>  Hi Alex,
>>
>> I noticed that these deprecated targets do not show up in the
>> output of "configure --help" at all anymore:
>>
>>  --target-list=LIST       set target list (default: build everything)
>>                            Available targets: aarch64-softmmu alpha-softmmu 
>>                            arm-softmmu avr-softmmu cris-softmmu hppa-softmmu 
>>                            i386-softmmu m68k-softmmu microblazeel-softmmu 
>>                            microblaze-softmmu mips64el-softmmu mips64-softmmu 
>>                            mipsel-softmmu mips-softmmu moxie-softmmu 
>>                            nios2-softmmu or1k-softmmu ppc64-softmmu ppc-softmmu 
>>                            riscv32-softmmu riscv64-softmmu rx-softmmu 
>>                            s390x-softmmu sh4eb-softmmu sh4-softmmu 
>>                            sparc64-softmmu sparc-softmmu tricore-softmmu 
>>                            x86_64-softmmu xtensaeb-softmmu xtensa-softmmu 
>>                            aarch64_be-linux-user aarch64-linux-user 
>>                            alpha-linux-user armeb-linux-user arm-linux-user 
>>                            cris-linux-user hppa-linux-user i386-linux-user 
>>                            m68k-linux-user microblazeel-linux-user 
>>                            microblaze-linux-user mips64el-linux-user 
>>                            mips64-linux-user mipsel-linux-user mips-linux-user 
>>                            mipsn32el-linux-user mipsn32-linux-user 
>>                            nios2-linux-user or1k-linux-user ppc64le-linux-user 
>>                            ppc64-linux-user ppc-linux-user riscv32-linux-user 
>>                            riscv64-linux-user s390x-linux-user sh4eb-linux-user 
>>                            sh4-linux-user sparc32plus-linux-user 
>>                            sparc64-linux-user sparc-linux-user 
>>                            x86_64-linux-user xtensaeb-linux-user 
>>                            xtensa-linux-user
>>
>> The text "default: build everything" is now also not accurate anymore.
>> How is a user who is still interested in these targets supposed to find
>> the right --target-list parameters now?
> 
> How about:
> 
> --8<---------------cut here---------------start------------->8---
> modified   configure
> @@ -1644,9 +1644,11 @@ Standard options:
>    --prefix=PREFIX          install in PREFIX [$prefix]
>    --interp-prefix=PREFIX   where to find shared libraries, etc.
>                             use %M for cpu name [$interp_prefix]
> -  --target-list=LIST       set target list (default: build everything)
> +  --target-list=LIST       set target list (default: build all non-deprcated)
>  $(echo Available targets: $default_target_list | \
>    fold -s -w 53 | sed -e 's/^/                           /')
> +$(echo Deprecated targets: $deprecated_targets_list | \
> +  fold -s -w 53 | sed -e 's/^/                           /')
>    --target-list-exclude=LIST exclude a set of targets from the default target-list
>  
>  Advanced options (experts only):
> --8<---------------cut here---------------end--------------->8---
> 
> Which would give:
> 
> 
>   --target-list=LIST       set target list (default: build all non-deprcated)
>                            Available targets: aarch64-softmmu alpha-softmmu 
>                            arm-softmmu avr-softmmu cris-softmmu hppa-softmmu 
>                            i386-softmmu m68k-softmmu microblaze-softmmu 
>                            microblazeel-softmmu mips-softmmu mips64-softmmu 
>                            mips64el-softmmu mipsel-softmmu moxie-softmmu 
>                            nios2-softmmu or1k-softmmu ppc-softmmu ppc64-softmmu 
>                            riscv32-softmmu riscv64-softmmu rx-softmmu 
>                            s390x-softmmu sh4-softmmu sh4eb-softmmu 
>                            sparc-softmmu sparc64-softmmu tricore-softmmu 
>                            x86_64-softmmu xtensa-softmmu xtensaeb-softmmu 
>                            aarch64-linux-user aarch64_be-linux-user 
>                            alpha-linux-user arm-linux-user armeb-linux-user 
>                            cris-linux-user hppa-linux-user i386-linux-user 
>                            m68k-linux-user microblaze-linux-user 
>                            microblazeel-linux-user mips-linux-user 
>                            mips64-linux-user mips64el-linux-user 
>                            mipsel-linux-user mipsn32-linux-user 
>                            mipsn32el-linux-user nios2-linux-user 
>                            or1k-linux-user ppc-linux-user ppc64-linux-user 
>                            ppc64le-linux-user riscv32-linux-user 
>                            riscv64-linux-user s390x-linux-user sh4-linux-user 
>                            sh4eb-linux-user sparc-linux-user 
>                            sparc32plus-linux-user sparc64-linux-user 
>                            x86_64-linux-user xtensa-linux-user 
>                            xtensaeb-linux-user
>                            Deprecated targets: 
>                            ppc64abi32-linux-user,tilegx-linux-user,lm32-softmmu,
>                            unicore32-softmmu
>   --target-list-exclude=LIST exclude a set of targets from the default target-list

Sounds good!

 Thomas




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

* [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
                   ` (3 preceding siblings ...)
  2020-09-15  2:09 ` Hansni Bu
@ 2020-11-08  9:43 ` Thomas Huth
  2020-12-10  9:17 ` Thomas Huth
  5 siblings, 0 replies; 73+ messages in thread
From: Thomas Huth @ 2020-11-08  9:43 UTC (permalink / raw)
  To: qemu-devel

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=fb730c8683807d549c4a

** Changed in: qemu
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  Fix Committed

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

* [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed
  2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
                   ` (4 preceding siblings ...)
  2020-11-08  9:43 ` Thomas Huth
@ 2020-12-10  9:17 ` Thomas Huth
  5 siblings, 0 replies; 73+ messages in thread
From: Thomas Huth @ 2020-12-10  9:17 UTC (permalink / raw)
  To: qemu-devel

Released with QEMU v5.2.0.

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895080

Title:
  pgb_reserved_va: Assertion `addr == test' failed

Status in QEMU:
  Fix Released

Bug description:
  This problem occurs on CentOS-7.5 (64-bit) with qemu-5.1.0, qemu head
  (commit 9435a8b3dd35f1f926f1b9127e8a906217a5518a) for riscv32-linux-
  user.

  Firstly, compile fails:
  Compiling C object libqemu-riscv32-linux-user.fa.p/linux-user_strace.c.o
  ../qemu.git/linux-user/strace.c:1210:18: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared here (not in a function)
       FLAG_GENERIC(FALLOC_FL_KEEP_SIZE),

  I have to add below include to linux-user/strace.c
  diff --git a/linux-user/strace.c b/linux-user/strace.c
  index 11fea14fba..22e51d4a8a 100644
  --- a/linux-user/strace.c
  +++ b/linux-user/strace.c
  @@ -7,6 +7,7 @@
   #include <sys/mount.h>
   #include <arpa/inet.h>
   #include <netinet/tcp.h>
  +#include <linux/falloc.h>
   #include <linux/if_packet.h>
   #include <linux/netlink.h>
   #include <sched.h>

  Then trying qemu-riscv32 with a simple ELF, I get:
  linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.

  strace shows that:
  mmap(0x1000, 4294963200, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x10000
  write(2, "qemu-riscv32: ../qemu.git/linux-"..., 103qemu-riscv32: ../qemu.git/linux-user/elfload.c:2341: pgb_reserved_va: Assertion `addr == test' failed.
  ) = 103

  The source code is in the function pgb_reserved_va (linux-
  user/elfload.c). I think mmap cannot guarantee that the returned
  pointer (test) equals to the parameter of addr. So is this a bug to
  assert (addr == test)?

  Attached configure script and test ELF file.

  Thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895080/+subscriptions


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

end of thread, other threads:[~2020-12-10  9:56 UTC | newest]

Thread overview: 73+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 15:07 [PATCH v1 0/6] deprecation and linux-user tweaks (+test fix) Alex Bennée
2020-09-14 15:07 ` [PATCH v1 1/6] linux-user: test, don't assert addr != test in pgb_reserved_va Alex Bennée
2020-09-14 15:07   ` [Bug 1895080] " Alex Bennée
2020-09-14 15:07 ` [PATCH v1 2/6] configure: use add_to for tweaking deprecated_features Alex Bennée
2020-09-14 16:14   ` Thomas Huth
2020-09-14 15:07 ` [PATCH v1 3/6] configure: also skip deprecated targets with target-list-exclude Alex Bennée
2020-09-14 19:17   ` Peter Maydell
2020-09-15  9:22     ` Alex Bennée
2020-09-14 15:07 ` [PATCH v1 4/6] configure: include tilegx-linux-user in the auto-exclude logic Alex Bennée
2020-09-15 12:58   ` Philippe Mathieu-Daudé
2020-09-14 15:07 ` [PATCH v1 5/6] gitlab: create a build-deprecated target Alex Bennée
2020-09-14 15:15   ` Philippe Mathieu-Daudé
2020-09-14 16:16   ` Thomas Huth
2020-09-14 15:07 ` [PATCH v1 6/6] iotests: Work around failing readlink -f Alex Bennée
  -- strict thread matches above, loose matches on Subject: below --
2020-09-16 12:26 [PULL 0/8] configure deprecation, linux-user and test fix Alex Bennée
2020-09-16 12:26 ` [PULL 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va Alex Bennée
2020-09-16 12:26   ` [Bug 1895080] " Alex Bennée
2020-09-16 12:26 ` [PULL 2/8] iotests: Drop readlink -f Alex Bennée
2020-09-16 12:26 ` [PULL 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
2020-09-16 12:26 ` [PULL 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
2020-09-16 12:26 ` [PULL 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
2020-09-16 12:26 ` [PULL 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
2020-09-16 12:26 ` [PULL 7/8] gitlab: create a build-deprecated target Alex Bennée
2020-09-16 12:40   ` Peter Maydell
2020-09-16 13:23     ` Alex Bennée
2020-09-16 13:52       ` Philippe Mathieu-Daudé
2020-09-25 15:54         ` Peter Maydell
2020-09-25 18:34           ` Richard Henderson
2020-09-25 18:47             ` Peter Maydell
2020-09-16 12:26 ` [PULL 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
2020-09-17 19:40 ` [PULL 0/8] configure deprecation, linux-user and test fix Peter Maydell
2020-09-15 13:43 [PATCH v2 0/8] configure deprecation, linux-user and iotest fixes Alex Bennée
2020-09-15 13:43 ` [PATCH v2 1/8] linux-user: test, don't assert addr != test in pgb_reserved_va Alex Bennée
2020-09-15 13:43   ` [Bug 1895080] " Alex Bennée
2020-09-15 15:58   ` Laurent Vivier
2020-09-15 15:58     ` [Bug 1895080] " Laurent Vivier
2020-09-15 17:13   ` Richard Henderson
2020-09-15 13:43 ` [PATCH v2 2/8] iotests: Drop readlink -f Alex Bennée
2020-09-15 17:14   ` Richard Henderson
2020-09-15 13:43 ` [PATCH v2 3/8] configure: move deprecated feature processing to supported_target Alex Bennée
2020-09-15 13:51   ` Michael Tokarev
2020-09-15 13:43 ` [PATCH v2 4/8] configure: also skip deprecated targets with target-list-exclude Alex Bennée
2020-09-15 17:16   ` Richard Henderson
2020-09-15 13:43 ` [PATCH v2 5/8] configure: clean-up the target-list-exclude logic Alex Bennée
2020-09-15 17:17   ` Richard Henderson
2020-09-15 13:43 ` [PATCH v2 6/8] configure: include tilegx-linux-user in the deprecation logic Alex Bennée
2020-09-15 17:17   ` Richard Henderson
2020-09-15 17:47   ` Philippe Mathieu-Daudé
2020-09-15 13:43 ` [PATCH v2 7/8] gitlab: create a build-deprecated target Alex Bennée
2020-09-15 13:43 ` [PATCH v2 8/8] configure: add [lm32|unicore32]-softmmu to deprecation logic Alex Bennée
2020-09-15 17:20   ` Richard Henderson
2020-10-29 12:25   ` Thomas Huth
2020-10-29 14:42     ` Alex Bennée
2020-10-29 15:28       ` Thomas Huth
2020-09-11 14:56 [RFC PATCH] linux-user: test, don't assert addr != test in pgb_reserved_va Alex Bennée
2020-09-11 14:56 ` [Bug 1895080] Re: pgb_reserved_va: Assertion `addr == test' failed Alex Bennée
2020-09-10  3:46 [Bug 1895080] [NEW] " Hansni Bu
2020-09-10  6:18 ` [Bug 1895080] " Laurent Vivier
2020-09-10 19:04 ` [Bug 1895080] [NEW] " Laurent Vivier
2020-09-11  5:57   ` Hansni Bu
2020-09-11  9:34   ` Alex Bennée
2020-09-11  9:38     ` Alex Bennée
2020-09-11 10:18       ` Hansni Bu
2020-09-11 11:54         ` Alex Bennée
2020-09-11 11:54           ` Alex Bennée
2020-09-11 12:32           ` Hansni Bu
2020-09-11 14:47             ` Alex Bennée
2020-09-11 14:47               ` Alex Bennée
2020-09-11  8:30 ` [Bug 1895080] " Alex Bennée
2020-09-11  9:31   ` Hansni Bu
2020-09-15  2:09 ` Hansni Bu
2020-11-08  9:43 ` Thomas Huth
2020-12-10  9:17 ` Thomas Huth

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.