Linux user for 7.1 patches
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(-)
Signature · 1 line
2.37.1
[PULL 1/3] linux-user/flatload.c: Fix setting of image_info::end_code
From: Peter Maydell <[email protected]>
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
Message-Id: <[email protected]>
--- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/flatload.c +1 -1
@@ -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;
Signature · 1 line
2.37.1
[PULL 2/3] linux-user: Do not treat madvise()'s advice as a bitmask
In reply to Laurent VivierFrom: Ilya Leoshkevich <[email protected]>
Advice is enum, not flags. Doing (advice & MADV_DONTNEED) also matches e.g. MADV_MERGEABLE.
Message-Id: <[email protected]>
--- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/mmap.c +1 -1
@@ -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 )); }
Signature · 1 line
2.37.1
[PULL 3/3] linux-user: Use memfd for open syscall emulation
In reply to Laurent VivierFrom: Rainer Müller <[email protected]>
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.
Message-Id: <[email protected]>
--- linux-user/syscall.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
linux-user/syscall.c +14 -8
@@ -8260,16 +8260,22 @@ static int do_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, intchar 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;
Signature · 1 line
2.37.1
Richard Henderson
AppliedQuoted 6 lines · 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:
Quoted 8 lines
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~
Quoted 17 lines
----------------------------------------------------------------
Ilya Leoshkevich (1):
linux-user: Do not treat madvise()'s advice as a bitmaskPeter Maydell (1):
linux-user/flatload.c: Fix setting ofimage_info::end_codeRainer Müller (1):
linux-user: Use memfd for open syscall emulationlinux-user/flatload.c | 2 +- linux-user/mmap.c | 2 +- linux-user/syscall.c | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-)