Now that host_memory_backend_pagesize() is not depending on the hugetlb
memory path handling anymore, we can also remove the #ifdef and the
TOCTTOU comment from the calling functions - the code should now work
equally well on all host architectures.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
softmmu/physmem.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index dc3c3e5f2e..50231bab30 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1331,13 +1331,6 @@ GString *ram_block_format(void)
return buf;
}
-#ifdef __linux__
-/*
- * FIXME TOCTTOU: this iterates over memory backends' mem-path, which
- * may or may not name the same files / on the same filesystem now as
- * when we actually open and map them. Iterate over the file
- * descriptors instead, and use qemu_fd_getpagesize().
- */
static int find_min_backend_pagesize(Object *obj, void *opaque)
{
long *hpsize_min = opaque;
@@ -1391,16 +1384,6 @@ long qemu_maxrampagesize(void)
object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize);
return pagesize;
}
-#else
-long qemu_minrampagesize(void)
-{
- return qemu_real_host_page_size();
-}
-long qemu_maxrampagesize(void)
-{
- return qemu_real_host_page_size();
-}
-#endif
#ifdef CONFIG_POSIX
static int64_t get_file_size(int fd)
--
2.31.1
On Wed, 10 Aug 2022 14:57:19 +0200
Thomas Huth <thuth@redhat.com> wrote:
> Now that host_memory_backend_pagesize() is not depending on the hugetlb
> memory path handling anymore, we can also remove the #ifdef and the
> TOCTTOU comment from the calling functions - the code should now work
> equally well on all host architectures.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> softmmu/physmem.c | 17 -----------------
> 1 file changed, 17 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index dc3c3e5f2e..50231bab30 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -1331,13 +1331,6 @@ GString *ram_block_format(void)
> return buf;
> }
>
> -#ifdef __linux__
> -/*
> - * FIXME TOCTTOU: this iterates over memory backends' mem-path, which
> - * may or may not name the same files / on the same filesystem now as
> - * when we actually open and map them. Iterate over the file
> - * descriptors instead, and use qemu_fd_getpagesize().
> - */
> static int find_min_backend_pagesize(Object *obj, void *opaque)
> {
> long *hpsize_min = opaque;
> @@ -1391,16 +1384,6 @@ long qemu_maxrampagesize(void)
> object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize);
> return pagesize;
> }
> -#else
> -long qemu_minrampagesize(void)
> -{
> - return qemu_real_host_page_size();
> -}
> -long qemu_maxrampagesize(void)
> -{
> - return qemu_real_host_page_size();
> -}
> -#endif
>
> #ifdef CONFIG_POSIX
> static int64_t get_file_size(int fd)
On 10.08.22 14:57, Thomas Huth wrote:
> Now that host_memory_backend_pagesize() is not depending on the hugetlb
> memory path handling anymore, we can also remove the #ifdef and the
> TOCTTOU comment from the calling functions - the code should now work
> equally well on all host architectures.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> softmmu/physmem.c | 17 -----------------
> 1 file changed, 17 deletions(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index dc3c3e5f2e..50231bab30 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -1331,13 +1331,6 @@ GString *ram_block_format(void)
> return buf;
> }
>
> -#ifdef __linux__
> -/*
> - * FIXME TOCTTOU: this iterates over memory backends' mem-path, which
> - * may or may not name the same files / on the same filesystem now as
> - * when we actually open and map them. Iterate over the file
> - * descriptors instead, and use qemu_fd_getpagesize().
> - */
> static int find_min_backend_pagesize(Object *obj, void *opaque)
> {
> long *hpsize_min = opaque;
> @@ -1391,16 +1384,6 @@ long qemu_maxrampagesize(void)
> object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize);
> return pagesize;
> }
> -#else
> -long qemu_minrampagesize(void)
> -{
> - return qemu_real_host_page_size();
> -}
> -long qemu_maxrampagesize(void)
> -{
> - return qemu_real_host_page_size();
> -}
> -#endif
>
> #ifdef CONFIG_POSIX
> static int64_t get_file_size(int fd)
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
© 2016 - 2026 Red Hat, Inc.