From nobody Wed Sep 06 21:57:03 2023 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 4Rgx6m3JcHz4sJTv; Wed, 6 Sep 2023 21:57:04 +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 4Rgx6m0tltz3cft; Wed, 6 Sep 2023 21:57:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694037424; 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=QCXy6MrhcDg8im6dxQmA8oc1vBq5DLr0XeRvFqNYe2Q=; b=I/NpIOIZqAEVghyT6JaXaKvhOSpW2MPjXltrz9anlbBrgj55cq0U2/50NSGkCybN+PoejA XE/iTV+kx2baVo8YPujKMGdiH6aZNARzZ1PrxFsv0ri/Cd2/u6AfoWibD1BQ1H1v2j44F0 s1t/u8UHHtsce/E0ba2rgOO9lioqcgC93Q+f54kioG9Vcbf0gl4b834PfXcDH3ezB9NdcJ L3OC5AA5nWzAn1QdxrRfbNMWOsEvqrBgcJ5TgE3WwErD+nrbjcCb+MVqrGD592X1DpT/Ns Wa78VhVHiZLqJr+ccvjfk2/8syzNJDthyGJ3p1rR8d68dT9L5W+C74jnHYYtuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694037424; a=rsa-sha256; cv=none; b=WXf1kA2DNJgLKOSbVwKOuQzJSv/tjL8VYdJYaktbPtrFK0Ue6blwCLQJ4KUJsMBtzzqFNh U9znHM/I/bURO5y94fwg78bAS96nX/Li/hbg+6BJnUhCCUfeKTHc44bgse4KbHIkCMnyMw 07uwhTyTSbV/jXoJ8mfe1PIJ/WtyfZV4aGqtshrxO8nO1v5lk/dcQ7eAAx860KDl2+plRI VUzTZvnlBjfvZv4Rd+AlEqAKd/eRQ8mYpe/Kr0UN321L1wF9v4QDnuPyxwODHy9aD17XNQ 2vSBd44R1nQhanyYEjHHp0WepJR+d6rrYcbWKYoHjkNY2/rGwkBJSIWd/lPfqg== 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=1694037424; 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=QCXy6MrhcDg8im6dxQmA8oc1vBq5DLr0XeRvFqNYe2Q=; b=Www01zJGA5sC9Q71I7mULpTZQi7w0wG/h0Df+wSTHvl0Wm1SUcrHDg0qXyNkcgLz21wbbR Y6DCnHaFkjLsdbEs31IuW5suaV72DU+c8jyz1+2KJyMqGSNUTF0BG4VUaE2woSJLIjT4Qf zTxrGaY8fDlHHmxVfvKAIED0ppT4kkn4vfQ2xs9RiFBpJNJOtfmZ1rcRCLJlcKsLOjZDYL pDbUiPgNzYzF2c7SOTezOVrQg1piORXeFu6FEW229MvVhEa4JRD7wBLbBrMP+UAB178bCY txTW5EuCyKMGQ8klIZPXiA2GqogssdvQJCPpVzl2KtRs3c1Q8pnMOd2PQwRxSg== 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 4Rgx6m00LvzZ6K; Wed, 6 Sep 2023 21:57:04 +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 386Lv3il023797; Wed, 6 Sep 2023 21:57:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 386Lv3N1023794; Wed, 6 Sep 2023 21:57:03 GMT (envelope-from git) Date: Wed, 6 Sep 2023 21:57:03 GMT Message-Id: <202309062157.386Lv3N1023794@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 16f142865cb8 - stable/12 - cd9660: Reject volumes with small logical block sizes 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 16f142865cb8190c733271969aa243a2fc934093 Auto-Submitted: auto-generated The branch stable/12 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=16f142865cb8190c733271969aa243a2fc934093 commit 16f142865cb8190c733271969aa243a2fc934093 Author: John Baldwin AuthorDate: 2023-08-04 23:41:50 +0000 Commit: John Baldwin CommitDate: 2023-09-06 20:03:05 +0000 cd9660: Reject volumes with small logical block sizes ISO9660 permits specifying a logical block size that is any power of 2 greater than or equal to 512. The geom disk layer requires requests to be aligned on sector boundaries of the provider. With a volume that uses a logical block size smaller than the underlying disk sector size (e.g. a logical block size of 512 or 1024 on a CD which uses 2048 byte sectors), the current cd9660 vfs can issue requests for partial sectors, or on non-sector boundaries. Fixing this properly would require wrapping all of the calls to bread*/bwrite* in cd9660 vfs to roundup requests to be on sector boundaries which can include both the length, but also the starting sector number (and thus requiring use of an offset relative to b_data in the resulting buf). These images do not seem to be common however given that no one has fixed this in cd9660's vfs in the past few decades, so just reject them during mount with an error. If such images are found to be used in the wild in practice, then the larger fix can be applied. PR: 258063 Reported by: Robert Morris Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41228 (cherry picked from commit 4af849d71f69306432941d91fa46c3c303059d63) --- sys/fs/cd9660/cd9660_vfsops.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index d1fbd0100668..f9fb30face42 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -340,6 +340,13 @@ iso_mountfs(devvp, mp) goto out; } + if (logical_block_size < cp->provider->sectorsize) { + printf("cd9660: Unsupported logical block size %u\n", + logical_block_size); + error = EINVAL; + goto out; + } + rootp = (struct iso_directory_record *) (high_sierra? pri_sierra->root_directory_record: