From nobody Sat Mar 09 09:05:34 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TsHFB30rYz5DDpF; Sat, 9 Mar 2024 09:05:34 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TsHFB2KRVz4G5h; Sat, 9 Mar 2024 09:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709975134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2mTIClQM4GRE4LJiQEJ+lT+6SIMBchjBE1ZDQ53lDVg=; b=C5OZj2jWUw+dTI9S+42VXnFCSxUVVPP3zZ5ZBN394WqAQ8aEz9YWpDsG9qIb8amBM0axfo yiDgEVrBehwUbWphtU26vJjWR3SCkgW84BhQfGSbyw3i7gd4wlSdWgeV0pcn/zWT0ykKWP FoUwClyJtybitcF79rDZvMKdURr4mIbalXBlQmmFoZ0w1V1eKcGtjdsk3hVVUBmJWdGTkx aEnK93jke8Q1Kx+LDF/x9rj+oWTSHL/vLE/CPr28leY7hWcWiWzVrEF/ZphhP67PAiVobW wGPuaaAL0wvpGXBgKEXjtuK/teXn/0VrhtkLH0quJNnZdgae+FyVEjssYdTURw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709975134; a=rsa-sha256; cv=none; b=NFTWHV7x8wwv6oUWGoEeeF9OpH8979j5S/liX2yNaJK0PCbYBIPK6Og2hqRrbczq+Ba2SM Wb8Dx8FRvBgg7FgCpO5k82vpc8mCr5//+74b4xegbCNpjUo8YNITH/KGUs8bdmoYPL+lWT rtXdqXYMFuKnxFpfNDnYhPydtIosg4azevxTPez2G6ptbfqcAMmcAeYA7X4t55Qg4QpXYA lVeUncSF953bCD1ihMZgrJjXTa0SGtOPZ2yXP0u6/AqpHsSyCJ1VfcBvgA22zwbMJMvH1n 0JevxrnbyO2swX4mA8AapFk4zoaRN8qscvVVZSImaMZ60UxTyVltxlywI9NVFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709975134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2mTIClQM4GRE4LJiQEJ+lT+6SIMBchjBE1ZDQ53lDVg=; b=TmNqvsS9Z0DfORTMQc+wtjJofU5X+ITv9Fo7LYmg07RoU7OLCBAqLZ7TaWjlgn5sKHgD9M GrR8Og3bTwMwhEnixYTGfLw38ww1pbiozoMcPgAUhG41njJQNTn2CCVMLDUcdU00hfzCig 9G8IeZ6NlA0W7GV2qb+yL+GCOuguZZovKwlJ4ry4I3fbWzy8kUGgFvzwLagatSbTbByFdD Loth88Y29IDHtizwv6ElXN3PLE6NexHiIO0TADBCz3OCbpucKN3QGZ2rWLqan2r4jmqxIz co+8WyodYqC86A0zIHXOrxsO1ufYP8fxAakUUbTJiaM8GZ0s3Uzq8DF76zqx0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TsHFB1p1Vzwhk; Sat, 9 Mar 2024 09:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42995YW5078308; Sat, 9 Mar 2024 09:05:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42995YiG078305; Sat, 9 Mar 2024 09:05:34 GMT (envelope-from git) Date: Sat, 9 Mar 2024 09:05:34 GMT Message-Id: <202403090905.42995YiG078305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f7d51eb77e84 - stable/14 - getblkx(9): be more tolerant but also strict with the buffer size checks List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f7d51eb77e848a6f7823d98349ebabb6efce4e52 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f7d51eb77e848a6f7823d98349ebabb6efce4e52 commit f7d51eb77e848a6f7823d98349ebabb6efce4e52 Author: Konstantin Belousov AuthorDate: 2024-03-02 04:58:57 +0000 Commit: Konstantin Belousov CommitDate: 2024-03-09 09:05:03 +0000 getblkx(9): be more tolerant but also strict with the buffer size checks PR: 277414 (cherry picked from commit 7e4ac11b6076e6a9bf7341ddeae22784284ed733) --- sys/kern/vfs_bio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 56f9d604b9eb..1b55c523c436 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3980,9 +3980,11 @@ getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, int slpflag, ("GB_KVAALLOC only makes sense with GB_UNMAPPED")); if (vp->v_type != VCHR) ASSERT_VOP_LOCKED(vp, "getblk"); - if (size > maxbcachebuf) - panic("getblk: size(%d) > maxbcachebuf(%d)\n", size, + if (size > maxbcachebuf) { + printf("getblkx: size(%d) > maxbcachebuf(%d)\n", size, maxbcachebuf); + return (EIO); + } if (!unmapped_buf_allowed) flags &= ~(GB_UNMAPPED | GB_KVAALLOC); @@ -4156,6 +4158,12 @@ newbuf_unlocked: vmio = vp->v_object != NULL; if (vmio) { maxsize = size + (offset & PAGE_MASK); + if (maxsize > maxbcachebuf) { + printf( + "getblkx: maxsize(%d) > maxbcachebuf(%d)\n", + maxsize, maxbcachebuf); + return (EIO); + } } else { maxsize = size; /* Do not allow non-VMIO notmapped buffers. */