From nobody Wed Sep 6 21:56:47 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 4Rgx6R6BBWz4sJ7Y; Wed, 6 Sep 2023 21:56:47 +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 4Rgx6R5MbQz3bsL; Wed, 6 Sep 2023 21:56:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694037407; 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=wUjPHHOB0+sU4vN5pFyP6GYHNF4uIf/ZCqPZA40fUyI=; b=jbXCglgsUSqD5f4hroX9hvsYR2kmjBWvmc6/O5c5ye9fEiir3U63fUlwwHEC7nvlks1piA CgKJk/2va5SnRC8V/JekDVvXHBr+jhSkL18AjZYakMtFDRGNmyL1VC0zqjCXLqZGlys8SI BYGmN+s6K3kt1lfhuBVGd+161u83/Fd175WRc0LkzYv6YmRcTthUzpU2EC9fyVnoD/hQrT tCz9KeU3ctBlH+b3zaTeiqjC/kYF8iTCFgm/nbG93Ah1qQrzcyjKNTgcivuDK/cLizuppt iFmfHFB3gsN50+clSws7wKb9r3kakJhz6SiEf35HGwV4rgiRKpIa/ewKmpXbxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694037407; a=rsa-sha256; cv=none; b=N/zEwsSGEYZL+PUnYFcYVxZXm/k4oOWA0kLdqInl8anxkwuJWHJIHTO9L5KTyuT2FUemlX NZj4LCGOdoMSUU/C+XC0T13FxWqvJRmOmvVETcAt245l3rOVdCBUApAQvjgu40He28V653 RioMOXcY71X6RaNajyGTU814lfWJjwtLZ0H73l3Z0NA/SmaCJ3ibEQ0HZkKIiD7oh7gYM3 5GkMIPqXooTrUJvNvtC3AfK5TeB1I+5PrEDYOqMhQG6EHRAU+8+iunMV/eeef81GGyyds+ 4PjqP0LkcamizNzGxK1g4H5t+4SokAOscddrhnqtINizNM4RJhNE/dPUaTc8FA== 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=1694037407; 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=wUjPHHOB0+sU4vN5pFyP6GYHNF4uIf/ZCqPZA40fUyI=; b=E9ZavlXneao4mzDGfFuV7r5Mmw2awBW3PQEBidqKTXpGpNT1j+3s8dnDYg9kHFqGrdWjHo ck6690Ogxaf6B2cVpRJrEVATcMX6l8wcxVCDgyhfNUILLku/uB+GXECGGLk8PFZO+62rQl 0a8H5Guu/RcnFQVELLXL5W6SgX8+vcSRjOIZZj7fIcnpDmgJ/iPoT3R3coCoDQ1pxwfZA5 45NB2Sec1ETbsMunE4IFi09t78K7xlu1KnrWEnrh2w5D5h84hr1TrEgRTQbBRUjUSYUYIO DapaeGTZ+O7/QIGuljA5cwSopuZSpkP/32z/TlKmMVBAxvdQ5Utz1rNTKOF+Mw== 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 4Rgx6R40qfzYvZ; Wed, 6 Sep 2023 21:56:47 +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 386LulWR023077; Wed, 6 Sep 2023 21:56:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 386Lul9E023074; Wed, 6 Sep 2023 21:56:47 GMT (envelope-from git) Date: Wed, 6 Sep 2023 21:56:47 GMT Message-Id: <202309062156.386Lul9E023074@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: 983819d21799 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 983819d217999303770876885250e70a89ad2687 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=983819d217999303770876885250e70a89ad2687 commit 983819d217999303770876885250e70a89ad2687 Author: John Baldwin AuthorDate: 2023-08-04 23:41:50 +0000 Commit: John Baldwin CommitDate: 2023-09-06 21:56:10 +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 08c0fbb78b1d..90a8996c9651 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -336,6 +336,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: