From owner-svn-src-head@freebsd.org Fri Apr 10 01:28:47 2020 Return-Path: Delivered-To: svn-src-head@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 C52A52AD255; Fri, 10 Apr 2020 01:28:47 +0000 (UTC) (envelope-from kib@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 48z0lg4Whhz4Z6W; Fri, 10 Apr 2020 01:28:47 +0000 (UTC) (envelope-from kib@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 968391E27E; Fri, 10 Apr 2020 01:28:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03A1Slor050093; Fri, 10 Apr 2020 01:28:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03A1SlVB050092; Fri, 10 Apr 2020 01:28:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202004100128.03A1SlVB050092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 10 Apr 2020 01:28:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359767 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 359767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2020 01:28:47 -0000 Author: kib Date: Fri Apr 10 01:28:47 2020 New Revision: 359767 URL: https://svnweb.freebsd.org/changeset/base/359767 Log: Do not pass bogus page to mbufs. This is a bug in r359473. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Fri Apr 10 01:24:16 2020 (r359766) +++ head/sys/kern/kern_sendfile.c Fri Apr 10 01:28:47 2020 (r359767) @@ -649,6 +649,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h struct file *sock_fp; struct vnode *vp; struct vm_object *obj; + vm_page_t pga; struct socket *so; #ifdef KERN_TLS struct ktls_session *tls; @@ -948,6 +949,9 @@ retry_space: softerr = EBUSY; break; } + pga = pa[i]; + if (pga == bogus_page) + pga = vm_page_relookup(obj, sfio->pindex0 + i); if (use_ext_pgs) { off_t xfs; @@ -997,7 +1001,7 @@ retry_space: ext_pgs->nrdy++; } - ext_pgs->pa[ext_pgs_idx] = VM_PAGE_TO_PHYS(pa[i]); + ext_pgs->pa[ext_pgs_idx] = VM_PAGE_TO_PHYS(pga); ext_pgs->npgs++; xfs = xfsize(i, npages, off, space); ext_pgs->last_pg_len = xfs; @@ -1016,7 +1020,7 @@ retry_space: * threads might exhaust the buffers and then * deadlock. */ - sf = sf_buf_alloc(pa[i], + sf = sf_buf_alloc(pga, m != NULL ? SFB_NOWAIT : SFB_CATCH); if (sf == NULL) { SFSTAT_INC(sf_allocfail);