* [Buildroot] [PATCH] package/xfsprogs: Fix builds for architectures without MAP_SYNC
@ 2022-07-20 20:59 Florian Fainelli
2022-07-21 3:27 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2022-07-20 20:59 UTC (permalink / raw)
To: buildroot
Cc: bernd.kuhls, chrismcc, Florian Fainelli, yann.morin.1998,
thomas.petazzoni, fontaine.fabrice
Include a patch that was submitted to the linux-xfs mailing list to
address build failures for io/mmap.c:
https://lore.kernel.org/linux-xfs/20220720205307.2345230-1-f.fainelli@gmail.com/
Fixes:
autobuild.buildroot.net/results/407131b767fc8241e8f5f5001c0b5d4e2c488dea
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
...fs.h-for-proper-HAVE_MAP_SYNC-defini.patch | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 package/xfsprogs/0004-xfs_io-Include-xfs.h-for-proper-HAVE_MAP_SYNC-defini.patch
diff --git a/package/xfsprogs/0004-xfs_io-Include-xfs.h-for-proper-HAVE_MAP_SYNC-defini.patch b/package/xfsprogs/0004-xfs_io-Include-xfs.h-for-proper-HAVE_MAP_SYNC-defini.patch
new file mode 100644
index 000000000000..27b10b698424
--- /dev/null
+++ b/package/xfsprogs/0004-xfs_io-Include-xfs.h-for-proper-HAVE_MAP_SYNC-defini.patch
@@ -0,0 +1,61 @@
+From ffdcb87460db644c952d9b50486a86975b188fdb Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Wed, 20 Jul 2022 11:58:06 -0700
+Subject: [PATCH] xfs_io: Make HAVE_MAP_SYNC more robust
+
+MIPS platforms building with recent kernel headers and the musl-libc toolchain
+will expose the following build failure:
+
+mmap.c: In function 'mmap_f':
+mmap.c:196:12: error: 'MAP_SYNC' undeclared (first use in this function); did you mean 'MS_SYNC'?
+ 196 | flags = MAP_SYNC | MAP_SHARED_VALIDATE;
+ | ^~~~~~~~
+ | MS_SYNC
+mmap.c:196:12: note: each undeclared identifier is reported only once for each function it appears in
+make[4]: *** [../include/buildrules:81: mmap.o] Error 1
+
+The reason for that is that the linux.h header file which intends to provide a fallback definition for MAP_SYNC and MAP_SHARED_VALIDATE is included too early through:
+
+input.h -> libfrog/projects.h -> xfs.h -> linux.h and this happens
+*before* sys/mman.h is included.
+
+sys/mman.h -> bits/mman.h which has a:
+ #undef MAP_SYNC
+
+see: https://git.musl-libc.org/cgit/musl/tree/arch/mips/bits/mman.h#n21
+
+The end result is that sys/mman.h being included for the first time
+ends-up overriding the HAVE_MAP_SYNC fallbacks.
+
+To remedy that, make sure that linux.h is updated to include sys/mman.h
+such that its fallbacks are independent of the inclusion order. As a
+consequence this forces us to ensure that we do not re-define
+accidentally MAP_SYNC or MAP_SHARED_VALIDATE so we protect against that.
+
+Fixes: dad796834cb9 ("xfs_io: add MAP_SYNC support to mmap()")
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ include/linux.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/include/linux.h b/include/linux.h
+index 3d9f4e3dca80..c3cc8e30c677 100644
+--- a/include/linux.h
++++ b/include/linux.h
+@@ -252,8 +252,13 @@ struct fsxattr {
+ #endif
+
+ #ifndef HAVE_MAP_SYNC
++#include <sys/mman.h>
++#ifndef MAP_SYNC
+ #define MAP_SYNC 0
++#endif
++#ifndef MAP_SHARED_VALIDATE
+ #define MAP_SHARED_VALIDATE 0
++#endif
+ #else
+ #include <asm-generic/mman.h>
+ #include <asm-generic/mman-common.h>
+--
+2.25.1
+
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH] package/xfsprogs: Fix builds for architectures without MAP_SYNC
2022-07-20 20:59 [Buildroot] [PATCH] package/xfsprogs: Fix builds for architectures without MAP_SYNC Florian Fainelli
@ 2022-07-21 3:27 ` Florian Fainelli
2022-07-21 7:06 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2022-07-21 3:27 UTC (permalink / raw)
To: buildroot
Cc: bernd.kuhls, chrismcc, yann.morin.1998, thomas.petazzoni,
fontaine.fabrice
On 7/20/2022 1:59 PM, Florian Fainelli wrote:
> Include a patch that was submitted to the linux-xfs mailing list to
> address build failures for io/mmap.c:
>
> https://lore.kernel.org/linux-xfs/20220720205307.2345230-1-f.fainelli@gmail.com/
>
> Fixes:
> autobuild.buildroot.net/results/407131b767fc8241e8f5f5001c0b5d4e2c488dea
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Looks like we got the attention of a few XFS developers, and sorry
Fabrice for not having seen your earlier attempt. Assuming Darrick's
patch get accepted I will provide a backport shortly after:
https://lore.kernel.org/all/YtiPgDT3imEyU2aF@magnolia/
Please do not apply this patch.
--
Florian
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH] package/xfsprogs: Fix builds for architectures without MAP_SYNC
2022-07-21 3:27 ` Florian Fainelli
@ 2022-07-21 7:06 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-07-21 7:06 UTC (permalink / raw)
To: Florian Fainelli
Cc: bernd.kuhls, chrismcc, yann.morin.1998, buildroot,
fontaine.fabrice
On Wed, 20 Jul 2022 20:27:23 -0700
Florian Fainelli <f.fainelli@gmail.com> wrote:
> On 7/20/2022 1:59 PM, Florian Fainelli wrote:
> > Include a patch that was submitted to the linux-xfs mailing list to
> > address build failures for io/mmap.c:
> >
> > https://lore.kernel.org/linux-xfs/20220720205307.2345230-1-f.fainelli@gmail.com/
> >
> > Fixes:
> > autobuild.buildroot.net/results/407131b767fc8241e8f5f5001c0b5d4e2c488dea
> >
> > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Looks like we got the attention of a few XFS developers, and sorry
> Fabrice for not having seen your earlier attempt. Assuming Darrick's
> patch get accepted I will provide a backport shortly after:
>
> https://lore.kernel.org/all/YtiPgDT3imEyU2aF@magnolia/
>
> Please do not apply this patch.
Thanks for following-up, I've marked your patch as "Rejected" in
patchwork.
Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-21 7:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-20 20:59 [Buildroot] [PATCH] package/xfsprogs: Fix builds for architectures without MAP_SYNC Florian Fainelli
2022-07-21 3:27 ` Florian Fainelli
2022-07-21 7:06 ` Thomas Petazzoni via buildroot
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.