diff options
author | Peter Maydell | 2020-11-11 22:54:01 +0100 |
---|---|---|
committer | Peter Maydell | 2020-11-11 22:54:01 +0100 |
commit | 674ee1245b4f14d998299d83410ac147e6e54eca (patch) | |
tree | 04ce00f1c8dc6bc547cb59a5b4e9fcc26c8a4163 /linux-user/syscall.c | |
parent | Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/tracing-pull-reque... (diff) | |
parent | linux-user: Prevent crash in epoll_ctl (diff) | |
download | qemu-674ee1245b4f14d998299d83410ac147e6e54eca.tar.gz qemu-674ee1245b4f14d998299d83410ac147e6e54eca.tar.xz qemu-674ee1245b4f14d998299d83410ac147e6e54eca.zip |
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.2-pull-request' into staging
Fixes for epoll_ctl and stack_t
# gpg: Signature made Wed 11 Nov 2020 21:40:16 GMT
# gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg: issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C
* remotes/vivier2/tags/linux-user-for-5.2-pull-request:
linux-user: Prevent crash in epoll_ctl
linux-user: Correct definition of stack_t
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r-- | linux-user/syscall.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3160a9ba06..27adee908e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -12590,17 +12590,25 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, struct epoll_event ep; struct epoll_event *epp = 0; if (arg4) { - struct target_epoll_event *target_ep; - if (!lock_user_struct(VERIFY_READ, target_ep, arg4, 1)) { - return -TARGET_EFAULT; + if (arg2 != EPOLL_CTL_DEL) { + struct target_epoll_event *target_ep; + if (!lock_user_struct(VERIFY_READ, target_ep, arg4, 1)) { + return -TARGET_EFAULT; + } + ep.events = tswap32(target_ep->events); + /* + * The epoll_data_t union is just opaque data to the kernel, + * so we transfer all 64 bits across and need not worry what + * actual data type it is. + */ + ep.data.u64 = tswap64(target_ep->data.u64); + unlock_user_struct(target_ep, arg4, 0); } - ep.events = tswap32(target_ep->events); - /* The epoll_data_t union is just opaque data to the kernel, - * so we transfer all 64 bits across and need not worry what - * actual data type it is. + /* + * before kernel 2.6.9, EPOLL_CTL_DEL operation required a + * non-null pointer, even though this argument is ignored. + * */ - ep.data.u64 = tswap64(target_ep->data.u64); - unlock_user_struct(target_ep, arg4, 0); epp = &ep; } return get_errno(epoll_ctl(arg1, arg2, arg3, epp)); |