All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/3] Linux user for 7.1 patches
@ 2022-08-03 14:56 Laurent Vivier
  2022-08-03 14:56 ` [PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code Laurent Vivier
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Laurent Vivier @ 2022-08-03 14:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier

The following changes since commit 3e4abe2c92964aadd35344a635b0f32cb487fd5c:

  Merge tag 'pull-block-2022-07-27' of https://gitlab.com/vsementsov/qemu into staging (2022-07-27 20:10:15 -0700)

are available in the Git repository at:

  https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request

for you to fetch changes up to 5b63de6b54add51822db3c89325c6fc05534a54c:

  linux-user: Use memfd for open syscall emulation (2022-08-02 15:44:27 +0200)

----------------------------------------------------------------
Pull request linux-user 20220803

----------------------------------------------------------------

Ilya Leoshkevich (1):
  linux-user: Do not treat madvise()'s advice as a bitmask

Peter Maydell (1):
  linux-user/flatload.c: Fix setting of image_info::end_code

Rainer Müller (1):
  linux-user: Use memfd for open syscall emulation

 linux-user/flatload.c |  2 +-
 linux-user/mmap.c     |  2 +-
 linux-user/syscall.c  | 22 ++++++++++++++--------
 3 files changed, 16 insertions(+), 10 deletions(-)

-- 
2.37.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code
  2022-08-03 14:56 [PULL 0/3] Linux user for 7.1 patches Laurent Vivier
@ 2022-08-03 14:56 ` Laurent Vivier
  2022-08-03 14:56 ` [PULL 2/3] linux-user: Do not treat madvise()'s advice as a bitmask Laurent Vivier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2022-08-03 14:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Peter Maydell, Richard Henderson

From: Peter Maydell <peter.maydell@linaro.org>

The flatload loader sets the end_code field in the image_info struct
incorrectly, due to a typo.

This is a very long-standing bug (dating all the way back to when
the bFLT loader was added in 2006), but has gone unnoticed because
(a) most people don't use bFLT binaries
(b) we don't actually do anything with the end_code field, except
    print it in debugging traces and pass it to TCG plugins

Fix the typo.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1119
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220728151406.2262862-1-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/flatload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index e4c2f89a2267..e99570ca182b 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -808,7 +808,7 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info)
 
     /* Stash our initial stack pointer into the mm structure */
     info->start_code = libinfo[0].start_code;
-    info->end_code = libinfo[0].start_code = libinfo[0].text_len;
+    info->end_code = libinfo[0].start_code + libinfo[0].text_len;
     info->start_data = libinfo[0].start_data;
     info->end_data = libinfo[0].end_data;
     info->start_brk = libinfo[0].start_brk;
-- 
2.37.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PULL 2/3] linux-user: Do not treat madvise()'s advice as a bitmask
  2022-08-03 14:56 [PULL 0/3] Linux user for 7.1 patches Laurent Vivier
  2022-08-03 14:56 ` [PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code Laurent Vivier
@ 2022-08-03 14:56 ` Laurent Vivier
  2022-08-03 14:56 ` [PULL 3/3] linux-user: Use memfd for open syscall emulation Laurent Vivier
  2022-08-03 17:12 ` [PULL 0/3] Linux user for 7.1 patches Richard Henderson
  3 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2022-08-03 14:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Ilya Leoshkevich

From: Ilya Leoshkevich <iii@linux.ibm.com>

Advice is enum, not flags. Doing (advice & MADV_DONTNEED) also matches
e.g. MADV_MERGEABLE.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220725134100.128035-1-iii@linux.ibm.com>
Fixes: 892a4f6a750a ("linux-user: Add partial support for MADV_DONTNEED")
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 4e7a6be6ee19..edceaca4a8e1 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -891,7 +891,7 @@ abi_long target_madvise(abi_ulong start, abi_ulong len_in, int advice)
      * anonymous mappings. In this case passthrough is safe, so do it.
      */
     mmap_lock();
-    if ((advice & MADV_DONTNEED) &&
+    if (advice == MADV_DONTNEED &&
         can_passthrough_madv_dontneed(start, end)) {
         ret = get_errno(madvise(g2h_untagged(start), len, MADV_DONTNEED));
     }
-- 
2.37.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PULL 3/3] linux-user: Use memfd for open syscall emulation
  2022-08-03 14:56 [PULL 0/3] Linux user for 7.1 patches Laurent Vivier
  2022-08-03 14:56 ` [PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code Laurent Vivier
  2022-08-03 14:56 ` [PULL 2/3] linux-user: Do not treat madvise()'s advice as a bitmask Laurent Vivier
@ 2022-08-03 14:56 ` Laurent Vivier
  2022-08-03 17:12 ` [PULL 0/3] Linux user for 7.1 patches Richard Henderson
  3 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2022-08-03 14:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier, Rainer Müller, Richard Henderson

From: Rainer Müller <raimue@codingfarm.de>

For certain paths in /proc, the open syscall is intercepted and the
returned file descriptor points to a temporary file with emulated
contents.

If TMPDIR is not accessible or writable for the current user (for
example in a read-only mounted chroot or container) tools such as ps
from procps may fail unexpectedly. Trying to read one of these paths
such as /proc/self/stat would return an error such as ENOENT or EROFS.

To relax the requirement on a writable TMPDIR, use memfd_create()
instead to create an anonymous file and return its file descriptor.

Signed-off-by: Rainer Müller <raimue@codingfarm.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220729154951.76268-1-raimue@codingfarm.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b27a6552aa34..ef53feb5ab45 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8260,16 +8260,22 @@ static int do_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, int
         char filename[PATH_MAX];
         int fd, r;
 
-        /* create temporary file to map stat to */
-        tmpdir = getenv("TMPDIR");
-        if (!tmpdir)
-            tmpdir = "/tmp";
-        snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir);
-        fd = mkstemp(filename);
+        fd = memfd_create("qemu-open", 0);
         if (fd < 0) {
-            return fd;
+            if (errno != ENOSYS) {
+                return fd;
+            }
+            /* create temporary file to map stat to */
+            tmpdir = getenv("TMPDIR");
+            if (!tmpdir)
+                tmpdir = "/tmp";
+            snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir);
+            fd = mkstemp(filename);
+            if (fd < 0) {
+                return fd;
+            }
+            unlink(filename);
         }
-        unlink(filename);
 
         if ((r = fake_open->fill(cpu_env, fd))) {
             int e = errno;
-- 
2.37.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PULL 0/3] Linux user for 7.1 patches
  2022-08-03 14:56 [PULL 0/3] Linux user for 7.1 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2022-08-03 14:56 ` [PULL 3/3] linux-user: Use memfd for open syscall emulation Laurent Vivier
@ 2022-08-03 17:12 ` Richard Henderson
  3 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2022-08-03 17:12 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel

On 8/3/22 07:56, Laurent Vivier wrote:
> The following changes since commit 3e4abe2c92964aadd35344a635b0f32cb487fd5c:
> 
>    Merge tag 'pull-block-2022-07-27' of https://gitlab.com/vsementsov/qemu into staging (2022-07-27 20:10:15 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request
> 
> for you to fetch changes up to 5b63de6b54add51822db3c89325c6fc05534a54c:
> 
>    linux-user: Use memfd for open syscall emulation (2022-08-02 15:44:27 +0200)
> 
> ----------------------------------------------------------------
> Pull request linux-user 20220803

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.


r~


> 
> ----------------------------------------------------------------
> 
> Ilya Leoshkevich (1):
>    linux-user: Do not treat madvise()'s advice as a bitmask
> 
> Peter Maydell (1):
>    linux-user/flatload.c: Fix setting of image_info::end_code
> 
> Rainer Müller (1):
>    linux-user: Use memfd for open syscall emulation
> 
>   linux-user/flatload.c |  2 +-
>   linux-user/mmap.c     |  2 +-
>   linux-user/syscall.c  | 22 ++++++++++++++--------
>   3 files changed, 16 insertions(+), 10 deletions(-)
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PULL 0/3] Linux user for 7.1 patches
  2022-07-26  9:44 Laurent Vivier
@ 2022-07-26 14:29 ` Peter Maydell
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Maydell @ 2022-07-26 14:29 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel

On Tue, 26 Jul 2022 at 10:49, Laurent Vivier <laurent@vivier.eu> wrote:
>
> The following changes since commit 5288bee45fbd33203b61f8c76e41b15bb5913e6e:
>
>   Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-07-21 11:13:01 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request
>
> for you to fetch changes up to 6f200f51869ff0de7ea0343dd7104362e994b382:
>
>   linux-user: Use target abi_int type for pipefd[1] in pipe() (2022-07-25 10:42:11 +0200)
>
> ----------------------------------------------------------------
> linux-user pull request 20220726
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PULL 0/3] Linux user for 7.1 patches
@ 2022-07-26  9:44 Laurent Vivier
  2022-07-26 14:29 ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2022-07-26  9:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier

The following changes since commit 5288bee45fbd33203b61f8c76e41b15bb5913e6e:

  Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-07-21 11:13:01 +0100)

