]> git.ipfire.org Git - thirdparty/qemu.git/commit
linux-user: Handle short reads in mmap_h_gt_g
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 15 Aug 2024 21:13:31 +0000 (07:13 +1000)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 28 Aug 2024 05:37:29 +0000 (08:37 +0300)
commit71ce8dbc6bb90caf37813af2148a5a10ba0b9d8c
tree72e703b858a6b51ea62ebef65e33a16ac022b569
parent518ad659fe47d5cff091eb56792ec3e349e2ea5f
linux-user: Handle short reads in mmap_h_gt_g

In particular, if an image has a large bss, we can hit
EOF before reading all host_len bytes of the mapping.

Create a helper, mmap_pread to handle the job for both
the larger block in mmap_h_gt_g itself, as well as the
smaller block in mmap_frag.

Cc: qemu-stable@nongnu.org
Fixes: eb5027ac618 ("linux-user: Split out mmap_h_gt_g")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2504
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240820050848.165253-2-richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit a4ad4a9d98f7fbde806f07da21e69f39e134cdf1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
linux-user/mmap.c