From owner-svn-src-stable-11@freebsd.org Thu Mar 30 20:05:17 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66456D2669D; Thu, 30 Mar 2017 20:05:17 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DDD0FCA; Thu, 30 Mar 2017 20:05:17 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2UK5Gux046215; Thu, 30 Mar 2017 20:05:16 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2UK5G8u046214; Thu, 30 Mar 2017 20:05:16 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201703302005.v2UK5G8u046214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Thu, 30 Mar 2017 20:05:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r316296 - stable/11/sys/compat/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Mar 2017 20:05:17 -0000 Author: dchagin Date: Thu Mar 30 20:05:16 2017 New Revision: 316296 URL: https://svnweb.freebsd.org/changeset/base/316296 Log: MFC r314311: Restore signal mask in epoll_pwait. Modified: stable/11/sys/compat/linux/linux_event.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_event.c ============================================================================== --- stable/11/sys/compat/linux/linux_event.c Thu Mar 30 20:04:28 2017 (r316295) +++ stable/11/sys/compat/linux/linux_event.c Thu Mar 30 20:05:16 2017 (r316296) @@ -530,23 +530,32 @@ static int linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events, int maxevents, int timeout, sigset_t *uset) { - struct file *epfp; - struct timespec ts, *tsp; - cap_rights_t rights; struct epoll_copyout_args coargs; struct kevent_copyops k_ops = { &coargs, epoll_kev_copyout, NULL}; + struct timespec ts, *tsp; + cap_rights_t rights; + struct file *epfp; + sigset_t omask; int error; if (maxevents <= 0 || maxevents > LINUX_MAX_EVENTS) return (EINVAL); + error = fget(td, epfd, + cap_rights_init(&rights, CAP_KQUEUE_EVENT), &epfp); + if (error != 0) + return (error); + if (epfp->f_type != DTYPE_KQUEUE) { + error = EINVAL; + goto leave1; + } if (uset != NULL) { error = kern_sigprocmask(td, SIG_SETMASK, uset, - &td->td_oldsigmask, 0); + &omask, 0); if (error != 0) - return (error); + goto leave1; td->td_pflags |= TDP_OLDMASK; /* * Make sure that ast() is called on return to @@ -558,14 +567,6 @@ linux_epoll_wait_common(struct thread *t thread_unlock(td); } - error = fget(td, epfd, - cap_rights_init(&rights, CAP_KQUEUE_EVENT), &epfp); - if (error != 0) - return (error); - if (epfp->f_type != DTYPE_KQUEUE) { - error = EINVAL; - goto leave; - } coargs.leventlist = events; coargs.p = td->td_proc; @@ -575,7 +576,7 @@ linux_epoll_wait_common(struct thread *t if (timeout != -1) { if (timeout < 0) { error = EINVAL; - goto leave; + goto leave0; } /* Convert from milliseconds to timespec. */ ts.tv_sec = timeout / 1000; @@ -595,7 +596,12 @@ linux_epoll_wait_common(struct thread *t */ if (error == 0) td->td_retval[0] = coargs.count; -leave: + +leave0: + if (uset != NULL) + error = kern_sigprocmask(td, SIG_SETMASK, &omask, + NULL, 0); +leave1: fdrop(epfp, td); return (error); }