are available in the Git repository at:

  https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request

for you to fetch changes up to 6f200f51869ff0de7ea0343dd7104362e994b382:

  linux-user: Use target abi_int type for pipefd[1] in pipe() (2022-07-25 10:42:11 +0200)

----------------------------------------------------------------
linux-user pull request 20220726

----------------------------------------------------------------

Helge Deller (3):
  linux-user/hppa: Fix segfaults on page zero
  linux-user: Unconditionally use pipe2() syscall
  linux-user: Use target abi_int type for pipefd[1] in pipe()

 linux-user/hppa/cpu_loop.c |  3 +++
 linux-user/syscall.c       | 13 ++-----------
 meson.build                |  9 ---------
 3 files changed, 5 insertions(+), 20 deletions(-)

-- 
2.37.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PULL 0/3] Linux user for 7.1 patches
  2022-06-24  9:49 Laurent Vivier
@ 2022-06-24 17:50 ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2022-06-24 17:50 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel

On 6/24/22 02:49, Laurent Vivier wrote:
> The following changes since commit c8b2d413761af732a0798d8df45ce968732083fe:
> 
>    Merge tag 'bsd-user-syscall-2022q2-pull-request' of ssh://github.com/qemu-bsd-user/qemu-bsd-user into staging (2022-06-19 13:56:13 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request
> 
> for you to fetch changes up to 9a7f682c26acae5bc8bfd1f7c774070da54f1625:
> 
>    linux-user: Adjust child_tidptr on set_tid_address() syscall (2022-06-24 10:00:01 +0200)
> 
> ----------------------------------------------------------------
> linux-user pull request 20220624

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.


r~


> 
> ----------------------------------------------------------------
> 
> Helge Deller (1):
>    linux-user: Adjust child_tidptr on set_tid_address() syscall
> 
> Ilya Leoshkevich (1):
>    linux-user: Add partial support for MADV_DONTNEED
> 
> Richard Henderson (1):
>    linux-user/x86_64: Fix ELF_PLATFORM
> 
>   linux-user/elfload.c        | 30 +++++++++--------
>   linux-user/mmap.c           | 64 +++++++++++++++++++++++++++++++++++++
>   linux-user/syscall.c        | 20 ++++++------
>   linux-user/user-internals.h |  1 +
>   linux-user/user-mmap.h      |  1 +
>   5 files changed, 92 insertions(+), 24 deletions(-)
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PULL 0/3] Linux user for 7.1 patches
@ 2022-06-24  9:49 Laurent Vivier
  2022-06-24 17:50 ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2022-06-24  9:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Laurent Vivier

The following changes since commit c8b2d413761af732a0798d8df45ce968732083fe:

  Merge tag 'bsd-user-syscall-2022q2-pull-request' of ssh://github.com/qemu-bsd-user/qemu-bsd-user into staging (2022-06-19 13:56:13 -0700)

are available in the Git repository at:

  https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request

for you to fetch changes up to 9a7f682c26acae5bc8bfd1f7c774070da54f1625:

  linux-user: Adjust child_tidptr on set_tid_address() syscall (2022-06-24 10:00:01 +0200)

----------------------------------------------------------------
linux-user pull request 20220624

----------------------------------------------------------------

Helge Deller (1):
  linux-user: Adjust child_tidptr on set_tid_address() syscall

Ilya Leoshkevich (1):
  linux-user: Add partial support for MADV_DONTNEED

Richard Henderson (1):
  linux-user/x86_64: Fix ELF_PLATFORM

 linux-user/elfload.c        | 30 +++++++++--------
 linux-user/mmap.c           | 64 +++++++++++++++++++++++++++++++++++++
 linux-user/syscall.c        | 20 ++++++------
 linux-user/user-internals.h |  1 +
 linux-user/user-mmap.h      |  1 +
 5 files changed, 92 insertions(+), 24 deletions(-)

-- 
2.36.1



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-08-03 17:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 14:56 [PULL 0/3] Linux user for 7.1 patches Laurent Vivier
2022-08-03 14:56 ` [PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code Laurent Vivier
2022-08-03 14:56 ` [PULL 2/3] linux-user: Do not treat madvise()'s advice as a bitmask Laurent Vivier
2022-08-03 14:56 ` [PULL 3/3] linux-user: Use memfd for open syscall emulation Laurent Vivier
2022-08-03 17:12 ` [PULL 0/3] Linux user for 7.1 patches Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2022-07-26  9:44 Laurent Vivier
2022-07-26 14:29 ` Peter Maydell
2022-06-24  9:49 Laurent Vivier
2022-06-24 17:50 ` Richard Henderson

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.