svn commit: r265387 - user/dchagin/lemul/sys/compat/linux

Dmitry Chagin dchagin at FreeBSD.org
Mon May 5 20:13:26 UTC 2014


Author: dchagin
Date: Mon May  5 20:13:25 2014
New Revision: 265387
URL: http://svnweb.freebsd.org/changeset/base/265387

Log:
  hecking epoll fd against fd is useless as different fds could
  resolve to the same file.
  Instead of checking of file descriptors compare file pointers.
  
  Suggested by: mjg

Modified:
  user/dchagin/lemul/sys/compat/linux/linux_event.c

Modified: user/dchagin/lemul/sys/compat/linux/linux_event.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_event.c	Mon May  5 19:53:03 2014	(r265386)
+++ user/dchagin/lemul/sys/compat/linux/linux_event.c	Mon May  5 20:13:25 2014	(r265387)
@@ -339,9 +339,6 @@ linux_epoll_ctl(struct thread *td, struc
 	int nchanges = 0;
 	int error;
 
-	if (args->epfd == args->fd)
-		return (EINVAL);
-
 	if (args->op != LINUX_EPOLL_CTL_DEL) {
 		error = copyin(args->event, &le, sizeof(le));
 		if (error != 0)
@@ -359,6 +356,12 @@ linux_epoll_ctl(struct thread *td, struc
 	if (error != 0)
 		goto leave1;
 
+	/* Linux disallows spying on himself */
+	if (epfp == fp) {
+		error = EINVAL;
+		goto leave0;
+	}
+
 	ciargs.changelist = kev;
 
 	switch (args->op) {


More information about the svn-src-user mailing list