mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-09-06 09:55:55 +00:00
linux-user: fix Coverity CID 1464101
target_mmap() can fail and return -1, but we don't check for that and
instead assume it's always valid.
Fixes: db2af69d6b
("linux-user: Add infrastructure for a signal trampoline page")
Cc: richard.henderson@linaro.org
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211121151711.331653-1-laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
aee14c77f4
commit
802ae45e94
|
@ -3254,9 +3254,13 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info)
|
|||
* Otherwise, allocate a private page to hold them.
|
||||
*/
|
||||
if (TARGET_ARCH_HAS_SIGTRAMP_PAGE) {
|
||||
abi_ulong tramp_page = target_mmap(0, TARGET_PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
abi_long tramp_page = target_mmap(0, TARGET_PAGE_SIZE,
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
if (tramp_page == -1) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
setup_sigtramp(tramp_page);
|
||||
target_mprotect(tramp_page, TARGET_PAGE_SIZE, PROT_READ | PROT_EXEC);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue