aboutsummaryrefslogtreecommitdiff
path: root/linux-user/elfload.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-10-09 15:06:42 +0100
committerPeter Maydell <peter.maydell@linaro.org>2024-10-09 15:06:42 +0100
commit54cdddc6dc29e557de33138fc0d89e73510c8487 (patch)
tree545b1c7f95928c3aaa570dbf30ee8c43f4b62c40 /linux-user/elfload.c
parentc9beb029b5bd8cc028411db2270995f5e0dc3567 (diff)
parent25f4e71722417db1f7d5140847849197053b23dd (diff)
downloadqemu-54cdddc6dc29e557de33138fc0d89e73510c8487.zip
qemu-54cdddc6dc29e557de33138fc0d89e73510c8487.tar.gz
qemu-54cdddc6dc29e557de33138fc0d89e73510c8487.tar.bz2
Merge tag 'pull-tcg-20241008' of https://gitlab.com/rth7680/qemu into staging
linux-user: Fix parse_elf_properties GNU0_MAGIC check linux-user: Various improvements to strace linux-user: Add openat2 support linux-user/flatload: Take mmap_lock in load_flt_binary() accel/tcg: Make page_set_flags() documentation public tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr target/m68k: Always return a temporary from gen_lea_mode # -----BEGIN PGP SIGNATURE----- # # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmcFeLQdHHJpY2hhcmQu # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+8Wgf9FJb/71zPAg7idUo8 # k+P5hOmE0PzPKdkoCh5WP0+TF4m/gMc3ABMFO2ABx4EcAkWxUmNP1Po5Lb0/A9Gq # LuSDRJVk3jSeGebmMsIH0SVzKY3ewQv7ZGB6A2uFdXtkwDUCxgHUQcfQY9yvjFut # eU11zWkPbmbI4bwz9Y+Tyv9LOXRk/Br5B/uQEzQ9/Go/0OeJP0iTXre/veGufqND # wK35AoDCVNomjw6h2Fg0t3kCt/mtR8W8D16+4QhsH+iE9IQMmhj4itz8Uq2ikh29 # lQIUT8acHC8fNUQJXw0nPXbNsimp/GyRGJiYCH7g7V67o/fjDUSbYMxk2TMZPuJV # dGy3KQ== # =UeX8 # -----END PGP SIGNATURE----- # gpg: Signature made Tue 08 Oct 2024 19:23:48 BST # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full] # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * tag 'pull-tcg-20241008' of https://gitlab.com/rth7680/qemu: accel/tcg: Make page_set_flags() documentation public target/m68k: Always return a temporary from gen_lea_mode tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st linux-user: Add strace for recvfrom() linux-user: Add strace for sendto() linux-user: Factor print_buf_len() out linux-user: Display sockaddr buffer as pointer linux-user: Correct print_sockaddr() format linux-user: Trace wait4()'s and waitpid()'s wstatus linux-user: add strace support for openat2 linux-user: add openat2 support in linux-user linux-user: Fix parse_elf_properties GNU0_MAGIC check linux-user/flatload: Take mmap_lock in load_flt_binary() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/elfload.c')
-rw-r--r--linux-user/elfload.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0678c9d..52c88a6 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -3121,11 +3121,11 @@ static bool parse_elf_properties(const ImageSource *src,
}
/*
- * The contents of a valid PT_GNU_PROPERTY is a sequence
- * of uint32_t -- swap them all now.
+ * The contents of a valid PT_GNU_PROPERTY is a sequence of uint32_t.
+ * Swap most of them now, beyond the header and namesz.
*/
#ifdef BSWAP_NEEDED
- for (int i = 0; i < n / 4; i++) {
+ for (int i = 4; i < n / 4; i++) {
bswap32s(note.data + i);
}
#endif
@@ -3135,15 +3135,15 @@ static bool parse_elf_properties(const ImageSource *src,
* immediately follows nhdr and is thus at the 4th word. Further, all
* of the inputs to the kernel's round_up are multiples of 4.
*/
- if (note.nhdr.n_type != NT_GNU_PROPERTY_TYPE_0 ||
- note.nhdr.n_namesz != NOTE_NAME_SZ ||
+ if (tswap32(note.nhdr.n_type) != NT_GNU_PROPERTY_TYPE_0 ||
+ tswap32(note.nhdr.n_namesz) != NOTE_NAME_SZ ||
note.data[3] != GNU0_MAGIC) {
error_setg(errp, "Invalid note in PT_GNU_PROPERTY");
return false;
}
off = sizeof(note.nhdr) + NOTE_NAME_SZ;
- datasz = note.nhdr.n_descsz + off;
+ datasz = tswap32(note.nhdr.n_descsz) + off;
if (datasz > n) {
error_setg(errp, "Invalid note size in PT_GNU_PROPERTY");
return false;