Skip to contentSkip to conversation

Fix the build on CentOS 7

PATCH In review Ilya Leoshkevich 4 participants 8 messages Aug 10, 2023 – Aug 17, 2023

lore
Share & tools
lore
#0 lore raw

cover Fix the build on CentOS 7

Hi,

I know that CentOS 7 is not tested anymore, but unfortunately it's the only ppc64le system that I have, so I had to fix a few build issues that crept in since the testing stopped. The fixes are simple and may be helpful to people in the same situation.

Best regards,
Ilya

Ilya Leoshkevich (3):
linux-user: Fix the build on systems without SOL_ALG
linux-user: Fix the build on systems without MAP_SHARED_VALIDATE
linux-user: Fix the build on systems without MADV_{KEEP,WIPE}ONFORK

 linux-user/mmap.c    | 1 +
 linux-user/syscall.c | 3 +++
 2 files changed, 4 insertions(+)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/3 linux-user: Fix the build on systems without SOL_ALG

Building QEMU on CentOS 7 fails, because there SOL_ALG is not defined. There already exists #if defined(SOL_ALG) in do_setsockopt(); add it to target_to_host_cmsg() as well.

Fixes 27404b6c15c1 ("linux-user: Implement SOL_ALG encryption support")
---
 linux-user/syscall.c | 2 ++
 1 file changed, 2 insertions(+)
linux-user/syscall.c +2 -0
index 18d3107194b..42f4aed8e84 100644
@@ -1806,6 +1806,7 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
             __get_user(cred->pid, &target_cred->pid);
             __get_user(cred->uid, &target_cred->uid);
             __get_user(cred->gid, &target_cred->gid);
+#ifdef SOL_ALG
         } else if (cmsg->cmsg_level == SOL_ALG) {
             uint32_t *dst = (uint32_t *)data;
 
@@ -1814,6 +1815,7 @@ static inline abi_long target_to_host_cmsg(struct msghdr *msgh,
             if (len >= sizeof(uint32_t)) {
                 *dst = tswap32(*dst);
             }
+#endif
         } else {
             qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n",
                           cmsg->cmsg_level, cmsg->cmsg_type);
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH 1/3] linux-user: Fix the build on systems without SOL_ALG

Quoted 3 lines · Ilya Leoshkevich

Building QEMU on CentOS 7 fails, because there SOL_ALG is not defined. There already exists #if defined(SOL_ALG) in do_setsockopt(); add it to target_to_host_cmsg() as well.

Does including "crypto/afalgpriv.h" help?

Quoted 5 lines
Fixes 27404b6c15c1 ("linux-user: Implement SOL_ALG encryption support")
---
  linux-user/syscall.c | 2 ++
  1 file changed, 2 insertions(+)
#3 lore raw

PATCH 2/3 linux-user: Fix the build on systems without MAP_SHARED_VALIDATE

In reply to Ilya Leoshkevich

CentOS 7 does not define MAP_SHARED_VALIDATE. Use a definition provided by the QEMU's copy of linux/mman.h.

Fixes 4b840f96096d ("linux-user: Populate more bits in mmap_flags_tbl")
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
index 42f4aed8e84..256f38cdd5d 100644
@@ -121,6 +121,7 @@
 #ifdef HAVE_BTRFS_H
 #include <linux/btrfs.h>
 #endif
+#include <linux/mman.h>
 #ifdef HAVE_DRM_H
 #include <libdrm/drm.h>
 #include <libdrm/i915_drm.h>
Signature · 1 line
2.41.0
#4 lore raw

Re: [PATCH 2/3] linux-user: Fix the build on systems without MAP_SHARED_VALIDATE

Quoted 5 lines · Ilya Leoshkevich

CentOS 7 does not define MAP_SHARED_VALIDATE. Use a definition provided by the QEMU's copy of linux/mman.h.

Fixes 4b840f96096d ("linux-user: Populate more bits in mmap_flags_tbl")

Does it fix the missing MADV_WIPEONFORK as well?
https://gitlab.com/qemu-project/qemu/-/issues/1824#note_1507837354

Helge

Quoted 16 lines
---
  linux-user/syscall.c | 1 +
  1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
index 42f4aed8e84..256f38cdd5d 100644
@@ -121,6 +121,7 @@
  #ifdef HAVE_BTRFS_H
  #include <linux/btrfs.h>
  #endif
+#include <linux/mman.h>
  #ifdef HAVE_DRM_H
  #include <libdrm/drm.h>
  #include <libdrm/i915_drm.h>
#5 lore raw

Re: [PATCH 2/3] linux-user: Fix the build on systems without MAP_SHARED_VALIDATE

Quoted 5 lines · Helge Deller
Quoted 4 lines · Ilya Leoshkevich

CentOS 7 does not define MAP_SHARED_VALIDATE. Use a definition provided
by the QEMU's copy of linux/mman.h.

Quoted 8 lines
Quoted 3 lines
Fixes 4b840f96096d ("linux-user: Populate more bits in

mmap_flags_tbl")

Does it fix the missing MADV_WIPEONFORK as well?
https://gitlab.com/qemu-project/qemu/-/issues/1824#note_1507837354

Helge

What a coincidence, that multiple people ran into this on the same day.

This should be fixed by [3/3] of this series.

Best regards,
Ilya

#6 lore raw

PATCH 3/3 linux-user: Fix the build on systems without MADV_{KEEP, WIPE}ONFORK

In reply to Ilya Leoshkevich

CentOS 7 does not define MADV_KEEPONFORK and MADV_WIPEONFORK. Use definitions provided by the QEMU's copy of linux/mman.h.

Fixes 4530deb1 ("linux-user: Add emulation for MADV_WIPEONFORK and MADV_KEEPONFORK in madvise()")
---
 linux-user/mmap.c | 1 +
 1 file changed, 1 insertion(+)
linux-user/mmap.c +1 -0
index 9aab48d4a30..127962c1c26 100644
@@ -17,6 +17,7 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
+#include <linux/mman.h>
 #include "trace.h"
 #include "exec/log.h"
 #include "qemu.h"
Signature · 1 line
2.41.0
#7 lore raw
In reply to Ilya Leoshkevich
Quoted 6 lines · Ilya Leoshkevich

Hi,

I know that CentOS 7 is not tested anymore, but unfortunately it's the only ppc64le system that I have, so I had to fix a few build issues that crept in since the testing stopped. The fixes are simple and may be helpful to people in the same situation.

Actually it is more than not tested. CentOS 7 is explicitly unsupported per our platform support matrix:

https://www.qemu.org/docs/master/about/build-platforms.html

and thus we will *intentionally* delete backwards compatibility code that it needs, in order to simplify QEMU's codebase.

Quoted 4 lines

Ilya Leoshkevich (3):
linux-user: Fix the build on systems without SOL_ALG
linux-user: Fix the build on systems without MAP_SHARED_VALIDATE
linux-user: Fix the build on systems without MADV_{KEEP,WIPE}ONFORK

We explicitly do NOT want to add this kind of back compat code for unsupported platforms.

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|