[PATCH 0/2] Fix build with glibc 2.36

With glibc 2.36, sys/mount.h and linux/mount.h conflict: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3... Easiest way to run this through CI? Submit MR to libvirt gitlab? Cole Robinson (2): lxc: containter: fix build with glibc 2.36 virfile: Fix build with glibc 2.36 src/lxc/lxc_container.c | 3 --- src/util/virfile.c | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) -- 2.36.1

With glibc 2.36, sys/mount.h and linux/mount.h conflict: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3... lxc_container.c imports sys/mount.h and linux/fs.h, which pulls in linux/mount.h. linux/fs.h isn't required here though. glibc sys/mount.h has had MS_MOVE since 2.12 in 2010 Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/lxc/lxc_container.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b5278831da..a5401c2186 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -33,9 +33,6 @@ /* Yes, we want linux private one, for _syscall2() macro */ #include <linux/unistd.h> -/* For MS_MOVE */ -#include <linux/fs.h> - #if WITH_CAPNG # include <cap-ng.h> #endif -- 2.36.1

On Mon, Aug 01, 2022 at 03:59:14PM -0400, Cole Robinson wrote:
With glibc 2.36, sys/mount.h and linux/mount.h conflict: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3...
lxc_container.c imports sys/mount.h and linux/fs.h, which pulls in linux/mount.h.
linux/fs.h isn't required here though. glibc sys/mount.h has had MS_MOVE since 2.12 in 2010
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/lxc/lxc_container.c | 3 --- 1 file changed, 3 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b5278831da..a5401c2186 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -33,9 +33,6 @@ /* Yes, we want linux private one, for _syscall2() macro */ #include <linux/unistd.h>
-/* For MS_MOVE */ -#include <linux/fs.h> - #if WITH_CAPNG # include <cap-ng.h> #endif -- 2.36.1
Reviewed-by: Erik Skultety <eskultet@redhat.com>

With glibc 2.36, sys/mount.h and linux/mount.h conflict: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3... virfile.c imports sys/mount.h and linux/fs.h, which pulls in linux/mount.h. Manually define the constants we need from linux/fs.h, like was done in llvm: https://reviews.llvm.org/rGb379129c4beb3f26223288627a1291739f33af02 Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/util/virfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 99da058db3..65d6d2a701 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -71,7 +71,9 @@ # endif # include <sys/ioctl.h> # include <linux/cdrom.h> -# include <linux/fs.h> +# define FS_IOC_GETFLAGS _IOR('f', 1, long) +# define FS_IOC_SETFLAGS _IOR('f', 2, long) +# define FS_NOCOW_FL 0x00800000 #endif #if WITH_LIBATTR -- 2.36.1

On Mon, Aug 01, 2022 at 03:59:15PM -0400, Cole Robinson wrote:
With glibc 2.36, sys/mount.h and linux/mount.h conflict: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3...
virfile.c imports sys/mount.h and linux/fs.h, which pulls in linux/mount.h.
Manually define the constants we need from linux/fs.h, like was done in llvm:
https://reviews.llvm.org/rGb379129c4beb3f26223288627a1291739f33af02
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/util/virfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c index 99da058db3..65d6d2a701 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -71,7 +71,9 @@ # endif # include <sys/ioctl.h> # include <linux/cdrom.h> -# include <linux/fs.h>
The commit message does explain the issue, but I'd still appreciate if there was a short commentary explaining this explicit constant definition here as well.
+# define FS_IOC_GETFLAGS _IOR('f', 1, long) +# define FS_IOC_SETFLAGS _IOR('f', 2, long)
^this one has to be defined as FS_IOC_SETFLAGS _IOW('f', 2, long)
+# define FS_NOCOW_FL 0x00800000 #endif
#if WITH_LIBATTR -- 2.36.1
With the fixes: Reviewed-by: Erik Skultety <eskultet@redhat.com>

On 8/2/22 3:12 AM, Erik Skultety wrote:
On Mon, Aug 01, 2022 at 03:59:15PM -0400, Cole Robinson wrote:
With glibc 2.36, sys/mount.h and linux/mount.h conflict: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3...
virfile.c imports sys/mount.h and linux/fs.h, which pulls in linux/mount.h.
Manually define the constants we need from linux/fs.h, like was done in llvm:
https://reviews.llvm.org/rGb379129c4beb3f26223288627a1291739f33af02
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/util/virfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c index 99da058db3..65d6d2a701 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -71,7 +71,9 @@ # endif # include <sys/ioctl.h> # include <linux/cdrom.h> -# include <linux/fs.h>
The commit message does explain the issue, but I'd still appreciate if there was a short commentary explaining this explicit constant definition here as well.
Done.
+# define FS_IOC_GETFLAGS _IOR('f', 1, long) +# define FS_IOC_SETFLAGS _IOR('f', 2, long)
^this one has to be defined as FS_IOC_SETFLAGS _IOW('f', 2, long)
Darn, nice catch! Here's the CI pipeline: https://gitlab.com/crobinso/libvirt/-/pipelines/602982400 It passed, so I pushed with your suggested changes. Thanks, Cole

On Mon, Aug 01, 2022 at 03:59:13PM -0400, Cole Robinson wrote:
With glibc 2.36, sys/mount.h and linux/mount.h conflict:
https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3...
Easiest way to run this through CI? Submit MR to libvirt gitlab?
Are you out of your CI minutes? If so, let me know I'll run it for you I haven't run anything this month yet. Normally, you push to your libvirt gitlab fork and the pipeline will run automatically. I Rb'd both patches, but let's run it through CI please first. Erik
participants (2)
-
Cole Robinson
-
Erik Skultety