linux-user: Check for bad event numbers in epoll_wait
The kernel checks that the maxevents parameter to epoll_wait is non-negative and not larger than EP_MAX_EVENTS. Add this check to our implementation, so that: * we fail these cases EINVAL rather than EFAULT * we don't pass negative or overflowing values to the lock_user() size calculation Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
This commit is contained in:
committed by
Riku Voipio
parent
700fa58e4b
commit
2ba7fae3bd
@@ -2585,6 +2585,9 @@ struct target_epoll_event {
|
||||
abi_uint events;
|
||||
target_epoll_data_t data;
|
||||
} TARGET_EPOLL_PACKED;
|
||||
|
||||
#define TARGET_EP_MAX_EVENTS (INT_MAX / sizeof(struct target_epoll_event))
|
||||
|
||||
#endif
|
||||
struct target_rlimit64 {
|
||||
uint64_t rlim_cur;
|
||||
|
||||
Reference in New Issue
Block a user