summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-08-03 08:32:44 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-08-03 08:32:44 -0700
commit2480f3bbd03814b0651a1f74959f5c6631ee5819 (patch)
treec5a3c798344ead1393a73cbcb1d3a2c9d3c441a2
parentd2656dd577754129f86328f95e6ee4a241913d6f (diff)
parent5b63de6b54add51822db3c89325c6fc05534a54c (diff)
Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging
Pull request linux-user 20220803 # -----BEGIN PGP SIGNATURE----- # # iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmLqjIMSHGxhdXJlbnRA # dml2aWVyLmV1AAoJEPMMOL0/L748bpAP/1HW4wQztNCDL2epXGtDMTHFIjsLlc05 # h/3BwnXXXbRv/m4+IEJLITI5WpyZ24CGgA5kIFPRDxLCIHxcTo5etzqkJzxhnRvU # MNP3m8L5gSAUUZhD8Xw2b95V8vOv4cu8J+sgub8ZaRXJpcHK1cuCF43OeI3bBuoz # HNVY8XHl0E46JyXQmK9/phBRSK8INhlMIORd+k/GzSx7+9/UdIqTj1kVpdgbQ8we # GqrnVW9hYA2T2vUL3SEV8t6GE6lSGRr9bvsyRRfLxJanUEQbGmbJPvqBwjamRwUF # xZOBou/cYQOoI9AVku9bL+h2ITGfrfNZ8Oo7r7oOrz+ZjBfL9hUQqhFhI/oI265n # 4ivzdOcsXH6OT7X+JdZRvyv6pxVL7ycu2KCKvmnNvQSocGHT1OvFqIHAWd+NAdEr # c4q1ob1QdUfZjrzjzLR/qY2NPZat1Ge5lSIXOwC1G3T5umuw8cV7BV9KJJRoQXfE # AWeXsLKqqByQ59z+qObnFIkUXLaUOzKMjHNFpDGSqk+dzXxQYJtBn+b8ZLoL9MLa # miIN9imVzI2gzolIBz9Za2pnBw72bIR2PdXd3zfKH0cqmytOhKlMIEK4KJcB6kMB # CNAbszUwrmBSopGGryf+hLMk9VsPLVUg+Yqnc6/GLY8LF9d8Xr5rd8UzelYowBuh # 3UR/V06U2Skv # =41sQ # -----END PGP SIGNATURE----- # gpg: Signature made Wed 03 Aug 2022 07:56:03 AM PDT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [undefined] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu: linux-user: Use memfd for open syscall emulation linux-user: Do not treat madvise()'s advice as a bitmask linux-user/flatload.c: Fix setting of image_info::end_code Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--linux-user/flatload.c2
-rw-r--r--linux-user/mmap.c2
-rw-r--r--linux-user/syscall.c22
3 files changed, 16 insertions, 10 deletions
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index e4c2f89a22..e99570ca18 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;
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 4e7a6be6ee..edceaca4a8 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));
}
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b27a6552aa..ef53feb5ab 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;