From nobody Fri Aug 4 23:43:08 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 4RHj2P6nnLz4mFfk; Fri, 4 Aug 2023 23:43:09 +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 4RHj2P0mNtz3Lw2; Fri, 4 Aug 2023 23:43:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691192589; 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=WoTWaJWWrS7U364n12YwgJqgJhjxedPy+aRtg5I5SJ0=; b=kNA9/qSeOKL3OldRrA08X9bWKdRX1Vw/EoPEaSg1csmdNXAzw+63LzFijBljo8RjEiNvJf hXzCew5BWSstUkRn47OMQ3WHQUaoT0Y/nwwIHU3cDKPBL2zgbBRENtTPLD314ufMpJmfwt gbvhha6tFi8wSudrMyhtxDiXqt3yPWiYUX/zgOlBbGyh2bfHgyyWZJ124Vimlz7FQ3LSUf KdsStFxAi/Or7uc6a+a2Ew1HwGNXI6a+r+KqRq9jAlQo/dLQTSv0xEHJuhh9AQF2nY65yp Ieup5xmxrOuc+LXU8UTcF2WbxN0+OFELF4Xo+E3FIGCAQJGwoBO3mSBKUGrZyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691192589; 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=WoTWaJWWrS7U364n12YwgJqgJhjxedPy+aRtg5I5SJ0=; b=maHxvkNdL5CsOL/oAbGuoF6q9mBTNSaDOt8bCdiUoJhkhlNbl9v8UvYFq4PXnGR/H7nOlb y5j47MNQjjFL1/jT6kRfnlqRFGWLp+giZg9XhUX3CDg92fA1NLgOMI0C1L/OZh85VOjOMV gbarYa2ZnFCE8HHAInYz0dQdOHyz/pZZon9zRNi2fhZGdfnnbgz7xIsxKEDR3tJfGe6wSI QeeESWukHrJOil5fBwzYttaCU2vcfOj0eLR4n2XsxybNYbtnyhOsS4kDIkOvnqufO4pPPY zsfgEofGIhxd9/RPy6mUfZx+3SwdSYSYrG3y+04BJY/mE9mP9D87mlcpuvcjMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691192589; a=rsa-sha256; cv=none; b=GyT0IlSji+QIubv6+hu5ZnDiYenQRbhvgAtvqbH5Ap1vUw/TErX4xAqdCMyDal1mrnIESS fQgsiaUZQvnhCYDycQ+LElni7p6Eho627IM7U6HlfNPMJAqU2U8ot3Yh58tXfSxeo+qBAz F4MN5/DRKalBjkYBQSLpo5a6iMG3YW7EaxzWgVkiPW9O6kpS2/WiJineeIG1HIJWNCBFOP qIUkG5T2L9F5kmd5dZN/T/KKsI1T9kxC3asZRm+XpBzFfzPcZlkCVVCmU7kK1Y4h1C1sEC n9kdYOq4fK6PoU5yoWzna8DP18bkJcetMIAyh/hwzyuRUlWjYnwMsAdfRB2NXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RHj2N6y4Vz1Lsf; Fri, 4 Aug 2023 23:43:08 +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 374Nh8N5059202; Fri, 4 Aug 2023 23:43:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 374Nh8UW059201; Fri, 4 Aug 2023 23:43:08 GMT (envelope-from git) Date: Fri, 4 Aug 2023 23:43:08 GMT Message-Id: <202308042343.374Nh8UW059201@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4af849d71f69 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4af849d71f69306432941d91fa46c3c303059d63 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4af849d71f69306432941d91fa46c3c303059d63 commit 4af849d71f69306432941d91fa46c3c303059d63 Author: John Baldwin AuthorDate: 2023-08-04 23:41:50 +0000 Commit: John Baldwin CommitDate: 2023-08-04 23:41:50 +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 --- 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 6d5551c69312..015d4b308978 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -336,6 +336,13 @@ iso_mountfs(struct vnode *devvp, struct mount *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: