From owner-svn-src-all@freebsd.org Thu Apr 23 17:46:30 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC2642BEA5B; Thu, 23 Apr 2020 17:46:30 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 497Pqp40XDz46pf; Thu, 23 Apr 2020 17:46:30 +0000 (UTC) (envelope-from brooks@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A61B8538; Thu, 23 Apr 2020 17:46:30 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03NHkUw9043685; Thu, 23 Apr 2020 17:46:30 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03NHkUNO043683; Thu, 23 Apr 2020 17:46:30 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202004231746.03NHkUNO043683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 23 Apr 2020 17:46:30 +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: r360225 - in stable/11/sys: compat/freebsd32 kern X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/11/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 360225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2020 17:46:30 -0000 Author: brooks Date: Thu Apr 23 17:46:29 2020 New Revision: 360225 URL: https://svnweb.freebsd.org/changeset/base/360225 Log: MFC r359938: Remove bogus use of useracc() in (clock_)nanosleep. There's no point in pre-checking that we can access the user's rmtp pointer before we do it in copyout(). While here, improve style(9) compliance. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24409 Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c stable/11/sys/kern/kern_time.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Thu Apr 23 17:30:03 2020 (r360224) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Thu Apr 23 17:46:29 2020 (r360225) @@ -2325,7 +2325,7 @@ freebsd32_user_clock_nanosleep(struct thread *td, cloc { struct timespec32 rmt32, rqt32; struct timespec rmt, rqt; - int error; + int error, error2; error = copyin(ua_rqtp, &rqt32, sizeof(rqt32)); if (error) @@ -2334,18 +2334,13 @@ freebsd32_user_clock_nanosleep(struct thread *td, cloc CP(rqt32, rqt, tv_sec); CP(rqt32, rqt, tv_nsec); - if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 && - !useracc(ua_rmtp, sizeof(rmt32), VM_PROT_WRITE)) - return (EFAULT); error = kern_clock_nanosleep(td, clock_id, flags, &rqt, &rmt); if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) { - int error2; - CP(rmt, rmt32, tv_sec); CP(rmt, rmt32, tv_nsec); error2 = copyout(&rmt32, ua_rmtp, sizeof(rmt32)); - if (error2) + if (error2 != 0) error = error2; } return (error); Modified: stable/11/sys/kern/kern_time.c ============================================================================== --- stable/11/sys/kern/kern_time.c Thu Apr 23 17:30:03 2020 (r360224) +++ stable/11/sys/kern/kern_time.c Thu Apr 23 17:46:29 2020 (r360225) @@ -613,20 +613,15 @@ user_clock_nanosleep(struct thread *td, clockid_t cloc const struct timespec *ua_rqtp, struct timespec *ua_rmtp) { struct timespec rmt, rqt; - int error; + int error, error2; error = copyin(ua_rqtp, &rqt, sizeof(rqt)); if (error) return (error); - if (ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0 && - !useracc(ua_rmtp, sizeof(rmt), VM_PROT_WRITE)) - return (EFAULT); error = kern_clock_nanosleep(td, clock_id, flags, &rqt, &rmt); if (error == EINTR && ua_rmtp != NULL && (flags & TIMER_ABSTIME) == 0) { - int error2; - error2 = copyout(&rmt, ua_rmtp, sizeof(rmt)); - if (error2) + if (error2 != 0) error = error2; } return (error);