* [PATCH] linux-user: Add missing includes
@ 2025-09-04 15:21 Peter Foley
2025-09-05 7:31 ` Paolo Bonzini
0 siblings, 1 reply; 7+ messages in thread
From: Peter Foley @ 2025-09-04 15:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, nabihestefan, Peter Foley
We're getting errors about this:
linux-user/elfload.c:2770:36: error: use of undeclared identifier 'MAP_FIXED_NOREPLACE'
Signed-off-by: Peter Foley <pefoley@google.com>
---
linux-user/elfload.c | 1 +
linux-user/mmap.c | 1 +
linux-user/syscall.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 26c090c95d3e90ad4a23a927267e4106f68975b0..edbacf041f25d88472c95efb4eb9bdccd81e9902 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -5,6 +5,7 @@
#include <sys/prctl.h>
#include <sys/resource.h>
#include <sys/shm.h>
+#include <linux/mman.h>
#include "qemu.h"
#include "user/tswap-target.h"
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 002e1e668e631130526053599e1d18ffb4b4141a..9e92117ca3e8e4f45cb333366ecf3668b8986200 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include <sys/shm.h>
+#include <linux/mman.h>
#include "trace.h"
#include "exec/log.h"
#include "exec/page-protection.h"
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 91360a072c7f478085ac1c7cc8bb2026f8b32038..4101b0e4e7812740afe7a4246a902a5364d7c331 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -101,6 +101,7 @@
#include <linux/soundcard.h>
#include <linux/kd.h>
#include <linux/mtio.h>
+#include <linux/mman.h>
#include <linux/fs.h>
#include <linux/fd.h>
#if defined(CONFIG_FIEMAP)
---
base-commit: baa79455fa92984ff0f4b9ae94bed66823177a27
change-id: 20250904-includes-19d9afaed67a
Best regards,
--
Peter Foley <pefoley@google.com>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user: Add missing includes
2025-09-04 15:21 [PATCH] linux-user: Add missing includes Peter Foley
@ 2025-09-05 7:31 ` Paolo Bonzini
2025-09-05 8:48 ` Richard Henderson
0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2025-09-05 7:31 UTC (permalink / raw)
To: Peter Foley, qemu-devel; +Cc: Laurent Vivier, nabihestefan
On 9/4/25 17:21, Peter Foley wrote:
> We're getting errors about this:
> linux-user/elfload.c:2770:36: error: use of undeclared identifier 'MAP_FIXED_NOREPLACE'
Queued, thanks.
Paolo
>
> Signed-off-by: Peter Foley <pefoley@google.com>
> ---
> linux-user/elfload.c | 1 +
> linux-user/mmap.c | 1 +
> linux-user/syscall.c | 1 +
> 3 files changed, 3 insertions(+)
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 26c090c95d3e90ad4a23a927267e4106f68975b0..edbacf041f25d88472c95efb4eb9bdccd81e9902 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -5,6 +5,7 @@
> #include <sys/prctl.h>
> #include <sys/resource.h>
> #include <sys/shm.h>
> +#include <linux/mman.h>
>
> #include "qemu.h"
> #include "user/tswap-target.h"
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 002e1e668e631130526053599e1d18ffb4b4141a..9e92117ca3e8e4f45cb333366ecf3668b8986200 100644
> --- a/linux-user/mmap.c
> +++ b/linux-user/mmap.c
> @@ -18,6 +18,7 @@
> */
> #include "qemu/osdep.h"
> #include <sys/shm.h>
> +#include <linux/mman.h>
> #include "trace.h"
> #include "exec/log.h"
> #include "exec/page-protection.h"
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 91360a072c7f478085ac1c7cc8bb2026f8b32038..4101b0e4e7812740afe7a4246a902a5364d7c331 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -101,6 +101,7 @@
> #include <linux/soundcard.h>
> #include <linux/kd.h>
> #include <linux/mtio.h>
> +#include <linux/mman.h>
> #include <linux/fs.h>
> #include <linux/fd.h>
> #if defined(CONFIG_FIEMAP)
>
> ---
> base-commit: baa79455fa92984ff0f4b9ae94bed66823177a27
> change-id: 20250904-includes-19d9afaed67a
>
> Best regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user: Add missing includes
2025-09-05 7:31 ` Paolo Bonzini
@ 2025-09-05 8:48 ` Richard Henderson
2025-09-05 16:00 ` Peter Foley
0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2025-09-05 8:48 UTC (permalink / raw)
To: Paolo Bonzini, Peter Foley, qemu-devel; +Cc: Laurent Vivier, nabihestefan
On 9/5/25 09:31, Paolo Bonzini wrote:
> On 9/4/25 17:21, Peter Foley wrote:
>> We're getting errors about this:
>> linux-user/elfload.c:2770:36: error: use of undeclared identifier 'MAP_FIXED_NOREPLACE'
>
> Queued, thanks.
>
> Paolo
>
>>
>> Signed-off-by: Peter Foley <pefoley@google.com>
>> ---
>> linux-user/elfload.c | 1 +
>> linux-user/mmap.c | 1 +
>> linux-user/syscall.c | 1 +
>> 3 files changed, 3 insertions(+)
>>
>> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
>> index 26c090c95d3e90ad4a23a927267e4106f68975b0..edbacf041f25d88472c95efb4eb9bdccd81e9902
>> 100644
>> --- a/linux-user/elfload.c
>> +++ b/linux-user/elfload.c
>> @@ -5,6 +5,7 @@
>> #include <sys/prctl.h>
>> #include <sys/resource.h>
>> #include <sys/shm.h>
>> +#include <linux/mman.h>
There's no reason to include <linux/mman.h>.
This value is provided by <sys/mman.h> directly for musl and by <sys/mman.h> via
<bits/mman-map-flags*> for glibc.
Are you using some other libc? You're solidly in non-standard territory there.
Perhaps that other libc needs updating.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user: Add missing includes
2025-09-05 8:48 ` Richard Henderson
@ 2025-09-05 16:00 ` Peter Foley
2025-09-05 16:06 ` Peter Foley
2025-09-05 16:26 ` Richard Henderson
0 siblings, 2 replies; 7+ messages in thread
From: Peter Foley @ 2025-09-05 16:00 UTC (permalink / raw)
To: Richard Henderson; +Cc: Paolo Bonzini, qemu-devel, Laurent Vivier, nabihestefan
[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]
On Fri, Sep 5, 2025 at 4:48 AM Richard Henderson <
richard.henderson@linaro.org> wrote:
> On 9/5/25 09:31, Paolo Bonzini wrote:
> > On 9/4/25 17:21, Peter Foley wrote:
> >> We're getting errors about this:
> >> linux-user/elfload.c:2770:36: error: use of undeclared identifier
> 'MAP_FIXED_NOREPLACE'
> >
> > Queued, thanks.
> >
> > Paolo
> >
> >>
> >> Signed-off-by: Peter Foley <pefoley@google.com>
> >> ---
> >> linux-user/elfload.c | 1 +
> >> linux-user/mmap.c | 1 +
> >> linux-user/syscall.c | 1 +
> >> 3 files changed, 3 insertions(+)
> >>
> >> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> >> index
> 26c090c95d3e90ad4a23a927267e4106f68975b0..edbacf041f25d88472c95efb4eb9bdccd81e9902
>
> >> 100644
> >> --- a/linux-user/elfload.c
> >> +++ b/linux-user/elfload.c
> >> @@ -5,6 +5,7 @@
> >> #include <sys/prctl.h>
> >> #include <sys/resource.h>
> >> #include <sys/shm.h>
> >> +#include <linux/mman.h>
>
> There's no reason to include <linux/mman.h>.
>
> This value is provided by <sys/mman.h> directly for musl and by
> <sys/mman.h> via
> <bits/mman-map-flags*> for glibc.
>
> Are you using some other libc? You're solidly in non-standard territory
> there.
> Perhaps that other libc needs updating.
>
We're using glibc 2.27.
I definitely saw build failures earlier without this patch, but I'm now
unable to reproduce them at head.
So maybe there was an issue with our headers at an earlier point that has
since been fixed?
I'll revert this patch from our local fork and you should probably drop it
upstream as well.
>
> r~
>
[-- Attachment #2: Type: text/html, Size: 2509 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user: Add missing includes
2025-09-05 16:00 ` Peter Foley
@ 2025-09-05 16:06 ` Peter Foley
2025-09-05 16:26 ` Richard Henderson
1 sibling, 0 replies; 7+ messages in thread
From: Peter Foley @ 2025-09-05 16:06 UTC (permalink / raw)
To: Richard Henderson; +Cc: Paolo Bonzini, qemu-devel, Laurent Vivier, nabihestefan
[-- Attachment #1: Type: text/plain, Size: 2149 bytes --]
On Fri, Sep 5, 2025 at 12:00 PM Peter Foley <pefoley@google.com> wrote:
>
>
> On Fri, Sep 5, 2025 at 4:48 AM Richard Henderson <
> richard.henderson@linaro.org> wrote:
>
>> On 9/5/25 09:31, Paolo Bonzini wrote:
>> > On 9/4/25 17:21, Peter Foley wrote:
>> >> We're getting errors about this:
>> >> linux-user/elfload.c:2770:36: error: use of undeclared identifier
>> 'MAP_FIXED_NOREPLACE'
>> >
>> > Queued, thanks.
>> >
>> > Paolo
>> >
>> >>
>> >> Signed-off-by: Peter Foley <pefoley@google.com>
>> >> ---
>> >> linux-user/elfload.c | 1 +
>> >> linux-user/mmap.c | 1 +
>> >> linux-user/syscall.c | 1 +
>> >> 3 files changed, 3 insertions(+)
>> >>
>> >> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
>> >> index
>> 26c090c95d3e90ad4a23a927267e4106f68975b0..edbacf041f25d88472c95efb4eb9bdccd81e9902
>>
>> >> 100644
>> >> --- a/linux-user/elfload.c
>> >> +++ b/linux-user/elfload.c
>> >> @@ -5,6 +5,7 @@
>> >> #include <sys/prctl.h>
>> >> #include <sys/resource.h>
>> >> #include <sys/shm.h>
>> >> +#include <linux/mman.h>
>>
>> There's no reason to include <linux/mman.h>.
>>
>> This value is provided by <sys/mman.h> directly for musl and by
>> <sys/mman.h> via
>> <bits/mman-map-flags*> for glibc.
>>
>> Are you using some other libc? You're solidly in non-standard territory
>> there.
>> Perhaps that other libc needs updating.
>>
>
> We're using glibc 2.27.
> I definitely saw build failures earlier without this patch, but I'm now
> unable to reproduce them at head.
> So maybe there was an issue with our headers at an earlier point that has
> since been fixed?
> I'll revert this patch from our local fork and you should probably drop it
> upstream as well.
>
>
Oh, I figured out why I couldn't reproduce the issue.
We had a separate patch we were carrying that added linux/mman.h
to linux-user/user-mmap.h.
If I revert both patches, I see this:
third_party/qemu/linux-user/mmap.c:602:40: error: use of undeclared
identifier 'MAP_FIXED_NOREPLACE'
602 | if (start || (flags & (MAP_FIXED | MAP_FIXED_NOREPLACE))) {
>
>>
>> r~
>>
>
[-- Attachment #2: Type: text/html, Size: 3570 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user: Add missing includes
2025-09-05 16:00 ` Peter Foley
2025-09-05 16:06 ` Peter Foley
@ 2025-09-05 16:26 ` Richard Henderson
2025-09-05 16:28 ` Peter Foley
1 sibling, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2025-09-05 16:26 UTC (permalink / raw)
To: Peter Foley; +Cc: Paolo Bonzini, qemu-devel, Laurent Vivier, nabihestefan
On 9/5/25 18:00, Peter Foley wrote:
> We're using glibc 2.27.
That's just too old.
commit c42e77a90d9244c8caf76fe0e54f84200430a4e1
Author: Richard Henderson <richard.henderson@linaro.org>
Date: Tue Aug 8 09:44:18 2023 -0700
qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
linux-user target_mmap, we require a non-zero value. This does not
require host kernel support, merely the bit being defined.
MAP_FIXED_NOREPLACE was added with glibc 2.28. From repology.org:
Fedora 36: 2.35
CentOS 8 (RHEL-8): 2.28
Debian 11: 2.31
OpenSUSE Leap 15.4: 2.31
Ubuntu LTS 20.04: 2.31
Reported-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230808164418.69989-1-richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user: Add missing includes
2025-09-05 16:26 ` Richard Henderson
@ 2025-09-05 16:28 ` Peter Foley
0 siblings, 0 replies; 7+ messages in thread
From: Peter Foley @ 2025-09-05 16:28 UTC (permalink / raw)
To: Richard Henderson; +Cc: Paolo Bonzini, qemu-devel, Laurent Vivier, nabihestefan
[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]
On Fri, Sep 5, 2025 at 12:26 PM Richard Henderson <
richard.henderson@linaro.org> wrote:
> On 9/5/25 18:00, Peter Foley wrote:
> > We're using glibc 2.27.
>
> That's just too old.
>
Yeah, I'm picking up on that.
So it looks like short of back-porting support for MAP_FIXED_NOREPLACE to
our "grte" fork of glibc, we should just keep carrying a local patch.
Sorry for the noise.
>
> commit c42e77a90d9244c8caf76fe0e54f84200430a4e1
> Author: Richard Henderson <richard.henderson@linaro.org>
> Date: Tue Aug 8 09:44:18 2023 -0700
>
> qemu/osdep: Remove fallback for MAP_FIXED_NOREPLACE
>
> In order for our emulation of MAP_FIXED_NOREPLACE to succeed within
> linux-user target_mmap, we require a non-zero value. This does not
> require host kernel support, merely the bit being defined.
>
> MAP_FIXED_NOREPLACE was added with glibc 2.28. From repology.org:
>
> Fedora 36: 2.35
> CentOS 8 (RHEL-8): 2.28
> Debian 11: 2.31
> OpenSUSE Leap 15.4: 2.31
> Ubuntu LTS 20.04: 2.31
>
> Reported-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> Message-Id: <20230808164418.69989-1-richard.henderson@linaro.org>
>
>
> r~
>
>
[-- Attachment #2: Type: text/html, Size: 2611 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-05 16:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 15:21 [PATCH] linux-user: Add missing includes Peter Foley
2025-09-05 7:31 ` Paolo Bonzini
2025-09-05 8:48 ` Richard Henderson
2025-09-05 16:00 ` Peter Foley
2025-09-05 16:06 ` Peter Foley
2025-09-05 16:26 ` Richard Henderson
2025-09-05 16:28 ` Peter Foley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).