git: select: Don't allow unwanted/leftover fds being returned.
Sepherosa Ziehau
sephe at crater.dragonflybsd.org
Mon Aug 28 06:57:14 PDT 2017
commit ce4975442fa0524017fb3c1aef93bbe6880ae770
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date: Mon Aug 28 21:49:00 2017 +0800
select: Don't allow unwanted/leftover fds being returned.
The root cause is that the lwp_kqueue_serial will wrap pretty quickly,
6 seconds on my laptop, if the select(2) is polling, either due to heavy
workload or 0 timeout. The POC test:
https://leaf.dragonflybsd.org/~sephe/select_wrap.c
Fixing this issue by saving the original fd_sets and do additional
kevent filtering before return the fd to userland.
poll(2) suffers the similar issue and will be fixed in later commit.
Reported-by: many
Summary of changes:
sys/kern/sys_generic.c | 106 ++++++++++++++++++++++++++++++++-----------------
1 file changed, 69 insertions(+), 37 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/ce4975442fa0524017fb3c1aef93bbe6880ae770
--
DragonFly BSD source repository
More information about the Commits
mailing list